Guest Posted April 13, 2007 Posted April 13, 2007 I have a quick question that I'm hoping somebody can answer. When somebody selects a Country that doesn't have any Zones or States, what is the correct selection for the State drop-down? I've been toying with a way to dynamically select which states should be shown when a country is selected. For instance, if I select United States, only states within the United States are shown. But if I select a country without any states or zones, I get an error because the field is required. "your state must contain a minimum of two letters." That is the error from the form before I made any changes. Or to ask it another way, if a customer was to select the country "Togo" which has no zones/states in osc, what should they select for the State inorder to get past the required field? Any state? Thanks
Guest Posted April 14, 2007 Posted April 14, 2007 have you installed modules to control your countries/states?
Guest Posted April 14, 2007 Posted April 14, 2007 My bad... forgot about that. Yes I installed the state drop-down selector (Country-State Selector i think). It only shows states/zones defined in the database. So if it was still a test input box, then they could enter their two letter state abbreviation? So I would have to get all the zones for all the countries that don't currently have zones? Or remove countries that don't have zones? I've been looking through the contributions for a more elaborate zone file that might contain zones for countries that don't have zones in the default 2.2 release. There's quite a few, but World Zones looks promising, but it looks like it's still missing some. Can any one recommend a contribution that contain more or all zones for all countries? Thanks
Guest Posted April 14, 2007 Posted April 14, 2007 well really depends how you're running your store. Do you want to have shipping for example to few countries but allow registration from many country around the world? If so have a look at this: http://www.oscommerce.com/community/contributions,3607 It also uses the world zones module. If you need all countries and you're ok with the current module you should check the support thread of the countries/state selector.
Guest Posted April 15, 2007 Posted April 15, 2007 http://www.oscommerce.com/community/contributions,3607 Thanks, I'll check that out. Do you want to have shipping for example to few countries but allow registration from many country around the world? I would like to have as many countries as possible for both registration and shipping. Thanks
Guest Posted April 16, 2007 Posted April 16, 2007 OK, unfortunately World Zones and Active Countries break a few things by default. Any tax zones already defined have to be re-set up. Plus Active Countries has allot of features I really don't need. So what I did is export the default osc 2.2 zones table and added the missing zones from the World Zones sql file. This way, any predefined tax zones based on the 2.2 release are preserved. Also the World Zone sql had "&" and ";" characters in some of the zones names for reasons unknown to me, so I removed them. Now instead of 239 countries with 181 zones (6 countries with zones and 233 without) I have 239 countries with 3842 (211 countries with zones and 28 without). Much, much better. To make sure this won't break anything, I would recommend exporting your current zones table and comparing it this file. Particularity everything before "NEW ZONES FOR EXISTING COUNTRIES START". It should all be the same. Remaining countries without zones: # (7, 'Anguilla', 'AI', 'AIA', 1); # (8, 'Antarctica', 'AQ', 'ATA', 1); # (12, 'Aruba', 'AW', 'ABW', 1); # (29, 'Bouvet Island', 'BV', 'BVT', 1); # (45, 'Christmas Island', 'CX', 'CXR', 1); # (69, 'Falkland Islands (Malvinas)', 'FK', 'FLK', 1); # (70, 'Faroe Islands', 'FO', 'FRO', 1); # (75, 'French Guiana', 'GF', 'GUF', 1); # (83, 'Gibraltar', 'GI', 'GIB', 1); # (87, 'Guadeloupe', 'GP', 'GLP', 1); # (88, 'Guam', 'GU', 'GUM', 1); # (118, 'Lebanon', 'LB', 'LBN', 1); # (126, 'Macedonia, The Former Yugoslav Republic of', 'MK', 'MKD', 1); # (134, 'Martinique', 'MQ', 'MTQ', 1); # (137, 'Mayotte', 'YT', 'MYT', 1); # (151, 'Netherlands Antilles', 'AN', 'ANT', 1); # (157, 'Niue', 'NU', 'NIU', 1); # (158, 'Norfolk Island', 'NF', 'NFK', 1); # (169, 'Pitcairn', 'PN', 'PCN', 1); # (172, 'Puerto Rico', 'PR', 'PRI', 1); # (174, 'Reunion', 'RE', 'REU', 1); # (188, 'Singapore', 'SG', 'SGP', 4); # (190, 'Slovenia', 'SI', 'SVN', 1); # (194, 'South Georgia and the South Sandwich Islands', 'GS', 'SGS', 1); # (201, 'Svalbard and Jan Mayen Islands', 'SJ', 'SJM', 1); # (228, 'Vatican City State (Holy See)', 'VA', 'VAT', 1); # (231, 'Virgin Islands (British)', 'VG', 'VGB', 1); # (234, 'Western Sahara', 'EH', 'ESH', 1); Here's a links to the zones file: zones_update.sql.txt Might come in handy for someone. Thanks again.
Guest Posted April 16, 2007 Posted April 16, 2007 OK, unfortunately World Zones and Active Countries break a few things by default. Any tax zones already defined have to be re-set up. Plus Active Countries has allot of features I really don't need.. not active countries. because they include a different worlzone sql file for this reason. So when I installed it I did not had to re-set the tax zones. The countries are also associated with the customer accounts and address books. So these are not "features" but required changes so someone can edit the customer accounts and address books to setup the states via ID and not by name. As well as synchronizing active countries/states with customer details. If you blindly installed the default worldzones, your existing customer accounts will have problems with the states.
Guest Posted April 16, 2007 Posted April 16, 2007 not active countries. because they include a different worlzone sql file for this reason. So when I installed it I did not had to re-set the tax zones. The worldzone sql file looks near identical to me, what's the difference? The countries are also associated with the customer accounts and address books. So these are not "features" but required changes so someone can edit the customer accounts and address books to setup the states via ID and not by name. As well as synchronizing active countries/states with customer details. By features I meant enabling and disabling countries from admin. I'm just trying to get as many as possible, I don't need to disable any. But I see what you mean. If you blindly installed the default worldzones, your existing customer accounts will have problems with the states. None of the existing countries or zones where changed, this just added to the zones. So all the existing customers info should be alright, no? The problem I was having is that people from other countries that didn't have zones had to select some random zone from the state drop-down and then contact us to let us know it was the wrong one, and that theirs wasn't available. And after I put on the filter that only shows zones from the selected country, it would kick out an error because no zone was available. Basically before I had 233 potential country/zone problems, and now I have 28. I'll have another look through Active Countries again, but I think it might be a little overkill for me. Thanks
Guest Posted April 16, 2007 Posted April 16, 2007 the world zones is here http://www.oscommerce.com/community/contributions,1792 the active countries includes a different one, same states more or less with different order to maintain backwards dbase compatibility with the osc. Now the link you posted not sure where the sql came from (from the active countries?). In any case the auto-increment is left to 3843. So if someone tries to use that, he will have problems with the state ids. Becaues the ids will start from 3843 instead of 1. However I noticed you added references to some countries with the missing zones so I may use it perhaps and add a single zone for each called "All Areas" till states for these countries are known. This way I could possibly enhance the active countries with the next version. Whatever sql additional file is added for new countries has to go after everything else is installed so the identifiers will be consistent.
Guest Posted April 16, 2007 Posted April 16, 2007 Now the link you posted not sure where the sql came from (from the active countries?) World Zones In any case the auto-increment is left to 3843. So if someone tries to use that, he will have problems with the state ids. Becaues the ids will start from 3843 instead of 1. I thought that was how it's supposed to be, sine the ids are already filled out, eg "1" is already used. I left it at "3843" because that's the next free number. That was really for my reference so that if I add more later, it will start at "3843" since the last id is "3842". I may install Active Categories later, but I just need a quick fix in the meantime. Got people climbing climbing my throat.
Guest Posted April 16, 2007 Posted April 16, 2007 World ZonesI thought that was how it's supposed to be, sine the ids are already filled out, eg "1" is already used. I left it at "3843" because that's the next free number. That was really for my reference so that if I add more later, it will start at "3843" since the last id is "3842". I may install Active Categories later, but I just need a quick fix in the meantime. Got people climbing climbing my throat. for the countries without states as I mentioned you could add a single state called "all areas" or something to cover till you find the actual states.
Guest Posted April 21, 2007 Posted April 21, 2007 Ok, I took your advice and installed Active Countries. I see what you mean now, but there where a few minor hickups... 13. In catalog\admin\zones.php c) Locate the following code: $zones_query_raw = "select z.zone_id, c.countries_id, c.countries_name, z.zone_name, z.zone_code, z.zone_country_id from " . TABLE_ZONES . " z, " . TABLE_COUNTRIES . " c where z.zone_country_id = c.countries_id order by c.countries_name, z.zone_name"; Right below it add this code: //-MS- Added Active-Zones support $zones_query_raw = "select z.zone_id, c.countries_id, c.countries_name, z.zone_name, z.zone_code, z.zone_country_id, z.zone_status from " . TABLE_ZONES . " z left join " . TABLE_COUNTRIES . " c on (z.zone_country_id = c.countries_id) where c.countries_status='1' order by c.countries_name, z.zone_name"; //-MS- Added Active-Zones support EOM I could be mistaken, but shouldn't the original line be replaced? And not placed underneath? Since that both use the same variable "$zones_query_raw". Also Under "Database Changes", you say "Simply run the countries_custom.sql file that came with this archive". Then you say to import "The world_zones_sequential.sql is based on the world zones contribution". Problem is that ALTER TABLE `zones` ADD `zone_status` tinyint(1) default '1' not null; Gets dropped when you import the world_zones_sequential.sql DROP TABLE IF EXISTS zones; Might want to reverse that order in the instructions or add the zones status entry to the worldzone sql file. Also, what's with the "&" and ";" in the country names? Other than that, I must say that I'm impressed :) Last time I was in a rush and I messed up a bit plus the problems I listed above. This time I took it slow and figured it out :P Thanks
Guest Posted April 22, 2007 Posted April 22, 2007 yes both points are valid. I will fix the documentation with the next version. The '&' and ';' characters were like that when I downloaded the world zones sql. This problem was reported by another member here and when i get a chance I will modify the sql or maybe I would use your version. I will have to do some testing though. Thanks for the feedback.
Guest Posted April 23, 2007 Posted April 23, 2007 Here is the worldzones from Active Countries contrib minus the "&" and ";" in the country names. No other difference. worldzones_clean.sql.txt
Recommended Posts
Archived
This topic is now archived and is closed to further replies.