Shopping Cart
<%
error=""
OpenConnection1
Set rs=Server.CreateObject("ADODB.Recordset")
If Request.QueryString("DI")<>"" then
Del="SELECT * FROM SCart WHERE ItemID=" & Request.QueryString("DI")
rs.Open Del,DB,1,3
If Not rs.EOF then rs.Delete
rs.Close
End If
If Not Logged Then
Session("page")="viewcart.asp"
Response.Redirect("login.asp")
End If
Sel="SELECT txtFname,txtLname,txtCompany FROM Customers WHERE CustomerID=" & Request.Cookies("wades")("cid")
rs.Open Sel,DB,1,3
txtName=rs("txtFname") & " " & rs("txtLname")
txtCompany=""
If rs("txtCompany")<>"" then txtCompany="("&rs("txtCompany")&")"
rs.Close
If Request.Cookies("wades")("curopt")=1 then
curmess="All prices are in Canadian Dollars."
Else
curmess="All prices are in U.S. Dollars."
End If
Sel="SELECT * FROM SCart WHERE nCustomerID=" & Request.Cookies("wades")("cid")
rs.Open Sel,DB,1,3
%>
Shopping cart for <%=txtName & " " & txtCompany%> <%=curmess%>
<%If rs.EOF then%>
There are currently no items in your shopping cart.
<%Function GetPrice(supplyId)
Set gp=Server.CreateObject("ADODB.Recordset")
If Request.Cookies("wades")("curopt")=1 then
sql="SELECT curCanPrice FROM Supplies WHERE SupplyID=" & supplyId
gp.Open sql,DB,1,3
If gp.EOF then
GetPrice="No longer available"
Else
GetPrice=cstr(formatcurrency(gp("curCanPrice"),2,0))
End If
Else
sql="SELECT curUSPrice FROM Supplies WHERE SupplyID=" & supplyId
gp.Open sql,DB,1,3
If gp.EOF then
GetPrice="No longer available"
Else
GetPrice=cstr(formatcurrency(gp("curUSPrice"),2,0))
End If
End If
gp.Close
End Function
Function GetTotal(supplyId,quantity)
Set gt=Server.CreateObject("ADODB.Recordset")
If Request.Cookies("wades")("curopt")=1 then
sql="SELECT curCanPrice FROM Supplies WHERE SupplyID=" & supplyId
gt.Open sql,DB,1,3
If gt.EOF then
GetTotal="NA"
Else
GetTotal=cstr(formatcurrency(cint(quantity)*gt("curCanPrice"),2,0))
End If
Else
sql="SELECT curUSPrice FROM Supplies WHERE SupplyID=" & supplyId
gt.Open sql,DB,1,3
If gt.EOF then
GetTotal="NA"
Else
GetTotal=cstr(formatcurrency(cint(quantity)*gt("curUSPrice"),2,0))
End If
End If
gt.Close
End Function
%>