title: Magento 1.6 Adding New Address Template
body: <p>I am trying to add a new address template to Magento 1.6, so I can output addresses formatted for labels in my shipments PDF as well as keeping the standard PDF address format.</p>
  
  <p>So far I have copied the file app/code/core/Mage/Customer/etc/config.xml to the local code pool and have copied the xml from an existing template and renamed it to . Below are the relevant parts of the config.xml </p>
  
  <p><strong>Code:</strong> 
  app/code/core/Mage/Customer/etc/config.xml</p>
  
  <p><strong>Part One:</strong></p>
  
  <pre><code>   &lt;customer&gt;
          &lt;address&gt;
              &lt;formats&gt;
                  &lt;text translate="title" module="customer"&gt;
                      &lt;title&gt;Text&lt;/title&gt;
                  &lt;/text&gt;
                  &lt;oneline translate="title" module="customer"&gt;
                      &lt;title&gt;Text One Line&lt;/title&gt;
                  &lt;/oneline&gt;
                  &lt;html translate="title" module="customer"&gt;
                      &lt;title&gt;HTML&lt;/title&gt;
                      &lt;htmlEscape&gt;true&lt;/htmlEscape&gt;
                  &lt;/html&gt;
                  &lt;pdf translate="title" module="customer"&gt;
                      &lt;title&gt;PDF&lt;/title&gt;
                  &lt;/pdf&gt;
                  &lt;js_template template="title" module="customer"&gt;
                      &lt;title&gt;JavaScript Template&lt;/title&gt;
                  &lt;/js_template&gt;
                  &lt;add_label template="title" module="customer"&gt;
                      &lt;title&gt;Address Label&lt;/title&gt;
                  &lt;/add_label&gt;
              &lt;/formats&gt;
          &lt;/address&gt;
      &lt;/customer&gt;
  </code></pre>
  
  <p><strong>Part Two:</strong></p>
  
  <pre><code>   &lt;address_templates&gt;
              &lt;text&gt;
                  {{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}
                  {{depend company}}{{var company}}{{/depend}}
                  {{if street1}}{{var street1}}
                  {{/if}}
                  {{depend street2}}{{var street2}}{{/depend}}
                  {{depend street3}}{{var street3}}{{/depend}}
                  {{depend street4}}{{var street4}}{{/depend}}
                  {{if city}}{{var city}},  {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}
                  {{var country}}
                  T: {{var telephone}}
                  {{depend fax}}F: {{var fax}}{{/depend}}
                  {{depend vat_id}}VAT: {{var vat_id}}{{/depend}}
              &lt;/text&gt;
              &lt;oneline&gt;{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}, {{var street}}, {{var city}}, {{var region}} {{var postcode}}, {{var country}}&lt;/oneline&gt;
              &lt;html&gt;
                  {{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}&amp;lt;br/&amp;gt;
                  {{depend company}}{{var company}}&amp;lt;br /&amp;gt;{{/depend}}
                  {{if street1}}{{var street1}}&amp;lt;br /&amp;gt;{{/if}}
                  {{depend street2}}{{var street2}}&amp;lt;br /&amp;gt;{{/depend}}
                  {{depend street3}}{{var street3}}&amp;lt;br /&amp;gt;{{/depend}}
                  {{depend street4}}{{var street4}}&amp;lt;br /&amp;gt;{{/depend}}
                  {{if city}}{{var city}},  {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}&amp;lt;br/&amp;gt;
                  {{var country}}&amp;lt;br/&amp;gt;
                  {{depend telephone}}T: {{var telephone}}{{/depend}}
                  {{depend fax}}&amp;lt;br/&amp;gt;F: {{var fax}}{{/depend}}
                  {{depend vat_id}}&amp;lt;br/&amp;gt;VAT: {{var vat_id}}{{/depend}}
              &lt;/html&gt;
              &lt;pdf&gt;
                  {{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}|
                  {{depend company}}{{var company}}|{{/depend}}
                  {{if street1}}{{var street1}}
                  {{/if}}
                  {{depend street2}}{{var street2}}|{{/depend}}
                  {{depend street3}}{{var street3}}|{{/depend}}
                  {{depend street4}}{{var street4}}|{{/depend}}
                  {{if city}}{{var city}},|{{/if}}
                  {{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}|
                  {{var country}}|
                  {{depend telephone}}T: {{var telephone}}{{/depend}}|
                  {{depend fax}}&amp;lt;br/&amp;gt;F: {{var fax}}{{/depend}}|
                  {{depend vat_id}}&amp;lt;br/&amp;gt;VAT: {{var vat_id}}{{/depend}}|
              &lt;/pdf&gt;
              &lt;js_template&gt;#{prefix} #{firstname} #{middlename} #{lastname} #{suffix}&amp;lt;br/&amp;gt;#{company}&amp;lt;br/&amp;gt;#{street0}&amp;lt;br/&amp;gt;#{street1}&amp;lt;br/&amp;gt;#{street2}&amp;lt;br/&amp;gt;#{street3}&amp;lt;br/&amp;gt;#{city}, #{region}, #{postcode}&amp;lt;br/&amp;gt;#{country_id}&amp;lt;br/&amp;gt;T: #{telephone}&amp;lt;br/&amp;gt;F: #{fax}&amp;lt;br/&amp;gt;VAT: #{vat_id}&lt;/js_template&gt;
              &lt;add_label&gt;
                  {{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}|
                  {{depend company}}{{var company}},|{{/depend}}
                  {{if street1}}{{var street1}},{{/if}}
                  {{depend street2}}{{var street2}},|{{/depend}}
                  {{depend street3}}{{var street3}},|{{/depend}}
                  {{depend street4}}{{var street4}},|{{/depend}}
                  {{if city}}{{var city}},|{{/if}}
                  {{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}|
                  {{var country}}|
              &lt;/add_label&gt;
          &lt;/address_templates&gt;
  </code></pre>
  
  <p>Then I copied app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php to the local code pool and tried to output my new address template with the following code.</p>
  
  <p><strong>Code:</strong> app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php</p>
  
  <pre><code>$shippingAddress = $this-&gt;_formatAddress($order-&gt;getShippingAddress()-&gt;format('add_label'));
  
  $this-&gt;y = 170;
  foreach ($shippingAddress as $value){
      $page-&gt;drawText(strip_tags(ltrim($value)), 40, $this-&gt;y, 'UTF-8');
      $this-&gt;y -=10;
  }
  </code></pre>
  
  <p>But what gets outputted is not my new address template it seems to be some sort of default template. I have refreshed the cache but this doesn't change anything. Does anyone know where I am going wrong? </p>