Format of Price

General ShopSite user discussion

Format of Price

Postby GiftSpecialists » Fri Sep 01, 2006 1:36 pm

Is ther a way to format the price on product pages so they show up as $20 instead of $20.00? We would like the prices to display withou the cents.

Is this possible?

Thanks,
Rick,

www.GiftSpecialistsInc.com
www.WineGiftClub.com - Gifts for wine lovers
www.BeerOnTheWall.com - Gifts for beer lovers
GiftSpecialists
 
Posts: 130
Joined: Thu Aug 17, 2006 7:20 am
Location: Modesto, California

Postby robm » Fri Sep 01, 2006 5:15 pm

You could use a call tag in a custom template to call a perl script that takes the price and removes the ".00" part and returns that for the price. Then your prices on publish would appear without the cents on ShopSite generated pages.

Price: [-- CALL script.cgi (PRODUCT.Price) --]

Simple perl script:
Code: Select all
#!/usr/local/bin/perl

$price = $ARGV[0];

if ($price =~ /\.00/) {
   $rounded = sprintf("%.0f", $price);
}
else {$rounded = $price;}

print $rounded;
exit;
robm
 
Posts: 463
Joined: Fri Aug 04, 2006 5:46 pm
Location: Connecticut

Postby GiftSpecialists » Sun Sep 03, 2006 9:24 am

Rob,

I will give that a try!

Thanks a bunch,
Rick,

www.GiftSpecialistsInc.com
www.WineGiftClub.com - Gifts for wine lovers
www.BeerOnTheWall.com - Gifts for beer lovers
GiftSpecialists
 
Posts: 130
Joined: Thu Aug 17, 2006 7:20 am
Location: Modesto, California


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 131 guests