1

How can i echo grand total without the $ symbol attached to it?

Am using the following code to display grand total

echo Mage::helper('checkout')->formatPrice(Mage::helper('checkout')->getQuote()->getGrandTotal())

right now it is displaying $50.00 but i want to get only 50.00, how can i do the same?

Thank you in advance.

5 Answers 5

9

Try this:

Mage::helper('checkout')->getQuote()->getGrandTotal()

It will get you the grand total in this format 50.0000. If you want only 2 decimals use this:

number_format(Mage::helper('checkout')->getQuote()->getGrandTotal(), 2);
2
  • where does this code go? Inline or a specific file?
    – Jon
    Nov 3, 2013 at 18:08
  • 3
    it goes where you need it.
    – Marius
    Nov 3, 2013 at 20:34
7

You can use the directory/currency model, this has a format function that will include standard localisation but it can also be customised. It has the following options:

  1. price,
  2. options (in this case NO_SYMBOL),
  3. include container,
  4. add brackets

So you can use it as follows and it will convert 15000.59863 into 15.000,60 for a German set-up, 15,000.60 for an English set-up and 15000,60 for a French set-up:

echo Mage::getModel('directory/currency')->format(
    Mage::helper('checkout')->getQuote()->getGrandTotal(),
    array('display'=>Zend_Currency::NO_SYMBOL),
    false
);
2

Please Try This below one line code It's working for me.

<?php echo Mage::getModel('directory/currency')->format($_product->getFinalPrice(), array('display'=>Zend_Currency::NO_SYMBOL), false); ?>
1

try this :

$grandTotalOfProduct = $order->getData('grand_total');

$currencySymbol = Mage::app()->getLocale()->currency($order-> getOrderCurrencyCode())->getSymbol();

echo  $currencySymbol .number_format(Mage::helper('checkout')->getQuote()->getGrandTotal(), 2);
0
$grandTotalOfProduct = $order->getData('grand_total');

$currencySymbol = Mage::app()->getLocale()->currency($order-> getOrderCurrencyCode())->getSymbol();

echo  $currencySymbol .number_format(Mage::helper('checkout')->getQuote()->getGrandTotal(), 2);
1
  • 2
    Wont this display the price with the currency symbol? The question was how to remove it. Jan 24, 2014 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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