Block Countries
27 posts
• Page 1 of 2 • 1, 2
Block Countries
How do you block all countries from ordering except the U.S. and Canada?
Thanks.
Thanks.
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
There's not a "good" way to do it currently via the admin menu. That is something planned for 0.8...
For now, the easiest way is to run this sql in your phpmyadmin:
For now, the easiest way is to run this sql in your phpmyadmin:
- Code: Select all
delete from country where `name` != 'United States' and `name` != 'Canada';

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: Block Countries
Have a look at this thread http://forum.opencart.com/index.php/topic,1613.0.html, since it deals with pretty much the same subject.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
fido-x wrote:Have a look at this thread http://forum.opencart.com/index.php/topic,1613.0.html, since it deals with pretty much the same subject.
I get this error when I follow those instructions:
Notice: Undefined variable: error_country in /home/x/x/catalog/template/default/content/account_create.tpl on line 86
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
Add the following line:-
after or before
in "/catalog/controller/account_create.php" (somewhere around line 89)
EDIT:
Added line should read --
- Code: Select all
$view->set('error_country', @$this->error['country']);
after or before
- Code: Select all
$view->set('error_city', @$this->error['city']);
in "/catalog/controller/account_create.php" (somewhere around line 89)
EDIT:
Added line should read --
- Code: Select all
$view->set('error_country', @$this->error['country_id']);
Last edited by fido-x on Tue Jan 06, 2009 3:55 am, edited 1 time in total.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
fido-x wrote:Add the following line:-
- Code: Select all
$view->set('error_country', @$this->error['country']);
after or before
- Code: Select all
$view->set('error_city', @$this->error['city']);
in "/catalog/controller/account_create.php" (somewhere around line 89)
EDIT:
Added line should read --
- Code: Select all
$view->set('error_country', @$this->error['country_id']);
Okay, and by making these modifications it will block all countries except U.S. and Canada?
Thanks.
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
This will not necessarily "block" countries other than US or Canada, but will flag an error and prevent the creation of an account if the address is outside the US or Canada.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
fido-x wrote:This will not necessarily "block" countries other than US or Canada, but will flag an error and prevent the creation of an account if the address is outside the US or Canada.
No error pops up when I attempt to create an account with an address outside the U.S. or Canada. It just does not continue.
Isn't there supposed to be an error?
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
Andrew_M wrote:No error pops up when I attempt to create an account with an address outside the U.S. or Canada. It just does not continue.
Isn't there supposed to be an error?
If you have followed the instructions properly, you should be getting an error message.
You stated earlier in this thread that you were getting an error--
Andrew_M wrote:Notice: Undefined variable: error_country in /home/x/x/catalog/template/default/content/account_create.tpl on line 86
The original line 86 in RC5 reads --
- Code: Select all
</select></td>
Your edited line 86 should read --
- Code: Select all
</select><?php if ($error_country) { ?><span class="error"><?php echo $error_country; ?></span><?php } ?></td>
In other words place the inserted code between the and . If you have placed it before the or after the then it will not display.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
Yes I have edited account_create.tpl and edited line 86 to make it look like
- Code: Select all
</select><?php if ($error_country) { ?><span class="error"><?php echo $error_country; ?></span><?php } ?></td>
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
Apologies for not responding sooner to your last post, I've been away from the Internet for a few days. The instructions you have been given, although originally written for 0.7.7, will work in the current version (0.7.9RC6). If you're not getting an error message, you must have missed something (maybe the language file?).
All I can suggest is to go over what you've been told and make sure you have followed the instructions properly.
All I can suggest is to go over what you've been told and make sure you have followed the instructions properly.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
fido-x wrote:Apologies for not responding sooner to your last post, I've been away from the Internet for a few days.
HOW DARE YOU! WE ARE DOCKING YOUR PAY

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: Block Countries
Qphoria wrote:HOW DARE YOU! WE ARE DOCKING YOUR PAY
LOL
Pay? You mean I'm supposed to be getting paid? 

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
That page (http://forum.opencart.com/index.php/topic,1613.0.html) blocks every country except the United States. How do you unblock Canada?
Thanks.
Thanks.
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
Andrew_M wrote:That page (http://forum.opencart.com/index.php/topic,1613.0.html) blocks every country except the United States. How do you unblock Canada?
Thanks.
Further down the page that the link goes to (http://forum.opencart.com/index.php/topic,1613.msg7959.html#msg7959), you will find this bit of code --
- Code: Select all
if ($request->get('country_id') != 38 || $request->get('country_id') != 223) {
$this->error['country_id'] = $language->get('error_country');
}
Translated into English, the code snippet means -- if the requested country code is not equal to 38 (Canada) OR if the requested country code is not equal to 223 (United States), then output an error.

If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
-

fido-x - Posts: 1960
- Joined: Fri Jun 27, 2008 5:09 pm
- Location: Tasmania, Australia
Re: Block Countries
forget this manual nonsense 
bthirsk has a great contrib for country & zone enable/disable status here:
http://forum.opencart.com/index.php/topic,2887.0.html
Works perfect!

bthirsk has a great contrib for country & zone enable/disable status here:
http://forum.opencart.com/index.php/topic,2887.0.html
Works perfect!

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: Block Countries
Qphoria wrote:forget this manual nonsense :)
bthirsk has a great contrib for country & zone enable/disable status here:
http://forum.opencart.com/index.php/topic,2887.0.html
Works perfect!
I'm getting this error when I go to Localization > Country:
- Code: Select all
Error: Unknown column 'country_status' in 'field list'
Error No: 1054
select country_id, name, country_status, iso_code_2, iso_code_3 from country order by name asc limit 0, 20
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
Andrew_M wrote:Qphoria wrote:forget this manual nonsense :)
bthirsk has a great contrib for country & zone enable/disable status here:
http://forum.opencart.com/index.php/topic,2887.0.html
Works perfect!
I'm getting this error when I go to Localization > Country:
- Code: Select all
Error: Unknown column 'country_status' in 'field list'
Error No: 1054
select country_id, name, country_status, iso_code_2, iso_code_3 from country order by name asc limit 0, 20
First you need to post in "that" thread as that would be the support thread. Second, you need to read the included readme on the steps needed to execute the included sql file needed to use it.

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: Block Countries
Qphoria wrote:Andrew_M wrote:Qphoria wrote:forget this manual nonsense :)
bthirsk has a great contrib for country & zone enable/disable status here:
http://forum.opencart.com/index.php/topic,2887.0.html
Works perfect!
I'm getting this error when I go to Localization > Country:
- Code: Select all
Error: Unknown column 'country_status' in 'field list'
Error No: 1054
select country_id, name, country_status, iso_code_2, iso_code_3 from country order by name asc limit 0, 20
First you need to post in "that" thread as that would be the support thread. Second, you need to read the included readme on the steps needed to execute the included sql file needed to use it.
How do you "execute" country.sql?
Could you PLEASE give me step by step instructions? Thanks.
- Andrew_M
- Posts: 31
- Joined: Fri Jan 02, 2009 5:38 pm
Re: Block Countries
Log into PHPMyAdmin and open up you database. Click on SQL Query at the top for the screen and a Query box will open. Paste the SQL into this box and press the go button at the bottom.
You will get a confirmation that the query has updated 240 row in country and 3841 in zone.
You are done.
Just logout and have a beer.
You will get a confirmation that the query has updated 240 row in country and 3841 in zone.
You are done.
Just logout and have a beer.
Brent
-

bthirsk - Posts: 121
- Joined: Wed Sep 03, 2008 3:33 am
- Location: Canada
27 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 2 guests













