Question

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.

Was it helpful?

Solution

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);

OTHER TIPS

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
);

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); ?>

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);
$grandTotalOfProduct = $order->getData('grand_total');

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

echo  $currencySymbol .number_format(Mage::helper('checkout')->getQuote()->getGrandTotal(), 2);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top