Page 1 of 1

Backup and restore zones, countries and geo zones from one store to another - for Dummies

Posted: Mon Jun 08, 2020 12:15 am
by JeepSWAG
OC experts, please review and comment.

I've got a lot of from this community and I think I found a way to contribute something.

I needed to make a gold copy of my zones, geo zones and countries, that I would be able to import when I do a new install of OC. Here is what I've come up with and I it looks like it works. I'd welcome process reviews and feedback by OC developers.

I am not a developer and do not have the ability to thoroughly test this. As always backup before doing this and do it at your own risk.

In source store;
1. Delete all zones, geo zones and countries that I would not be using, in order to create a gold list.
2. System>Maintenance>Backup/Restore - Unselect all then Select the following (your database names may be different);
- ocxx_country
- ocxx_geo_zone
- ocxx_zone
- ocxx_zone_to_geo_zone
3. Click export and save the file

In Target store
1. System>Maintenance>Backup/Restore - Unselect all then Select the following ;
- ocyy_country
2. Click export and save the file

With Notepad++
1. Edit the target store and determine the database name. In the above example you will see ocyy
2. Edit the source store and Replace <Ctrl-H> all instances of the database name (in our example above ocxx) with the database name of target store (in our example above ocyy).

Example of what it starts as and becomes;

Source Store;

Code: Select all

TRUNCATE TABLE `ocxx_country`;

INSERT INTO `ocxx_country` (`country_id`, `name`, ...
INSERT INTO `ocxx_country` (`country_id`, `name`, ...
INSERT INTO `ocxx_country` (`country_id`...
WILL BECOME

Target Store;

Code: Select all

TRUNCATE TABLE `ocyy_country`;

INSERT INTO `ocyy_country` (`country_id`, `name`, ...
INSERT INTO `ocyy_country` (`country_id`, `name`, ...
INSERT INTO `ocyy_country` (`country_id`...
3. Save this file as zonesgold.sql

In the Target store;
1. System>Maintenance>Backup/Restore <Restore>
2. Import the zonesgold.sql file and check your work.

Re: Backup and restore zones, countries and geo zones from one store to another - for Dummies

Posted: Mon Jun 08, 2020 12:16 am
by straightlight
This topic has now been moved to the OpenCart 3.0 Support > General Support section of the forum.

Re: Backup and restore zones, countries and geo zones from one store to another - for Dummies

Posted: Mon Jun 08, 2020 4:58 am
by sw!tch
Built in backup restore is terrible IMO. You can easily do the export / import with PHPmyAdmin less chance for error. The rest of your logic is fine otherwise.

Re: Backup and restore zones, countries and geo zones from one store to another - for Dummies

Posted: Wed Jun 10, 2020 9:08 am
by JeepSWAG
Thanks for reading through the first post.
Is the built in backup not very reliable? I'm planning on moving one of my sites soon and was going to use the backup and restore.
If someone would give me the basic steps to do this via PHPmyAdmin, I'd be happy to idiot proof it (make it so easy that I can even do it...)

sw!tch wrote:
Mon Jun 08, 2020 4:58 am
Built in backup restore is terrible IMO. You can easily do the export / import with PHPmyAdmin less chance for error. The rest of your logic is fine otherwise.