Request for support of Canadian addresses in module "Address field for CCK".

I looked at the official CanadaPost guide and for civic addresses found the following components:

  1. additional delivery information is optional data that a mailer wishes to include. (title, floor, etc.) It is always placed above the civic address
  2. unit number - Unit/Apt/Suite
  3. civic number - street number assigned by the municipality
  4. civic number suffix (123A or 123 1/2)
  5. street name - the official name recognized by municipality (could be alfa-numerical 2ND AVE, 36A ST)
  6. street type - ST, AVE, BLVD, etc. (in some instances, the street type is also the street name: THE PARKWAY, BROADWAY)
  7. street direction - NW, N, S, etc.
  8. municipality name - city, town (TORONTO, CALGARY, etc.)
  9. province - should be presented using the recognized two-letter symbol (AB, BC, MB, etc.)
  10. postal code - should be in upper case and with one space between the first three and last three characters (R1A 2B3)

Here's an example address:

10(2)-123(3) 1/2(4) MAIN(5) ST(6) NW(7)
MONTREAL(8) QC(9) H3Z 2Y7(10)

I would say this requires at least five fields in database:

  • street address: combines points 2, 3, 4, 5, 6 and 7 (part 2 can have its own field, must be alpha-numeric)
  • municipality: for part 8
  • province: for part 9
  • postal code: for part 10
  • country: already exists (official abbriviation is CA)


sshvetsov’s picture

There are also other address types like Post Office Box Addresses, Rural Route Addresses, General Delivery Addresses and Military Addresses. Those have their own requirements, but could be accommodated with two more fields, additional information and second street address (or something like that).

Also, here's link to goty details on Canada's Addressing Guidelines:

rconstantine’s picture

Assigned: Unassigned » rconstantine

So it sound like there are almost enough fields now:

U.S. Canada
street1 street address
street2 second street address
apartment/suite unit number
city municipality
state province
zip postal code
country country

The only thing that isn't there is your 'additional information' field. When I get a chance, I'll put together a template for state/province install-include files and a layout for Canadian addresses. Feel free to beat me to it. I'll also figure out a country selector of some kind.

sshvetsov’s picture

Here's a list of provinces/territories and the official abriviations:

Alberta, AB
British Columbia, BC
Manitoba, MB
New Brunswick, NB
Newfoundland and Labrador, NL
Northwest Territories, NT
Nova Scotia, NS
Nunavut, NU
Ontario, ON
Prince Edward Island, PE
Québec, QC
Saskatchewan, SK
Yukon, YT

sshvetsov’s picture

Sorry, can't help much with code, but will definitely provide data and testing results.

ray007’s picture

If different countries have very different address fields, we should probably only have the common fields as rows in the database and add a column "data" to hold a serialized array with country-specific data.
If I look at canadian addresses, the civic data and the street direction may be candidates for the data-field, maybe unit number, ... ?

sshvetsov’s picture

Or it could be a good idea to have a separate table for every country. That way all address information could be as detailed or as general as required. The problem is how would you let user/administrator choose what country's address form is displayed and form processing for every country would have to be different.

rconstantine’s picture

Just thought I'd let you know I started on this.

rconstantine’s picture

Status: Active » Fixed

I think I've added what you need. The new release should show up within 12 hours (drupal's cron job). One thing I wasn't sure about is what was needed besides the province info. So if I left something out, open another issue regarding that specifically.

If anyone doesn't like the way the fields are presented, you could write a cck widget to make it look how you'd like. Or you can theme it differently.

Anonymous’s picture

Status: Fixed » Closed (fixed)