I use Four currencies. The default is Euro. Value of All currencies is up to two decimals: 1.170000 etc.
Store prices set in Euro are also up to two decimals: 3.9800 etc.
When proceeding the checkout in Euro everything is Okay.
When proceeding the checkout in other currency, there is often error with 0.01 in the total sum. Sometimes this error is in products Sum and sometimes it is in the sum product+shipping cost. I don't have any other taxes in the checkout.
For example:
Product 1 = 3.20CHF
Product 2 = 4.58CHF
Sub-Total: 7.77CHF (wrong with -0.01)
or:
Product 1 = 5.83USD
Shipping = 0.59USD
Total: 6.41USD (wrong with -0.01)
When the sum is wrong, the checkout results in error in connecting with the payment method page.
So, Opencart can not work with other currencies aside of the default.
Why is that? How to be solved?
This is a real bug in Opencart!?!?
The products and the shipping are listed in shopping cart (and respectively in the invoice) rounded to two decimals, which is okay.
But the Sub-total and the Total are sum of not rounded prices.
For example: Default product price: 4.98EUR and Shipping 0.50EUR, when one changes the currency to USD (1EUR=1.17USD):
in the table and invoice it is rounded:
Product 1 = 5.83USD
Shipping = 0.59USD
but Opencart sums in the background:
Product 1 = 5.8266USD + Shipping = 0.585USD and then round it in the Total=6.41USD which is different from the sum of the prices in the table which is 6.42USD.
As a result, when the checkout is confirmed, the bank module doesn't accept it and opens error page.
How to make the cart to sum the initially rounded prices which are shown in the table?
---
Price Rounding
https://www.opencart.com/index.php?rout ... n_id=10016
---
found here:
https://www.opencart.com/index.php?rout ... arch=round
---
This always has been a potential problem, as it looks, and
according to older topics, but I never made any tests, to be able to judge.
Good Luck!
Ernie
---
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
I can't believe such a huge bug to exist and Opencart developers do nothing!
Shouldn't we tell the world that Opencart can't work with multiple currencies.
So, people, what is the solution?
change:
$amount = $value ? (float)$number * $value : (float)$number;
into:
$amount = $value ? (float)$number * round($value,(int)$decimal_place) : (float)$number;
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Well, by trying this (matched to my OC Version) in my file, it ended upinto: $amount = $value ? (float)$number * round($value,(int)$decimal_place) : (float)$number;
to result in one price, i.E. 400.00, shown in all currencies used.
But I also compared the v.3.1.0.0.a File with my 1.5.6.x Version File, and
found out, that my ROUNDING Code looks quite similar in v.3.x Versions.
By setting it to 1, (v.3.x - $amount, 1) (v.1.5.x - $value, 1) it results in 'even'
Numbers (00/10/20) only, and 01 - 09 will no longer exist. It a Product Price
results in 88.88 or 99.99, by a (v.3.x - $amount, 1) (v.1.5.x - $value, 1) Setting,
it will show/use 89.00 or 100.00 Values.
This might not please Germans, and others, still using single-cent Amounts,
I'm aware of that, but for some, it might be of help, if it works in your Version.
And depending on that (v.3.x - $amount, x) (v.1.5.x - $value, x) it could more
precisely meet specific needs of some of you.
Just in Case ..., and untested in later than OC 1.5.6.5_rc Versions.
Ernie
---
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
if you have price including tax on your site, product price is calculated in 4 decimals, make sure you calculate them into 8 decimals.
to do so you wil have to alter in product table the price from 15.4 to 15.8
when entering product price enter with 8 decimals, there are mods that will allow you to input price and calculate ex tax price up to 8 decimals.
Now when prices are calculated from one currency to another or when large sums are ordered correct totals are calculated.
Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com
My default currency is Taiwan dollar with 0 decimal places.
JPY is set to 0 decimal places.
All others have 2 decimal places.
so far with
Code: Select all
$amount = $value ? (float)$number * round($value,(int)$decimal_place) : (float)$number;
I guess you need to round the numbers to the decimals you display before using them in the calculations.
I must admit, I do not use the tax classes (my prices include those) so you may have to double check if you do.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Code: Select all
$amount = $value ? (float)$number * round($value,(int)$decimal_place) : (float)$number;
Code: Select all
$string .= number_format($amount, (int)$decimal_place, $this->language->get('decimal_point'), $this->language->get('thousand_point'));
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Hello,
Are you answering this to me ? If yes, in which file ?
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
THanks, but still same problem :
I am able to reproduce more specifically it :
If a add 130 items with 5.5% of taxe with a price of 5€ ==> everything is fine
If a add 129 items with 5.5% of taxe with a price of 5€ ==> 0.1cents is missing on final price
If a add 129 (and more) items with 20% of taxe with a price of 5€ ==> everything is fine
If a add 129 items (and more) with 5.5% of taxe with a price of 6€ (and more or less) ==> everything is fine
What's wrong ?? This problem occured on each items which are in this case. It seem to be related to price and taxe.
Got a demo here with another cart.
Any idea ?
FYI, got this in the currency.php :
Code: Select all
$amount = $value ? (float)$number * $value : (float)$number;
$amount = round($amount, (int)$decimal_place);
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
public function calculate($value, $tax_class_id, $calculate = true) {
and
public function getRates($value, $tax_class_id) {
in the tax class: system/library/cart/tax.php
there is where the tax calculations take place.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Code: Select all
<file path="system/library/cart/cart.php">
<operation>
<search><![CDATA[($tax_rate['amount'] * $product['quantity'])]]></search>
<add position="replace"><![CDATA[round(($tax_rate['amount'] * $product['quantity']),2)]]></add>
</operation>
</file>
Users browsing this forum: No registered users and 148 guests