newbee asp help

Discussion in 'C#' started by acerf1, Nov 27, 2007.

  1. #1
    hiya all im new to asp and im follwoing a tut on the internet but im stuck with the following, i want £ instead of $ the follwoing is the code i think i need to change can some please help

    
    <%=formatCurrency( orderTotal )%>
    Code (markup):
    here is the entire code for the page
    
    <%
    ' THIS BIT DEFINES THE CONSTANTS USED IN OUR SCRIPT
    
    CONST CARTPID = 0
    CONST CARTPNAME = 1
    CONST CARTPPRICE = 2
    CONST CARTPQUANTITY = 3
    
    
    '------------------------------------------------
    
    ' THIS BIT GETS THE SHOPPING CART SESSION VARIABLE
    
    IF NOT isArray( Session( "cart" ) ) THEN
      DIM localCart( 4, 20 )
    ELSE
      localCart = Session( "cart" )
    END IF
    
    '-------------------------------------------------------
    %>
    
    <html>
    <head>
    <title>DEFAULT</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body bgcolor="#FEFEFE" text="#CC3366" link="#CC3366" vlink="#CC3366" alink="#CC3366" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="99%" border="0" cellspacing="0" cellpadding="5">
      <tr valign="top"> 
        <td height="71" bgcolor="#E0E0E0"><b><font face="Comic Sans MS" size="+3">Gordys 
          Wine Shop<br>
          <font size="2">Great Wines - Great Service - Great Prices</font> </font></b></td>
      </tr>
      <tr valign="top"> 
        <td height="382">
          <div align="center"><b><font face="Comic Sans MS" size="4">CHECKOUT<br>
            </font></b>
            <form name="checkout" method="post" action="shop_ccard.asp">
              <table width="500" border="1" cellspacing="0" cellpadding="0">
                <tr valign="top"> 
                  <td colspan="3"> 
                    <div align="center"><font face="Comic Sans MS"><b><font size="2">Your 
                      Order Details</font></b></font></div>
                  </td>
                </tr>
                <tr valign="top"> 
                  <td colspan="3"> 
                    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"> 
                      <textarea name="message" value=onfocus="window.document.checkout.txtReadonly.blur()" READONLY=true 
    cols="50" rows="5"><%
    'THIS BIT UNSCRAMBLES THE INFO FROM THE SESSION VARIABLE
    
    FOR x = 0 TO UBOUND( localCart, 2 )
    IF localCart( CARTPID, x ) <> "" THEN
    orderTotal = orderTotal + ( localCart( CARTPPRICE, x ) * localCart( CARTPQUANTITY, x ) )
    
    DIM chId,chProduct,chPrice,chQuantity
    chId=(localCart( CARTPID, x) )
    chProduct=Server.HTMLEncode( localCart( CARTPNAME, x ) )
    chPrice= formatCurrency( localCart( CARTPPRICE, x ) )
    chQuantity=localCart( CARTPQUANTITY, x )%>
    <% 'THE NEXT BIT PRINTS THE CONTENTS OF THE CART TO THE TEXT BOX %>
    <%="ID#: " & chId & vbcrlf & "Products: " & chProduct & vbcrlf &"Unit Price: £ " & chPrice  & vbcrlf &"Quatity: " & chQuantity & " Item" & vbcrlf & "_________" & vbcrlf%>
    <%
    END IF
    NEXT
    %>
    </textarea>
                      </font></div>
                  </td>
                </tr>
                <tr valign="top"> 
                  <td colspan="3"> 
                    <div align="center"><b><font face="Comic Sans MS" size="2">Total 
                      Order Value  <%=formatCurrency( orderTotal )%><br>
                  <input type="hidden" name="total" value="<%=formatCurrency( orderTotal )%>">
    
    
    
                      <input type="hidden" name="contents" value="<%
    FOR x = 0 TO UBOUND( localCart, 2 )
    IF localCart( CARTPID, x ) <> "" THEN
    orderTotal = orderTotal + ( localCart( CARTPPRICE, x ) * localCart( CARTPQUANTITY, x ) )
    
    chId=(localCart( CARTPID, x) )
    chProduct=Server.HTMLEncode( localCart( CARTPNAME, x ) )
    chPrice=formatCurrency( localCart( CARTPPRICE, x ) )
    chQuantity=localCart( CARTPQUANTITY, x )%>
    
    <%="ID#: " & chId & vbcrlf & "Wine: " & chProduct & vbcrlf &"Unit Price: " & chPrice & vbcrlf &"Quatity: " & chQuantity & " Bottles" & vbcrlf & "_________" & vbcrlf%>
    <%
    END IF
    NEXT
    %>">
                      </font></b></div>
                  </td>
                </tr>
                <tr valign="top"> 
                  <td colspan="3"> 
                    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b><font face="Comic Sans MS">Please 
                      enter your delivery details</font></b></font></div>
                  </td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">First Name 
                    </font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="firstname" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Last Name 
                    </font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="lastname" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Address line 
                    1</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="address1" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Address line 
                    2</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="address2" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104" height="20"><b><font face="Comic Sans MS" size="2">Town 
                    / City</font></b></td>
                  <td colspan="2" width="390" height="20"><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="town" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Postcode 
                    / Zip</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="code" size="20">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">County / 
                    State</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="county" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Country</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="country" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Telephone</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="phone" size="30">
                    <b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Include 
                    Area code</font></b></font></td>
                </tr>
                <tr valign="top"> 
                  <td width="104"><b><font face="Comic Sans MS" size="2">Email</font></b></td>
                  <td colspan="2" width="390"><font face="Arial, Helvetica, sans-serif" size="2"></font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="email" size="40">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td colspan="3"><font face="Arial, Helvetica, sans-serif" size="2"></font></td>
                </tr>
                <tr valign="top"> 
                  <td colspan="3"> 
                    <div align="center"><font face="Comic Sans MS" size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif">Please 
                      click on the &quot;Next&quot; button below. You will then be 
                      transferred to the secure server area where you will be asked 
                      for your payment / billing details </font></b></font></div>
                  </td>
                </tr>
                <tr valign="top"> 
                  <td colspan="3"> 
                    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"> 
                      <input type=image src="buttons/next.gif">
                      </font></div>
                  </td>
                </tr>
              </table>
            </form>
            <b><font face="Comic Sans MS" size="4"> </font></b></div>
        </td>
      </tr>
      <tr valign="top"> 
        <td bgcolor="#E0E0E0"> 
          <div align="center"><font face="Comic Sans MS" size="2" color="#999999"><b>This 
            site is for demonstration purposes only</b><br>
            <b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">copyright 
            &copy; www.WebThang.co.uk 2002</font></b></font></div>
        </td>
      </tr>
    </table>
    </body>
    </html>
    
    Code (markup):
     
    acerf1, Nov 27, 2007 IP
  2. imvain2

    imvain2 Peon

    Messages:
    218
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are a few different solutions.

    I follow the KISS principle to programming so here is a simple solution.

    
    function usdtogpp(str)
    usdtogpp = replace(formatcurrency(str),"$","£")
    end function
    
    Code (markup):
    then instead of calling formatcurrency just call usdtogpp
     
    imvain2, Nov 27, 2007 IP
  3. calebbender

    calebbender Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Not sure if that was clear sine you did not reply yet so use the function that was posted above by doing the following instead of what you had before.

    <%= usdtogpp(orderTotal) %>
     
    calebbender, Nov 28, 2007 IP
  4. urstop

    urstop Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Put this line of code before the formatcurrency line of code
    varLocale = SetLocale(2057)

    and after the formatcurrency line of code put this line of code
    SetLocale(varLocale)

    It is that simple ;-)
     
    urstop, Dec 2, 2007 IP
  5. suchiarya

    suchiarya Peon

    Messages:
    213
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Why do not people respond properly whether their problem was solved or not.
     
    suchiarya, Dec 4, 2007 IP