I have added some quick support for addresses in the UK.
To be honest, I am struggling to work out just which fields to use - but that is the fun of the "standard".

Patch attached.

Comments

rszrama’s picture

Hmm, it looks like your patch includes the entire project source. ; )

If you check the project out from CVS and update to HEAD, you can then reapply your modifications and follow the CVS instructions at http://drupal.org/patch/create to generate a diff that just includes your changes against our development version.

balazs.hegedus’s picture

StatusFileSize
new7.63 KB

Hi,

here's another patch to add support for UK addresses. I'm doing some research on the recommended address format by Royal Mail, as the included tpl.php is not perfect. As an improvement to the previous one, this patch lists all postal county names in England, Wales, Scotland and Northern Ireland.

balazs.hegedus’s picture

StatusFileSize
new7.63 KB

Thought something wasn't right. Here's the same patch for the dev version, hopefully everything is now according to Ryan.

damien tournoud’s picture

+          'Antrim' => t('Antrim'),
+          'Armagh' => t('Armagh'),
+          'Down' => t('Down'),
+          'Fermanagh' => t('Fermanagh'),
+          'Londonderry' => t('Londonderry'),
+          'Tyrone' => t('Tyrone'),

Is there a more defined standard for the key here? If there is, you should use it: store the standardized key in the database, and transform the stored value on display in the template.

balazs.hegedus’s picture

Damien,

yeah, that did my head in. We don't really have abbreviations for county names in the UK (some counties do have short names, but not all of them), I can imagine we could use something like e-01 for the first one in England, s-01 for Scotland, etc. is that what you meant?

If that's acceptable, I'll create a patch, if not, somebody else may have a better idea.

rszrama’s picture

It mostly just matters if your government has accepted standards. We wouldn't want to invent a standard unique to Drupal Commerce. The postal service is often the best place to check for this, and it would certainly be helpful to know for certain if persons who mail packages are required to include this information on an address.

balazs.hegedus’s picture

Ryan,

found what I was looking for, based on Royal Mail's recommendations at http://www.royalmail.com/portal/rm/content1?catId=400044&mediaId=9200078... I'll do another patch later on today.

It's a bit strange that they didn't even mention using county names as most people and [governmental] organisations tend to use them.

rszrama’s picture

Status: Active » Needs review

At the Paris Commerce Sprint, Richard from i-Kos has rolled a version of the template and class that tweaks it according to the link above. Once it gets some review we can close this issue down. Update to the latest CVS HEAD to give it a whirl.

damien tournoud’s picture

