Page 1 of 1

### Problem with Total price on cart page

Posted: Thu Oct 12, 2017 3:47 am
Hi,
I got product with price without tax 0,90
my tax is 25% so it show 1,13 with tax on product page (image 1)

If I set 100 pieces in cart, on cart page Total with tax is 112,50 !!! (image 2) (It should be 1,13*100=113,00)

http://www.opencart-web.xyz/3020/index. ... duct_id=47
This is default opencart without any extenzions!
I supposed problem is in rounded numbers or something like this, how can I fix this problem ? My opencart version is 3020 but it is same on opencart 20x.

### Re: Problem with Total price on cart page

Posted: Thu Oct 12, 2017 4:18 am
Actually, 25% of 0,90 is 0,225, which totals 1,125. I'm not sure what you think to be the solution, to round the value down instead of up?

### Re: Problem with Total price on cart page

Posted: Thu Oct 12, 2017 4:28 am
yodapt wrote:
Thu Oct 12, 2017 4:18 am
Actually, 25% of 0,90 is 0,225, which totals 1,125. I'm not sure what you think to be the solution, to round the value down instead of up?
As you see something is not wright, because price 1,13*100 pieces is 113,00 in total But in cart show total 112,50 ? and customer is confused
On product page 0,225 is rounded to 0,23 so 0,90+0,23= 1,13
but on cart page is problem because 25% of 90 is 22,50 so system havent got nothing to round

### Re: Problem with Total price on cart page

Posted: Thu Oct 12, 2017 5:08 am
That is just how it is. The values are round to the second decimal, not the first, so 1,55 doesnt become 1,60, but 1,555 becomes 1,56. The best you can do, if you dont want your customers confused over a cent, is to round down the total, so that 1,555 becomes 1,55 instead of 1,56

### Re: Problem with Total price on cart page

Posted: Thu Oct 12, 2017 9:14 am
yodapt wrote:
Thu Oct 12, 2017 5:08 am
That is just how it is. The values are round to the second decimal, not the first, so 1,55 doesnt become 1,60, but 1,555 becomes 1,56. The best you can do, if you dont want your customers confused over a cent, is to round down the total, so that 1,555 becomes 1,55 instead of 1,56
Hm dont know what i get with such solution, and what to change in code or settings to get this ? Thanks

### Re: Problem with Total price on cart page

Posted: Thu Oct 12, 2017 11:43 am

### Re: Problem with Total price on cart page

Posted: Fri Oct 13, 2017 7:44 am
UPDATED! 2017-10-18 with //CHANGE 3

Hi!

Check out this solution: https://github.com/copona/copona/commit ... t-24944535

In file:

Code: Select all

system\library\cart\tax.php

Code: Select all

// CHANGE 1:
// find line (~line 74):
return \$value + \$amount;
// replace with
return round(\$value + \$amount, 2);

// CHANGE 2:
// find line (~line 122)
'amount'      => \$amount
// replace with:
'amount'      => round(\$amount, 2)
In file:

Code: Select all

system/library/cart/cart.php

Code: Select all

// CHANGE 3:
// find lines (~line 275)
'price'           => (\$price + \$option_price),
'total'           => (\$price + \$option_price) * \$cart['quantity'],
// replace with:
'price'           => round(\$price + \$option_price, 2),
'total'           => round(\$price + \$option_price, 2) * \$cart['quantity'],

P.S. It has been already discussed here (without a solution). Hope we can fix this together.
Here https://github.com/opencart/opencart/issues/5657
And even here ... https://www.opencart.com/forum/viewtopi ... 19&t=50997
And probably, this one too: https://github.com/opencart/opencart/issues/1990

### Re: Problem with Total price on cart page

Posted: Fri Oct 13, 2017 8:32 am
@arnisraido Hi, I can confirm that your modificaton on tax.php made total price corect, but bottom Total , subtotal and tax is not correct, also Total price on top cart button is not corect. Please see image in attachement
Thank You

### Re: Problem with Total price on cart page

Posted: Fri Oct 13, 2017 5:24 pm
That's great!

Ok, I think, in Copona we use little bit different calculations and my cart was calculating correctly, but I will check.
For Opencart - I have updated the answer with // CHANGE 2:, so - try that one together with previous fix.

Post a feedback.

### Re: Problem with Total price on cart page

Posted: Sat Oct 14, 2017 3:54 am
Still same for me after change 2

### Re: Problem with Total price on cart page

Posted: Sat Oct 14, 2017 5:34 am
Are you clearing cache after doing those modifications?

### Re: Problem with Total price on cart page

Posted: Sat Oct 14, 2017 10:33 am
yes, I wass refresh modificaton button for extenzion and refresh theme and SASS cache

### Re: Problem with Total price on cart page

Posted: Sat Oct 14, 2017 8:55 pm
Ok, please, pm. I would be happy to solve this.

### Re: Problem with Total price on cart page

Posted: Wed Oct 18, 2017 7:40 am