Zen Cart Logo
Forums / General Questions / Removed all countries except uk, gc doesnt work!!

Removed all countries except uk, gc doesnt work!!

Views: 2,749

Results 1 to 17 of 17
5 Mar 2012, 8:37 AM
#1
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Removed all countries except uk, gc doesnt work!!

a while back i followed a post made about removing countries from zen cart the post was....

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');

That will remove all countries except USA. Then go to Admin - Locations/Taxes - Zones and manually remove Alaska and Hawaii (and some others like Puerto Rico), depending if you want to sell there.

You could also set up a US-only shipping zone, but I don't think that will stop people from outside the US from creating accounts.

I altered the .sql to say GBR instead of USA.
I am wondering is there anyway to reverse this?
i have upgraded to the most recent zen version and installed a new payment module, now google checkout is giving me an error from the integration console saying "the cart was posted with an unrecognised country code" I can only assume it to be this that is causing the problem, i did have a coder that had made google checkout work for me before via an express checkout button but i can unfortunatly no longer get in touch with this person.
Any help would be greatly appreciated.

5 Mar 2012, 11:00 AM
#2
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Removed all countries except uk, gc doesnt work!!

You should be able to restore the 'countries' table in phpMyAdmin.

I have never done this (or something similar) but I would just install another instance of Zen Cart on a sub domain (make sure it's the same version of ZC), then go to phpMyAdmin on that new install and export the 'countries' table to my HD.

Next step would be to back up my live DB and then import the previously exported 'countries' table from my HD into my live DB.

That should restore all your country codes (I hope..... :lookaroun)

5 Mar 2012, 11:50 AM
#3
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

thankyou for your response, im not that well adapt but i shall give it a go.

5 Mar 2012, 11:53 AM
#4
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Removed all countries except uk, gc doesnt work!!

Xbox Memberships:

thankyou for your response, im not that well adapt but i shall give it a go.

Just make sure that you back up your live DB before doing this!

You may want to post the result here when you are done.

5 Mar 2012, 11:58 AM
#5
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

ive posted it as a job on vworker as knowing me id try it and it result in complete anarchy :oops:

5 Mar 2012, 12:17 PM
#6
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Removed all countries except uk, gc doesnt work!!

Check your PM

5 Mar 2012, 12:18 PM
#7
stevesh avatar

stevesh

Black Belt

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

Re: Removed all countries except uk, gc doesnt work!!

I just tested Frank's method on a couple of test sites and it worked as he described. You'll get an error message as the Import function tries to copy the country that's already there, but you can ignore it.

5 Mar 2012, 12:31 PM
#8
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Removed all countries except uk, gc doesnt work!!

stevesh:

I just tested Frank's method on a couple of test sites and it worked as he described. You'll get an error message as the Import function tries to copy the country that's already there, but you can ignore it.

Thanks, stevesh, I thought that error may bob up.

But other than that it should work easily as this table (countries) is what I would call a 'static' table, it does not change every 5 minutes - unlike the 'customers' or 'orders' tables ...

5 Mar 2012, 12:36 PM
#9
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

great stuff good to know it will work. im having trouble using my ftp. i use filezilla and even the pre saved quick connect settings or importing settings from cpanel dont work? closest i can get is a folder that contains nothing named "import" and a file named ftp.quota??

5 Mar 2012, 12:41 PM
#10
stevesh avatar

stevesh

Black Belt

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

Re: Removed all countries except uk, gc doesnt work!!

No, you don't use FTP for this. Under 'databases' in your hosting control panel should be a selection called 'phpMyAdmin', which is a database tool.

5 Mar 2012, 12:42 PM
#11
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

i need to use ftp to install zen to a subdomain so i can pinch the database from it dont i?

5 Mar 2012, 12:43 PM
#12
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

might help to mention ive already accessed the php myadmin area and backed up the zen_countries file :blush:

5 Mar 2012, 1:04 PM
#13
stevesh avatar

stevesh

Black Belt

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

Re: Removed all countries except uk, gc doesnt work!!

Sorry, I misunderstood. That's right. You might check post #7 here for a little easier installation method.

http://www.zen-cart.com/forum/showthread.php?t=190947

6 Mar 2012, 8:50 AM
#14
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Removed all countries except uk, gc doesnt work!!

@Xbox Memberships

Emailed the countries table as requested.

If you are using a prefix in your DB then you need to open the countries.sql file with your editor and add the prefix asf:

If your prefix is zen_ then change the line

CREATE TABLE IF NOT EXISTS `countries` (

to

CREATE TABLE IF NOT EXISTS `zen_countries` (

and change the line

INSERT INTO `countries` (`countries_id`, `countries_name`, `countries_iso_code_2`, `countries_iso_code_3`, `address_format_id`) VALUES

to

INSERT INTO `zen_countries` (`countries_id`, `countries_name`, `countries_iso_code_2`, `countries_iso_code_3`, `address_format_id`) VALUES

Save the changed file and then import the sql patch into your DB

Make sure you backup your live DB before doing this.

Best to set your store to Maintenance mode.

6 Mar 2012, 12:42 PM
#15
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

thanks frank worked a treat i did email you back not long ago, i now have all countries active once again, now my only 2 problems i can see are

  1. admin home displays 10 rows of visitors data all as today with todays figures?

  2. google checkout still wont work as it should, i have the express checkout button working but if google checkout is selected as payment option during normal checkout process i get an error on the integration console of google saying "you tried to post a none valid us address" the order processes as if payment has been made in zencart admin ui and delivers emails. but instead of being sent to the google checkout payment gateway page they are displayed with a warning about a .php error which i have placed below...

Warning: Invalid argument supplied for foreach() in /home/xboxmemb/public_html/includes/classes/order.php on line 778

Warning: Cannot modify header information - headers already sent by (output started at /home/xboxmemb/public_html/includes/classes/order.php:778) in /home/xboxmemb/public_html/includes/functions/functions_general.php on line 44

6 Mar 2012, 12:44 PM
#16
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

and also i have noticed emails are being sent out with weird symbols ive copy pasted it below as easier than trying to describe

Order Number: 436
Date Ordered: Tuesday 06 March, 2012
Detailed Invoice:
https://crazygamer.co.uk/index.php?main_page=account_history_info&order_id=436

Products

1 x new top/bottom screen for ds/ds lite (dsscreenfix) = £30.00

6 Mar 2012, 1:02 PM
#17
xbox_memberships avatar

xbox_memberships

Zen Follower

Join Date:
Jan 2010
Posts:
157
Plugin Contributions:
0

Re: Removed all countries except uk, gc doesnt work!!

im not sure how this line could be affecting the order process

line 778 in classes/order.php is

foreach($this->products[$i]['attributes'] as $attributes){