Magento failure.phtml, get the order total
Posted
by
Kieran
on Stack Overflow
See other posts from Stack Overflow
or by Kieran
Published on 2010-12-22T16:51:28Z
Indexed on
2010/12/22
16:54 UTC
Read the original article
Hit count: 382
magento
Hello. One of the projects I work on has the failure page and success page in magento as exactly the same and requires some tracking code on both. The tracking code requires the order ID and the amount being ordered. The issue I'm having is trying to get the order total on the failure page.
The methods built into the block class Mage_Checkout_Block_Onepage_Failure
are getRealOrderId()
, getErrorMessage()
and getContinueShoppingUrl()
, so no help there.
I found some code to do what I want on the success page but it doesn't work for the failure page.
<?php
$orderId = $this->getRealOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($orderId);
$_totalData = $order->getData();
$_grand = $_totalData['grand_total'];
?>
I dumped $order
and $_totalData
. $_totalData
just an empty array and $order
an empty Mage_Sales_Model_Order
instance.
Does anyone have any suggestions for where to get the grand total of what is being purchased?
Regards, Kieran
(I'm also having issues testing the success page as I can't get to it, even putting in the correct test card details on the dev server - but I'll find a way around this)
© Stack Overflow or respective owner