Zen Cart Logo
Forums / Currencies & Sales Taxes, VAT, GST, etc. / deleted zones from zen_zones

deleted zones from zen_zones

Views: 2,538

Results 1 to 15 of 15
19 Jan 2012, 12:55 AM
#1
mentose457 avatar

mentose457

New Zenner

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

deleted zones from zen_zones

Howdy all,

I deleted all of the zones from zen_zones database and know I can only select one state when making an account.

I need to add the other 49 states back in. What is the easiest way to to this? Im not that familiar with sql. Can I make a spreadsheet with the required info and upload it?

Any help would be appreciated.

Brent

19 Jan 2012, 3:09 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: deleted zones from zen_zones

Best to restore from the backup you made before deleting them.

19 Jan 2012, 8:17 AM
#3
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,792
Plugin Contributions:
14

Re: deleted zones from zen_zones

IF no backup, perhaps http://tinyurl.com/7mjaw5l can help.

21 Jan 2012, 1:11 AM
#4
mentose457 avatar

mentose457

New Zenner

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

Re: deleted zones from zen_zones

DrByte:

Best to restore from the backup you made before deleting them.

I dont have a back up. I was working with a fresh installation. Thanks though.

21 Jan 2012, 1:28 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: deleted zones from zen_zones

Look at your database in phpMyAdmin ...

How many records are in the zones table now?

21 Jan 2012, 4:42 AM
#6
mentose457 avatar

mentose457

New Zenner

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

Re: deleted zones from zen_zones

Ajeh:

Look at your database in phpMyAdmin ...

How many records are in the zones table now?

Only one for Nevada. I put this together and was planning on pasting it in SQL tools.

INSERT INTO 'zones' ('zone_id', 'zone_country_id', 'zone_code', 'zone_name') VALUES
(1, 223, AL, Alabama),
(2, 223, AK, Alaska),
(3, 223, AZ, Arizona),
(4, 223, AR, Arkansas),
(5, 223, CA, California),
(6, 223, CO, Colorado),
(7, 223, CT, Connecticut),
(8, 223, DE, Delaware),
(9, 223, FL, Florida),
(10, 223, GA, Georgia),
(11, 223, HI, Hawaii),
(12, 223, ID, Idaho),
(13, 223, IL, Illinois),
(14, 223, IN, Indiana),
(15, 223, IA, Iowa),
(16, 223, KS, Kansas),
(17, 223, KY, Kentucky),
(18, 223, LA, Louisiana),
(19, 223, ME, Maine),
(20, 223, MD, Maryland),
(21, 223, MA, Massachusetts),
(22, 223, MI, Michigan),
(23, 223, MN, Minnesota),
(24, 223, MS, Mississippi),
(25, 223, MO, Missouri),
(26, 223, MT, Montana),
(27, 223, NE, Nebraska),
(28, 223, NV, Nevada),
(29, 223, NH, New Hampshire),
(30, 223, NJ, New Jersey),
(31, 223, NM, New Mexico),
(32, 223, NY, New York),
(33, 223, NC, North Carolina),
(34, 223, ND, North Dakota),
(35, 223, OH, Ohio),
(36, 223, OK, Oklahoma),
(37, 223, OR, Oregon),
(38, 223, PA, Pennsylvania),
(39, 223, RI, Rhode Island),
(40, 223, SC, South Carolina),
(41, 223, SD, South Dakota),
(42, 223, TN, Tennessee),
(43, 223, TX, Texas),
(44, 223, UT, Utah),
(45, 223, VT, Vermont),
(46, 223, VA, Virginia),
(47, 223, WA, Washington),
(48, 223, WV, West Virginia),
(49, 223, WI, Wisconsin),
(50, 223, WY, Wyoming);
21 Jan 2012, 4:52 AM
#7
mentose457 avatar

mentose457

New Zenner

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

Re: deleted zones from zen_zones

The first line in the code above should read:

INSERT INTO `zones` (`zone_id`, `zone_country_id`, `zone_code`, `zone_name`) VALUES

