Zen Cart Logo
Forums / Bug Reports / The dreaded penny problem returns

The dreaded penny problem returns

Views: 1,059

Results 1 to 2 of 2
17 Jun 2013, 9:15 PM
#1
peteratdd avatar

peteratdd

New Zenner

Join Date:
May 2009
Posts:
8
Plugin Contributions:
0

The dreaded penny problem returns

Had this sorted in 1.3.9h and upgraded to 1.5.1 and it returns - yet from reading the forums it was stated the penny issue had been fixed in this version. I don't think so! And here's why.

I can quickly re-create the issue in a fresh installation. Only change is the UK tax rate of 20% (just to make it more realistic from my point of view!) Otherwise as is.

Have two products. One priced at £23 and the other at £12.95. If I buy two at £23 and one at £12.95 - the cart total is £58.95 and if I proceed to checkout the checkout total is £58.95.

Attachment 12672

Attachment 12675

Whoopee! All is well.

Now we sell a lot of discounted products. So let's do that differently.

One product at £40 and another at £24. But this time we add a products price manager special price. The £40 product's special price is £19.17 (so with 20% tax that's £23.00)
The £24 product's special price is £10.79 (so with 20% tax that's £12.95)

Now add that to the cart (including 2 x £23 and 1 x 12.95) and the total is £58.95 - as before. Great. Proceed to checkout and the sub-total is now £58.96. One penny out.

Attachment 12676

We've gone backwards and are in a mess with book-keeping and customers demanding penny refunds etc.

Can anyone please offer a solution!

This error is easy to recreate so I am hoping a developer will read this and be able to work out where to change the code.

18 Jun 2013, 8:03 AM
#2
peteratdd avatar

peteratdd

New Zenner

Join Date:
May 2009
Posts:
8
Plugin Contributions:
0

Re: The dreaded penny problem returns

Apologies for the double post but I have made progress is locating what causes this issue.

includes/classes/order.php line 511 and 512 were altered in 1.5.1.

If I substitute the lines that were in 1.5.0 then the problems is resolved.

Question is why was the 1.5.1 alteration made and can I safely use the 1.5.0 version (on a 1.5.1 site) without then screwing up something else? To say we are desperate to sort this would be an understatement. We are getting 3/4 orders per day with a penny issue and that causes subsequent book-keeping imports to fall over as the math doesn't work (so back to hand entries) - plus handling emails from folk pointing out the website isn't adding up properly...

These are the lines in 1.5.1:

$shown_price = (zen_add_tax($this->products[$index]['final_price'] * $this->products[$index]['qty'], $this->products[$index]['tax']))
      + zen_add_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']);

replaced with this from 1.5.0:

$shown_price = zen_round(zen_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) ,$decimals) * $this->products[$index]['qty'];
      $shown_price +=  zen_round(zen_add_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);