%@ Language=VBScript %>
<%
Dim conn, rsList, strSQL
Call OpenDB()
' Authorize.net API Login ID:
Set rsList = Server.CreateObject("ADODB.REcordset")
Set rsTemp = Server.CreateObject("ADODB.REcordset")
If Request.Cookies("cartid")<>"" Then
intCartID=Request.Cookies("cartid")
Else
Response.Redirect("cart.asp")
End IF
For Each strThing in Request.Form()
'Response.Write(strThing & "
")
Next
firstname = SQLClean(Request.Form("firstname"))
email = SQLClean(Request.Form("email"))
lastName = SQLClean(Request.Form("lastName"))
customerCompany = SQLClean(Request.Form("customerCompany"))
shippingName = SQLClean(Request.Form("shippingName"))
shippingLastName = SQLClean(Request.Form("shippingLastName"))
shippingPhone = SQLClean(Request.Form("shippingPhone"))
shippingAddress = SQLClean(Request.Form("shippingAddress"))
shippingAddress2 = SQLClean(Request.Form("shippingAddress2"))
shippingCity = SQLClean(Request.Form("shippingCity"))
shippinglocState = SQLClean(Request.Form("shippinglocState"))
shippinglocState2 = SQLClean(Request.Form("shippinglocState2"))
shippingZip = SQLClean(Request.Form("shippingZip"))
ShippingAddrType = SQLClean(Request.Form("ShippingAddrType"))
phone = SQLClean(Request.Form("phone"))
locState = SQLClean(Request.Form("locState"))
AddrType = SQLClean(Request.Form("AddrType"))
expyear = SQLClean(Request.Form("expyear"))
address = SQLClean(Request.Form("address"))
address2 = SQLClean(Request.Form("address2"))
dowhat = SQLClean(Request.Form("dowhat"))
city = SQLClean(Request.Form("city"))
expMonth = SQLClean(Request.Form("expMonth"))
zip = SQLClean(Request.Form("zip"))
upass = SQLClean(Request.Form("pass1"))
upass2 = SQLClean(Request.Form("pass2"))
uname = SQLClean(Request.Form("username"))
IF Request("dowhat")="Complete Order" Then
' Update Carthead
IF Len(shippingAddress)>5 Then
'If Session("shipzip") = shippingZip Then
strSQL = "UPDATE carthead SET "
strSQL = strSQL & "lastName='" & lastName & "', "
strSQL = strSQL & "name='" & firstname & "', "
strSQL = strSQL & "customerCompany='" & customerCompany & "', "
strSQL = strSQL & "shippingName='" & shippingName & "', "
strSQL = strSQL & "shippingLastName='" & shippingLastName & "', "
strSQL = strSQL & "shippingPhone='" & shippingPhone & "', "
strSQL = strSQL & "shippingAddress='" & shippingAddress & "', "
strSQL = strSQL & "shippingAddress2='" & shippingAddress2 & "', "
strSQL = strSQL & "shippingCity='" & shippingCity & "', "
strSQL = strSQL & "shippinglocState='" & shippinglocState & "', "
strSQL = strSQL & "shippingZip='" & shippingZip & "', "
strSQL = strSQL & "phone='" & phone & "', "
strSQL = strSQL & "locState='" & locState & "', "
strSQL = strSQL & "email='" & email & "', "
strSQL = strSQL & "address='" & address & "', "
strSQL = strSQL & "address2='" & address2 & "', "
strSQL = strSQL & "city='" & city & "', "
strSQL = strSQL & "zip='" & zip & "' WHERE idOrder=" & intCartID & " "
conn.Execute strSQL
'Else
' strError = "You have changed your shipping Zipcode from " & Session("shipzip") & " to " & shippingZip & " Please correct or change Your Cart."
'End IF
Else
'If Session("shipzip") = zip Then
shippinglocState=locState
strSQL = strSQL & "Update carthead SET lastName='" & lastName & "', "
strSQL = strSQL & "name='" & firstname & "', "
strSQL = strSQL & "customerCompany='" & customerCompany & "', "
strSQL = strSQL & "shippingName='" & firstname & "', "
strSQL = strSQL & "shippingLastName='" & lastName & "', "
strSQL = strSQL & "shippingPhone='" & phone & "', "
strSQL = strSQL & "shippingAddress='" & address & "', "
strSQL = strSQL & "shippingAddress2='" & address2 & "', "
strSQL = strSQL & "shippingCity='" & city & "', "
strSQL = strSQL & "shippinglocState='" & locState & "', "
strSQL = strSQL & "shippingZip='" & zip & "', "
strSQL = strSQL & "phone='" & phone & "', "
strSQL = strSQL & "locState='" & locState & "', "
strSQL = strSQL & "email='" & email & "', "
strSQL = strSQL & "address='" & address & "', "
strSQL = strSQL & "address2='" & address2 & "', "
strSQL = strSQL & "city='" & city & "', "
strSQL = strSQL & "zip='" & zip & "' WHERE idOrder=" & intCartID & " "
conn.Execute strSQL
'Else
'strError = "You have changed your shipping Zipcode from " & Session("shipzip") & " to " & shippingZip & " Please correct or change Your Cart."
'End If
End If
' Get Totals
strSQL = "SELECT idCartRow,quantity, description, sku, unitprice, idproduct, unitweight FROM cartrows WHERE idOrder = " & intCartID & " "
rsList.Open strSQL, conn
If Not rsList.EOF Then
arCartRows = rsList.GetRows()
blnIsCart = "Y"
Else
blnIsCart = "N"
End If
rsList.Close
IF blnIsCart="Y" Then
intTotal = 0
For i = 0 to UBOUND(arCartRows, 2)
intTotal = intTotal + (arCartRows(1,i)*arCartRows(4,i))
Next
strSQL = "UPDATE carthead SET disctotal=" & intTotal & " WHERE idOrder=" & intCartID & " "
conn.Execute strSQL
strSQL = "SELECT handlingfeetotal, disctotal, taxrate FROM carthead WHERE idOrder=" & intCartID & " "
rsList.Open strSQL, conn
If Not rsList.EOF THen
handlefee=rsList("handlingfeetotal")
taxrate=rsList("taxrate")
End IF
rsList.Close
'Response.WRite("Product Total: " & FormatCurrency(intTotal) & " Shipping: " & FormatCurrency(handlefee) & " Total: " & FormatCurrency(intTotal+handlefee))
taxtotal = taxrate*intTotal
grandTotal=intTotal+handlefee+taxtotal
If strError<>"" Then
Response.Write(strError)
Else
Response.Redirect("payment.asp")
End If
'strPayMsg=ProcessAuth(intCartID, grandTotal)
' IF strPayMsg="

your shopping cart