Zen Cart Logo
Forums / Customization from the Admin / How do I Limit to One Country in Account Setup?

How do I Limit to One Country in Account Setup?

Views: 5,595

Results 1 to 17 of 17
22 Jun 2011, 5:19 AM
#1
bacbladerunner avatar

bacbladerunner

New Zenner

Join Date:
Feb 2011
Location:
California
Posts:
65
Plugin Contributions:
0

How do I Limit to One Country in Account Setup?

I cannot find what controls the population of the drop-down menu for COUNTRY when a customer is creating a new account. The way it is, the drop down menu has all countries listed. I deleted a few names from the Locations/Countries list and this works. I can just delete all countries from this list except the US if I need to. It probably wouldn't take more than a half hour. If I want to sell into Canada and Mexico later I could just add those back to the list.

Is this the only way, or is there a simpler, cleaner method?

22 Jun 2011, 5:34 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

Yes, deleting unwanted countries will do the trick.

remember that when / if you later add countries back to the list, make sure you include their ISO codes (both the 2-digit and 3-digit codes.)

There are various lists in the internet that tell you the official ISO codes... I use the one at wikipedia.

22 Jun 2011, 6:18 AM
#3
bacbladerunner avatar

bacbladerunner

New Zenner

Join Date:
Feb 2011
Location:
California
Posts:
65
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

Thanks, schoolboy. That's what I'll do.

22 Jun 2011, 10:19 AM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How do I Limit to One Country in Account Setup?

If you'll never want to sell outside the US, the easiest way is probably to back up your database, then run this in Admin - Tools - Install SQL Patches :

DELETE from countries WHERE countries_iso_code_3 NOT IN('USA');

A better way might be to set up a shipping zone that only includes the US:

https://www.zen-cart.com/tutorials/index.php?article=69

That way, customers in other countries will be able to buy from you and ship the product to someone in the US - gifts, for example.

23 Jun 2011, 3:12 AM
#5
bacbladerunner avatar

bacbladerunner

New Zenner

Join Date:
Feb 2011
Location:
California
Posts:
65
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

Thanks, Stevesh. Good ideas. I was able to delete them all manually in 10-15 minutes. I am B-B only for industrial tooling, so I expect no orders from outside the US as gifts. I will probably add Canada and Mexico later. Also, I tried the zone idea, but there does not seem to be any way to apply a zone to the COUNTRY drop down in account creation. This seems to populate directly from the Countries list.

23 Jun 2011, 3:23 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: How do I Limit to One Country in Account Setup?

When you do re-add those countries, you should put them back EXACTLY as they were in the original install, including their countries_id number.

25 Jun 2011, 7:49 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

DrByte:

...including their countries_id number.

...critically important...

I have had to do this, and it requires a lot of care. The SQL can be found in the zc_install/sql/mysql_zencart.sql of your ZC version. You also need to know what you are doing when applying SQL "patches".

18 Jan 2012, 12:55 PM
#8
adem_i avatar

adem_i

New Zenner

Join Date:
Jul 2010
Location:
Sydney, Australia
Posts:
86
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

stevesh:

If you'll never want to sell outside the US, the easiest way is probably to back up your database, then run this in Admin - Tools - Install SQL Patches :

DELETE from countries WHERE countries_iso_code_3 NOT IN('USA');

A better way might be to set up a shipping zone that only includes the US:

https://www.zen-cart.com/tutorials/index.php?article=69

That way, customers in other countries will be able to buy from you and ship the product to someone in the US - gifts, for example.

Hi Stevesh, was just wondering what the safest method to restrict to only one country would be for a beginner at coding. I'm not really confident enough to run an SQL patch to restrict my customers to only selecting Australia.

18 Jan 2012, 1:31 PM
#9
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How do I Limit to One Country in Account Setup?

No coding (or confidence) required. Just back up your database, then Copy the statement below, Paste it into the big box in Admin - Tools - Install SQL Patches and click the Send button.

DELETE from countries WHERE countries_iso_code_3 NOT IN('AUS');

As I said in my other post, if you follow the tutorial I referenced and set up a shipping zone just for Australia, people in other countries can still buy from you and have the products shipped within your country, if you think that might happen.

20 Jan 2012, 12:35 AM
#10
adem_i avatar

adem_i

New Zenner

Join Date:
Jul 2010
Location:
Sydney, Australia
Posts:
86
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

thanks for your help. I'd rather stick to purchases within Australia also to prevent the risk of fraud for now.

28 Mar 2013, 2:48 AM
#11
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

stevesh:

If you'll never want to sell outside the US, the easiest way is probably to back up your database, then run this in Admin - Tools - Install SQL Patches :

DELETE from countries WHERE countries_iso_code_3 NOT IN('USA');

A better way might be to set up a shipping zone that only includes the US:

https://www.zen-cart.com/tutorials/index.php?article=69

That way, customers in other countries will be able to buy from you and ship the product to someone in the US - gifts, for example.

That deletes all but USA. How about if you want to keep USA and Canada?

Could you add an "AND" in there somewhere?

28 Mar 2013, 3:38 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: How do I Limit to One Country in Account Setup?

"NOT IN('USA');" would become "NOT IN('USA', 'CAN');"

Or alternatively consider using the plugin for restricting available countries.

28 Mar 2013, 5:52 AM
#13
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

Which one works best with Zen 1.5.1?

This plugin you mention will restrict same countries from appearing in the customer registration area as well?

28 Mar 2013, 6:32 AM
#14
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

Per Doctor's recommendation, I used selectable_countries_v101

It eliminates the unwanted countries, while registering as well.

It works great. Thank you.

25 Sep 2013, 10:35 PM
#15
lolwaut avatar

lolwaut

Zen Follower

Join Date:
Dec 2010
Posts:
142
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

Hello fellow Zenners,

When I first launched my store, we only shipped within the USA so I ran the code that was suggested earlier in this thread:

DELETE from countries WHERE countries_iso_code_3 NOT IN('USA');

Now, I would like to start shipping to Canada. How do I add Canada back to my list of countries?

Any help is greatly appreciated. Thanks for your time!

26 Sep 2013, 3:47 AM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: How do I Limit to One Country in Account Setup?

INSERT INTO countries VALUES (38,'Canada','CA','CAN','2');
28 Sep 2013, 5:12 AM
#17
lolwaut avatar

lolwaut

Zen Follower

Join Date:
Dec 2010
Posts:
142
Plugin Contributions:
0

Re: How do I Limit to One Country in Account Setup?

DrByte:

INSERT INTO countries VALUES (38,'Canada','CA','CAN','2');


This worked for me. Thank you.