Defining Custom Address Format in Magento

Written by shuron on December 13, 2009 – 02:09 -

If you want to change the default address representation in your Magento shop you should simply add new address format for desired country. It should be done in the table mage_directory_country_format.

The following example illustrates how to do this. This statemet inserts the same format in three forms: HTML, text and PDF for beeing used in PDF documents like invoices.

INSERT INTO `mage_directory_country_format` (`country_id`, `type`, `format`) VALUES
('DE', '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}}'),
('DE', '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}}'),
('DE', '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}}|')

Prioduces something like:
My Company GmbH
Max Mustermann
Mönkeberg Str. 123
22090 Hamburg
Hansestadt Hambug
Deutschland

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • LinkedIn
  • Live
  • MisterWong
  • MisterWong.DE
  • Print
  • StumbleUpon
  • Technorati
  • TwitThis
  • Yigg

Posted in Magento | No Comments »

Denied access with pure PHP

December 8, 2009 – 12:05

Often you have to protect a directory or website, so ...

1 Comment »

First Steps with Magento

May 5, 2009 – 00:14

I would like to start new topic with this ...

No Comments »

Joomla 1.5.9 and Community Builder 1.2 in German

January 31, 2009 – 08:36

I'was facing problems with installation of  Joomla 1.5.9 and ...

2 Comments »

Blog HTML Validity and plug-ins

December 18, 2008 – 02:34

Maintaining the Wordpress blog valid to the declared HTML standard ...

No Comments »

Wordpress 2.7 released

December 12, 2008 – 23:18

Several days ago, the new version of Wordpress "Coltrane" has ...

1 Comment »

Browser detection in PHP

November 12, 2008 – 22:32

It was short time ago. I was sitting in my ...

No Comments »

Three, Two, One, Launch

July 30, 2008 – 08:34

Finally, after several weeks of delay, the TechPHP.net is launched. ...

No Comments »

Awakening

July 20, 2008 – 21:13

As you may notified, some weeks are past since my ...

No Comments »

Hello World

March 21, 2008 – 19:55

I'm very pleasured to announce the birth of TechPHP - ...

No Comments »