Jump to content

Round Problem


Recommended Posts

Hello,

 

we installed (from scratch) the latest version of Prestashop (1.4.8.2). Unfortunately, even this version is affected by some major problem regarging calculating the total in the cart.

 

Example:

 

Product 1 EUR 23.00 ×1 EUR 23.00

Product 2 EUR 12.19 ×1 EUR 12.19

Product 3 EUR 7.74 ×1 EUR 7.74

Product 4 EUR 7.74 ×1 EUR 7.74

Product 5 EUR 10.51 ×1 EUR 10.51

Product 6 EUR 14.60 ×1 EUR 14.60

Product 7 EUR 2.12. ×10 EUR 21.20

 

Total: EUR 96.98

Shipping: EUR 8.00

Taxes (21%): EUR 22.06

Total: EUR 127.04

 

 

The total should be EUR 127.0258 → EUR 127.03. The old version 1.4.2.5 calculated the total correctly.

 

Also, the PayPal module (v.2.8.7 by PrestaShop) adds some miscalculations to the total. Using the order above:

 

 

 

Product 1 EUR 27.83 (×1.21=27.83)

Product 2 EUR 14.75 (12.19×1.21=14.7499)

Product 3 EUR 9.37 (7.74×1,21=9.3654)

Product 4 EUR 9.37 (7.74×1.21=)

Product 5 EUR 12.72 (10.51×1.21=12.7171)

Product 6 EUR 17.67 (14.60×1.21=17.666)

Product 7 EUR 25.70 (2.12×1.21=25.652)

 

Products EUR 117.41

Shipping EUR 9.68

Total EUR 127.09

 

 

As you can see, the biggest miscalculation happens on the last item(s): while the total for that item should be 25.652 (21.20 + 21%), PayPal gets EUR 25.70 (EUR 0.05 more).

Thus, with Prestashop 1.4.8.2 the customer would pay EUR 0.05 more (127.09−127.04). Also, this rounding problem generates an error that the customer receives.

 

Probably there is some rounding to take away or something. With Prestashop 1.4.2.5 I “solved” this problem by disabling the error message (just for the customer, not in the BO), when the difference is ABS(0.05) or less.

Sometimes payments goes up to EUR 2.00 more than expected. Sometimes the customer pays less.

 

Is there a solution or a workaround to solve this problem with this major rounding problem (__for both Prestashop and Paypal module!__)? Thank you!

 

 

Best Regards,

Link to comment
Share on other sites

Hello,

 

after further calculations, I found out that the newer Prestashop gives a “correct” rounded total:

 

Product 1 EUR 23.00 ×1 EUR 23.00 VAT21% 4.830000 4.83 SUBTOT: 27.83

Product 2 EUR 12.19 ×1 EUR 12.19 VAT21% 2,559900 2.56 SUBTOT: 14.75

Product 3 EUR 7.74 ×1 EUR 7.74 VAT21% 1,625400 1.63 SUBTOT: 9.37

Product 4 EUR 7.74 ×1 EUR 7.74 VAT21% 1,625400 1.63 SUBTOT: 9.37

Product 5 EUR 10.51 ×1 EUR 10.51 VAT21% 2,207100 2.21 SUBTOT: 12.72

Product 6 EUR 14.60 ×1 EUR 14.60 VAT21% 3,066000 3.07 SUBTOT: 17.67

Product 7 EUR 2.12. ×10 EUR 21.20 VAT21% 4,452000 4.45 SUBTOT: 25.65

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ EUR 96.98 20.3658 20.38 TOTAL: 117.36

 

Shipping: 8.00 VAT21% 1.68 SUBTOTAL: 9.68

 

Total taxes: 20.38+1.68=22.06

 

Thus:

 

Total: EUR 96.98 (y)

Shipping: EUR 8.00 (y)

Taxes (21%): EUR 22.06 (y)

Total: EUR 127.04 (y)

 

 

Because of the rounding process, there are actually some incongruencies between a “correct” sum. This error cannot be avoided, for we are using two decimals for currencies.

 

This clears Prestashop from the previous claim--Prestashop does somehow calculates correctly the results. The problem now is with PayPal.

 

It seems that it gets taxes for each product, then multiplies them by the quantity:

 

[…]

Product 7

Price (tax excl.): EUR 2.12.

Quantity: 10

Subtotal (tax excl.) EUR 21.20

Total VAT (21%): EUR 4,452000

Total taxes (round) EUR 4.45

SUBTOT: Subtotal+taxes=21.20+4.45=25.65

 

Paypal gets the taxes for each product:

Product 7

Price (tax excl.): EUR 2.12

Quantity: 10

Subtotal (tax excl.) EUR 21.20

VAT (21%) per product: EUR 0.4452000

Taxes (per product): EUR 0.45

Total taxes EUR 4.50

SUBTOT: Subtotal+taxes=21.20+4.50=25.70

 

25.70 instead of 25.65

 

And this for just one product.

 

 

Is there a solution for this rounding problem?

 

 

 

Best Regards,

--

Betafer.it

Link to comment
Share on other sites

×
×
  • Create New...