Rounding errors in shopping basket.

Author Message

Richard Lundberg

Tuesday 16 November 2010 3:30:02 am

Apologies if this has been addressed, but I could not find any mention which did surprise me as this is a potential fundamental flaw in the shop module.

If you apply a discount of for example 30% to products in the webshop, the calculation produces numbers of many decimal points. These are rounded for the display in the shopping basket. However, the stored number that is used to produce the total is not rounded. Therefore, as the number of products in the basket increase, the totals do not equal a sum of the listed products. In large shopping baskets this can add up to a difference of 10s or cents, which becomes unacceptable. Because of rounding, the totals are less than the sum of the line items so customers are not being overcharged, the problem for me is that the order is generated by the shop module, but invoices are generated by my ERP system which does get the pricing correct, so customers think they are being overcharged from their order.

does anyone have any ideas how to fix this, as getting the totals correct should be quite a fundemental element of a shopping cart.

Update. Even if you do not apply discount, the rounding error effects the excluding VAT total and the amount of VAT. If you are preparing your VAT tax returns from the webshop calculations, they will be wrong. You will be paying to much VAT so the tax man will be happy.

www.peakm3.com

Richard Lundberg

Monday 29 November 2010 3:09:58 pm

Anyone??

Am I missing something. I thought this issue would solicit some response or is it normal for a shopping cart not to add up the totals correctly. If you are using the shopping cart, do you simply ignore this, or are you not aware, or does it not manifest itself in your webshop?

www.peakm3.com

Heath

Monday 29 November 2010 11:14:19 pm

Hello Richard,

Not everyone who uses eZ Publish uses the shop module.

Also it sounds like (from the lack of response) that others are not having the problems you describe. I honestly have not encountered the problem you describe.

You might be better served by posting a new issue at http://issues.ez.no/ezpublish

Cheers,

Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Richard Lundberg

Thursday 02 December 2010 7:22:48 am

Hi Heath,

Thanks for at least an acknowledgment. I have already raised this as an issue #017667, a couple of weeks ago, and applied a priority of medium. My concern is that for all those using the webshop, they might not be aware of the problem, you naturally assume that it is doing the calculations correctly and do not double check with a calculator. It was not until I entered orders created by the webshop into a different accounting system that the problem became apparent.

It is easy to recreate the problem. Simply create a product with a price of 99.99. Apply a discount of 30%. The new price is displayed as 69.99 (69.993 rounded). Add it to your basket, change the quantity to 2, and already there is an error. The shopping cart will now display the total as 139.99 (69.993 *2 =139.986 rounded up) , not 139.98 (2*69.99) and the customer is being overcharged. I have tested this on 4.02, 4.2 and 4.3.

This has to be happening to all webshop users who are applying sales tax, or discounts. Should I change the issue priority to high as overcharging customers is not a good feature of a webshop?

www.peakm3.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.