WP-e-Commerce icon indicating copy to clipboard operation
WP-e-Commerce copied to clipboard

Country code updates.

Open ace-dent opened this issue 12 years ago • 9 comments

Update Country table information: tidier and a better match to ISO.

These changes are the least controversial, so hopefully won't need too much discussion. Associated db fixes will also need to be created (although I'm not sure existing ones work - will raise a separate issue).

  • Changes in patch (Source: ISO 3166-1:2006) : Bosnia-Herzegovina -> Bosnia and Herzegovina - ISO Czech Rep. -> Czech Republic - ISO Avoid abbreviation. Guadeloupe (French) -> Guadeloupe - ISO Guam (USA) -> Guam - ISO Guinea Bissau -> Guinea-Bissau - ISO Martinique (French) -> Martinique - ISO New Caledonia (French) -> New Caledonia - ISO Pitcairn Island -> Pitcairn - ISO Polynesia (French) -> French Polynesia - ISO Reunion (French) -> Reunion - ISO Saint Kitts & Nevis Anguilla - Saint Kitts and Nevis - ISO Saint Vincent & Grenadines -> Saint Vincent and the Grenadines - ISO South Georgia & South Sandwich Islands -> South Georgia and South Sandwich Islands - ISO Vatican -> Vatican City State - Not ISO but common usage. Virgin Islands (USA) -> Virgin Islands (U.S.) - ISO Wallis and Futuna Islands -> Wallis and Futuna - ISO
  • Added in patch Canary Islands - CI (Not in ISO, but Exceptionally Reserved on request of WCO for area not covered by European Union Customs arrangements).

ace-dent avatar Jan 18 '13 17:01 ace-dent

The following changes are also recommended, but not included in the patch. Needs discussion. Admin may want to split out into separate issue. Source: ISO 3166-1:2006.

  • Possible removal: Netherlands Antilles - AN - Dissolved 2010: http://en.wikipedia.org/wiki/Netherlands_Antilles but still recognised in ISO under Transitional reserved code (to be deleted in 2015).
  • Removed: Deutschland - DE - No longer in currency_list.php - but no db fix was raised(?). Need to update code comment: wpsc_includes/country.class.php:90 // TODO: remove duplicate entry for Germany (Deutschland)
  • Probably should add: American Samoa - AS Republic of Kosovo - XK
  • Possible changes - needs discussion: Falkland Islands -> Falkland Islands (Malvinas) - According to ISO.. but Spanish name may be offensive to locals... would suggest not changing. Iran -> Iran (Islamic Republic of) - ISO, but also states "Also referred to as Iran". Ivory Coast -> Cote d'Ivoire - According to ISO. But looks strange in English and not used by Interlink Express (courier). Korea, North -> Korea, Democratic People's Republic of - ISO but may be confusing and also states: "Often referred to as North Korea" Korea, South -> Korea, Republic of - ISO but may be confusing and also states: "Often referred to as South Korea" Laos -> Lao People's Democratic Republic - ISO, but also states "Also referred to as Laos". Macau -> Macao - ISO but original spelling has wider usage. Macedonia -> Macedonia (former Yugoslav Republic of) - ISO. Micronesia -> Micronesia (Federated States of) - ISO. Moldova -> Moldova (Republic of) - ISO, but also states "Often referred to as Moldava". Palestinian Territories -> Palestinian Territory (the Occupied) - ISO but politically sensitive(?)... Russia -> Russian Federation - ISO. Svalbard and Jan Mayen Islands -> Svalbard and Jan Mayen - According to ISO. However, UN does suffix with 'Islands'- seems more correct. Syria -> Syrian Arab Republic - ISO, but also states "Often referred to as Syria". Taiwan -> Taiwan, Province Of China -> ISO (political?). Tanzania -> Tanzania, United Republic Of - ISO, but also states "Often referred to as Tanzania". USA -> United States - Avoid abbreviation ISO. However, USA is immediately recognisable... Opinions from US users? USA Minor Outlying Islands -> U.S. Minor Outlying Islands - ISO Vatican -> ISO and Royal Mail suggests: Holy See (Vatican City State)... but not sure this is in such widespread use?... Vietnam -> Viet Nam - according to ISO, but not widely used.

