There are several posts on Ubercart.org about the UK country import file we've had in core for some time now. It was a contribution originally, and I obviously didn't look through the dozens of zones to see that some were named improperly or just missing. I'm really just calling for someone with time to update the .cif to take care of all the following posts on Ubercart.org:

  • Drop "Greater" from Greater London and Greater Manchester - 1
  • Include Cumbria, Cleveland, and all other missed zones, including N. Ireland - 1, 2, 3, 4

The standard to use is this page on Wikipedia for zone names and abbreviations:

http://en.wikipedia.org/wiki/ISO_3166-2:GB

So, we need to update the install query and then write an update function that first modifies the names of any existing zones that were changed and then in a second query adds in the zones that weren't there in version 1.

Comments

chrisschaub’s picture

Ryan, how do these codes map to the codes in ubercart? Where do the the "codes" for each city come from in UC? From the wikipedia article, I have codes like ...

GB-ABD|Aberdeenshire
GB-ABE|Aberdeen

...

rszrama’s picture

I believe if we're to use them, we should just use the three letter ABD, ABE, etc. as the zone_code and not include the GB- since they're being associated to the country by the ISO number, not the code. I heard there are some mislabeled codes in the current version, so updating this will require an update function to change existing data.

chrisschaub’s picture

Are the current codes in the db for UK used by anything you know of? I saw your post about WPP from Paypal. I guess these would be passed in a gateway? Also, is there any more official source than Wikipedia for this info? I was working on a diff / re-code for this, but I'm a bit worried about an American doing this sort of thing -- I'm sure a UK resident would do a better job. Anybody out there up to the task of looking over the list of zones and codes?

chrisschaub’s picture

I guess I'm wondering if these codes are even necessary?

longwave’s picture

I've never seen the 3-letter ISO zone codes used anywhere in the UK for addressing purposes. The county (zone) name can be left out of a UK address as long as the town/city and postcode are present, see http://www.upu.int/post_code/en/countries/GBR.pdf for details.

As per that PDF, I would recommend changing the default UK address format to the following:

!first_name !last_name
!company
!street1
!street2
!city
!zone_name
!postal_code
!country_name_if

To be fully correct, we would also need a new variant of !city that transforms the city field to uppercase. But this is still not quite enough for some UK addresses, which have three "street address" lines:

1A Seastone Cottages
Station Road
Weybourne
HOLT
NR25 7HG

Holt is the post town, so a customer would have to combine two of their address lines into one to enter their details into Ubercart.

I suspect most payment gateways will not validate the county name, and will only require a street address, town and postcode, as an extremely short address can be perfectly valid:

10 Downing Street
LONDON
SW1 2AA

The zone system is confused even further by the Channel Islands of Jersey and Guernsey. These use UK postcodes and address formats, but are Crown dependencies and aren't technically part of the UK. They have zone codes of GB-JSY and GB-GSY in ISO 3166-2:GB, but then they also have their own separate ISO country codes of JE and GG. The Isle of Man is in a similar situation, the Wikipedia page mentions GB-IOM but there is also an ISO country code of IM.

longwave’s picture

Looking through ISO 3166-2:GB again, I don't think this is suitable for using directly, as they don't correspond with what people think of as "counties" when specifying their address, these are more for administrative purposes only.

For example, no one from London would expect to select their borough (Camden, Greenwich, Lambeth etc) from a county dropdown when entering their address. Someone living in Coventry, Solihull, Sandwell, Walsall or Wolverhampton would enter that as their town name and look for West Midlands in a county dropdown - but West Midlands isn't listed as a single entry in the ISO document.

There are also entries like Ards, which I'd never heard of before, but is apparently a district of County Down - but that already has its own ISO zone code.

Maybe http://en.wikipedia.org/wiki/Postal_counties_of_the_United_Kingdom would be a better reference point?

rszrama’s picture

Version: 5.x-1.5 » 6.x-2.x-dev
Status: Active » Postponed

Postponing as it seems like the real thing to do might be to remove zones from UK altogether.

chrisschaub’s picture

Or make it a text field, not a drop down. This would help in many other countries as well since you wouldn't have to define the zones -- just let the user enter their zone name if none are predefined. This would instantly make Ubercart country files more dependable.

joachim’s picture

Status: Postponed » Needs review
StatusFileSize
new801 bytes

