October 24, 2020


Thinking Magento

Magento - Getting To Grips

When you first come into contact with Magento, its one of those love hate relationships that makes you want to tear your own hair out 40% of the time, but has such rewards in what it can do that you'll stick by it through thick and thin.

In terms of development its always a learning curve as to how get the information you want and how it is going to be displayed. The fantastic thing about Magento is its EAV attributes (the Entity Attribute), which are the back bone and gateway to all the information in the database and allow you to avoid doing raw queries. Raw queries were a big thing in early version of Magento and this can be seen in a lot of the old modules created, such as the Softicket. Now we first started working in Magento in 2008 on version 1.6 and as time has gone on, the EAV attributes has played an important role in every upgrade. Luckily we were not subject to any major problems such as corrupting databases, but we have learnt our lessons about working on a live site. NEVER EVER DO IT. Luckily our hosting company Global Gold is also prepared to learn with us and have made the appropriate changes to their servers whenever required for the upgrades, especially when it comes to Magento performance, but we're straying off the point here.

The Magento team finally found their feet with the EAV database tables when they introduced the flat_catalog_product tables and flat_catalog_categories tables, which in essense takes the data it requires from the EAV tables and puts them into the flat_catalog tables to avoid a slowing down the database. It does cause some issues with duplicating data, but at the end of the day its performance you want after all.

If you begin to experience problems with your catalog then its normally the case that the flat_catalog tables are not updating. An example would be the tiered price rules showing or the products not being sortable on the product frontend. Things to think about... did I setup a cronjob to run refresh layered indices or is there a problem with the server running out of memory. A quick solution is to go to system cache and hit refresh layered indices. If you receive an out of memory error, then you'll need to either update the php.ini file max_memory or extend the execution time. If it refreshes correctly, then it means your cronjob is not setup to run every 5 minutes, which will in turn refresh your catalog indices each morning keeping your catalog fresh and up to date.

EAV and the flat_catalo is the future, but there is always room for improvement and we are always on the look out to how the Magento team is going to improve on this.