Currently old issues in this area include:

  • Issue 577: Countries assigned to incorrect continents. - http://code.google.com/p/wp-e-commerce/issues/detail?id=577
  • Issue 600: Incorrect iso codes in currency_list table, and refresh table enhancement request. - http://code.google.com/p/wp-e-commerce/issues/detail?id=600

ace-dent avatar Jan 18 '13 17:01 ace-dent

This is excellent. Thanks for the pull request.

One additional thing we need to do is writing database update routines for existing sites with outdated db. We have an incremental DB update routine API for that.

  • Open wpsc-constants.php and change WPSC_DB_VERSION to 4 (here).
  • Create a new file named 4.php in wpsc-admin/db-upgrades/routines. In there, create a function named _wpsc_db_upgrade_4 that executes SQL queries to update the database.

You can take a look at the files in wpsc-admin/db-upgrades/routines to get a rough idea how that works.

garyc40 avatar Jan 21 '13 14:01 garyc40

Also, please leave the .css files outside of the pull request so that we can conveniently merge this pull request later when it's complete. Thanks again!

garyc40 avatar Jan 21 '13 14:01 garyc40

Sorry, the CSS patch wasn't meant to get into this pull request (Github being 'helpful'). I'm a newb- but it seems I have to create a new branch for each pull request ?!... I will try to figure out how to remove that... As for db updates, thanks for helpful guidance. However, as an end-user I don't really have time to write and test the routines (esp. with a possible bug lurking #121). Hopefully someone will pick up on this initial work and develop further :).

ace-dent avatar Jan 21 '13 22:01 ace-dent

Next time, the best way to revert the changes is:

git reset --soft HEAD^1 to switch back to the previous commit with the working index intact.

Then you can git checkout -- path_to_file or git reset HEAD path_to_file to remove file from the index, and git commit again.

Finally, do a force push: git push -f .

No worries, I'll take over from here.

garyc40 avatar Jan 22 '13 03:01 garyc40

Thanks for the tips- v. helpful :)

ace-dent avatar Jan 23 '13 03:01 ace-dent

Punting to 3.8.12 pending a proper upgrade routine.

JustinSainton avatar Apr 29 '13 19:04 JustinSainton

Since the country lists are for shipping purposes I'd suggest the names follow common usage as per the advice from the International Postal Union rather than the ISO.

From http://www.upu.int/uploads/tx_sbdownloader/manualAddressingKnowledgeCentreGeneralIssuesEn.pdf

In most cases, and for the sake of simplicity, the common name of a country (and not the ISO one) should be used on addresses on envelopes. In most cases, common names are better recognized or simply easier to fit on the envelope than the official country name.

and from http://www.upu.int/uploads/tx_sbdownloader/descriptionPostcodesAddressingAddressElementsEn.pdf

  • you write addresses in roman letters and Arabic numerals; if other letters and numerals are used in the destination country, the address should also be written using these letters and numerals;
  • you comply with the recommendations of the postal authority of the country in which you post your items as regards indication of the destination country
  • you follow the recommendations of the destination country's postal authority for the remainder of the address
  • you always write the name of the destination country in one of the languages used in the country in which you post your items; if this language is not an internationally known language, you should add the name of the destination country in an internationally known language.

This implies for example that the Vatican would be addressed with the city line as 00120 CITTÀ DEL VATICANO, and the country as VATICAN (as per the UPU) or VATICAN CITY (common usage), though I'm sure VATICAN CITY STATE would work.

Also note that country names need to be translatable (if they're not already) in order to comply with this.

For politically sensitive areas it's most important for shipping not to annoy the end customer, so I wouldn't list Taiwan as Taiwan (Province of China) as per the ISO. The pragmatic call for this is probably to list it simply as Taiwan as calling it Taiwan (R.O.C.) as per Chunghwa POST (where ROC=Republic of China) may also not be wise.

Northern Cyprus is tricky as for mail to get there the address must not mention Cyprus, it has to be routed as MERSIN 10, TURKEY - but the pick list would probably work better if it listed Northern Cyprus.

the-itinerant avatar May 17 '13 17:05 the-itinerant

Moving to a future release, pending further traction.

JustinSainton avatar Mar 19 '14 18:03 JustinSainton

Closing ancient PR's for the author's benefit!

ace-dent avatar Jun 19 '24 20:06 ace-dent