### Problem with Total price on cart page

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.

#### Attachments

image 2 - round2.jpg (163.2 KiB) Viewed 2290 times

image 1 - round1.jpg (84.16 KiB) Viewed 2290 times

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

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

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?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com

Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm

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

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

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

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

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

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com

Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm

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

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

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

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

I don't use the Forum Mailer, to reach me, contact: jti@jacob.ch
-
Demoversions:
OpenCart LIGHT v.1.5.6.5 http://www.bigmax.ch/
OpenCart V-PRO v.1.5.6.5 http://www.ebikes.li/shop/
-
1'700+ FREE OC Extensions - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
-

Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

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

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
Last edited by arnisraido on Wed Oct 18, 2017 7:43 am, edited 2 times in total.

Newbie

Posts

Joined
Mon Aug 27, 2012 11:24 pm

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

@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

#### Attachments

total - round3.jpg (169.76 KiB) Viewed 2190 times

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

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

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.

Newbie

Posts

Joined
Mon Aug 27, 2012 11:24 pm

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

Still same for me after change 2

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

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

Are you clearing cache after doing those modifications?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com

Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm

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

yes, I wass refresh modificaton button for extenzion and refresh theme and SASS cache

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

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

Ok, please, pm. I would be happy to solve this.

Newbie

Posts

Joined
Mon Aug 27, 2012 11:24 pm

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

Newbie

Posts

Joined
Mon Aug 27, 2012 11:24 pm

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

Is there any solution ?

Newbie

Posts

Joined
Sun Oct 06, 2019 3:07 pm
Who is online

Users browsing this forum: No registered users and 38 guests