¿Cómo obtener el precio sin símbolo de moneda?
-
16-10-2019 - |
Pregunta
¿Cómo puedo hacer eco de gran total sin el $
símbolo adjunto?
Estoy usando el siguiente código para mostrar un gran total
echo Mage::helper('checkout')->formatPrice(Mage::helper('checkout')->getQuote()->getGrandTotal())
ahora mismo se está mostrando $50.00
Pero quiero conseguir solo 50.00
, ¿cómo puedo hacer lo mismo?
Gracias de antemano.
Solución
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);
Otros consejos
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);