I want to iterate over all the total models in order to get the code & values.
I have $order
object and the only way I can get all the totals is using $quote
object as:
$order = Mage::getModel('sales/order')->load($orderId);
$quoteId = $order->getQuoteId();
$quote = Mage::getModel('sales/quote')->load($quoteId);
$totals = $quote->getTotals();
foreach ($totals as $_total) {
echo $_total->getCode() . ' => ' . $_total->getValue() . '<br />;
}
which works fine & outputs as:
subtotal => 19.9
shipping => 10.0000
reward => 0
giftcardaccount => 0
customerbalance => -25
grand_total => 4.9
giftwrapping =>
So my main query is how to get the totals from $order
object itself without using $quote
. Since $quote
is earlier state of $order
and I doubt there might be some issues using it for the calculation.
Let me know your thoughts.