Status: Needs review » Closed (won't fix)

The -reloaded branch has been merged. It comes with reasonable defaults for the UK. Could you please check?

Firetracker’s picture

HI,

Just been having a look at commerce and noticed that the Address fields still aren't quite right:

City -> Town/City
State -> County

Seeing as UK is made up of England, N.Ireland, Scotland and Wales. That field would also be useful.

Lastly a County list would be great as well (much like the states in the US version).

Cheers
Zap

ps - commerce is looking good!

SeriousMatters’s picture

According Royal Mail and Postcomm, county is obsolete and not required for postal purposes. UK counties are used for administrative purposes only. In another words, to say that "I live in Cambridgeshire" officially means "I pay tax to Cambridgeshire council", not "my address is in Cambridgeshire".

Moreover, Royal Mail and Postcomm are considering to drop county information all together next year. It would be silly to work on it now.

Therefore, let's follow Royal Mail's recommendation and change UK county (state) to not required.

reference:
http://www.psc.gov.uk/documents/302.pdf
http://en.wikipedia.org/wiki/Postal_counties_of_the_United_Kingdom

mrpauldriver’s picture

County might not be strictly necessary for postal purposes, but that does not mean that normal humans do not live in them (whether tax payers or not).

And whilst I agree fully that it should be optional, it really doesn't make sense to have the label as 'state'. We don't have states in the UK and I am sure that some clients will insist that this is corrected.

Shadlington’s picture

Status: Closed (won't fix) » Active

I agree with Paul Driver.
Many people in the UK still include counties in addresses.

Additionally, there are use cases for address field outside of providing a postal address in which counties remain relevant.
You may wish to allow users to search for nodes located within a particular county, for example.

Shadlington’s picture

Status: Active » Needs work

I suppose this is the more appropriate status.

mrpauldriver’s picture

I notice also that in the address field form, the postcode appears before the town. This can't be right.

I am sure that quite Royal Mail and other delivery operators would prefer to see the postcode to appear last (after the county).

See also http://drupal.org/node/1188526

Shadlington’s picture

That's not what I see - Postal Code is last in my install.

mrpauldriver’s picture

Strange.

I'm using address field from the commerce kickstart installation profile and it's presented differently.

I notice that Address filed module is Beta 1 and that Beta 2 is now available. I'll do some more checking.

mrpauldriver’s picture

StatusFileSize
new3.25 KB

OK the problem was with Beta 1, Beta 2 is better.

With Beta 2, I would just make the point that the output for City, State and Postcode appears on one line - as screenshot.

They should appear on separate lines really.

Shadlington’s picture

Yeah, that's what I see - and I agree they should be on separate lines.

flortjes’s picture

Okay, I'm trying to find out how address field get's its information on what format to use for different countries. I don't mind helping out (if I can) but I really don't know where to start.

A couple of points:

  1. It still says "State" for a UK address, if anything this really needs to be "County"
  2. The list of counties in one of the patches is not complete (it would have to include things like City of Glasgow. That's probably because it's an old system and Royal Mail does not use counties anymore.
  3. The official line of Royal Mail is that you don't need to include a county, so is there a way to make this at least optional? In fact the only time you need a county is when the post code is unknown. But the post code is compulsory so can we please remove the county all together? The UK is really not that big!
  4. Oh, and Royal Mail wants the city/town in uppercase. Can we configure that?
joachim’s picture

> The list of counties in one of the patches is not complete (it would have to include things like City of Glasgow. That's probably because it's an old system and Royal Mail does not use counties anymore.

The problem with counties is: what's a county? Plenty of places in the UK are no longer in any county, because they're in a unitary authority. And then there are places that used to be in one county and are now in another.

If you give a dropdown of current administrative areas, you will get customers complaining that they can't use the 'Historic' county name -- you really will, they write in to newspapers!

(For that matter, the list of counties in the patch contains some which ceased to exist about 20 years ago... ;)

Simplest thing is to remove the county field completely.

flortjes’s picture

I agree.

I have been hunting a bit around in the source code (not very good with that). In the file \modules\addressfield\plugins\format\address.inc I found this line:

// Those countries generally use their administrative division in postal addresses.

and then removed GB from the array. Seems to work. I guess I now need to figure out how to submit a patch.

However, it still makes me think, how are the individual country formats configured? Is there not away that you can exactly define the items required, the order, whether they should be on a singe line etc?

flortjes’s picture

StatusFileSize
new2.41 KB

Bear with my, I said I'm not good with code but I've come up with an attempt to fix this issue. Not sure if I've taken the right approach.

The attached patch should do the following (for UK addresses):

  1. Change a couple of labels, e.g. City / town.
  2. Put the post code below the city/town.
  3. Remove the state field all together
  4. Correct the country HTML-tag from span to div (sorry, totally different issue; applies to all countries)
flortjes’s picture

Hold on, the issue for UK addresses seems to be filed twice?

See #1219658: GB Specific Changes

sammyd56’s picture

Indeed. Can we mark one as a duplicate and get one of the various patches committed? No UK-facing website is going to want to use this module with 'County' displayed as 'State'...

jdelaune’s picture

Status: Needs work » Closed (duplicate)

Continue conversation in other thread as #24 says.