I am trying to add payment method's info text to the PDF invoice but I can't figure out the right code.
Any ideas how to do this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityThis generally comes down to the specific implementation of the payment method. However the default payment methods provide this functionality by first defining a toPdf method - like this
class Mage_Payment_Block_Info_Purchaseorder extends Mage_Payment_Block_Info
{
protected function _construct()
{
parent::_construct();
$this->setTemplate('payment/info/purchaseorder.phtml');
}
public function toPdf()
{
$this->setTemplate('payment/info/pdf/purchaseorder.phtml');
return $this->toHtml();
}
}
Which in this case will reference this template file. Your payment method might not have it's own specified toPdf method in which case you will end up using the default template which will affect all not specified payment methods.
To customise admin templates I would suggest your own admin theme, see here for details. Just copy the relevant file to the your theme and add your information there.
Another avenue to look into is to update the payment method to provide its specific information similar to how the CC method does it
In app/desing/adminhtml/default/default/template/payment/info/pdf/default.phtml
I write this line:
<?php echo $this->escapeHtml($this->getMethod()->getInstructions()) ?>
and works