Magento trouble – again…

I remember talking to another web designer at a networking meeting a few years ago and mentioning that I was building eCommerce sites on Magento.

“That’s brave!” – he said.

He was right: Magento is not for the faint-hearted. If you want an easy life, pick WordPress and Woocommerce, much easier to set up and a lot less stressful to update.

Of course I don’t use Magento just to punish myself, I have my reasons: when set up correctly, it’s hands down the most powerful and sophisticated eCommerce solution on the market. Plus it comes with the sort of price tag I like: £0. And unlike Woocommerce, you are not then pestered with continuous reminders that you are running the free version and you’d be much better off buying this or that extension. Magento CE can already do it all – or almost.

The problem is that it requires you to set up you server properly, which means fiddling with php.ini, cron jobs and other even more obscure settings that should only ever be tweaked by server administrators – I am not one of those.

The other problem is updating. Even relying on Softaculous (Saint-aculous I call it) to handle the (absolutely necessary) back-up and subsequent version upgrade, you should always brace yourself for the infamous Magento error screen, if not a completely blank screen, which is even worse because then you really don’t know where to start.

So when a client asked me to upgrade her store from Magento 1.6.0 to 1.9.2 (a considerable leap I assure you) I was fairly nervous. It turned out I had every reason to be: straight after the upgrade not only did all order emails stop sending, but customers could no longer see the links to their downloadable products in the account area.

Three days were spent investigating and addressing those hiccups, and I can now share my newly found knowledge of the possible problems arising from updating Magento to 1.9.

First of all, Magento 1.9+ relies completely on cron jobs to send transactional emails. If you didn’t have cron jobs set up properly before, you are going to have to do it now.

First of all make sure you have set up cron tasks in the Magento admin under System > Configuration > Advanced > System > Cron. The default settings are:

Generate Schedules Every 15
Schedule Ahead for 20
Missed if Not Run Within 15
History Cleanup Every 10
Success History Lifetime 60
Failure History Lifetime 600

There are people suggesting these settings should be changed, but since they can’t seem to agree on the best combination, I’d rather leave it as it is.

You then need to go into your hosting control panel and set up cron jobs. In cPanel it’s under Advanced > Cron Jobs. Set them up to run every five minutes and use this command:

php -f /home/username/public_html/cron.php

Check that the above path is correct and that the file cron.php is actually there in the root of your Magento installation (if you’ve just upgraded, it should be). Change username to the correct account.

Now, I initially made the mistake of following the advice of the developers at who say to use a wget command string:
wget -O /dev/null -q

This did not work for me at all, whereas the php command did, so my advice is: stick with that.

For the next problem, i.e. links to downloadable products disappearing from the Magento customer area, this turned out to be simply a bug in Magento 1.9.2. The app/design/frontend/base/default/template/downloadable/customer/products/list.phtml is simply wrong – don’t ask me why, all I know is it produces faulty pagination and no links in the “My downloadable products” page. What I did to fix it was to overwrite this file with one taken from an older Magento version (1.7 in fact) and everything seems to work again.

I have heard of “if it ain’t broke, don’t fix it” but this is more a case of “it wasn’t broken, now it is”.

There other minor issues to iron out, mainly due to this particular store having overriden Magento core files by using app/code/local/Mage. A big no-no we are told… Well, I can confirm that. So if you get any blank pages when clicking on the “Add to Cart” links or anything like that, try deleting everything in that folder (maybe back it up first) and see if it fixes it.

That’s it for today, I hope this is of use to someone!