When we start our e-commerce website often we question ourself to cost cutting and cart type used. As a result we tend to select a hosting provider or service type which becomes a bottleneck, or may be the service is not that good enough which you desired. This leads to changing the hosting provider and we need to move our system to new provider. Although there are many forums which share details of the migration but I thought to update them here as well just for reference.

E-commerce store based on opencart has three major components.
1. Database (DB)
2. main page web-files
3. admin panel web-files

There is no need to make any changes at DB level however we need to make few changes on the config files of the web-pages.

After uploading all the web-files following things need to changed:
Open your public folder (public_html).
Next, right click on your config.php file and select ‘View/Edit’ (if you have installed your OpenCart in a sub folder, you will find your config file in there.)
The file should now open up for editing. In here you will need to edit a few lines of code. Find the lines:

// DIR
define(‘DIR_APPLICATION’, ‘/home/sites/YOUR-DOMAIN/public_html/catalog/’);
define(‘DIR_SYSTEM’, ‘/home/sites/YOUR-DOMAIN/public_html/system/’);
define(‘DIR_DATABASE’, ‘/home/sites/YOUR-DOMAIN/public_html/system/database/’);
define(‘DIR_LANGUAGE’, ‘/home/sites/YOUR-DOMAIN/public_html/catalog/language/’);
define(‘DIR_TEMPLATE’, ‘/home/sites/YOUR-DOMAIN/public_html/catalog/view/theme/’);
define(‘DIR_CONFIG’, ‘/home/sites/YOUR-DOMAIN/public_html/system/config/’);
define(‘DIR_IMAGE’, ‘/home/sites/YOUR-DOMAIN/public_html/image/’);
define(‘DIR_CACHE’, ‘/home/sites/YOUR-DOMAIN/public_html/system/cache/’);
define(‘DIR_DOWNLOAD’, ‘/home/sites/YOUR-DOMAIN/public_html/download/’);
define(‘DIR_LOGS’, ‘/home/sites/YOUR-DOMAIN/public_html/system/logs/’);

You will need to update these to your correct path. Contact your hosting company for the full path to your public folder. Make sure to replace YOUR-DOMAIN with your domain without the www. e.g. /home/sites/mywebsite.com/public_html/) OR the physical path of the web-pages

Next, you need to update your database connection settings. Find the below:

// DB
define(‘DB_DRIVER’, ‘mysql’);
define(‘DB_HOSTNAME’, ‘localhost’);
define(‘DB_USERNAME’, ‘your-old-opencart-databse-username’);
define(‘DB_PASSWORD’, ‘your-old-opencart-databse-password);
define(‘DB_DATABASE’, ‘your-old-opencart-databse-database);
define(‘DB_PREFIX’, ‘oc_’);

You will need to replace these with the new details;

DB_HOSTNAME = Your database host (usually localhost).
DB_USERNAME = Your Database username.
DB_PASSWORD = Your Database password
DB_DATABASE = Your database name

You will have to do the same for admin config.php. ensure that path is also correct.

Hope it helps! for migration assistance and help you can contact me as well.

Leave a Reply

Your email address will not be published. Required fields are marked *