+1 for removing zones from the UK altogether -- and seconding longwave, I've never seen these codes used in UK addresses. They will be meaningless and confusing to users.

In the first instance, could "!zone_code" be removed from the address format so at least they are hidden from users?
Here's a patch for that.

problue solutions’s picture

Whats the story with this?

I have a localised website in Northern Ireland which is completely missing from the United Kingdom regions, meaning I cant use ubercart.

Can I download an updated file somewhere or should I look at other carts?

problue solutions’s picture

Apologies for any ignorance to the technical details involved with this issue, but I'm being completely honest here when i say its ridiculous to suggest that ubercart is a realistic solution for a business if essential things like this are missing, totally baffled how this is not considered a critical problem and corrected as a matter of urgency!

longwave’s picture

StatusFileSize
new7.19 KB

Attached is my attempt at version 2 of the UK country data file. This includes the following changes:

  • Adds the six Northern Ireland counties
  • Adds Avon, Cleveland, Isles of Scilly and Middlesex
  • Corrects Manchester to Greater Manchester
  • Corrects the address format to use zone name instead of code

I was also going to add Humberside as I've seen it in several county dropdowns on other sites, but this is not included for now on joachim's advice.

joachim’s picture

Yup, FYI Humberside was a short-lived country from the early 1970s to the early 1990s. It was generally unliked and was the subject of many campaigns for its abolition. It is still present in many sites' databases because they're using crappy old datasets they bought 20 years ago. At least one MP in the area is campaigning to get it removed from mailing addresses and the like. We *really* don't want it! :)

problue solutions’s picture

can that country data file not be used with ubercart 1.x?

getting the following error when importing...

