Page 1 of 1
Adding a thousand separator
Posted: Wed Apr 05, 2006 3:15 pm
How easy would it be to amend NorPrice to format the output with a thousands separator on currencies such as Japanese Yen?
Finance Director does not like the current display.
Posted: Wed Apr 05, 2006 4:14 pm
NorPrice displays the alternate currency in 2 ways. If the exchange rate is below a certain value (CUSTOMVAR:HIDEFRACTIONRATE) it uses nnnn.nn If the exchange rate is above it just displays the integer value.
Neither of these routines do any comma type formatting. It wouldn't be hard to add, however. All you'd need to do is alter 2 files
Cart and Checkout the Perl routine ActinicOrder.pm, lines the format strings within
$sFormattedPrice .= sprintf(" (%d $iso)", $nNorprice);
$sFormattedPrice .= sprintf(" (%1.2f $iso)", $nNorprice);
for the integer and decimal version.
return prefix + ' (' + optplus + Math.round(altprice) + ' ' + isoname + ')' + suffix;
return prefix + ' (' + optplus + topounds(altprice) + ' ' + isoname + ')' + suffix;
where the Math.round(altprice) and topounds(altprice) would need some code added to fit in the commas.
This http://www.web-source.net/web_developme ... atting.htm
Posted: Wed Apr 05, 2006 4:59 pm
Will let you know how I get on.
Posted: Thu Apr 06, 2006 2:00 am
I'm almost there.
I have consistently working perl.
Want a copy back when I'm finished?
Posted: Thu Apr 06, 2006 2:15 am
I was going to look at adding this myself when I had some free time but anything that speeds that up will be useful.
Posted: Thu Apr 06, 2006 9:43 am
Posted: Thu Apr 06, 2006 2:12 pm
Just emailed you what's hopefully a solution.
Posted: Thu Apr 06, 2006 2:16 pm
I just came on to say my solution is now working 100% in everything except Opera 9.
OK in IE6, IE7, Firefox and Opera 8.5.
Will look at your solution, and see if it's the same change I made, then come back at you.
Posted: Thu Apr 06, 2006 3:26 pm
Posted: Thu Apr 06, 2006 3:40 pm
- guess I won't send you anything new after all.
Thanks loads, Norman.
Posted: Sun Apr 09, 2006 12:21 am
I can't take too much credit. I got most of it from the O'Reilly Perl Cookbook.