Upgrading OpenCart

Exclusive offer: get 50% off this eBook here
OpenCart 1.4: Beginner's Guide

OpenCart 1.4: Beginner's Guide — Save 50%

Build and manage professional online shopping stores easily using OpenCart.

$9.99    $5.00
by Murat Yilmaz | August 2010 | Beginner's Guides Open Source

It is wise to update our OpenCart environment to the latest version regularly. It protects our system against security vulnerabilities and allows us to use new features. It is also possible that the new OpenCart version will have several bug fixes.

Moreover, new versions can have new bugs. Because of this, it is a common practice to wait while a version with major changes matures and gets rid of serious bugs with minor release fixes.

In this article by Murat Yilmaz, author of OpenCart 1.4 Beginner's Guide, we shall learn about:

  • Making a backup of current OpenCart system
  • Downloading the latest OpenCart version
  • Uploading the new files to a server
  • Running the upgrade script
  • Checking whether everything works as expected or not
  • Restoring the OpenCart system if an upgrade fails or has serious problems

This article is suggested reading even for an experienced user. It will show us any possible problems that might occur while upgrading, so we can avoid them.

Making backups of the current OpenCart system

One thing we should certainly do is backup our files and database before starting any upgrade process. This will allow us to restore the OpenCart system if the upgrade fails and if we cannot solve the reason behind it.

Time for action – backing up OpenCart files and database

In this section, we will now learn how to back up the necessary files and database of the current OpenCart system before starting the upgrading processes.

We will start with backing up database files. We have two choices to achieve this.

The first method is easier and uses the built-in OpenCart module in the administration panel.

  1. We need to open the System | Backup / Restore menu.

    Upgrading OpenCart

  2. In this screen, we should be sure that all modules are selected. If not, click on the Select All link first. Then, we will need to click on the Backup button.

    Upgrading OpenCart

  3. A backup.sql file will be generated for us automatically. We will save the file on our local computer.

    Upgrading OpenCart

    The second method to backup OpenCart database is through the Backup Wizard on cPanel administration panel which most hosting services provide this as a standard management tool for their clients. If you have applied the first method which we have just seen, skip the following section to apply. Still, it is useful to learn about alternative Backup Wizard tool on cPanel.

  4. Let's open cPanel screen that our hosting services provided for us. Click on the Backup Wizard item under the Files section.

    Upgrading OpenCart

  5. On the next screen, click on the Backup button.

    Upgrading OpenCart

  6. We will click on the MySQL Databases button on the Select Partial Backup menu.

    Upgrading OpenCart

  7. We will right-click on our OpenCart database file backup and save it on our local computer by clicking on Save Link As.

    Upgrading OpenCart

  8. Let's return to the cPanel home screen and open File Manager under the Files menu.

    Upgrading OpenCart

  9. Let's browse into the web directory where our OpenCart store files are stored. Right-click on the directory and then Compress it.

    Upgrading OpenCart

  10. We will compress the whole OpenCart directory as a Zip Archive file.

    Upgrading OpenCart

  11. As we can see from the following screenshot, the compressed store.zip file resides on the web server. We can also optionally download the file to our local computer.

    Upgrading OpenCart

What just happened?

We have backed up our OpenCart database using cPanel. After this, we also backed up our OpenCart files as a compressed archive file using File Manager in cPanel.

OpenCart 1.4: Beginner's Guide Build and manage professional online shopping stores easily using OpenCart.
Published: August 2010
eBook Price: $9.99
Book Price: $39.99
See more
Select your format and quantity:

New OpenCart version

Until OpenCart v1.4.7, we had to upgrade our system manually. Each new version included an upgrade.txt file to read first and apply upgrades manually.

For example, this is a screenshot from the v1.4.6 upgrade.txt file:

Upgrading OpenCart

Now, starting from v1.4.7, we are able to use a universal upgrade script without opening the phpAdmin tool to execute the SQL scripts manually. The web based script supports upgrading from any version later than v1.3.0 to v.1.4.7 directly.

If we are using a version older than OpenCart v1.3.0, we will need to first upgrade all the versions in between until we reach 1.3.0. Then we can run this script.

Now, let's learn how we will use the upgrade script.

Time for action – downloading the latest Opencart files, uploading them to the server, and upgrading

We will now learn how to download the latest version of OpenCart and upload to our server. Then, we will run upgrade script.

  1. Let's browse into
    http://www.opencart.com/index.php?route=download/download

    We will save latest OpenCart zip file on our local computer.

    Upgrading OpenCart

  2. Now, let's click on the Extract Here menu item to extract all the contents of a folder.

    Upgrading OpenCart

  3. We need to delete default, and empty the config.php file in the upload folder in our local computer.

    Do not delete the config.php file on your web server by mistake.

    Upgrading OpenCart

  4. We also delete the config.php file, which resides in the upload/admin folder in our local computer.

    Upgrading OpenCart

  5. Now, let's add all the files in the upload folder into an upload.zip archive file on our local computer.

    Upgrading OpenCart

  6. Let's upload the upload.zip file where our store files are on the web server. Then, let's Extract all the contents to the same folder on the web server. We should allow re-writing of all files if we get a message about doing it.

    The other solution would be deleting all files on the server except config.php and extracting the new files there.

    Upgrading OpenCart

  7. After the extraction is complete, let's browse into http://www.yourwebsite.com/store/install/upgrade.php path. Here, we have assumed our OpenCart installation is under /store directory. If our store files are under root folder of the website, we should browse into
    http://www.yourwebsite.com/install/upgrade.php.

    The script will run and inform us about the result. The following screenshot shows the success page:

    Upgrading OpenCart

  8. Let's browse into the storefront now and be sure that everything is working as expected. Also, let's open the administration panel and check the system settings. If there are any changes, let's apply them to the needed settings back.

