Post by Gobbo » Mon Feb 08, 2021 7:24 am

Hi,

Is there a faster way of disabling countries? Then going into each one, selecting disable and saving.

Upgraded to opencart version 3.0.3.2


Active Member

Posts

Joined
Tue Jun 22, 2010 12:38 am

Post by mikeinterserv » Mon Feb 08, 2021 7:36 am

Not easily no
You could write an sql query but then your going to have to add all the country names you want to disable them anyway.
That could be done by grabbing the countries from a simple txt list and changing the status in the DB
by the time you create the list, write the sql, mess it up a time or two - you could have done it manually anyway :-)
Good thing is you only have to do it once.
If you are absolutely sure you will never ever need those countries you could do a multiple delete.
But you have to delete the zones first - you cannot delete a country that is assigned to zones
Have you checked to see if there is an extension to help - this must have come up hundreds of times I think
Also remember to use geozones effectively and it becomes less important to disable countries

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Mon Feb 08, 2021 8:07 am

Gobbo wrote:
Mon Feb 08, 2021 7:24 am
Hi,

Is there a faster way of disabling countries? Then going into each one, selecting disable and saving.
Multiple possibilities can be chose and considered for these types of request:

- viewtopic.php?f=202&t=220373&p=801725#p801723
- and starting here: viewtopic.php?f=202&t=211632&p=754597#p754778 .

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xxvirusxx » Mon Feb 08, 2021 8:38 am

yes, using a SQL command.

My converted modules | Buy me a beer | Opencart upgrade service


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mikeinterserv » Mon Feb 08, 2021 8:45 am

Had a trawl through all that and a number of others, This is probably near a no1 question from a lot of shop owners.
I certainly have been asked no end when these country situations crop up with that amount of countries.
It would seem logical to have the exact reverse in that all countries are disabled as default and enable what you need.
or at least include continental zones etc. It is a question for straighlight really as I guess this has almost certainly been discussed.
It would be pretty easy to come up with a way to disable all countries in 1 query, then manually from admin enable what you need.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Mon Feb 08, 2021 9:34 am

mikeinterserv wrote:
Mon Feb 08, 2021 8:45 am
Had a trawl through all that and a number of others, This is probably near a no1 question from a lot of shop owners.
I certainly have been asked no end when these country situations crop up with that amount of countries.
It would seem logical to have the exact reverse in that all countries are disabled as default and enable what you need.
or at least include continental zones etc. It is a question for straighlight really as I guess this has almost certainly been discussed.
It would be pretty easy to come up with a way to disable all countries in 1 query, then manually from admin enable what you need.
It would then become problematic to handle extensions that are using geographic zones, for instance, with payment extension, shipping extension, and total extension modules where all zones are selected. Granted, the queries would follow along systematically. However, it's the admin users that might not follow the same path that easily as to know which of these geographic settings have been disabled altogether in order to re-enable all these settings one-at-a-time which means, in the end, it would then be as an equally encountered situation than simply disabling them one-by-one.

Besides, the Opencart admin core model does not have the distinction integrated where all geographic countries and zones must match accordingly. They're almost all running independently and aside from each other when deleting a country or a zone out-of-the-box.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mikeinterserv » Mon Feb 08, 2021 9:42 am

Its a bit like a hidden minefield - it doesn't seem much till you get into it. :-)
I see exactly what you say.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Mon Feb 08, 2021 9:49 am

mikeinterserv wrote:
Mon Feb 08, 2021 9:42 am
Its a bit like a hidden minefield - it doesn't seem much till you get into it. :-)
I see exactly what you say.
A hidden minefield can be disarmed once you know the combination whereas geographic extensions cannot be disarmed that easily once the counted rows are affected on the database and until the users do find the root cause.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Gobbo » Mon Feb 08, 2021 4:36 pm

Thank you for everyone's feedback 😉

Looks like I'll be manually disabling each one. Then I can enable them as the website grows.

Upgraded to opencart version 3.0.3.2


Active Member

Posts

Joined
Tue Jun 22, 2010 12:38 am

Post by xxvirusxx » Mon Feb 08, 2021 5:05 pm

Gobbo wrote:
Mon Feb 08, 2021 4:36 pm
Looks like I'll be manually disabling each one. Then I can enable them as the website grows.
Why you don't this with the SQL command?

Code: Select all

UPDATE `oc_country` SET `status` = '0';
Or if you need to have enabled one country

Code: Select all

UPDATE `oc_country` SET `status` = '0' WHERE `country_id` <> 'X';
where X, is the id of your country. Then edit a country and save, to clear cache.

My converted modules | Buy me a beer | Opencart upgrade service


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Gobbo » Mon Feb 08, 2021 5:11 pm

Yes, but I'll still have to do this line 239 times listing every country.

Is there a easily way to double check all countries required have been disabled?

Upgraded to opencart version 3.0.3.2


Active Member

Posts

Joined
Tue Jun 22, 2010 12:38 am

Post by xxvirusxx » Mon Feb 08, 2021 5:16 pm

239 times for what?

How many countries you use (you want enabled) ?

My converted modules | Buy me a beer | Opencart upgrade service


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Gobbo » Mon Feb 08, 2021 5:26 pm

I only want to ship to the UK, then as the site grows add more countries.

Upgraded to opencart version 3.0.3.2


Active Member

Posts

Joined
Tue Jun 22, 2010 12:38 am

Post by xxvirusxx » Mon Feb 08, 2021 5:29 pm

Gobbo wrote:
Mon Feb 08, 2021 5:26 pm
I only want to ship to the UK, then as the site grows add more countries.
If you want to use only UK, then disable all countries except UK

Code: Select all

UPDATE `oc_country` SET `status` = '0' WHERE `country_id` <> '222';
where 222 is the UK country ID.

And to understand:

< - all countries ID untill 222
> - all countries ID after 222

So is just one (1) command.

My converted modules | Buy me a beer | Opencart upgrade service


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Gobbo » Mon Feb 08, 2021 7:34 pm

Thanks, I'll try that.

Upgraded to opencart version 3.0.3.2


Active Member

Posts

Joined
Tue Jun 22, 2010 12:38 am

Post by Gobbo » Mon Feb 08, 2021 8:39 pm

Thanks, that worked perfectly.

I really have to learn SQL.

Upgraded to opencart version 3.0.3.2


Active Member

Posts

Joined
Tue Jun 22, 2010 12:38 am
Who is online

Users browsing this forum: No registered users and 8 guests