I need to know, if any solution how to add in magento success.phtml order's total price? Because I want after placed order, customer get all info how to make payment including what price need to pay, because customer don't remember in last step what is total price.
Asked
Active
Viewed 1.3k times
2 Answers
12
You could use something like this in your success.phtml
:
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$oOrder = Mage::getModel('sales/order')->load($sOrderId);
echo $oOrder->getGrandTotal();

Jürgen Thelen
- 12,745
- 7
- 52
- 71
-
1This is a terrible answer. You could easily accidentally show someone elses order if 2 orders came through with miliseconds of each other. Use `$order = Mage::getModel('sales/order')->load($this->getOrderId());` instead. – dotty Sep 25 '17 at 10:36
-
1@dotty: The `last_order_id` is saved in the PHP session when the user clicks 'Buy'. The PHP session id is bound to the browser of a specific user, usually by cookie. Mind to explain, how a value read from a user specific session should lead to show the order of a different user? – Jürgen Thelen Sep 26 '17 at 07:22
10
in success.phtml template you can use
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$total = $order->getGrandTotal();
proper way is to extend the Mage_Checkout_Block_Onepage_Success
and add your own method for loading the order again (As in this page quote is inactive already) as it is not nice to load such stuff in templates

Anton S
- 12,750
- 2
- 35
- 37