Skip to main content

Posts

Showing posts from December, 2016

5 worst Magento practices

I hope this article will help many to save their eCommerce problem and to optimize their code. Magento is a wonderful platform to kick start your e-commerce endeavors. But the worst part is its development flow. I will introduce you the 5 worst Magento development practices followed by detailed example. 1.  Collections – query results limitation To improve code performance and scalability remember to apply limitation on the collection’s query results — it’s much better to do  $collection->getSize()  instead of  $collection->count()  or  count($collection)  because that ways, all of the items will be loaded from the database and than iterated. 2.  SQL queries inside a loop Bad practice is to load Magento models inside a loop. Running SQL query is very expensive operation and doing it in a loop tends to make it even worse. Instead of doing that we could use data collections to load models and then process it.  To be careful when ...