user warning: Duplicate entry '0' for key 1 query: INSERT INTO uc_zones (zone_country_id, zone_code, zone_name) VALUES (826, 'ABN', 'Aberdeen'),(826, 'ABNS', 'Aberdeenshire'),(826, 'ANG', 'Anglesey'),(826, 'AGS', 'Angus'),(826, 'ARY', 'Argyll and Bute'),(826, 'AVON', 'Avon'),(826, 'BEDS', 'Bedfordshire'),(826, 'BERKS', 'Berkshire'),(826, 'BLA', 'Blaenau Gwent'),(826, 'BRI', 'Bridgend'),(826, 'BSTL', 'Bristol'),(826, 'BUCKS', 'Buckinghamshire'),(826, 'CAE', 'Caerphilly'),(826, 'CAMBS', 'Cambridgeshire'),(826, 'CDF', 'Cardiff'),(826, 'CARM', 'Carmarthenshire'),(826, 'CDGN', 'Ceredigion'),(826, 'CHES', 'Cheshire'),(826, 'CLACK', 'Clackmannanshire'),(826, 'CLVD', 'Cleveland'),(826, 'CON', 'Conwy'),(826, 'CORN', 'Cornwall'),(826, 'COAN', 'County Antrim'),(826, 'COAR', 'County Armagh'),(826, 'CODN', 'County Down'),(826, 'COFE', 'County Fermanagh'),(826, 'COLO', 'County Londonderry'),(826, 'COTY', 'County Tyrone'),(826, 'CMA', 'Cumbria'),(826, 'DNBG', 'Denbighshire'),(826, 'DERBY', 'Derbyshire'),(826, 'DVN', 'Devon'),(826, 'DOR', 'Dorset'),(826, 'DGL', 'Dumfries and Galloway'),(826, 'DUND', 'Dundee'),(826, 'DHM', 'Durham'),(826, 'ARYE', 'East Ayrshire'),(826, 'DUNBE', 'East Dunbartonshire'),(826, 'LOTE', 'East Lothian'),(826, 'RENE', 'East Renfrewshire'),(826, 'ERYS', 'East Riding of Yorkshire'),(826, 'SXE', 'East Sussex'),(826, 'EDIN', 'Edinburgh'),(826, 'ESX', 'Essex'),(826, 'FALK', 'Falkirk'),(826, 'FFE', 'Fife'),(826, 'FLINT', 'Flintshire'),(826, 'GLAS', 'Glasgow'),(826, 'GLOS', 'Gloucestershire'),(826, 'MAN', 'Greater Manchester'),(826, 'GDD', 'Gwynedd'),(826, 'HANTS', 'Hampshire'),(826, 'HWR', 'Herefordshire'),(826, 'HERTS', 'Hertfordshire'),(826, 'HLD', 'Highlands'),(826, 'IVER', 'Inverclyde'),(826, 'IOW', 'Isle of Wight'),(826, 'IOS', 'Isles of Scilly'),(826, 'KNT', 'Kent'),(826, 'LANCS', 'Lancashire'),(826, 'LEICS', 'Leicestershire'),(826, 'LINCS', 'Lincolnshire'),(826, 'LDN', 'London'),(826, 'MSY', 'Merseyside'),(826, 'MERT', 'Merthyr Tydfil'),(826, 'MIDDX', 'Middlesex'),(826, 'MLOT', 'Midlothian'),(826, 'MMOUTH', 'Monmouthshire'),(826, 'MORAY', 'Moray'),(826, 'NPRTAL', 'Neath Port Talbot'),(826, 'NEWPT', 'Newport'),(826, 'NOR', 'Norfolk'),(826, 'ARYN', 'North Ayrshire'),(826, 'LANN', 'North Lanarkshire'),(826, 'YSN', 'North Yorkshire'),(826, 'NHM', 'Northamptonshire'),(826, 'NLD', 'Northumberland'),(826, 'NOT', 'Nottinghamshire'),(826, 'ORK', 'Orkney Islands'),(826, 'OFE', 'Oxfordshire'),(826, 'PEM', 'Pembrokeshire'),(826, 'PERTH', 'Perth and Kinross'),(826, 'PWS', 'Powys'),(826, 'REN', 'Renfrewshire'),(826, 'RHON', 'Rhondda Cynon Taff'),(826, 'RUT', 'Rutland'),(826, 'BOR', 'Scottish Borders'),(826, 'SHET', 'Shetland Islands'),(826, 'SPE', 'Shropshire'),(826, 'SOM', 'Somerset'),(826, 'ARYS', 'South Ayrshire'),(826, 'LANS', 'South Lanarkshire'),(826, 'YSS', 'South Yorkshire'),(826, 'SFD', 'Staffordshire'),(826, 'STIR', 'Stirling'),(826, 'SFK', 'Suffolk'),(826, 'SRY', 'Surrey'),(826, 'SWAN', 'Swansea'),(826, 'TORF', 'Torfaen'),(826, 'TWR', 'Tyne and Wear'),(826, 'VGLAM', 'Vale of Glamorgan'),(826, 'WARKS', 'Warwickshire'),(826, 'WDUN', 'West Dunbartonshire'),(826, 'WLOT', 'West Lothian'),(826, 'WMD', 'West Midlands'),(826, 'SXW', 'West Sussex'),(826, 'YSW', 'West Yorkshire'),(826, 'WIL', 'Western Isles'),(826, 'WLT', 'Wiltshire'),(826, 'WORCS', 'Worcestershire'),(826, 'WRX', 'Wrexham') in /home/admin/digitalbeats.net/includes/database.mysql.inc on line 174.

Island Usurper’s picture

Committed the changes in #13, though with the address format that was requested in #474458: don't output meaningless region codes.

longwave’s picture

Status: Needs review » Fixed

Thanks for applying my changes :)

thiokol's issue is that they were trying to import a UC 2.x country file into UC 1, which won't work because the primary key has since changed on uc_zones and a call to uc_get_zone_ids() was needed instead in the previous version. I'll try to find time to make a version 2 of the UK country file for UC 1 soon.

Island Usurper’s picture

StatusFileSize
new7.67 KB

Don't worry about it, I figured out the problem, and got it fixed. This file has been committed to the 1.x branch.

kangaroobin’s picture

Hello, I am not a programmer but have figured out how to use most of drupal, therefore I do not know what to do with this patch in number 18.

Is anyone able to help me, and is there any conformation that this will fix the problem with usps shipping to the UK?

Thanks,
Reuben

kangaroobin’s picture

Alright I figured out where to put that file and how to update it however I got this warning:

