I create a new product and type price= $1.2222. But when I click Save and Continue edit the price = $1.22. I don't want to round the price, i want the price=$1.2222. How can I do that? Thank you!
Magento – Rounding products prices in magento
pricerounding
Related Solutions
Not a direct fix to solve your problem, but this should be solved in the CE 1.8 release that is expexted at the end of this month,
From http://www.magentocommerce.com/knowledge-base/entry/ce-18-later-release-notes:
Rounding Error Fixes
The following issues relate to one-cent rounding errors in the web store or shopping cart:
- Calculating taxes for bundled products with tiered pricing.
- Calculating the price before customization for bundled products.
- Calculating the grand total of items added to a cart in a different order.
- Viewing an order when taxes are calculated after a discount using either row-based or unit price. Applying a discount to an order with a shipping address different than the billing address.
- Calculating the grand total based on the order in which products are added to the shopping cart. Specifying that prices display in the web store excluding tax and setting a 20% tax rate (or discount rate) now calculates the grand total correctly. It is now possible to have grand totals in amounts like 6.99, 9.99, or 99.99—regardless of the currency units used in the web store.
- Adding multiple items to a cart does not affect the accuracy with which taxation is calculated.
- Subtotal (Incl. Tax) is now correct when catalog and shipping prices include tax. Both tax and discounts are applied after tax.
- Prices displayed in the cart and on the catalog page are consistent and correct when catalog prices include tax, and when items in the catalog are set to display both including and excluding tax. (In the Admin Panel, click System > Configuration > SALES > Tax. In the right pane, expand Calculation Settings.)
- Error in calculating the Grand Total Excl. Tax was resolved. This error occurred in a specific configuration: tax is applied to FPT, FPT is included in the subtotal, and the customer selects non-taxable flat rate shipping.
Go to app\code\core\Mage\Tax\Model\Calculation.php
and somewhere on line #466 there is a function.
public function calcTaxAmount($price, $taxRate, $priceIncludeTax=false, $round=true)
{
$taxRate = $taxRate/100;
if ($priceIncludeTax) {
$amount = $price*(1-1/(1+$taxRate));
} else {
$amount = $price*$taxRate;
}
/*if ($round) {
return $this->round($amount);
}*/
return $amount;
}
I have just commented out the last if condition.
But please override it, do not make any changes in core class.
Good Luck!:)
Best Answer
It's because of Mage_Core_Model_Store->roundPrice($price)
I've created a module which rewrite core/store and overrides the roundPrice() and has the round($price, 4) inside.