Reputation: 5213
I need for my shop up to 4 decimal points. So far I followed some tuts and theyre working fine in front & backend for products. Only in sales/invoice prices,tax and totals are still rounded to 2 decimal points.
I've edited/overwrote following files:
\app\code\local\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
somewhere around line 283 i changed
return number_format($value, 2, null, '');
inreturn number_format($value, 4, null, '');
\app\code\local\Mage\Adminhtml\Block\Catalog\Product\Helper\Form\Price.php
same as in Option.php
\app\code\local\Mage\Core\Model\Store.php* changed output of function
roundPrice()
line 740 intoreturn round($price, 4);
\app\code\local\Mage\Directory\Model\Currency.php in function
format()
changedformatPrecision
from 2 to 4 in line 197.\lib\Zend\Currency.php
$_options['precision']
changed from 2 to 4\app\design\adminhtml\default\default\template\catalog\product\edit\price\tier.phtml
echo sprintf('%.2f', $_item['price']);
changed tosprintf('%.4f', $_item['price'])
Ive looked into some core files like invoice.php or in adminhtml files if there are rounding stuff. But I couldnt find anything useful.
used extensions: (Magento 1.4.1.0)
Asperience_DeleteAllOrders
Flagbit_ChangeAttributeSet
Mxperts_Invoice
de_DE languagepack
thanks, greetz Rito
(sorry for german in picture)
Upvotes: 0
Views: 4410
Reputation: 885
Found out a different simple way in magento 1.5.1
Got to code/core/Mage/Directory/Model/Currency.php
change line number 194.
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false) { return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets); }
0 - Denotes the precision point for price.
Upvotes: 0
Reputation: 5213
"totals" was a good hint, thx to Jonathan Day
Heres the solution for sales/invoice with four decimal points.
\app\code\local\Mage\Adminhtml\Block\Sales\Items\Abstract.php
change following code:
Line 292: function displayPrices()
change to return $this->displayRoundedPrices($basePrice, $price, 4, $strong, $separator);
Line 305: $precision=2
into $precision
\app\code\local\Mage\Sales\Model\Order.php line 1358:
public function formatPrice($price, $addBrackets = false)
{
return $this->formatPricePrecision($price, 4, $addBrackets);
}
I know its very dirty, but it works fine :)
Upvotes: 0
Reputation: 18702
My first suggestion would be to turn on the Frontend and Backend Hints (System>Config>Advanced>Developer
) so you can see which Block and which phtml View is responsible for rendering the 2 decimal place content. If you install the Developer Toolbar extension, you'll find that much easier.
Looking at your screenshot, I think that comes from the Admin Sales Order view, and therefore the phtml files under app/design/adminhtml/default/default/template/sales/order/create/totals
and the Blocks = Mage_Adminhtml_Block_Sales_Order_Create_Totals_Default
are a good place to look. The formatPrice
function seems to be using Store.php that you have overridden, and some of the Currency files.
I suspect that @greg0ire is correct, this one is going to take some remote debugging to track down. It's possible that your $options['precision']
is being overwritten somewhere, so you need to see it's value at the time of execution.
Good luck, JD
P.S. I assume you have cleared and disabled cache... Note that the adminhtml cache is not cleared in the System>Cache Management
GUI, you must manually delete the files in var/cache
.
Upvotes: 1