user warning: Column count doesn't match value count at row 1 query: INSERT INTO drup_uc_zones (zone_id, zone_country_id, zone_code, zone_name) VALUES (826, 'AVON', 'Avon'),(826, 'COAN', 'County Antrim'),(826, 'COAR', 'County Armagh'),(826, 'CODN', 'County Down'),(826, 'COFE', 'County Fermanagh'),(826, 'COLO', 'County Londonderry'),(826, 'COTY', 'County Tyrone'),(826, 'CLVD', 'Cleveland'),(826, 'IOS', 'Isles of Scilly'),(826, 'MIDDX', 'Middlesex') in /home2/moptopme/public_html/includes/database.mysql.inc on line 174.

Can someone please help?

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dbassendine’s picture

As Guernsey and Jersey now have their own ISO-3166-1 codes, I have created separate .cif files for each. For Guernsey, please see http://www.ubercart.org/contrib/14721, and for Jersey see http://www.ubercart.org/contrib/14722.

Thanks, David.

joachim’s picture

Category: task » bug
Status: Closed (fixed) » Active

Reopening for the Channel Islands to be included in the UK:

- they have UK postcodes
- both Amazon.co.uk and Tesco -- two pretty large UK online retailers -- include Jersey and Guernsey within the UK. Whether they have a different ISO-3166-1 code is less important than what customers expect from other sites.

joachim’s picture

Status: Active » Needs review
StatusFileSize
new2.24 KB

Here is a patch to add the Channel Islands to the UK CIF.

joachim’s picture

Turns out it's rather more complicated than that; also the patch doesn't work :D

chriscohen’s picture

I'm from Jersey and lived there for 19 years. Ordering online was always a pain because some sites wanted you to use UK as the country, while others had an entry for Jersey. There are arguments for doing it both ways:

The Channel Islands should be their own countries

  • This is as per ISO-3166-1, so is the 'correct' way of doing it.
  • This would allow for Channel Islands customers to put in their parish using a drop-down, instead of putting it as their town, which would reduce the possibility of typos or confusion.
  • The Royal Mail address finder gives the address as (example): 1 Clubley Estate, St. Johns Road, St. Helier, JERSEY, JE2 3LF. Despite having a UK postcode, no mention of United Kingdom, Great Britain or England is made in the address.

