Magento Forum

   
Page 2 of 3
International address format
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 

Just got a pointer to the Mxperts - CustomerAddress extension which does exactly what we need. Great stuff!

 
Magento Community Magento Community
Magento Community
Magento Community
 
diedthreetimes
Jr. Member
 
Total Posts:  1
Joined:  2009-10-08
 

It is actually easier then adding a whole module. You can add an address format for every country, every city, hell every day of the year with a few lines of code in a config.xml.

Here is how it works

<config>
<global>

       <
customer>
            <
address>
                <
formats>
<!-- 
This is an example to render html without a telephone number the 'type' is htmlnotele -->
                    <
htmlnotele translate="title" module="customer">
                        <
title>HTML No Telephone</title>

<!-- 
this will escape any html special characters from the data fields only-->
                        <
htmlEscape>true</htmlEscape>


<!-- 
how you want the address to be rendered note the use of depend and var -->
                        <
defaultFormat><![CDATA[
{{depend prefix}}{{var prefix}} {{
/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}<br/>
{{depend company}}{{var company}}<br />{{/depend}}
{{var street1}}
<br />
{{depend street2}}{{var street2}}<br />{{/depend}}
{{depend street3}}{{var street3}}
<br />{{/depend}}
{{depend street4}}{{var street4}}
<br />{{/depend}}
{{depend city}}{{var city}}
,  {{/depend}}{{depend region}}{{var region}}{{/depend}}{{var postcode}}<br/>
{{var country}}
                    ]]
></defaultFormat>
                    </
htmlnotele>
                </
formats>
            </
address>
        </
customer>

</global>
</
config

You then call the format as follows given an address of type Mage_Customer_Model_Address_Abstract

echo $address()->format('htmlnotele');

There’s countless options for some good examples look in ‘app/code/customer/etc/config.xml’

 
Magento Community Magento Community
Magento Community
Magento Community
 
John
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2007-12-20
Sheffield, United Kingdom
 

Anyone got a DB extract I can use for address formats?

Looks like this works a treat for entered addresses.

Thanks
John

SeL - 21 May 2008 04:33 AM

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
 
krishnak
Jr. Member
 
Total Posts:  19
Joined:  2010-05-16
 

diedthreetime - I am using Magento 1.4.01 your method is not working, can you let me know what else needs to be done to make the system over ride the config.xml.

I have placed my config.xml in local/Mage/Customer/etc but it doesn’t get picked up

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pythonheads
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2009-11-12
 

I created a small module for the dutch address format.

Download @ http://pythonheads.nl/plugins/Pythonheads_Dutchaddress.tar.gz

 
Magento Community Magento Community
Magento Community
Magento Community
 
John
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2007-12-20
Sheffield, United Kingdom
 

Hi - I am currently using this file for formats

Hope this helps someone

Rgds
John

File Attachments
addressUpdate.sql  (File Size: 54KB - Downloads: 258)
 
Magento Community Magento Community
Magento Community
Magento Community
 
ds_1984
Mentor
 
Avatar
Total Posts:  3116
Joined:  2008-12-09
Potsdam, Germany
 

Yeah! grin

Since Magento 1.4.2.0 there is a good backend integration for this.

System->Configuration->Customer->Customers->Customer Configuration->Address Templates

You can set with this function the format you need for your audience.

It’s possible to include own variables, define an other sort order, remove not needed variables and so on.

If you have multi stores with different languages, you can define different address formats - e.g. for english, french and german.

In the “Default Config” i make it so that i use the default format (as an template for later modifications / debugging)

Really needed function - Thank you Magento Core Team!  grin

Daniel

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kazoo
Jr. Member
 
Total Posts:  3
Joined:  2009-11-29
 
ds_1984 - 14 December 2010 02:10 PM

Yeah! grin

Since Magento 1.4.2.0 there is a good backend integration for this.

System->Configuration->Customer->Customers->Customer Configuration->Address Templates

You can set with this function the format you need for your audience.

Hi there,

I’m using 1.4.2.0, and try to modify sort order like as “lastname”, “firstname”, “company”, “postcode”, “region”, “city”, “street”,"country", for Japanese customers, but It doesn’t work anything…
Nothing happen even I tried to change the sort order only “region” and “city"…

Is there anybody who could succeed to manage this function???

 
Magento Community Magento Community
Magento Community
Magento Community
 
magebid_connect
Sr. Member
 
Avatar
Total Posts:  92
Joined:  2010-09-17
Leipzig, Germany
 

Just as information.

There are 4 kind of address formats, which can be added in directory_country_format - table:
- html
- pdf
- text
- and “oneline” for the select options fields in the checkout when you select the address

 
Magento Community Magento Community
Magento Community
Magento Community
 
alexhost
Member
 
Avatar
Total Posts:  69
Joined:  2009-04-10
Kiev, Ukraine
 

Maybe this will helpful

http://www.magentocommerce.com/magento-connect/alex.host/extension/5959/magefast_usabr

 
Magento Community Magento Community
Magento Community
Magento Community
 
nasaralla
Jr. Member
 
Total Posts:  2
Joined:  2010-07-06
 

I have written a detailed configuration of address formatting for shipping, billing addresses in html, pdf and texts… You can do a country vise formatting as well as do things like lastname in upper case etc.

Please see:

http://magentophp.blogspot.com/2011/03/customer-address-format-by-country-in.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
freshshop
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2009-03-07
 

In 1.5.1 you can edit customer fields in backend, under configuration - customer config

 
Magento Community Magento Community
Magento Community
Magento Community
 
labanino
Jr. Member
 
Total Posts:  5
Joined:  2010-04-19
 

This topic is a mistery. I went to: System->Configuration->Customer->Customers->Customer Configuration->Address Templates and deleted everything, saved it and didn\’t see any changes, cache cleaned, etc. with no success. Am I missing something? What am I doing wrong? Thanks.  hmmm

 
Magento Community Magento Community
Magento Community
Magento Community
 
nogoodchoices
Jr. Member
 
Total Posts:  26
Joined:  2010-12-06
 
labanino - 29 September 2011 07:27 AM

This topic is a mistery. I went to: System->Configuration->Customer->Customers->Customer Configuration->Address Templates and deleted everything, saved it and didn\’t see any changes, cache cleaned, etc. with no success. Am I missing something? What am I doing wrong? Thanks.  hmmm

I wonder if by deleting everything Magento resorts to a default configuration?  See if you can try just deleting one field instead of all of them.

Also, where is it that you are looking for the changes to appear?

 
Magento Community Magento Community
Magento Community
Magento Community
 
rodrigo423
Member
 
Total Posts:  32
Joined:  2009-03-18
 

I’m having the same issue with version 1.6.2.

The sort order won’t change at checkout page even if I change the order at backend.

Any tips, here?

Thanks!

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