PDA

View Full Version : Removing pence/cents from a displayed price


JohnH
10-Apr-2005, 07:46 AM
Hi

In the V6 forum, Norman kindly identified a method of using JavaScript to strip off the pence/cents from a displayed price.

For example, I would like to display the pricing in the main catalog area in the form £1,000 / $1,870 rather than the default form £1,000.00 / $1,870.00.

I have studied the V6 solution with care and cannot get it to work correctly on my V7 site where I have dual GBP and USD pricing. The symptoms are that the price/cents remain present in the catalog preview displays.

The script that Norman proposed in the thread (http://community.actinic.com/showthread.php?t=2262) was:-

<!--
document.write("NETQUOTEVAR:COST".replace(/&amp;#46;\d\d/,""));
// -->
</script>
<noscript>NETQUOTEVAR:COST</noscript>

Any help on this point would be very much appreciated and I apologise if I have mis-understood something.

Thank you for such a superb community forum,

John.

DaveT
10-Apr-2005, 08:44 AM
Ignore. Sorry.

Nadeem
12-Apr-2005, 02:58 PM
Hi John,

Why don't you contact Norman regarding this, he may do the change for a fee, due to the fact that it will involve changes to the perlscript. His website address is: http://www.drillpine.biz.

Kind Regards

NormanRouxel
12-Apr-2005, 03:14 PM
It's the Form munging things.

Try<script language=JavaScript>
<!--
document.write("NETQUOTEVAR:COST".replace(/&#46;\d\d/g,""));
// -->
</script>
<noscript>NETQUOTEVAR:COST</noscript>Which I've also extended to convert both currencies if used.

JohnH
13-Apr-2005, 11:49 AM
Hi Norman,
Thank you so much for your assistance. The proposed code works superbly !!

I have now worked out how the global string replace function works and will apply that method to some other aspects of my site.

Many thanks again,
John.