I'm looking for how to get grand total in Mage_Payment_Block_Info.phtml. I know grandtotal comes from $quote so i was trying to bring this data to Mage_Payment_Block_Info.php. But I can't find answer!


#1 . 
<?php echo number_format(Mage::helper('checkout')->getQuote()->getGrandTotal(), 2) ?>
#2 . 
<?php echo number_format(Mage::getModel('checkout/session')->getQuote()->getGrandTotal(),2) ?> 
#3 . 
<?php echo number_format(Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal(), 2) ?>

#4 . 
<?php print_r(Mage::helper('checkout')->getQuote()->getData('grand_total')) ?>
<?php $grandTotal = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();
echo $grandTotal?>

I tested above them but they don't work. Do i have to declare that i use checkout model in Mage_Payment_Block_Info.phtml. If it is, how can i do that?


Write a function at Mage_Payment_Block_Info at

pulbic function getGrantTotalAmount(){

    if ($this instanceof Mage_Sales_Model_Order_Payment) {
         $grand_total = $this->getOrder()->getGrandTotal();
     } else {
         $grand_total = $this->getQuote()->getGrandTotal();
    return $grand_total ;

Then at your phtml file call this function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.