dear developers,
github .com/abantecart/abantecart-src/issues/685
i have this issue. only when i add multiple items in euro for example and the cart vs paypal differ by 0,01.
sometimes it works sometimes its not ,depending on the rounding.
is there any manual workaround?
thank you !
Which Paypal extension are you using?
latest 1.2.8 stock paypel express extension.
If you charge shipping, Paypal charges VAT to sub-total and shipping separately and then adds the 2 together. This causes rounding errors like you experience. If you google this problem, lots of examples.
Do you have to have Paypal calculate VAT? VAT/Tax can be setup in A-cart for both sub-total and shipping and then only the total is passed to Paypal. Personally, I don't let Paypal calculate anything.
I have free shipping on everything, and no TAX on the store.
Okay, maybe try putting the tax in the store and take it off Paypal. That way a total is passed to Paypal and your not relying on Paypal for any calculations.
It seems though that the Euro rounding error is not limited to my previous post with sub-total and tax.
The only other thing I can think of is currency conversion on Paypal side. I don't know how they do that. As far as I know, Paypal is USD based and has to do conversions. That could explain the randomness of the error.
If it was me, I would try taxing at store level and passing a total to Paypal. There is also a report for tax in Abantecart to help keep track of tax collected.
thanks for ur help, however i dont think it has to do anything with the taxation. i have AbanteCart with 0 tax. so no tax zone. paypal dont put any added tax to the totals. I think its some rounding related thing, where it round up by 1 cents sometimes. maybe can you help me via skype? i pm'd you :)
P.S: the big isssue:
SUB-TOTAL: $23.65
10% coupon: $2.37 (here come the problem, its actually counted with ($2.365 in the backend)
==============
TOTAL: $21.29.. (this is clearly $21.28) thats why it throw the error. Same happen in all currencies I guess.
I just simply cant find that function which calculateds the full total (like this: sub-total - discounts). If i find it, i can probably fix.
thanks.
Take a look at core/lib/cart.php but I don't think that's it. Took a look at the DB and it looks like it's there. Take a look at xxx_orders for a start(screen shot attached)
Some of the values are carried out beyond 2 places and I bet that's where the error occurs. AND it will do it in any currency. There's no reason I can see to carry a price out to 4+ decimal places. Maybe one of the dev team can chime in and give us some insight as to why the decimal places are more than 2. Maybe in some currencies there are more than 2 places.
BTW, it's a simple fix. Just change the values in the db. I've come across this elsewhere.
ahha, yeah i found it to be 4 decimal in my db.. will change and see if it helps! thanks
That's only one place I looked at quickly. You need to check product prices and any other table that deals with currency and adjust them accordingly too. Otherwise, you will still get an error at some point.
i modified my database, however the discount is still calculated by 3 decimal for some reason. somehow I should force it to use 2 decimal always.
product price full: $23.65, when i apply 10% coupon, it shows $2.37. It would work if it calculated with 2.37, but however in the background it counts with -2.365, tahts why paypal throw error. i need to found the variable where it count the full total in the PHP. I guess.
Check core/lib/cart.php You have to look at ALL tables that deal with currency. Did you change the decimal places in xxx_coupon.
i have this:
//Need to round price after discounts and specials
//round main price to currency decimal_place setting (most common 2, but still...)
$currency = $this->registry->get('currency')->getCurrency();
$decimal_place = (int)$currency['decimal_place'];
$decimal_place = !$decimal_place ? 2 : $decimal_place;
$price = round($price, $decimal_place);
however it does nothing if I remove the rounding of the price calc.
Quote from: kolynet on October 08, 2016, 07:46:56 AM
i have this:
//Need to round price after discounts and specials
//round main price to currency decimal_place setting (most common 2, but still...)
$currency = $this->registry->get('currency')->getCurrency();
$decimal_place = (int)$currency['decimal_place'];
$decimal_place = !$decimal_place ? 2 : $decimal_place;
$price = round($price, $decimal_place);
however it does nothing if I remove the rounding of the price calc.
See above
x
The DB thing is a logical suggestion as to why your having this problem. It may be code related, but if nothing else, it will confirm whether the db decimal places is the cause or not.
x
How's your currency setup in Localization? I bet you have to trim the conversion down to 2 decimal places. Been on the right track, maybe just the wrong place. Look at the screen shot.
========
You might have to change the db xxx_currencies It is "set" for 2 decimal places,but the value is 15,8. This makes more sense looking at things a bit closer.
x
x
That's what I'm saying in the DB. In xxx_currencies, "value" needs to be 15,2 not 15,8. This forces 2 decimal places regardless of code. It might not be the right fix, but it forces an output of 2 decimal places.
x
Look at your math. 83.05 is correct by the formatted total and the displayed total is correct with rounding.
Now, I don't understand what your getting at(http://digitaltradz.digitaltwister.com/Smileys/default/5.gif) Your example is correct both ways. It is displaying the correct amounts.
You were looking at why Paypal gets a 3 decimal place number and throws an error. I have suggested ways to correct it and things to look at. This is getting away from the original question/topic.
x