Forums / Managing Customers and Orders / Using 4 decimal places (Currency) whilst displaying only 2?

Using 4 decimal places (Currency) whilst displaying only 2?

Locked

Views: 6,865

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
23 Apr 2008, 3:47 PM
#1
guyp avatar

guyp

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Using 4 decimal places (Currency) whilst displaying only 2?

Hello,

Is it possible to set the Currency to use 4 decimal places, but have the front end only display the first 2 (or hide the last 2)?

I have tried setting My Store/ Tax Decimal Places to 2 but it still displays all 4 on the front end.

This might well solve a rounding issue i have where leaving the currency to use 2 decimal places is causing my tax calculations to be out ny 0.01p, I think due to rounding. Bizarrely the figures are correct most of the time!

Example:

£83.55
Sub-Total:

£10.00
Delivery (Delivery):

£16.38
UK VAT:

£109.93
Total:

VAT should actually be £16.37 (from 16.37125)

Thanks

Guy

23 Apr 2008, 4:13 PM
#2
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

Guy, when I add products to my store, I always insert the price to 4 decimal places:-

£4.95 is input as 4.9500

Have you tried this on your "rogue" products?

23 Apr 2008, 4:22 PM
#3
guyp avatar

guyp

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

Yes all of my products have been entered with 4 decimals, i.e £4.95 is entered as 4.9500.

If I set Localization/Currencies/ GB Pound (Default)/ to Decimal places 4, the resulting price in the cart is correct. However it is a bit much for the site cusotmers to see: £16.37125!

Setting it back to 2 is where the rounding issues arise.

Thanks for you help.

Guy

23 Apr 2008, 4:34 PM
#4
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

What about:-

ADMIN>>>CONFIGURATION>>>MY STORE>>>Tax Decimal Places... ?

Set to " 4 "

23 Apr 2008, 4:38 PM
#5
guyp avatar

guyp

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

Changing that doesn't seem to affect the payment calculations - shame!

24 Jun 2009, 8:36 AM
#6
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

Sorry for digging up an old thread here, but there's not a lot about decimal places on the forum, at least I can't find anything..

I've been working on a script that uploads product details to Twitter automatically. I have iit working about 99.9% but just one annoyance. When I upload the product, it's sending the special price to 4 decimal places £49.9900 instead of just £49.00

Can anyone see what I need to add to this section of the script so that it outputs to 2 decimal places only?
**
$display_special_price = zen_get_products_special_price($products_id, true)**

24 Jun 2009, 10:27 AM
#7
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

OK, solved:

round(zen_get_products_special_price($products_id, false), 2)

28 Sep 2010, 11:45 AM
#8
henrytan avatar

henrytan

New Zenner

Join Date:
Oct 2008
Location:
Singapore
Posts:
23
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

Hi limelites,

which file should i edit "round(zen_get_products_special_price($products_id, false), 2) "

can i know which file are you referring to?

thanks!
Henry

28 Sep 2010, 12:09 PM
#9
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

admin/includes/modules/update_product.php

29 Sep 2010, 12:02 AM
#10
henrytan avatar

henrytan

New Zenner

Join Date:
Oct 2008
Location:
Singapore
Posts:
23
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

Hi limelites,
I checked the file, but it does not have zen_get_products_special_price. Can you help me by pointing out which line and exactly what you did.

There are many other people with the same problem, and i believe many people will benefit from your invaluable reply.

thanks in advance!

Henry

29 Sep 2010, 10:19 AM
#12
henrytan avatar

henrytan

New Zenner

Join Date:
Oct 2008
Location:
Singapore
Posts:
23
Plugin Contributions:
0

Re: Using 4 decimal places (Currency) whilst displaying only 2?

hi,
i did and i tested changing a couple of things but nothing changed.

does this only change the no of decimal places from x to 2, or
does it actually make the shopping cart use $2.79 calculate rather than $2.7924 (this is the figure from the quantity discount if use a certain percentage to discount)

henry