8 common mistakes developers make in Magento

8 common mistakes developers make in Magento

Design tips:

  1. Create a custom theme; don’t modify core Magento theme files instead.
  2. Understand the package/theme relationship and how to make that work for you.  Sometimes, clever use of package/themes can allow for creative ways to handle subtle differences clients want among templates or pages.
  3. Don’t use the wrong starting theme (particularly in community).  When doing community projects, the blank theme saved a lot of time as it stripped out a lot of the unnecessary CSS styling, which allowed our front-end developers to speed up development. Similar to WordPress and using a “blank theme” that’s stripped of a lot of unneeded code, a similar trick/benefit can be achieved on Magento.
  4. Always carve with Magento in mind – Magento uses tables in some places, for instance.  Using a demo site to view source and cloning said source as the HTML you use when building your own CSS can be incredibly helpful in nailing down the nuances of Magento earlier.

Engineering tips:

  1. When extending functionality of a core class, don’t overwrite the core class by placing the file same relative path on the local code pool, app/code/local/Path to core class/  (i.e. app/code/local/Mage/Checkout/Block/Onepage.php). Instead, one should use class rewriting to overwrite. The new class should also inherit from the class you wish to extend;  not simply copy and paste the original code in the new class.  This allows for greater compatibility and less chances of things breaking when upgrading to a newer Magento version.  This also makes it easier to resolve module conflicts for other third party modules that also rewrite the same class.
  2. Watch out for nested collections. Every collection is a query, which means if you have a collection inside a loop, there is effectively a query inside the loop, which will slow down speed.
  3. Writing a module and then forgetting to test it with Full Page Caching on.  One of our developers cited an example of a module that stored data in a session to track how many times a user has visited a certain page. The module was working fine locally until it pushed to a staging environment where FPC was enabled.
  4. Not being wary of the namespaces used for a custom modules, which may conflict with the namespaces of core Magento modules.

What are some other common mistakes in Magento that developers should avoid? Share your tips in comments!

Source: http://www.pixafy.com/

Share this post