Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
International address format
 
SeL_
Magento Team
 
Avatar
Total Posts:  1140
Joined:  2007-10-10
Paris, France
 

Hi,

I saw that one can change address format for specific country by running the following command in SQL client:

update directory_country
set address_template_plain 
'{{firstname}} {{lastname}}
{{company}}
{{street1}}
{{street2}}
{{postcode}} {{city}}'
,
address_template_html '{{firstname}} {{lastname}}<br/>
{{company}}<br/>
{{street}}<br/>
{{postcode}} {{city}}<br/>
T: {{telephone}}'
where country_id 'FR'

In my example, address format is specific for France (no region, and postcode before city).

What about providing Magento team with address format of your own country ? So that they can integrate it in the database of stable version.
In my case, i don’t know how i should write down an address for Netherlands (even if it’s not far from France...). It would be better to centralize this, no ?

What do you think Magento team ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Grayson
Member
 
Avatar
Total Posts:  58
Joined:  2007-11-20
Netherlands
 
SeL - 08 January 2008 02:00 AM

What about providing Magento team with address format of your own country ? So that they can integrate it in the database of stable version.
In my case, i don’t know how i should write down an address for Netherlands (even if it’s not far from France...). It would be better to centralize this, no ?

Sounds like a great idea to me, SeL. And for the record, here’s the format for the Netherlands:

Jan Smits
Groteweg 124
1234AB Stadergens

That is:

First name Last name
Street name House number
Postcode City

 
Magento Community Magento Community
Magento Community
Magento Community
 
YoavKutner
Guru
 
Avatar
Total Posts:  491
Joined:  2007-08-08
 

We are already working on adding address format control per country. This should be available by the first stable release.

thanks

yoav

 
Magento Community Magento Community
Magento Community
Magento Community
 
SeL_
Magento Team
 
Avatar
Total Posts:  1140
Joined:  2007-10-10
Paris, France
 

Great !
smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
SeL_
Magento Team
 
Avatar
Total Posts:  1140
Joined:  2007-10-10
Paris, France
 

Hi,

This changed in latest versions.
How does it work now ?
How can i specify address format for France (or other countries) ?
Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Loic_LC
Sr. Member
 
Avatar
Total Posts:  194
Joined:  2007-12-19
Paris, France
 

+1 I’m also interested in knowing the answer

 
Magento Community Magento Community
Magento Community
Magento Community
 
Crucial
Enthusiast
 
Avatar
Total Posts:  770
Joined:  2007-11-07
Phoenix, AZ
 

Address formatting (and selection process for the user) has always been a major PITA. I would take a good look at PayPal and how they setup their registration form on a per country basis, because as the OP pointed out, someone in France has a different way of looking at an order form’s contact information compared to someone in, say, the US or England. They have different terminology and even a different order structure, e.g. Postal Code, ZIP Code, Postcode, etc. Some countries don’t have a State/Province, and some (like France) have things in an order that’s not the same as you would expect.

It would be great if Magento could organize the order form like this using JS to determine a lot of different information depending on what was entered. I actually have a pretty big PHP class that models PayPal and some other sources very well depending on the country selected. For example, if you select US as the country, it only shows US States with a drop down, or if you choose Canada only shows the provinces.

It’s a big task (of course) to get something like this organized, but data entry and formatting that’s not controlled by the user is something I personally look for.

Who knows, you might even have to call up some embassies or do some research on what the common naming conventions are and so on and to come up with the correct regex for each country, but that would be something very, very useful and powerful.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SeL_
Magento Team
 
Avatar
Total Posts:  1140
Joined:  2007-10-10
Paris, France
 

After a few tries, i was able to define postal address format for different countries.
Magento does it perfectly smile

By inserting format in directory_country_format table, you’ll have your addresses formated as you wish.
For each country, there are 3 format types to take into account:
- HTML
- TEXT
- PDF

Here is my SQL command to have address format for France:

