php - Custom Price Display Precision without Roundings in Magento -
on question member shivam helps me figure out problem custom price format...
how custom price format (with 3 precision) in magento
here use precision of 3
public function customformatprice($price, $includecontainer = true) { if ($this->getcurrentcurrency()) { //sets floating point precision 4 points return $this->getcurrentcurrency()->format($price, array('precision'=>3), $includecontainer); } return $price; }
but used round precision of 4
public function roundprice($price,$roundto=4) { return round($price, $roundto); }
all works fine when use backend input price 9.2400 € output in frontend fine then. when input in backend 9.2450 € output on fronend roundet. seams miss somewhere round price right way.
this code use list view... (wrong display in roundings):
<?php echo ''.mage::helper('checkout')->customformatprice($_minimalpricedisplayvalue /1.19 /$_bbase_qty, false) ?>
this code use product view. (perfekt roundings) cants use code in list or price phtml.
<span class="price"><?php echo ''.mage::helper('checkout')->customformatprice(min($product_price)*1.19/($_bbase_qty),true,false); ?></span>``
hope can me figuring out problem in roundings or can me how can use last code in directly in list.phtml.
thanks help
open file [magento]\app\code\core\mage\core\model\store.php
public function roundprice($price) { return round($price, 4);//change 2 4 } public function customformatprice($price, $includecontainer = true, $options=array()) { if ($this->getcurrentcurrency()) { return $this->getcurrentcurrency()->format($price,$options, $includecontainer); } return $price; } echo mage::helper('checkout')->customformatprice(3000.12313,true,array('precision'=>4));
hope you
note: don't change in core files directly instead override it
Comments
Post a Comment