Totally Zenned
- Join Date:
- Jan 2007
- Posts:
- 1,514
- Plugin Contributions:
- 1
[OPEN CHANGE-323]rounding error with attributes and salemaker
This happens with 1.3.9h or 1.5 on fresh install with no modules or modifications. If you add a product with multiple attributes and price the product by attributes and the product is on sale (may happen on special, too, but haven't checked).
Salemaker must be set to: Apply SaleDeduction to Specials Price - Otherwise Apply to Price, or: Ignore SaleCondition - No Sale Applied When Special Exists. If it's set to Ignore Specials Price - Apply to Product Price and Replace Special (and there are no specials running) the price comes out at $6.38 for some reason, but that's for a different bug report.:smile:
All attributes are radio buttons.
At least 2 attributes have prices and one is added to the base price but the others are not. So, an example would be a shirt, with attributes:
size : S ($5.88), M ($6.00), L ($6.50) (all marked as add to base price with S marked default)(notice, too, no plus signs are used since this is the base price but I don't think this will matter)
color: red, blue, green (no prices)
neck: crew (+$0.00), V (+$.50)
All attributes have Apply Discounts Used
by Product Special/Sale: Yes
A sale is set up for 5% off.
So, you select a Small, red shirt with V neck. The total price should be:
zen_round(5.88 * .95) + zen_round(.5 * .95) = (5.59) + (.48) = 6.07
But what is happening is this:
(5.88 * .95) + (.5 * .95) = (5.586) + (.475) = zen_round(6.061) = 6.06
On the product info page the correct sale prices are displayed: $5.59 and $.48 which added together equals $6.07, but when added to cart and in the order it's $6.06.
So it's rounding after adding all discounted attribute prices together instead of before adding them together which is off by a penny in this case and if someone is buying 100 we're giving them $1 off and it throws the books out of whack.
Please let me know if you need any more details.