Magento 1.9 - How to get OrderId & TotalOrderAmount from order successful page?
-
28-03-2021 - |
Question
Here is my stamped tracking code,
<img src="//stamped.io/conversion_tracking.gif?sId=5967067hgtt78y&apiKey=3956785687857869756769hhuhyuhuy&orderId=##orderId##&orderAmount=##totalOrderAmount##&orderCurrency=INR" />
How to load magento variable ##orderId## & ##totalOrderAmount##?
Solution
You can edit following file:
app/design/frontend/{package}/{theme}/template/checkout/success.phtml
In above file, you already having order Id i.e $this->getOrderId() based on Id you can get Order total like:
$orderId = $this->getOrderId();
$order = Mage::getModel("sales/order")->loadByIncrementId($orderId); // load order
$total = $order->getGrandTotal(); // order total with Shipping amount
$total = $order->getSubtotal(); // order total without Shipping amount
Now you have $orderId
and $total
Hope above will help!
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange