How to get price without currency symbol?
-
16-10-2019 - |
문제
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.
해결책
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);
다른 팁
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
);
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);
제휴하지 않습니다 magento.stackexchange