December 14, 2018

cm-mini

Thinking Magento

Magento - The Importance of Cronjob

Now the cronjob is probably the most overlooked factor when it comes to setting up your Magento store. The cronjob is responsible for the following;

  • Sending out product email alerts
  • Updating your catalog flat catalog each evening - these are your prices rules
  • Removing expired quotes from customers baskets
  • Updating your currencies
  • Sending out newsletters
  • Updating your google sitemap

The cronjob can also be utilised in future addons such as auto cancelling orders, cleaning out tables and expiring RMA's.

The wiki on how to setup the cronjob can be found below and it really depends on your server configuration and if you are able to set it up. Cpanel and plesk environments make this a very easy job, however both can be resource hog platforms when it comes to dealing with a Magento store.

http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job

So don't forget to get your developer or host to setup your cronjob for you. It will make the difference between a store that is becoming a black hole of expired quotes and a smooth running store.

If you have had your Magento store up and running for several years now and you've just got a cronjob to setup and running, however your receiving lots of php max_execution errors, it means your tables have become far too chunky for the cronjob to deal with. This leaves you with the quesiton of what the heck do i do now? Well, there is only one logical solution and that is the scary task of truncating tables. The main tables that you'll need to truncate are the sales_quote tables and the product alert tables. MAKE A BACKUP OF YOUR DATABASE FIRST! If you are not comfortable with this, do not attempt it and contact a Magento Developer or your hosting company to do so.

Next post - > how to prevent your database from turning into a black hole of data that you really really don't need and have it nicely cleaned each evening.

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.

Page 9 of 9