The 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.
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
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);
Method 2
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:
- price,
- options (in this case NO_SYMBOL),
- include container,
- 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
);
Method 3
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); ?>
Method 4
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);
Method 5
$grandTotalOfProduct = $order->getData('grand_total');
$currencySymbol = Mage::app()->getLocale()->currency($order-> getOrderCurrencyCode())->getSymbol();
echo $currencySymbol .number_format(Mage::helper('checkout')->getQuote()->getGrandTotal(), 2);
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0