Magento 1.9 – Alternative to {{var payment_html}}

magento-1.9transactional-mailvariables

I'm writing my own function for sending emails.
In the Magento email template, there's a variable {{var payment_html}} which I need to convert to $order object. The question is how can I get the content of payment_html from $order object?

Best Answer

You cannot the payment html directly form the order because there is a block involved.
You can generate the html like this:
Let's say $order is your order object.

$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())
                ->setIsSecureMode(true);
$paymentBlock->getMethod()->setStore($order->getStoreId());
$paymentBlockHtml = $paymentBlock->toHtml();

BUt if you want you can attache the payment html to the order object after generating it.

$order->setPaymentHtml($paymentBlockHtml);

and you can read it from the order object after that with

$order->getPaymentHtml();
Related Topic