INSERT INTO `directory_country_format` (`country_id`, `type`, `format`) VALUES
('FR''html''{{depend company}}{{var company}}<br />{{/depend}}\n{{var firstname}} {{var lastname}}<br/>\n{{var street1}}<br />\n{{depend street2}}{{var street2}}<br />{{/depend}}\n{{depend postcode}}{{var postcode}}{{/depend}}{{depend city}} {{var city}}{{/depend}}{{depend region}}, {{var region}}{{/depend}}<br/>\n{{var country}}<br/>\n{{depend telephone}}Tel : {{var telephone}}{{/depend}}\n{{depend fax}}<br/>Fax : {{var fax}}{{/depend}}'),
(
'FR''text''{{depend company}}{{var company}}\n{{/depend}}{{var firstname}} {{var lastname}}\n{{var street1}}{{depend street2}}{{var street2}}\n{{/depend}}\n{{depend postcode}}{{var postcode}}{{/depend}}{{depend city}} {{var city}}{{/depend}}{{depend region}}, {{var region}}{{/depend}}\n{{var country}}{{depend telephone}}\nTel : {{var telephone}}{{/depend}}{{depend fax}}\nFax : {{var fax}}{{/depend}}'),
(
'FR''pdf''{{depend company}}{{var company}}|\n{{/depend}}{{var firstname}} {{var lastname}}|\n{{var street1}}|{{depend street2}}{{var street2}}|\n{{/depend}}\n{{depend postcode}}{{var postcode}}{{/depend}}{{depend city}} {{var city}}{{/depend}}{{depend region}}, {{var region}}{{/depend}}|\n{{var country}}{{depend telephone}}|\nTel : {{var telephone}}{{/depend}}{{depend fax}}|\nFax : {{var fax}}{{/depend}}|');

If you need to know more about postal addresses format, here is a good link:
http://www.upu.int/post_code/fr/postal_addressing_systems_member_countries.shtml

Enjoy!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

Thanks !
I don’t know when I will use this but I ‘m sure it will be useful to me smile .

 
Magento Community Magento Community
Magento Community
Magento Community
 
dm06
Jr. Member
 
Total Posts:  5
Joined:  2008-07-27
 

Thanks SeL,

I spent all morning looking for that table before I finally found your post tongue laugh

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreasb
Jr. Member
 
Total Posts:  13
Joined:  2009-03-18
 

When is this feature going to be implemented by default/via backend?

Thanks,
Andreas

 
Magento Community Magento Community
Magento Community
Magento Community
 
Wilco
Jr. Member
 
Total Posts:  28
Joined:  2008-07-23
 

It would be very nice if this ever gets implemented to be able to choose if you want to print the customer’s VAT# which is very useful when using Magento to do B2B

 
Magento Community Magento Community
Magento Community
Magento Community
 
RolandG
Member
 
Total Posts:  75
Joined:  2008-05-16
 

Works fine. But how can I change the format in the select fields (for example on the one page checkout)?

Kind regards
Roland

 
Magento Community Magento Community
Magento Community
Magento Community
 
Way to go
Jr. Member
 
Total Posts:  18
Joined:  2009-02-16
 

@Roland, I have the same question. I can find something in the core file : country.php: But I don’t want to change the core, right? And I’m not sure this one provides the address formatting....

$template = $this->getData(’address_template_’.($html ? ‘html’ : ‘plain’));
if (empty($template)) {
if (!$this->getId()) {
$template = ‘{{firstname}} {{lastname}}’;
} elseif (!$html) {
$template = “{{firstname}} {{lastname}}
{{company}}
{{street1}}
{{street2}}
{{city}}, {{region}} {{postcode}}”;
} else {
$template = “{{firstname}} {{lastname}}<br/>
{{street}}<br/>
{{city}}, {{region}} {{postcode}}<br/>
Tel: {{telephone}}”;
}
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 

I really wonder why it’s not possible to custom define the address format, this is e.g. a default feature in osCommerce. There are 5 address formats to choose from on a per country basis.

US developers are sometimes too US (ex)centric tongue laugh

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 
YoavKutner - 09 January 2008 06:43 PM

We are already working on adding address format control per country. This should be available by the first stable release.

This statement is 1.5 years old, so maybe I just don’t know where to configure this?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3