Question

Where in default Magento installation can I find the file of {{var firstname}} and similar variables?

Was it helpful?

Solution

If you are just wanting to change the order that address variables appear in the customer address section of the pdf you can do this under System->Configuration->Customer Configuration->Address Templates->Pdf

The function Mage_Customer_Model_Address_Config::getFormatByCode will actually get the correct config from the code. In the case of the pdfs the code is pdf.

When rendering these formats the function is on the address model format and has a handy event that you can use to add or edit what will actually be formatted.

Mage::dispatchEvent('customer_address_format', array('type' => $formatType, 'address' => $this));

In the case of the pdf the type contains the information saved in the config or defaults to the information saved in xml and the address object.

If you are simply adding new customer address attributes then once they are in Magento attached to the address then they will be added when formatting occurs but if you want to add your own or change the information then I would suggest that you should then listen to this event and add variables to the address object.

Note the actual rendering happens by default in Mage_Customer_Block_Address_Renderer_Default::render

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top