News:

AbanteCart v1.4.2 is released.

Main Menu

function round tax is wrong

Started by legrand, August 01, 2017, 05:05:34 PM

Previous topic - Next topic

legrand

hi, i'm discover AbanteCart and i play with before 2 weeks, its seem perfect but
i've a difference of 0.01 on tax, for 2 products at 4.90 inc tax of 5.5% (tax= 0.26), AbanteCart cart calculate tax 0.51 and total 9.79!!  why not 0.52 and 9.80??
and why if i turn ON "display price with tax" and OFF "estimate shipping" option, the same product was displayed 4.64 inc tax? (not logged, cache cleared and store location was correct).

thanks
sorry for typing errors!

(i have read all the good docs but? ;)

Basara

Quote from: legrand on August 01, 2017, 05:05:34 PM
2 products at 4.90 inc tax

What is the price of product set in admin?

Basara

Quote from: legrand on August 01, 2017, 05:05:34 PM

and why if i turn ON "display price with tax" and OFF "estimate shipping" option, the same product was displayed 4.64 inc tax? (not logged, cache cleared and store location was correct).

When you set "estimate shipping" to off it just disable Estimate block on the shopping cart page

legrand


legrand

Quote from: Basara on August 02, 2017, 01:17:26 AM
Quote from: legrand on August 01, 2017, 05:05:34 PM

and why if i turn ON "display price with tax" and OFF "estimate shipping" option, the same product was displayed 4.64 inc tax? (not logged, cache cleared and store location was correct).

When you set "estimate shipping" to off it just disable Estimate block on the shopping cart page

When i set "estimate shipping" to off and no logged, all products prices are without tax but display inc tax, and on shopping cart page and block cart in header show sub total and total are same. (9.28=2x 4.64)
When i set "estimate shipping" to off and i'm logging, all products prices are with tax, but on shopping cart page sub total and total are same. (9.28=2x 4.64)

thanks

Basara

Thank you.

For the 'estimate' off - looks like bug. If no tax applied should not be 'inc tax'.

For the price calculation

4.64 + 5.5 % (0.2552) = 4.8952 x 2 = 9.7904

4.90 is rounded value for display only from 4.8952 (..52 - 3 digits)

so 9.79 is rounded for calculation from  9.7904 (...4 digits)

Why you think it should be 9.80?

legrand

#6
ok i understood the problem,

but it's same result when i set 4.6445 (4.90/1.055) in admin,

4.6445 x 2 = 9.2890
9.2890 x 1.055 (for tax 5.5%) = 9.7988

how to calculate with 4 digits and display round total to 9.80?

my price must be displayed with tax in france.
so when a customer take 2 x 4.90 product, the total should be 9.80, no?


abantecart

Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

legrand

hi, ok but how to round price sub total to 2 decimal after it is multiplied by qty?

for display that, for example if i buy 2 products 4.90 with 5.5% (4.6445 in admin):
sub total= 4.6445 x 2= 9.289,  display 9.28 should be 9.29
rounded tax= 0.2555 x 2 = 0.511 display 0.51 ok
total= 9.28 + 0.51 = 9.79  but i want 9.29+0.51=9.80  (4.90 X 2)

there are two methods:
1. Make the sum of the rounded prices
2. Make the rounding of the sum of the prices


thanks a lot!

abantecart

Quote from: legrand on August 03, 2017, 05:30:11 AM
hi, ok but how to round price sub total to 2 decimal after it is multiplied by qty?


There is an issue with this approach, and that was the way AbanteCart was working few versions back. There was an issue discovered with penny loss in conversion.

Here is an example of the problem:
Numbers before display: 4.6445 x 2= 9.289, 
Numbers at display and rounding: 4.64 x 2 = 9. 29 (0.01 lost in display)

Currently rounding happen on the product price before multiplication:
Numbers before and after display: 4.64 x 2= 9.28   




Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Forum Rules Code of conduct
AbanteCart.com 2010 -