Upgrading your Magento website: things to note

Upgrading your Magento website: things to note

Upgrading a platform like Magento can be difficult – with all those extensions, tweaks, and changes that you’ve made to the back end, the last thing that you want to do is to lose any of this. That’s why we’ve produced this handy guide to upgrading your Magento store from any version to the latest one without losing anything, including your sanity.

There are a number of ways to upgrade your Magento store.

Magento Connect Upgrade

You can often upgrade your Magento store simply by using Magento Connect. Go to System > Magento Connect > Magento Connect Manager and you should see a table which shows you which version you are using. Here you can choose to upgrade. If your store is well-built and not too complicated, this could be the quickest and easiest option.

Cart2Cart Migration Upgrade

Another option is to set up a Magento to Magento import. This means you can have a completely fresh installation of Magento, with all data imported and extensions and themes added.

Cart2Cart may however lose some information such as custom database tables if you have them.

Manual Upgrade

Here are our steps to doing a manual upgrade – based on real life experience. How complex any upgrade will be is dependent on how well your site has been coded. It can be anything from a few hours work to a virtual impossibility – which is why you should ensure that you only let professional Magento developers work on your site!

  1. Analyse your current site.

Have a look for any edited core files. These are Kryptonite to any PHP framework development. An FTP client will let you browse for any weird modification dates.

Then check for localised Magento overrides. These are core files which are stored in the Local folder which can override your core file – they can have a substantial impact on an upgrade.

Module files may make the core file code work differently. Make sure any using observers can still work after an upgrade.

  1. Backups.

Carry out upgrades on a test domain before you try and do it to the full site, then swap once you have proved that it worked. Make sure you take an SQL backup and a backup of all files. You may want to close down your live site so this might be a job for a night. It can take a few hours.

  1. Install latest Magento version on development domain.

Install all of the new files and the database for the new version of Magento on your development domain by running the browser-based installer.

  1. Copy the files you want to keep across.

This is the part where it gets a little more complicated. This is when we port over the theme files, custom layouts and extensions that we use on the old installation to the new one from step three. Go through files and make sure that you include things like:

  • app/etc/modules (all of the custom module xml)
  • app/code/local (all of these files and folders)
  • app/code/community (all of these files and folders)
  • app/design/frontend (our themes and also any extension files)
  • skin/frontend (this is our themes and any extension theme files)
  • skin/adminhtml (custom adminhtml theming)
  • app/design/adminhtml (custom adminhtml templates)
  • all local root files that are in use
  • media/ (images etc)

This is just a brief outline – you may have many more files and folders to port over.

Another technique is to duplicate your site over onto the development domain and then overwrite all of the files by simply laying a new Magento installation over the top. This may work if you’ve properly checked over the site in stage one.

  1. Check your new website hasn’t broken.

Here’s the scary bit – checking to see whether the new site is still working with all the old files in place. Try adding a few test categories and products. You can also take this time to check to see if your extensions are still working on the test database.

  1. Remove local.xml.

To tell Magento that you are going to run a new installation, you either need to delete or rename app/etc/local.xml or you can re-edit the database configuration details within the local.xml to go through the upgrade process without slogging through the installation process.

  1. Import your old database.

Create a new database on the server. You need to import the database from your old website. This can be done through SSH easily.

First, to create a db dump, try:

mysqldump -u dbusername -pdbpassword olddbname > afilename.sql

Then to import again:

mysql -u dbusername -pdbpassword newdbname < afilename.sql

Then refreshing the homepage on the development domain should trigger your installation script.

  1. Cross your fingers and run installer.

Hopefully this is where all your work should come to fruition. Your new files should contain the MySQL upgrade scripts for your core Magento functionality. Magento should alert you that it’s connected to the old database and that the upgrade is in progress.

  1. The waiting game.

Now comes the waiting. Depending on how vast the jump in versions is, this could take a while. If errors appear, you can try refreshing the installation to see if it will continue on from where it left off.

  1. Troubleshooting

First up – clear the cache. If the login screen won’t let you in try going to /var/ and rename the cache folder to cache_temp – this will allow Magento to recreate this folder and rewrite the cache.

Then, re-index all data as this could have gone mildly haywire in the process.

Finally, test the site. There may be small xml niggles to fix, hopefully nothing too complex.

There you are! You should have a fully working new Magento installation with all your content where it should be. This should have worked – if there are any issues then it could be any number of things, from extensions to straight up bad coding. Remember that you’re doing all this on a test domain so that any problems can be fixed before you try it on the live one. Document your processes to ensure that you can recreate it when it does go right.

How do you upgrade your Magento installation? Comment below!

Author Owen Radford

More posts by Owen Radford