Page 1 of 1
Wrong Calculation in Order Totals and Cart Items
Posted: Thu Apr 25, 2019 3:20 am
by aang12
Hi Together
I hope I'm correct here. I need help. Here you see my Problem:
https://prnt.sc/ngept6
The Article in the Cart has an Special Price; 39.425. Some Years in the Past, a Company made some Adjustments on my Shop. I don't know where they're stored and what they did (ocmod, vqmod, hardcoded…). But I know, that they made adjustments for Rounding.
On this Image
http://prnt.sc/ngequ9 you see, on Product Page we have two Prices one Rounded and one not.
The Main Problem is on Image 1. The Calculation of Order Totals is Wrong. The Sub_Total is 7.885, what is correct, but in the Cart is it 7.990 and that's wrong.
ALL what I need, is to know where this rounding calculation can be stored in OpenCart? Where have I to search for this?
I have OpenCart 2.0.3.1 and Journal 2.16.8
What I did:
- Loaded clear catalog Folder (from OC 2.0.3.1) to my FTP to overwrite existing catalog Files - doesn't helped (not hardcoded?)
- Deleted all VQMOD Files (doesn't helped) (not in a vqmod extension?)
- Searched in so many catalog and Modification (ocmod) Files for rnd / round / (/ 100) etc. nothing found.
Regards
Dominik
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu Apr 25, 2019 3:43 am
by thekrotek
Not sure, how you do the searching, but for me it returns a bunch of results for "round". For example, library\cart\currency.php
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu Apr 25, 2019 3:57 am
by aang12
thekrotek wrote: ↑Thu Apr 25, 2019 3:43 am
Not sure, how you do the searching, but for me it returns a bunch of results for "round". For example, library\cart\currency.php
Hi Thanks for Quick Responding.
in
system/library/cart/currency.php is nothing for that. In my Files, there should be a change. But the original 2.0.3.1 File is same like in my Store. And there is also no modified Currency.php in System/Modification & vqcache.
Must be somewhere else.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 8:45 pm
by aang12
Can no one helps here?
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 9:57 pm
by JNeuhoff
Searched in so many catalog and Modification (ocmod) Files for rnd / round / (/ 100) etc. nothing found.
Well, if that's the case then for example your 'system/library/currency.php' is corrupted or modified in a hard-coded way. It should contain this line:
Code: Select all
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 10:02 pm
by aang12
JNeuhoff wrote: ↑Thu May 02, 2019 9:57 pm
Searched in so many catalog and Modification (ocmod) Files for rnd / round / (/ 100) etc. nothing found.
Well, if that's the case then for example your 'system/library/currency.php' is corrupted or modified in a hard-coded way. It should contain this line:
Code: Select all
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
Thank you. Yes, my File "system/library/currency.php" has exactly this Line. So it isn't modified.
My Question is, where COULD it be possible that it's modified?
The Price in the Cart and the Sub_Total is wrong...
If the Product Price is 80.245 it rounds it in the Cart to 80.25. With Quantity 100 it's 8'025.00 (in the Cart!) but the Sub_Total has 8'024.50 (80.245x100). AND Where could this be programmed?
Currency.php, somewhere in cart.php?
Opencart Files itself or Journal 2?
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 10:09 pm
by JNeuhoff
For a start, temporarily switch to the default web theme, to see whether it's still the same problem or not.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 11:07 pm
by aang12
JNeuhoff wrote: ↑Thu May 02, 2019 10:09 pm
For a start, temporarily switch to the default web theme, to see whether it's still the same problem or not.
Switched Theme in Settings from Journal 2 to default. Same Problem. So not theme relevant?
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 11:10 pm
by straightlight
aang12 wrote: ↑Thu May 02, 2019 11:07 pm
JNeuhoff wrote: ↑Thu May 02, 2019 10:09 pm
For a start, temporarily switch to the default web theme, to see whether it's still the same problem or not.
Switched Theme in Settings from Journal 2 to default. Same Problem. So not theme relevant?
Switching from Journal 2 is insufficient. Testing from fresh installation may be needed to ensure the results are accurate.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 11:14 pm
by aang12
straightlight wrote: ↑Thu May 02, 2019 11:10 pm
aang12 wrote: ↑Thu May 02, 2019 11:07 pm
JNeuhoff wrote: ↑Thu May 02, 2019 10:09 pm
For a start, temporarily switch to the default web theme, to see whether it's still the same problem or not.
Switched Theme in Settings from Journal 2 to default. Same Problem. So not theme relevant?
Switching from Journal 2 is insufficient. Testing from fresh installation may be needed to ensure the results are accurate.
I tested it on another OC 2.0.3.1. Installation with same Journal Version. There, the Problem doesn't exist.
There is the Unit Price rounded up from 80.245 to 80.25. The Total is correct 8,024.50 (for 100units). And also the Sub-Total is correct.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Thu May 02, 2019 11:16 pm
by straightlight
Then, the issue must be originating from another extension where the store contains the error message as compared to the test store where you may also have installed Journal 2 but without the extra extension that is affecting your totals.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Fri May 03, 2019 12:13 am
by aang12
straightlight wrote: ↑Thu May 02, 2019 11:16 pm
Then, the issue must be originating from another extension where the store contains the error message as compared to the test store where you may also have installed Journal 2 but without the extra extension that is affecting your totals.
I finally found the wrongdoer!
I replaced existing Files in "system" by original 2.0.3.1 and the Bug was gone. So replied that Folder by Folder in "system" to elaborate the wrong File.
It's "system/library/tax.php".
This made the wrong Calculating. Thank's all for the Tips.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Fri May 03, 2019 12:44 am
by JNeuhoff
Glad to hear you resolved it. Quite often finding the cause of an error involves a simple process of elimination.
Re: Wrong Calculation in Order Totals and Cart Items
Posted: Fri May 03, 2019 1:32 am
by aang12
JNeuhoff wrote: ↑Fri May 03, 2019 12:44 am
Glad to hear you resolved it. Quite often finding the cause of an error involves a simple process of elimination.
Yeah

I would have searched further in /catalog.. without Tips.