Its a known fact that Magento, one of the popular e-commerce platform, is preferred by majority of online retailers across the world. Through numerous Magento projects, I have found the following to be some of the most common mistakes that developers make while building an e-commerce store.

Modifying Magento core files: Generally developers are given a short timeline to build or customize a Magento store.  As a result few developers attempt to modify Magento core files as a quick solution to customer customization requirements.  This type of patchwork development will have long term effects on the e-commerce website, since it will interfere with future Magento upgrades. One should always keep Magento core files protected for future upgrades.

The best way to modify core files is to create a copy of the same folder structure in a local module folder as shown on the example below:

e.g.: To modify app/code/core/Mage/Catalog/controller/ProductController.php 

Copy the complete folder structure to app/code/local/Mage/Catalog/controller/ProductController.php

Test module with full page cache: We find that after creating a custom module or installing any type of third party Magento module, developers choose to test a full page with caching disabled.  Most developers switch off caching while developing a custom module.  Yet it is essential for a developer to keep full page caching enabled when a module is created or customized.

Redundant data set utilization: A common mistake made by inexperienced Magento developers is to retrieve the complete collection of data, when only a limited number of items are required.

public function getRandomItem() {
 $collection = Mage::getResourceModel(‘mymodule/my_collection’)->setRandomOrder();
 return $collection->getFirstItem();
}

Always remember to apply a limitation to every collection query when retrieving one or more items. Below is an example of a collection query:

public function getRandomItem() {
    $collection = Mage::getResourceModel(‘mymodule/my_collection’)->setRandomOrder()->setPageSize(1);
     return $collection->getFirstItem();
 }

Queries inside a loop: We frequently find that developers load Magento models in a loop. Below is an example of how a developer will duplicate the collection of product ID’s.

foreach ($this->getProductIds() as $productId) {
 $product = Mage::getModel(‘catalog/product’)->load($productId);
 $this->processProduct($product);
}

Since Magento uses EAV model to retrieve results from the database, the number of heavy queries creates a performance bottleneck.  Instead of loading products in loop, a Magento data collection can assist loading a set of models in an efficient way.

$collection = Mage::getResourceModel(‘catalog/product_collection’)->addFieldToFilter(‘entity_id’, array($this->getProductIds()))->addAttributeToSelect(array(‘name’));
 foreach ($collection as $product) {
 $this->processProduct($product);
}

Admin router: On numerous occasions developers copy and paste standard XML from the internet and create a module that ends up receiving errors. For example, if your module doesn’t require an admin router, then you should not leave the admin router in the folder. The steps described above have to be followed whenever a new custom module is created or installed.

Among a lot of pitfalls that developers get into while building a Magento store, these are some of the common mistakes that happen. Avoiding these flaws would help a lot in improving the performance of the Magento store and thereby improving the revenue of the company.

DCKAP is an Enterprise Magento Implementation provider with extensive experience in customizing and building modules on the Magento e-commerce platform. We are attending the Magento Live conference in London next week (July 14 & 15). You can reach us at info@dckap.com or 1-877-872-3252

Reference

http://info.magento.com/rs/magentocommerce/images/Conquer_the_5_Most_Common_Magento_Coding_Issues_to_Optimize_Your_Site_for_Performance.pdf

Be the first to Know

Subscribe to our blog to get the latest articles directly to your inbox.

READY TO DRIVE SALES?

Request a Quote Today

Request a Quote

Leave a Reply

Be the First to Comment!