Community Forums

Block Countries

General support for technical problems with OpenCart v0.x

Block Countries

Postby Andrew_M » Tue Jan 06, 2009 2:24 am

How do you block all countries from ordering except the U.S. and Canada?

Thanks.
Andrew_M
 
Posts: 31
Joined: Fri Jan 02, 2009 5:38 pm

Re: Block Countries

Postby Qphoria » Tue Jan 06, 2009 2:44 am

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:
Code: Select all
delete from country where `name` != 'United States' and `name` != 'Canada';
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18200
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: Block Countries

Postby fido-x » Tue Jan 06, 2009 2:58 am

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.
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Andrew_M » Tue Jan 06, 2009 3:30 am

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

Postby fido-x » Tue Jan 06, 2009 3:50 am

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']);
Last edited by fido-x on Tue Jan 06, 2009 3:55 am, edited 1 time in total.
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Andrew_M » Tue Jan 06, 2009 3:56 am

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

Postby fido-x » Tue Jan 06, 2009 4:03 am

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.
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Andrew_M » Tue Jan 06, 2009 2:15 pm

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

Postby fido-x » Wed Jan 07, 2009 12:04 am

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.
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Andrew_M » Wed Jan 07, 2009 2:35 am

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>
but it still will not show me an error it will just not continue.
Andrew_M
 
Posts: 31
Joined: Fri Jan 02, 2009 5:38 pm

Re: Block Countries

Postby fido-x » Mon Jan 12, 2009 2:39 am

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.
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Qphoria » Mon Jan 12, 2009 2:46 am

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
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18200
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: Block Countries

Postby fido-x » Mon Jan 12, 2009 3:22 am

Qphoria wrote:HOW DARE YOU! WE ARE DOCKING YOUR PAY


LOL :D Pay? You mean I'm supposed to be getting paid? ;D
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Andrew_M » Mon Feb 02, 2009 1:16 am

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.
Andrew_M
 
Posts: 31
Joined: Fri Jan 02, 2009 5:38 pm

Re: Block Countries

Postby fido-x » Tue Feb 03, 2009 4:52 am

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.
Image
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?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Block Countries

Postby Qphoria » Tue Feb 03, 2009 5:53 am

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!
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18200
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: Block Countries

Postby Andrew_M » Tue Feb 03, 2009 2:45 pm

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

Postby Qphoria » Tue Feb 03, 2009 2:50 pm

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.
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18200
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: Block Countries

Postby Andrew_M » Tue Feb 03, 2009 10:16 pm

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

Postby bthirsk » Tue Feb 03, 2009 10:43 pm

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.
Brent
User avatar
bthirsk
 
Posts: 121
Joined: Wed Sep 03, 2008 3:33 am
Location: Canada

Next

Return to General Support

Who is online

Users browsing this forum: No registered users and 2 guests

Hosted by Arvixe Web Hosting