Page 1 of 1
How To Remove All Countries Except U.S & Canada
Posted: Tue Aug 07, 2018 2:28 am
by vvinyl
Is there any way to mass disable several countries and zones at a time?
I see that I can check them and mass delete, but I didn't want to do that in case I decide to ship internationally at some point in the future.
I started going through them and disabling each one at a time, but that is going to take forever.
Has anyone found a simple solution other than deleting?
Also, I tried to check all the ones I wanted to delete and when it went through I got an error that said
'Warning: This zone cannot be deleted as it is currently assigned to 1 address book entries!'
I can't find an address book so I can take this off. Does anyone know any fixes, solutions?
Thanks
Re: How To Remove All Countries Except U.S & Canada
Posted: Tue Aug 07, 2018 10:23 pm
by Johnathan
The fastest way to do it is directly through the database, where you can disable all countries at once. For example, if you ran this query, it would disable all countries, and then you could re-enable the two you want:
Code: Select all
UPDATE oc_country SET `status` = 0;
You should double-check the table name in your database, since you may have a different prefix than oc_
Re: How To Remove All Countries Except U.S & Canada
Posted: Wed Aug 08, 2018 1:00 am
by nastydwarf
Thanks for this info! When you run the query does it update quickly? i keep updating mine and when i go back in i noticed they are enabled.
Re: How To Remove All Countries Except U.S & Canada
Posted: Wed Aug 08, 2018 1:46 am
by straightlight
Depending on the server's resource, using an update query can normally go up to 500 rows. If lower, then we could be looking at a high resource usage of your mySQL server, an old PHP / mySQL server libraries installed.
Re: How To Remove All Countries Except U.S & Canada
Posted: Wed Aug 08, 2018 5:01 am
by Johnathan
It should be super fast, there are only 239 ~ 257 countries in a standard OpenCart installation. Mine takes less than 1 second to do it, so if yours isn't working, then it's probably not being run correctly.
Double-check the database table prefix (which is "oc_" by default, but might be something different in your installation) and double-check that you're clicking the correct button in your database editor (e.g. phpMyAdmin) to actually run the query. If you still have issues after that, I'd maybe ask your host to attempt it, and make sure that phpMyAdmin is working correctly.
Re: How To Remove All Countries Except U.S & Canada
Posted: Sun Apr 24, 2022 7:39 pm
by bird372
Johnathan wrote: ↑Tue Aug 07, 2018 10:23 pm
The fastest way to do it is directly through the database, where you can disable all countries at once. For example, if you ran this query, it would disable all countries, and then you could re-enable the two you want:
Code: Select all
UPDATE oc_country SET `status` = 0;
You should double-check the table name in your database, since you may have a different prefix than oc_
thank you very much , your solution helped me
Re: How To Remove All Countries Except U.S & Canada
Posted: Fri Mar 08, 2024 12:32 pm
by NavyUnsob
Johnathan wrote: ↑Tue Aug 07, 2018 10:23 pm
The fastest way to do it is directly through the database, where you can disable all countries at once. For example, if you ran this query, it would disable all countries, and then you could re-enable the two you want:
Code: Select all
UPDATE oc_country SET `status` = 0;
You should double-check the table name in your database, since you may have a different prefix than oc_
Kia Finance Login
Thank you @Johnathan for this help this is so helpful for me thank you again.