Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Show Prices with leading 0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

poldy
Starting Member

25 Posts

Posted - September 24 2012 :  08:09:05  Show Profile  Reply with Quote
We are selling low price products and need to show our prices with leading 0.
$ 0.95 looks better then $.95.

How do we do this.

Thanks

devshb
Senior Member

United Kingdom
1904 Posts

Posted - September 24 2012 :  17:42:53  Show Profile  Visit devshb's Homepage  Reply with Quote
if using vpasp v7, edit shopproductsubs2.asp in notepad, and a few lines down from here:

function ShopFormatCurrency

you'll see this:

if GetSess("Newcurrencysymbol")<>"" then
ShopFormatCurrency = GetSess("Newcurrencysymbol") & formatnumber (tamount, decimalpoint)
elseif GetConfig("XCurrencySymbol") <> "" then
ShopFormatCurrency = GetConfig("XCurrencySymbol") & formatnumber (tamount, decimalpoint)
else
ShopFormatCurrency = "$" & formatnumber (tamount, decimalpoint)
end if

change the formatnumber lines to have an extra argument of -1 (which indicates to show leading zeroes on the pre-decimal amount), ie so it's like:

if GetSess("Newcurrencysymbol")<>"" then
ShopFormatCurrency = GetSess("Newcurrencysymbol") & formatnumber (tamount, decimalpoint,-1)
elseif GetConfig("XCurrencySymbol") <> "" then
ShopFormatCurrency = GetConfig("XCurrencySymbol") & formatnumber (tamount, decimalpoint,-1)
else
ShopFormatCurrency = "$" & formatnumber (tamount, decimalpoint,-1)
end if

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
www.BigYellowKey.com
Follow us on Twitter: http://twitter.com/bigyellowzone
Web Design, Online Marketing and VPASP addons
Go to Top of Page

poldy
Starting Member

25 Posts

Posted - September 25 2012 :  01:48:11  Show Profile  Reply with Quote
Thanks.
I also added a space between currency symbol and number. This looks easier to read.


if GetSess("Newcurrencysymbol")<>"" then
ShopFormatCurrency = GetSess("Newcurrencysymbol")&" " & formatnumber (tamount, decimalpoint,-1)
elseif GetConfig("XCurrencySymbol") <> "" then
ShopFormatCurrency = GetConfig("XCurrencySymbol")&" " & formatnumber (tamount, decimalpoint,-1)
else
ShopFormatCurrency = "$"&" "& formatnumber (tamount, decimalpoint,-1)
end if
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00