When i past the code it get this error:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IN, Indiana), (15, 223, IA, Iowa), (16, 223, KS, Kansas), (17, 223, KY, Kentucky' at line 1
in:
[INSERT INTO zen_zones (zone_id, zone_country_id, zone_code, zone_name) VALUES (1, 223, AL, Alabama), (2, 223, AK, Alaska), (3, 223, AZ, Arizona), (4, 223, AR, Arkansas), (5, 223, CA, California), (6, 223, CO, Colorado), (7, 223, CT, Connecticut), (8, 223, DE, Delaware), (9, 223, FL, Florida), (10, 223, GA, Georgia), (11, 223, HI, Hawaii), (12, 223, ID, Idaho), (13, 223, IL, Illinois), (14, 223, IN, Indiana), (15, 223, IA, Iowa), (16, 223, KS, Kansas), (17, 223, KY, Kentucky), (18, 223, LA, Louisiana), (19, 223, ME, Maine), (20, 223, MD, Maryland), (21, 223, MA, Massachusetts), (22, 223, MI, Michigan), (23, 223, MN, Minnesota), (24, 223, MS, Mississippi), (25, 223, MO, Missouri), (26, 223, MT, Montana), (27, 223, NE, Nebraska), (28, 223, NV, Nevada), (29, 223, NH, New Hampshire), (30, 223, NJ, New Jersey), (31, 223, NM, New Mexico), (32, 223, NY, New York), (33, 223, NC, North Carolina), (34, 223, ND, North Dakota), (35, 223, OH, Ohio), (36, 223, OK, Oklahoma), (37, 223, OR, Oregon), (38, 223, PA, Pennsylvania), (39, 223, RI, Rhode Island), (40, 223, SC, South Carolina), (41, 223, SD, South Dakota), (42, 223, TN, Tennessee), (43, 223, TX, Texas), (44, 223, UT, Utah), (45, 223, VT, Vermont), (46, 223, VA, Virginia), (47, 223, WA, Washington), (48, 223, WV, West Virginia), (49, 223, WI, Wisconsin), (50, 223, WY, Wyoming);]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

There isn't any obvious errors in my code. Do you have any ideas?

Also, I noticed that zone_id is set as auto increment. Should i remove that from my code?

21 Jan 2012, 5:02 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: deleted zones from zen_zones

Those do not match the defaults in a clean install ...

You might look in the /zc_install/sql/mysql_latin1.sql or the /zc_install/sql/mysql_utf8.sql depending on how you set up your database and you will see the INSERT statements for USA ...

I would back everything up and rebuild that table ...

21 Jan 2012, 5:16 AM
#9
drbyte avatar

drbyte

Sensei

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

Re: deleted zones from zen_zones

Why exactly did you delete things in the first place?

mentose457:

I dont have a back up. I was working with a fresh installation.If it was a fresh install, then another fresh install will put back everything as it was.

21 Jan 2012, 4:13 PM
#10
mentose457 avatar

mentose457

New Zenner

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

Re: deleted zones from zen_zones

DrByte:

Why exactly did you delete things in the first place?
If it was a fresh install, then another fresh install will put back everything as it was.

I Thought I was deleting the ability to set up shipping/taxing zones. Not the ability to select the state while signing in.

21 Jan 2012, 4:14 PM
#11
mentose457 avatar

mentose457

New Zenner

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

Re: deleted zones from zen_zones

Ajeh:

Those do not match the defaults in a clean install ...

You might look in the /zc_install/sql/mysql_latin1.sql or the /zc_install/sql/mysql_utf8.sql depending on how you set up your database and you will see the INSERT statements for USA ...

I would back everything up and rebuild that table ...

Thanks. Ill give that a try.

21 Jan 2012, 4:19 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: deleted zones from zen_zones

I'd go with DrByte's suggestions if this is a new install ...

Then, you can make Zone Definitions and set in the DETAILS who you want to ship to ...

This way, Grandma in the UK can buy little Tiny Tim in the US a new crutch for Christmas ... :smile:

21 Jan 2012, 10:52 PM
#13
drbyte avatar

drbyte

Sensei

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

Re: deleted zones from zen_zones

The zones table contains zones which are associated with their country counterparts. In the US those are called States. In most countries they're called Provinces. The predefined entries should not be deleted.

The geo_zones and zones_to_geo_zones tables are what's used to define the zone definitions you use for assigning to taxes and shipping etc.

YOU NEVER NEED TO EDIT THOSE TABLES MANUALLY. The admin console gives you all the tools you need for managing those tables. There's no need to go to the raw database data. Especially for US stores.

31 Jan 2012, 1:56 AM
#14
mentose457 avatar

mentose457

New Zenner

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

Re: deleted zones from zen_zones

Thanks for the replies guys.

So... If i make a back up of everything in public_html can i restore it after i re-install zen cart?

31 Jan 2012, 6:46 AM
#15
drbyte avatar

drbyte

Sensei

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

Re: deleted zones from zen_zones

A proper backup consists of all the files in your Zen Cart folder on your server (sounds like in YOUR case that's public_html), plus an export of your database: https://www.zen-cart.com/tutorials/index.php?article=103