Zen Cart Logo
Forums / Addon Templates / Customers from other countries

Customers from other countries

Views: 2,478

Results 1 to 16 of 16
4 May 2016, 9:11 PM
#1
drbyte avatar

drbyte

Sensei

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

Customers from other countries

It's unadvisable to delete any countries from your database. Doing so DOES prevent ANY use of those removed countries for anything, including registration and sales and shipping quotes.

It's better to "disable" certain countries via your Admin. Deleting them altogether is generally a bad idea.

And, now that you've deleted them, you'll need to put them back by completely wiping out all the tables related to countries/zones, and put back the originals that came with Zen Cart: countries, zones, geo_zones, zones_to_geo_zones.
And, if you've ever added any countries/zones back via your Admin after having deleted some, you're going to run into some issues with your historical data that utilized those incorrectly-added records.

4 May 2016, 9:14 PM
#2
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

It's unadvisable to delete any countries from your database. Doing so DOES prevent ANY use of those removed countries for anything, including registration and sales and shipping quotes.

It's better to "disable" certain countries via your Admin. Deleting them altogether is generally a bad idea.

And, now that you've deleted them, you'll need to put them back by completely wiping out all the tables related to countries/zones, and put back the originals that came with Zen Cart: countries, zones, geo_zones, zones_to_geo_zones.
And, if you've ever added any countries/zones back via your Admin after having deleted some, you're going to run into some issues with your historical data that utilized those incorrectly-added records.

So if I only ship within United States I still need to put all the countries back into the Database after I delete them. So if did put them back into the Database how can I keep other countries from registering?

4 May 2016, 9:28 PM
#3
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

wmorris:

how can I keep other countries from registering?
Admin->Locations->Countries ... click the green dot next to any country you wish to "disable" registration/sales for. That will turn it red so that it's disabled.

4 May 2016, 9:30 PM
#4
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

Admin->Locations->Countries ... click the green dot next to any country you wish to "disable" registration/sales for. That will turn it red so that it's disabled.

What is the best way to insert those countries back into the database?

4 May 2016, 10:14 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

wmorris:

What is the best way to insert those countries back into the database?
All the data for the "countries" and "zones" tables is in the /zc_install/sql/install/mysql_utf8.sql file.

If you've added records to the geo_zones or zones_to_geo_zones tables that refer to countries or zones that are outside the normal list, or have manually added back any countries to the database that has resulted in those records getting a different countries_id or zone_id then you'll need to manually fix all the conflicts and point the IDs back to the proper original values.

5 May 2016, 12:53 AM
#6
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

All the data for the "countries" and "zones" tables is in the /zc_install/sql/install/mysql_utf8.sql file.

If you've added records to the geo_zones or zones_to_geo_zones tables that refer to countries or zones that are outside the normal list, or have manually added back any countries to the database that has resulted in those records getting a different countries_id or zone_id then you'll need to manually fix all the conflicts and point the IDs back to the proper original values.

Ok, when I try to re-insert the SQL I got this:

Error
SQL query:


## SQL Sections Specific to UTF8 character set

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Convert currencies for Text emails', 'CURRENCIES_TRANSLATIONS', '£,£:€,€:®,®:™,™', 'What currency conversions do you need for Text emails?<br />Example = &pound;,£:&euro;,€', 12, 120, NULL, '2003-11-21 00:00:00', NULL, 'zen_cfg_textarea_small(');
MySQL said: Documentation

#1062 - Duplicate entry 'CURRENCIES_TRANSLATIONS' for key 'unq_config_key_zen' 
5 May 2016, 3:53 AM
#7
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

That particular INSERT is for the "configuration" table.
You only want to run the ones for countries and zones (which I think are all the "rest" of the file, except that first one).
And, you'll get an error for any countries and zones that already exist in your database. You'll need to accommodate that manually. (Some people do that by TRUNCATEing the tables first; others do it by running each INSERT one at a time; others do it by running everything up until an error occurs and then deleting all the ones up until the error, and then continuing with the ones after that error and then repeat similarly until done. Lots of ways to do it, depending on how important it is to you to keep existing data in the table.)

5 May 2016, 3:57 AM
#8
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

That particular INSERT is for the "configuration" table.
You only want to run the ones for countries and zones (which I think are all the "rest" of the file, except that first one).
And, you'll get an error for any countries and zones that already exist in your database. You'll need to accommodate that manually. (Some people do that by TRUNCATEing the tables first; others do it by running each INSERT one at a time; others do it by running everything up until an error occurs and then deleting all the ones up until the error, and then continuing with the ones after that error and then repeat similarly until done. Lots of ways to do it, depending on how important it is to you to keep existing data in the table.)

What do you mean by "TRUNCATEing"?

5 May 2016, 4:09 AM
#9
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

There are 3 ways to "get rid of all records in a table":

a) manually delete all records. But this doesn't also reset the "id autoincrement counter"
b) TRUNCATE the table (TRUNCATE is the SQL statement, like INSERT is a SQL statement). This wipes the table empty and resets the autoincrement counter, giving the table and indexes a clean slate.
c) drop the table and recreate it; but this requires knowing how to recreate the table. But it does also give a clean slate.

In PhpMyAdmin you can truncate a table by listing all tables and clicking the "Empty" button beside the table you wish to truncate.
Be aware that this deletes EVERYTHING in the table.

5 May 2016, 4:12 AM
#10
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

There are 3 ways to "get rid of all records in a table":

a) manually delete all records. But this doesn't also reset the "id autoincrement counter"
b) TRUNCATE the table (TRUNCATE is the SQL statement, like INSERT is a SQL statement). This wipes the table empty and resets the autoincrement counter, giving the table and indexes a clean slate.
c) drop the table and recreate it; but this requires knowing how to recreate the table. But it does also give a clean slate.

In PhpMyAdmin you can truncate a table by listing all tables and clicking the "Empty" button beside the table you wish to truncate.
Be aware that this deletes EVERYTHING in the table.

Well they finally all got back into the database. So right now I am hitting the green buttons and make sure its red for other countries.

5 May 2016, 4:33 AM
#11
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte,

Right now, I don't ship to Alaska and/or Hawaii. What is the best way?

5 May 2016, 4:43 AM
#12
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

That's a zone thing. You can set up shipping zones for "lower 48" by hand, or by using a SQL script from the Plugins area for "lower 48".

5 May 2016, 4:48 AM
#13
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

That's a zone thing. You can set up shipping zones for "lower 48" by hand, or by using a SQL script from the Plugins area for "lower 48".

How can I set up shipping zone for "lower 48" by hand?

5 May 2016, 4:51 AM
#14
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

wmorris:

How can I set up shipping zone for "lower 48" by hand?

  1. Create the zone definition; give it a name

  2. Click its Details button

  3. One by one add each "allowed" Country+State combination. That would be 48 entries you'd create.

  4. Then apply that zone as a zone-restriction to each shipping/billing module you want to service addresses belonging only to that zone.

5 May 2016, 5:21 AM
#15
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,682
Plugin Contributions:
0

Re: Customers from other countries

DrByte:

  1. Create the zone definition; give it a name

  2. Click its Details button

  3. One by one add each "allowed" Country+State combination. That would be 48 entries you'd create.

  4. Then apply that zone as a zone-restriction to each shipping/billing module you want to service addresses belonging only to that zone.

So the billing is same thing as the payment module aka (PayPal)?

5 May 2016, 2:36 PM
#16
drbyte avatar

drbyte

Sensei

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

Re: Customers from other countries

wmorris:

So the billing is same thing as the payment module aka (PayPal)?
Yes .