Magento address template based on country

Magento out of box provide Address template configurable from back-end.  Navigate to System>Configuration>Customers > Customer Configuration >Address Templates. From here you can set address template for your store. But some time have requirements need to setup Address base for country. This module help you for define address format base on customer country.

Example :

For India:
RECIPIENT
[HOUSE_NUMBER] [STREET_NAME]
[DEPENDENT_LOCALITY] [, DOUBLE_DEPENDENT_LOCALITY]
LOCALITY - POSTAL_CODE
INDIA

For UK:
RECIPIENTRECIPIENT
[FLOOR] [APARTMENT]
[BUILDING]
[HOUSE_NUMBER] STREET_NAME
[DEPENDENT_LOCALITY]
LOCALITY
POSTAL_CODE
UNITED KINGDOM

Installation steps : 

1) Download module Zip file from below link.

2) Unzip files and copy file in your magento instance with given folder structure.

3)
address format step 1

4) Create Or Edit address template for country.
address_format_2
Here is download link Addressformat-1.0.1

Post your comment if you have issue on install module or any other query . I am happy to give answer.

7 thoughts on “Magento address template based on country

  1. Evelien Fick October 11, 2014 / 1:07 pm

    where does it save the data? I added the format for PDF, I click save and the format within my PDF files changes , but when I want to make additional changes, the standard input comes back, not my modified code.

    • magentopractice October 12, 2014 / 1:05 pm

      Hi data save in directory_country_format table.My module check the Customer address and apply base on it.

  2. Karsten November 4, 2014 / 6:25 pm

    Hello magentopractise,
    we have tryed out your module.
    We have the same problem as Evelien with your module. Its not possible to save the changes made in the Format Field Area. Always the Format Field Area gets refilled with the standard Code. Do you know how to solve this problem?

    • magentopractice November 5, 2014 / 8:07 am

      Yes Karsten you are right. I are some issue when get date in edit form update AddressformatController.php

      public function editAction() {
                      $id     = $this->getRequest()->getParam('id');
                     $model  = Mage::getModel('addressformat/addressformat')->load($id);
                     if ($model->getId() && $model->getFormat()) {
                         $model->setData($data);
                     } else {
                         $addressFormate = Mage::getStoreConfig('customer/address_templates/text');
                        $model->setFormat($addressFormate);
                    }
      
                  Mage::register('addressformat_data', $model);
      
                  $this->loadLayout();
                  $this->_setActiveMenu('addressformat/items');
      
                  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Country Wise Address Format'), Mage::helper('adminhtml')->__('Country Wise Address Format'));
                  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
                  $this->_addContent($this->getLayout()->createBlock('addressformat/adminhtml_addressformat_edit'))
                      ->_addLeft($this->getLayout()->createBlock('addressformat/adminhtml_addressformat_edit_tabs'));
      
                  $this->renderLayout();
              
          }
      
      
      • magentopractice November 5, 2014 / 8:16 am

        I have updated changes on githug you can download from there also. Thanks for addressing this issue.

  3. Cas January 2, 2018 / 10:25 am

    Do you have a german address template?

  4. magento2 January 3, 2018 / 6:42 am

    You can create your own template using this module

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.