<%
Sub GetFormItem(sItemName, sAliasName, iMinLength, iMaxLength, fRequired)
varItem = TRIM(Request.Form(sItemName))
If sAliasName = "" Then sAliasName = sItemName
If fRequired Then
If varItem = "" Then
Session("CustomError") = Session("CustomError") _
& "Please enter at least "&iMinLength&" characters in the """ _
& sAliasName & """ field. "
Else
If Len(varItem) < iMinLength Then Session("CustomError") = _
Session("CustomError") & "Please enter at least " _
& iMinLength &" characters in the """ _
& sAliasName & """ field. "
If Len(varItem) > iMaxLength Then Session("CustomError") = _
Session("CustomError") & "Please enter at most " _
& iMaxLength &" characters in the """ _
& sAliasName & """ field. "
End If
Else
varItem = TRIM(Request.Form(sItemName))
End If
Session(sItemName) = varItem
End Sub
CheckCartID = Request.Form("CartID")
If CheckCartID = 258 Then
Call GetFormItem ("Shipto", "Shipto", 3, 50, True)
Call GetFormItem ("SFirstName", "First Name", 3, 50, True)
Call GetFormItem ("SLastName", "Last Name", 3, 50, True)
Call GetFormItem ("SBusiness", "Business Name", 3, 50, False)
Call GetFormItem ("SAddress1", "Shipping Address", 3, 50, True)
Call GetFormItem ("SAddress2", "Address2", 3, 50, False)
Call GetFormItem ("SCity", "Shipping City", 3, 50, True)
Call GetFormItem ("SState", "Shipping State", 2, 4, True)
Call GetFormItem ("SZip", "Shipping Zipcode", 5, 10, True)
Call GetFormItem ("SPhone", "Shipping Phone", 7, 20, False)
End If
If Session("CustomError") <> "" Then
Response.Write "Error: " & Session("CustomError") & ""
Response.Write " Click here to go back and fix your errors"
Session("CustomError") = ""
Else
%>
Part Number
Description
Quantity
Price
Total
<%
strSQL = "SELECT CartID, PartID, IDCateg, Quantity, Price, PartDesc, Weight, Quantity * Price AS Price1 FROM CartItems WHERE CartID LIKE '" & CookCartID & "'"
Set CartsDB = CartsConn.Execute(strSQL)
Weight = 0
CARTs = 0
CartsCC = 0
Shipcost1 = 0
Shipcost2 = 0
If Not CartsDB.EOF Then
Do While NOT CartsDB.EOF
PartID = CartsDB("PartID")
PartDesc = CartsDB("PartDesc")
Quantity = CartsDB("Quantity")
Price = CartsDB("Price")
Price1 = CartsDB("Price1")
WeightD = CartsDB("Weight")
Weight = Weight + (Quantity * WeightD)
Response.Write "
" & PartID &"
"
Response.Write "
" & PartDesc &"
"
Response.Write "
"
Response.Write "
"
Response.Write "
$" & formatnumber(Price,2) & "
"
Response.Write "
$" & formatnumber(Price1,2) & "
"
'Cart Flat Rate Shipping
If PartID = "JRCART" OR PartID = "BIGCART" Then
CARTS = CARTS + Quantity
End If
If PartID = "Chrome" Then
CARTSCC = CARTSCC + Quantity
End If
CartsDB.MoveNext
Loop
CartsDB.Close
Set CartsDB = Nothing
If Session("SZip") <> "" Then
Session("zonecode") = Left(Session("SZip"),3)
Place = 96
For i = 0 to 96
If cInt(ZoneArray(0,i)) > cInt(Session("zonecode")) Then
Place = i-1
i = 999
End If
Next
Session("Zone") = ZoneArray(1,Place)
Shipcost1 = 0
If CARTS < 25 AND CARTS <> 0 Then
strSQL = "SELECT * FROM Shipping WHERE Zone = " & cInt(Session("Zone")) & ";"
'Response.Write strSQL
Set ScootsDB = CartsConn.Execute(strSQL)
If NOT ScootsDB.EOF Then
Shipcost1 = Shipcost1 + ScootsDB(CARTS)
'Response.Write Shipcost1 & ":"
Else
'Response.Write " Bad Session"
End If
ScootsDB.Close
Set ScootsDB = Nothing
End If
If CARTSCC < 25 AND CARTSCC <> 0 Then
strSQL = "SELECT * FROM ShippingCC WHERE Zone = " & cInt(Session("Zone")) & ";"
'Response.Write strSQL
Set ScootsDB = CartsConn.Execute(strSQL)
If NOT ScootsDB.EOF Then
Shipcost1 = Shipcost1 + ScootsDB(CARTSCC)
'Response.Write Shipcost1 & ":"
Else
'Response.Write " Bad Session"
End If
ScootsDB.Close
Set ScootsDB = Nothing
End If
End If
Session("Weight") = Weight
Else
%>
No products added yet!
<%
End If
strSQL = "SELECT TotalQuant, TotalPrice FROM Cart WHERE CartID LIKE '" & CookCartID & "'"
Set CartsDB = CartsConn.Execute(strSQL)
Tax = 0
If Session("SState") = "CA" Then
Tax = formatnumber((CartsDB("TotalPrice") * 0.0775),2)
Response.Write "
CA Sales Tax:
$" & Tax & "
"
End If
Session("SalesTax") = Tax
'Total
Response.Write "