Upgrading Opencart
Opencart is a really nice online store, so while I’m surprised opencart doesn’t have a more streamlined upgrade process than this, I’ve probably just been spoiled by updating in WordPress! The “copy files over” and then “run the upgrade script” is not that much harder than “login to admin” then “click button that starts download and runs upgrade script”. However, I did feel a little hesitant about upgrading Opencart.
Upgrading isn’t that difficult though, it’s just a case of following the procedure.
Upgrade Process
-
Set you store to “Maintenance Mode”.
Admin -> System -> Settings -> Server -> Maintenance Mode: Yes -> Save
-
Backup your existing databse and files. That way, if there are any problems, you can reinstall your site with the miniumum of disruption and have another crack at it. Follow
Admin -> System -> Backup/Restore -> Select All -> Backup
to download the SQL file. -
Rename
config.php
toconfig.php.bak
andadmin/config.php
toadmin/config.php.bak
. This means they won’t get overwritten when you copy in the new core files. -
Copy across the contents of the
upload
folder from the latest version of Opencart into the shop’s website directory. This will overwrite any core files with the new ones, but it will leave any additional files that are there. -
Remove the new
config.php
andadmin/config.php
files and rename your originals: changeconfig.php.bak
toconfig.php
andadmin/config.php.bak
toadmin/config.php
. (It’s possible to just omit copying the new config files across, but I prefer this method.) -
Major changes were introduced between v 1.4 and v 1.5. If you are upgrading from version 1.4.*, you will need to follow additional steps detailed below, before you continue.
-
To make the required changes to the database schema for the upgrade, you will need to run the upgrade script. In your browser, go to
http://your.site/shop/install
and click the button to upgrade. One the upgrade script has run, your site has been upgraded. Then there’s just a little clearing up to do. -
Remove the install directory from you web folder. This stops anyone else running these scripts again, accidentally or on purpose.
-
Log in to the admin pages of your store and check the options. If there are new options available because of the upgrade, they will need to be set.
-
Then check your storefront pages to make sure any installed plugins and modules are working.
-
And finally if everything’s running fine, open your store to visitors by taking it out of maintenance mode.
Admin -> System -> Settings -> Server -> Maintenance Mode: Yes -> Save
Upgrading from 1.4.* to 1.5.*
Some major changes were introduced in version 1.5.0 that mean the included update script will not work from before version 1.5.0. It’s not a problem though, there is a script that can do most of the work for you. However, because of changes to the way product options are handled, it is not possible to move these across automatically. After an upgrade from version 1.4.9.6 or earlier, no products will have selectable options after the upgrade, and these will have to be added manually where applicable.
At number 6 in the list above, perform these tasks before continuing:
-
Download the upgrade script from this forum post at forum.opencart.org.
-
Copy across the contents of the
install
directory to theinstall
folder of your store. -
Edit
config.php
in your store directory and add the following lines to the beginning:
`// HTTP define(‘HTTP_SERVER’, ‘http://your.site/shop/’); define(‘HTTP_IMAGE’, ‘http://your.site/shop/image/’); define(‘HTTP_ADMIN’, ‘http://your.site/shop/admin/’);
// HTTPS define(‘HTTPS_SERVER’, ‘https://your.site/shop/’); define(‘HTTPS_IMAGE’, ‘https://your.site/shop/image/’);`
- Then run the upgrade script by pointing your browser at
http://your.site/shop/install/upgrade-14x-to-15x.no-opt.php
.
A complete upgrade procedure is included in the 1.4.x-to-1.5.x-upgrade-steps.txt
file with the script components.
Of course none of this would work without the effort of the Opencart developers. I’ve compiled the guide here from the documentation files in the downloads, the online documentation and the information on the opencart forum. If anything, I’m hoping to make upgrading feel less daunting, so opencart installations can be more easily kept up to date.
GJay wrote, “You can also try an alternative way to upgrade OpenCart, installing fresh version and following the steps of instruction”