How can I get the zipcode of the order inside the track.html file?

I tried this, but that does not work:

<?php echo $this->escapeHtml($this->getShippingAddress()->getPostcode()) ?>

The block type of the track.phtml template is core/template so it's default without a method like $this->getShippingMethod().

If you check the shipment_new.html email template somewhere around the bottom the tracking block is included with the following statement

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

This means both the order and shipment are available in the data of the block class. Which means you can do this

<?php echo $this->escapeHtml($this->getOrder()->getShippingAddress()->getPostcode()) ?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.