The Channel Islands should appear as counties of the UK

  • Arguably this is what Channel Islanders expect, because it's used on sites like Amazon.co.uk
  • If (for example) country is Jersey and zone is St. Martin, what would one put in the town field? This is usually mandatory, but Channel Islands addresses usually take the form: STREET ADDRESS, PARISH, ISLAND (no town).
  • If you are from Alderney, which is an island unto itself (although it falls under Guernsey's government), it would be confusing to choose 'Guernsey' from the country list and then choose 'Alderney' from the counties list. Alderney postcodes begin with GY, the same as Guernsey postcodes, but the Royal Mail does not seem to have listings, so it's hard to be sure how they should be 'officially' written. What wouldn't be valid as an address would be, for example, 1 Example Road, St Anne, Alderney, Guernsey. Alderney websites tend to use 'United Kingdom' when describing their address, for example this one.

I appreciate it might not be much help, but I honestly have no idea which method would be easier, and there seems to be an absence of black and white guidelines on the issue.

tr’s picture

Category: bug » task
Status: Needs review » Needs work

As noted in #25, the offered patch doesn't work.

Waiting for someone to create a patch that can be tested ...

joachim’s picture

We need to figure out the best way to include these first...

kingandy’s picture

Any movement on the Channel Islands? I'm going to use David's CIF's from #22, but would encourage a more permanent fix.

mo6’s picture

I'm trying to develop a shipping quote module for a local company (TNT Post in the Netherlands) where I need to differentiate between the UK and the Channel Islands (or Gibraltar). The easiest way to do this is to give them different country definitions. Shipping companies from the UK probably will see Jersey and Guernsey as a province, but shipping companies from outside the UK see the islands as a more autonomous destination. Actually shipping costs to China and Jersey are the same from the Netherlands :)

oglord’s picture

The ISO3166-2 codes are not what people think of as their geography. For example it's a bit silly saying the city of Newport is in Newport! The canonical list of the 92 geographical counties is:

Aberdeenshire
Anglesey
Angus
Antrim
Argyllshire
Armagh
Ayrshire
Banffshire
Bedfordshire
Berkshire
Berwickshire
Brecknockshire
Buckinghamshire
Buteshire
Caernarfonshire
Caithness
Cambridgeshire
Cardiganshire
Carmarthenshire
Cheshire
Clackmannanshire
Cornwall
Cromartyshire
Cumberland
Denbighshire
Derbyshire
Devon
Dorset
Down
Dumfriesshire
Dunbartonshire
Durham
East Lothian
Essex
Fermanagh
Fife
Flintshire
Glamorgan
Gloucestershire
Hampshire
Herefordshire
Hertfordshire
Huntingdonshire
Inverness-shire
Kent
Kincardineshire
Kinross-shire
Kirkcudbrightshire
Lanarkshire
Lancashire
Leicestershire
Lincolnshire
Londonderry
Merionethshire
Middlesex
Midlothian
Monmouthshire
Montgomeryshire
Morayshire
Nairnshire
Norfolk
Northamptonshire
Northumberland
Nottinghamshire
Orkney
Oxfordshire
Peeblesshire
Pembrokeshire
Perthshire
Radnorshire
Renfrewshire
Ross-shire
Roxburghshire
Rutland
Selkirkshire
Shetland
Shropshire
Somerset
Staffordshire
Stirlingshire
Suffolk
Surrey
Sussex
Sutherland
Tyrone
Warwickshire
West Lothian
Westmorland
Wigtownshire
Wiltshire
Worcestershire
Yorkshire
longwave’s picture

@oglord: you also need to include the metropolitan counties, otherwise Birmingham and Manchester residents don't have a reasonable choice. What's the problem with the current list used by Ubercart?

Regarding the Channel Islands issue, I have Jersey and Guernsey selectable as separate countries, and have a CA condition that checks for these along with country code UK and postcodes beginning with JE or GY; this allows shipping rules to work no matter how the user enters their address.

dwkitchen’s picture

On a selection of the issues here:

It is better for me to have Jersey and Guernsey as separate countries in Ubercart; as although from the UK the shipping rate is the same (Royal Mail), they are not part of the EU VAT Zone.

So orders from Jersey pay no VAT, unlike orders from within the UK as well as France, Germany etc. do.

The other issue of !zone_code is it possible to display the full zone name in the address instead of the code or nothing at all?

David

arne.olafson’s picture

Has Northern Ireland been left out for good here? It seems like there's room for development or discussion.

rszrama’s picture

It should support any country defined by the core country list module. Is Northern Ireland selectable as the default country of a site?

arne.olafson’s picture

Northern Ireland is not currently available as a separate country nor are the Northern Ireland counties available to the 6.x.dev or 6.x branches. This seems like a major oversight.
Here are the missing counties:
County Antrim, County Armagh, County Down, County Fermanagh, County Londonderry, County Tyrone
(from wikipedia)

rszrama’s picture

Crap, my bad. I thought this was the Address Field queue for Drupal Commerce. I can't help you with Ubercart .cif's any more, and I sure am glad we left those behind. : P

arne.olafson’s picture

Northern Ireland Counties are listed alphabetically, in order, as:
County Antrim
County Armagh
.. etc.

problue solutions’s picture

I'm subscribed to this thread from a long time ago, just so happens I was doing some shipping quotes tonight that required the Northern Ireland counties. The counties are there in the UK .cif in the last copy of ubercart 6.x dev I downloaded, couldn't have been more than 2 weeks since I downloaded it I think. strange that they would be removed. You sure they arent there? They are listed differently to other UK counties, the NI counties are all prefixed with "County" whereas the rest are not. This is actually good imo, as in NI they are refered to as County Down, County Armagh etc, but in England they drop the word "County".

problue solutions’s picture

Found 'em then :P

problue solutions’s picture

It would actually be confusing to anyone outside of NI how they are listed, but it makes sense, at least for customers to any store I've worked on based in NI, they automatically look for "County...". It's almost as if it was someone from NI contributed that addition to the .cif file, maybe it was!

longwave’s picture

Title: Update the UK country file to include all zones » Jersey and Guernsey: UK counties, or separate countries?

Retitling this, as the UK country file is complete as far as I can tell, except for the Jersey/Guernsey issue described in #26.

longwave’s picture

Title: Jersey and Guernsey: UK counties, or separate countries? » Update the UK country file to include all zones
Status: Needs work » Fixed

Oh, since #1070342: Add missing CIF files, turns out that Jersey and Guernsey are now included as countries anyway, so I don't think there is anything left to do here.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.