hope someone can help.
Need number_format to show 3 decimal on this.... (actualy 2)
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()/$_product->getAnzeigeMenge()) ?>
alway used number_format($_value, 3,",",".") but dont know how to get this to work.
[magento]\app\code\core\Mage\Checkout\Helper\Data.php
add below function
public function customformatPrice($price)
{
return $this->getQuote()->getStore()->customformatPrice($price);
}
add below function in [magento]\app\code\core\Mage\Core\Model\Store.php
public function customformatPrice($price, $includeContainer = true)
{
if ($this->getCurrentCurrency()) {
//sets the floating point precision to 3 points
return $this->getCurrentCurrency()->format($price, array('precision'=>3), $includeContainer);
}
return $price;
}
you can use above like
//magento default call
echo Mage::helper('checkout')->formatPrice(3000.1231);//Rs3,000.12
echo "<br>";
//customized function call
echo Mage::helper('checkout')->customformatPrice(3000.12313);//Rs3,000.123
actually you can direct modify the formatPrice() in [magento]\app\code\core\Mage\Core\Model\Store.php but as you want both format we create custom function
hope this helpful for you
you can use like
Try Using this,
echo number_format($_value, '2', '.', ',')
or
echo number_format($_value, '3', '.', ',')
Also please check for
More information: http://php.net/manual/en/function.number-format.php
hope this will sure help you.
open [magento]\app\code\core\Mage\Core\Model\Store.php
public function formatPrice($price, $includeContainer = true)
{
if ($this->getCurrentCurrency()) {
//sets the floating point precision to 3 points
return $this->getCurrentCurrency()->format($price, array('precision'=>3), $includeContainer);
}
return $price;
}
Note:- change array('precision'=>3) instead of array()