1

Magento New Order Email

See above is a picture of new order acknowledgement email of Magento. On the website we're developing we use Fontis Australia extension (http://www.magentocommerce.com/magento-connect/fontis-australia.html) to implement BPay payment method. The extension works ok, except that on the order acknowledgement email, the Email ref always show 000000.

I try to look at it and see that the ref number generated need the order ID as input to generate the correct ref number. The extension use this code to get the last order number on payment info block: $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();

I try to use and print the result from other controller, it shows the correct order number. But seems that for the payment info block on email, the order number info can't be retrieved. Actually the same block also called out on the checkout success page, and it shows correctly.

Can somebody suggest other way to get the last order id on payment info block on Magento Email?

1 Answer 1

3

In info template you can use $order = $this->getInfo()->getOrder(); to get Mage_Sales_Model_Order object. Then you can get current order id by $order->getData('increment_id').

But with this code, you get error in checkout process, because $this->getInfo() returns other model.

So dirty solution, that works for me without errors, is:

$info = $this->getInfo();   
if ($info instanceof Mage_Sales_Model_Order_Payment) {
    $order = $info->getOrder();
    echo $order->getData('increment_id'));
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.