Magento – How to get order totals

magento-1.7orderstotals

I need order totals detail like in screen shot below

enter image description here

I tried below code but it is not working.

    $totals  = $order->getTotals();
    foreach ($totals as $_total) {
       echo $_total->getCode() . ' => ' . $_total->getValue() . '<br />';
    }

How can I achieve this?

Best Answer

If you have the order id:

$order = Mage::getModel("sales/order")->load($orderId); // get order

$order->getGrandTotal(); // get order total
Related Topic