I was recently tasked with upgrading an Ubercart ecommerce site, which was very outdated and based on Drupal 6. Although shop worked, we felt that there could be major improvements in usability, both for the customer and for the shop admins. As a fan of Opencart, I had recently heard that the Opencart team had released version 2 with some major updates, such as a brand new responsive template and a much slicker interface for updating the shop. Rather than upgrading to a newer version of Drupal & Ubercart, we decided to transfer everything over to a fresh Opencart 2 install.
I did some research into ecommerce migration and found a couple of solutions, but they don’t come cheap. I was quoted prices of £1500+ for the data transfer alone, and that’s assuming a basic install, without the customisations that were in place on the existing Ubercart site. Rather than spending that sort of money, I opted to write a migration script myself in node.js. I have made this script available for free download on my GitHub page.
If anyone else is looking to follow the same migration path, my script should help get you started in the right direction. Note that I started from an old, customised Ubercart build so the database layouts may be slightly different. There’s some basic error reporting in there too just in case you come across any problems.
The app includes a configuration file, where you can set up your database information, both for your Ubercart install and your Opencart install. It also includes an option to truncate databases, which if set to true will empty the list of database tables found in migration-scripts.js. Usually, you would want to set this to true if you have a fresh Opencart install with test data, but if you have an existing Opencart shop and are looking to merge the two together, you probably won’t want to truncate. I’ll leave that up to you.
As the app is written in node.js, everything is used within the async library to keep all of the functions asynchronous.
Please back up your databases before using the script. I take no responsibility for any data loss.
The script is set up for transfer of the following:
- Existing customers
- Store options (e.g. Size, Colour)
- Products to categories
- Setting up basic SEO urls
- Product Images
The front end
The front end is very basic, and initially only contains a single button which starts the migration. Once the app starts running, you will see progress updates, provided by the brilliant socket.io.
After running the script, we’re left with a ready to use Opencart 2 website, complete with all of the important information required to run the shop effectively. With a custom template also made for the new website, we have seen a decent increase in the website usage, and the shop admins are much happier with the new features that Opencart provides over Ubercart, and how easy it is to update.