What just happened?

We have downloaded the latest OpenCart version to our local computer. We have extracted the contents of the archive file and deleted two config.php files which reside in the upload and upload/admin folders.

 

Then, we re-packaged all the upload folder content as upload.zip. The next step was to upload the upload.zip file to our webserver and extract this archive. We have re-written all files with the new versions. We have run the upgrade script and have seen the results of the upgrade process.

 

Finally, we have controlled all functionality of the OpenCart system, both on the storefront and on the administration panel menus.

Have a go hero – exploring config.php files

Now, go and download the config.php files both from the store root and admin folders. Open them with any word editor and explore the contents. They include several path definitions which OpenCart uses and your database connection information.

Restoring to the original OpenCart version

No software is completely perfect, and OpenCart is no exception. Any upgrade process can fail partially or completely. This is especially true if we have manual changes on OpenCart system files, database structure, or have used several third party mods in the system. We will now see how we will use backup files to restore our OpenCart system when needed.

Time for action – restoring OpenCart system if upgrade fails

In this section, we will now learn how to replace OpenCart files and restore the database.

  1. Let's open File Manager in cPanel and find where our OpenCart files are located. In this case, they are in the store folder. Let's delete it.

    Upgrading OpenCart

  2. Let's upload our backup store.zip file here and extract the contents.

    Upgrading OpenCart

  3. We now have old OpenCart files which are retrieved from the backup file, as we can see from the following screenshot:

    Upgrading OpenCart

  4. We can use the built-in Restore tool of OpenCart. Let's browse into the System | Backup | Restore menu. After that let's choose the backup.sql files which we have previously saved in our local computer. All we need to do finally is to click on the Restore button on the top of the screen.

    Upgrading OpenCart

    If you have used the first method of restoring OpenCart database, you can skip the following section. Still, you can read it to increase your knowledge on cPanel Backup Wizard.

  5. Let's open Backup Wizard on cPanel. It is under the Files menu.

    Upgrading OpenCart

  6. We will need to click on the Restore button to continue.

    Upgrading OpenCart

  7. Let's click on the MySQL Databases button on the Select Restore Type menu.

    Upgrading OpenCart

  8. We will need to browse the OpenCart database backup file which we have already backed up before. After this, let's click on the Upload button.

    Upgrading OpenCart

  9. The restore wizard will run the contents of the SQL file in the archive. It will drop all tables in this database, recreate them, and reinsert all of the values.

    Upgrading OpenCart

  10. Now, we should check both the storefront and administration settings manually to be sure that every functionality works as expected.

What just happened?

We first deleted all OpenCart files. Then, we have uploaded the backup file and extracted the contents. So, we have finished restoring files. We have opened the Backup Wizard in cPanel and uploaded a database backup through the wizard. It has run and overwritten our database to old values which are retrieved from the SQL backup file.

Summary

As we can see, upgrading OpenCart is not a difficult task thanks to new upgrade script, but the upgrade process still needs a careful execution order. The most important thing is to back up files and the database beforehand. Also, we should be careful about not to overwrite working config.php files with the empty config files that come with new versions.

In this article, we learned how to upgrade OpenCart on a web server and restore the old system if an upgrade fails.

OpenCart 1.4: Beginner's Guide Build and manage professional online shopping stores easily using OpenCart.
Published: August 2010
eBook Price: $9.99
Book Price: $39.99
See more
Select your format and quantity:

About the Author :


Murat Yilmaz

Murat Yilmaz is a software developer and an online entrepreneur who lives in Antalya, Turkey. He has over 10 years of experience in different IT fields, including development of web-driven solutions, large databases, and OLAP systems. He has worked in several multinational companies in Istanbul and Moscow as a consultant. He currently runs his own blog and an e-commerce and online advertising network. He holds a bachelor's degree in Computer Science from Marmara University at Istanbul. He spends his free time playing progressive rock songs, online chess, and reading scientific books.

He has also authored two other books, OpenCart 1.4: Beginner's Guide and OpenX Ad Server: Beginner's Guide.

Books From Packt


Agile Web Application Development with Yii1.1 and PHP5
Agile Web Application Development with Yii1.1 and PHP5

JasperReports 3.6 Development Cookbook
JasperReports 3.6 Development Cookbook

jQuery 1.4 Reference Guidel
jQuery 1.4 Reference Guide

Python Multimedia
Python Multimedia

YUI 2.8: Learning the Library
YUI 2.8: Learning the Library

NetBeans Platform 6.9 Developer's Guide
NetBeans Platform 6.9 Developer's Guide

FreeSWITCH 1.0.6
FreeSWITCH 1.0.6

Magento 1.3: PHP Developer's Guide
Magento 1.3: PHP Developer's Guide


Your rating: None Average: 5 (1 vote)
Upgrade from 1.4.7 to 1.4.9.1 by
Hi, First of all many thanks for this great tutorial! I was wondering if I can follow the same steps for upgrading from a 1.4.7 to 1.4.9.1? Thank you!

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
U
e
4
8
5
R
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software