vianetz | Software Engineer for Magento®

Frequently Asked Questions

If you have any further questions do not hesitate to contact me.


DHL Location Finder Extension: Post number is printed multiple times in address

1
Last update: 19.04.2018

If you are using our Advanced Invoice Layout Extension with the DHL Extension Dhl_LocationFinder it may happen that if you have added the post number in the shipping address with the variable

{{var dhl_post_number}}
you will see the following output on the PDF invoice or shipment document:
Postnumber: Postnumber: Postnumber: Postnumber: Postnumber: Postnumber: Postnumber: Postnumber: 32403197

This issue happens due to a small bug in the DHL Extension that listens to the Magento event customer_address_format and adds the "Postnumber: " prefix. But as this event can occur multiple times (as it will within the Advanced Invoice Layout extension) the prefix is also added multiple times.

As this is not the desired behaviour you can patch the method Dhl_LocationFinder_Model_Observer::addPostNumberLabel() to only add the prefix once:

public function addPostNumberLabel(Varien_Event_Observer $observer)
    {
        $address = $observer->getData('address');
        $postNumberLabel = Mage::helper('dhl_locationfinder/data')->__('Postnumber: ');
        if ($address->getData('dhl_post_number') && strpos($address->getData('dhl_post_number'), $postNumberLabel) === false) {
            $postNumberString = $postNumberLabel . $address->getData('dhl_post_number');
            $address->setData('dhl_post_number', $postNumberString);
        }
    }

Please note that this was tested with Dhl_LocationFinder extension version 1.0.3.

« Back to the FAQ overview