Geeklog: What I Learnt Today / Adam

Things I wish I'd known when I picked up this Magento shop...

> Earlier this year I ended up inheriting a Magento site that had been abandoned by its previous developers leaving its owner in the lurch. Not having used Magento before there was a bit of a learning cliff, so I thought I'd write this to help anyone else who finds themselves in a similar issue.
1) Surprisingly some features don't work well, newsletters is probably best left alone, for example.
There may be fairly simple errors, for example: I upgraded the shop to the latest greatest in the 1.9 line thinking that those issues would be resolved they weren't. Mine were kind of minor, if your bought something with paypal buy now button the name of the customer would be blank on the 5 most recent orders. If you looked at the status of the order it would spray out html code rather than the link to the verify id. These aren't that bad and you can fix, reasonably easily. More to say that don't think everything will work just because its so widely used.

2) You need a beefy machine, this isn't going to work to well on shared hosting and its worth checking out how far you can push the PHP version beyond what versions they officially support. Newer versions of PHP being faster, generally. I pushed to .1 down from latest greatest version with some tweaking of the invoice creation code. Not got it onto php 7 (yet) though. The database is going to be a big and get bigger still so check your MySQL setup.

3) Its never going to be very fast, it wasn't really built to PHPs strengths. You are going to be working on coping with the core design decisions they made. Your back end options include enabling caching on as much as possible, including additional caching levels, I added a full page caching plugin Lesti which seems to work ok and reduced the time taken to actually chuckout the html to under 100ms. You will have to checkout that you have excluded the blocks that are customer specific. Magento have written some whitepapers about performance which are perhaps worth whizzing through. Including some configs that might work as starting points in Varnish, Nginx, PHP-FPM

4) Caching is also the root of problems if things don't appear or don't change on your updates after you 'update cache' in admin. Try emptying the cache directory
rm -rf var/cache/

5) Front end performance may not be that fantastic either, check if combining the many and various css and js files speed things up for you and things still work.

6) If you amend a css file, the file name of the combined css will not change to do that you have to change the names of the files or do something like add a blank css file named cssBuster-{monthName}-{dayName}.css and add that to the layout.xml that you upload simultaneously.

7) You can update on the command line checkout
./mage list-upgrades

8) You can do reindexing from the command line
php shell/indexer.php help
I found reindexing periodically whether it needed it or not worthwhile. Having it update on save or manually is dependent on your evaluation and how understanding the shop keeper is of messages that may get flashed up whilst the are waiting for update. If your indexing is slow out check this plugin out. Depending on your config it skips, non visible and hidden url indexing which can greatly improves the speed, in my case it went from 50 seconds to 8 seconds

9) Log cleaning on the command line, log cleaning does keep the database size down I went from a database archive of something around 600mb to 260mb initially as no one had done it previously.

10) You probably want to enable as much logging as you can System > Developer > Log Settings The logs are quite noisy by default but you can grep out the noise and show the exceptional stuff. I have a rough bash script to process the system log for example.

11) Repeated blocked calls to /app/etc/config.xml in your logs are actually calls from Magento itself checking that that file is hidden, not an attacker. Although people do attack so you want to check your configuration, specifically to Magento files like LICENSE.* and *.sample probably don't need to be there. You also need to consider if you want to have the downloader online.

12) Checkout get.php it may be set to display errors, you don't want it to. It may be worth putting a die() in if you don't want to use it/ disagree with the concept of get.php.

13) If you can't login to the admin on a test server checkout the cookie domain see if it looks right. You can do something like this to make it blank in sql
UPDATE prefix_core_config_data set value = '' where path = 

14) You can serve your static files from a CDN (and then toggle that according to if you are on https or not).

15) You set the timezone here System > Configuration > General > Locale Options > Timezone but Magento doesn't do British Summer time so you get times in GMT which may confuse you. It seems you can fiddle with it.

I'm still not sure I would recommend Magento to anyone, but I guess it works.

/ Adam