ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Phone Number function
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Phone Number function

 Post Reply Post Reply
Author
Message
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post Topic: Phone Number function
    Posted: 02-July-2011 at 5:40pm
Is there a sub function / function already built in the system to standardize or format phone numbers?

ie.
8669299626
to
(866) 929-9626

Josh
Josh Shirley
josh@windsurfutah.com
Back to Top
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post Posted: 02-July-2011 at 6:00pm
well, I guess it is not worth the time to search for:

Here is my edit to the stringfunctions.asp file:
///////////////////////////////////////////////////////////////////////////////////////////

'*****************************************************************************************************
'// Format display phone numbers
'*****************************************************************************************************
Function phoneformat(byVal phonenumber)

  phonenumber = Cstr(phonenumber)
  phonenumber = Trim(phonenumber)
  phonenumber = Replace( phonenumber, " ", "")
  phonenumber = Replace( phonenumber, "-", "")
  phonenumber = Replace( phonenumber, "(", "")
  phonenumber = Replace( phonenumber, ")", "")
  phonenumber = Replace( phonenumber, ".", "")
  phonenumber = Replace( phonenumber, ",", "")
  
  select case LEN(phonenumber)  
  Case 10
    tmp = tmp & "(" & mid(phonenumber,1,3) & ") "
    tmp = tmp & mid(phonenumber,4,3) & "-"
    tmp = tmp & mid(phonenumber,7,4)
  case 11
    tmp = tmp & mid(phonenumber,1,1) & " "
    tmp = tmp & "(" & mid(phonenumber,2,3) & ") "
    tmp = tmp & mid(phonenumber,5,3) & "-"
    tmp = tmp & mid(phonenumber,8,4)
  case else
    phoneformat = null
    exit function  
  end select
  
  phoneformat = tmp
end function
////////////////////////////////////////////////////////////////////////

So any place a phone number is listed this can be added:


phoneformat(scCompanyPhoneNumber) 'uses phone number listed by store settings.
or 
phoneformat("8669299626")

wah la


Josh Shirley
josh@windsurfutah.com
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.078 seconds.