I have a custom payment method with a custom info block. This info block is rendered on the invoice,shipment and other PDFs and in the e-mail templates.

I want to include payment instructions in this block. The payment instructions contain the customer id and the order id.

How can I render the customer id and the order id in the payment info block?


To include this information in the PDF you should edit the following file to include the correct information:


This file in EE 1.13/CE 1.8:

<?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}}

<?php if ($_specificInfo = $this->getSpecificInformation()):?>
<?php foreach ($_specificInfo as $_label => $_value):?>
<?php echo $_label ?>: <?php echo implode($this->getValueAsArray($_value), ' ')?>{{pdf_row_separator}}
<?php endforeach; ?>
<?php endif;?>

<?php echo implode($this->getChildPdfAsArray(), '{{pdf_row_separator}}') ?>

In here you can put the information you desire such as the customer's order number, Customer ID. The 'proper' way of accessing the customer object, order object information would be to create a new module that rewrites the Mage_Payment_Block_Info and add appropriate methods to give access to the template file to those objects.


To affect this change in email, you may or may not look to edit similar files named payment/info/*/default.phtml

  • I don't have to edit the default template or rewrite the Mage_Payment_Block_Info, because I already created a custom Payment info block which inherits Mage_Payment_Block_Info. How can I access the order data from the Mage_Payment_Block_Info? I don't think it is possible without editing the sendMail functions.
    – i.amniels
    Jan 22 '14 at 14:07

This one took some time to solve. Magento always seems to use the Mage_Payment_Helper_Data::getInfoBlock function to retrieve a Payment's info block. This helper function accepts a Mage_Payment_Model_Info model as parameter. This model doesn't contain the order model or any link to the order model.

Luckily in Magento, most of the time the Mage_Sales_Model_Order_Payment is passed to the helper, this is possible, because Mage_Sales_Model_Order_Payment is a child of Mage_Payment_Model_Info.

So by rewriting the Mage_Payment_Helper_Data::getInfoBlock function it is possible to get the order from the Info model and pass it to the info block.


You can use render function in order to achieve this goal

Prepare the collection

protected function _prepareCollection()
$store = $this->_getStore();
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('short_description') // THIS IS WHAT WE HAVE ADDED
if ($store->getId()) {
$collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId());
$collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());
else {
return $this;

Create a render file


class Mage_Adminhtml_Block_Catalog_Product_Renderer_Red extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
public function render(Varien_Object $row)
$value =  $row->getData($this->getColumn()->getIndex());
return '<span style="color:red;">'.$value.'</span>';

Include the renderer in corresponding grid file

protected function _prepareColumns()
$this->addColumn('Short description',
'header'=> Mage::helper('catalog')->__('Short description'),
'index' => 'short_description',
'renderer'  => 'Mage_Adminhtml_Block_Catalog_Product_Renderer_Red',// THIS IS WHAT THIS POST IS ALL ABOUT

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.