### Rounding issue on 1.5.4.1

I have a product with the price 3,90€. If i take it 10 times to the cart the price gets 39,03€ instead of 39€. Is there a way to fix this?

edit: I think the tax calculation is causing this. The original price is 3.2800 and afterwards it gets 3.9032. How can i reduce the calculation to 2 decimal places?

Active Member

Posts

Joined
Wed Oct 20, 2010 9:49 pm

### Re: Rounding issue on 1.5.4.1

Check your local laws. I don't know of any country that allows for per product rather than per order tax calculation.

-Ryan

Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am

### Re: Rounding issue on 1.5.4.1

Ok, problem solved.
I had to calculate the original price with 4 decimalplaces.
for example:

3,90€ / 1,19 (19% VAT) = 3,2773

Active Member

Posts

Joined
Wed Oct 20, 2010 9:49 pm

### Re: Rounding issue on 1.5.4.1

fourgood wrote:Ok, problem solved.
I had to calculate the original price with 4 decimalplaces.
for example:

3,90€ / 1,19 (19% VAT) = 3,2773
which file did you fix this in?

thanks

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am

### Re: Rounding issue on 1.5.4.1

no file - just edit the product prices.

Active Member

Posts

Joined
Wed Oct 20, 2010 9:49 pm

### Re: Rounding issue on 1.5.4.1

I have a similar problem myself and I've just read the fix here. This however is a really messy way to solve the problem, I don't know of any currency or country which can produce an invoice to 4 decimal places. I understand paying EUR 3,90 but I'm not sure how I would pay EUR 3,2773 (for example if my company was tax exempt) I would expect to pay EUR 3,27 or EUR 3,28 but never EUR 3,2773

New member

Posts

Joined
Sat Dec 22, 2012 10:58 pm

### Re: Rounding issue on 1.5.4.1

In most of the world:

One rounds the money itself, in whole-order transactions and even on tax forms and in tax payments. Prices can be entered to four places (tenths of a mil in dollars), which may seem silly till noticing that the degrees of freedom given the machine in both stepwise and cumulative arithmetic are thereby truncated. Rounding commences with the first questionable digit; half a cent rounds up; half a mil here and there en route to fixing that standard cutoff does not round. Granted, there are people who round down, usually selling or buying gasoline (one pumps a while to pile the saved mils into a penny, a dime, or more, and is supposed to think that it's only \$3.99 rather than \$4.00 per gallon); that was one of Rockefeller's oil kingdom legacies, following one of Barnum's observations (born every minute). But on taxes, even gasoline sellers charge taxes on totals pumped and report taxes on annual rake by rounding up from half-pennies.

In some of the world:

VAT itself is calculated, then apparently rounded even down.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

### Re: Rounding issue on 1.5.4.1

Thanks for the detailed explanation the points are well made but it does leave me in a bit of a dilemma as to what to do next given what my customers expect to see.

Take for example: http://www.jigsaw24.com/brands_apple_ip ... egory/list the site shows both Inc and Ex tax prices all rounded to 2 decimal places it is pretty sophisticated and I would love to see OpenCart offer similar functionality. And I particularly like this site: http://www.dabs.com/articles/help/polic ... s-102.html which offers the customer to choose how to have the prices displayed.

So to highlight further as per my example:

http://www.dabs.com/products/dynamode-u ... html?src=3

Then use the switch at the bottom of the page to change between displaying Inc or Ex VAT

New member

Posts

Joined
Sat Dec 22, 2012 10:58 pm

### Re: Rounding issue on 1.5.4.1

The dual untaxed price and taxed price display may have to be turned "on" rather than "off" among successive versions of OC, where admin choice overrides customer choice, which customers cannot even exercise. Letting customers do that would require transplanting modified code to footer or wherever they'll see it. In your two examples, it would appear that probably the admin can turn customer choice off or on and override it with his own choice.

Try the product. and footer. files among .tpl and .php among the directory branches. Make backups first.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

### Re: Rounding issue on 1.5.4.1

I see, I'll give that a try otherwise I'm happy to pay for an extension which offers this functionality.

And on the other rounding note. I must apologise I've been making life rather difficult. It never actually occurred to me to check the customer side display of a 4 place rounded number i.e. 3.3252 is displayed correctly to the customer as 3.33 Once again apologies for this elementary mistake. I feel rather foolish now.

New member

Posts

Joined
Sat Dec 22, 2012 10:58 pm

### Re: Rounding issue on 1.5.4.1

"It can be difficult whilst up to one's gluteals in crocodilians to remember that one's original mission was to drain the swamp."

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

### Re: Rounding issue on 1.5.4.1

love it

New member

Posts

Joined
Sat Dec 22, 2012 10:58 pm
Who is online

Users browsing this forum: No registered users and 48 guests