%
On Error Resume Next
PageTitle="Checkout Page"
ThisPage="Check_Out"
SQLVerboseMode=False
TestMode=TrueX
%>
<%
If Session("SessShowLeftMenu")<>"" Then
ShowLeftMenu=Session("SessShowLeftMenu")
Else
ShowLeftMenu=True
End If
RowPadLoop=8
%>
<%
Function LimitQtyTo1Ck(ItemRef)
FoundIt=False
PrefixStr="3,5,9"
If InStr(1,PrefixStr,Mid(ItemRef,1,1)) > 0 Then
LimitQtyStr="01,01a,01b,02a,02b,03a,03b,04a,04b,05a,05b"
ItemRefCk=Mid(ItemRef,4) 'ie the last part of 30001b = 01b
If InStr(1,LimitQtyStr,ItemRefCk) > 0 Then
FoundIt=True
End If
End If
LimitItems="80001a,80011a,80021a,80022b,80002a,80012a,80003a,80013a"
If InStr(1,NewLimitItems,ItemRef) > 0 Then
FoundIt=True
End If
LimitItems="1225-90,1222-90,1226-90,1223-90,1224-90,1227-90,1228-90,1118-89,8888-a,8887-a"
If InStr(1,NewLimitItems,ItemRef) > 0 Then
FoundIt=True
End If
LimitItems="8771-a,8772-a,8773-a,8774-a,8775-a,8776-a,8777-a,8778-a"
If InStr(1,NewLimitItems,ItemRef) > 0 Then
FoundIt=True
End If
LimitQtyTo1Ck = FoundIt
End Function
mvCustID=Session("EPCCustomerID")
Today=CDate(Date())
CustomerID=Session("EPCCustomerID")
FName=SESSION("SessFName")
PromoCode=Session("SessPromoCode")
PromoName=Session("SessPromoEntry")
'ThisPage="check_out"
ShopFromPage=Session("SessShopFromPage")
If ShopFromPage="" Then
ShopFromPage="Package.asp"
End If
Session("CPg")=ThisPage
BkColor = Session("EPCBkGrndColor")
EPCURL = Session("strEPCURL")
iCount = Session("EPCItemCount")
ARYshoppingcart = Session("EPCMyShoppingCart")
ErrMsg = ""
ItemRef=ReqString("ItemRef")
CartCategory=ReqString("Cat")
ProdClass=ReqString("Cat")
bcBrowser=Session("bcBrowser")
Set Conn = Server.CreateObject("ADODB.Connection")
SessStg = Session("ConnectionString")
ARYItemNo=1
ReDim ARYCartSub(ARYItemNo,11)
CartCtr=1
If ItemRef<>"" Then
For x = 1 to InventoryCtr
If ARYInventory(x,zItemNum)=ItemRef Then
'Response.Write "
" & x & ". ARYInventory(x,zItemDescription): "
'Response.Write ARYInventory(x,zItemDescription)
For y = 1 to 11
ARYCartSub(ARYItemNo,y) = ARYInventory(x,y)
Next
End If
Next
End If
LimitQty1Str="3001,3002,3003,3004,3005,5001,5002,9001,9003,9004"
'Response.Write "0
"
If ItemRef <> "" Then
'Do search to existing cart to see if ItemRef already there, if found then increment qty by 1
ItemAlreadyInCart=FALSE
For i = 1 to iCount
If ARYshoppingcart(cartProductID,i)=ItemRef Then
Quantity=ARYshoppingcart(cartItemQuantity,i)+1
'If InStr(1,LimitQty1Str,ItemRef) > 0 Then
If LimitQtyTo1Ck(ItemRef) = True Then
Quantity=1
End If
Quantity=abs(CLng(Quantity))
ARYshoppingcart(cartItemQuantity,i) = Quantity
ItemAlreadyInCart=TRUE
Exit For
End If
Next
'Response.Write "1
"
If ItemAlreadyInCart=FALSE Then
'Response.Write "2
"
If iCount < EPCMaxShoppingCartItems Then
iCount = iCount + 1
End if
Session("EPCItemCount") = iCount
ARYItem = Session("EPCMyARYItem")
If ARYCartSub(ARYItemNo,zListPrice)="call" Then
ErrMsg = "Sorry, Items Without Pricing Specified Can NOT Be Placed Into Shopping Cart.
"
ErrMsg = ErrMsg & "Please Call (800)877-5445 for More Information"
Else
'Response.Write "3
"
Desc=ARYCartSub(ARYItemNo,zItemDescription)
'Response.Write "
Desc: "
'Response.Write Desc
ARYshoppingcart(cartCHECKED,iCount) = "CHECKED"
ARYshoppingcart(cartRefNo,iCount) = ARYCartSub(ARYItemNo,zRefNo)
ARYshoppingcart(cartProductName,iCount) = ARYCartSub(ARYItemNo,zCategory)
str1=UCASE(ProdClass) & ": " & Desc
TotStr=str1
TotStr=Desc
ARYshoppingcart(cartProductDescription,iCount) = TotStr
ARYshoppingcart(cartItemQuantity,iCount) = 1
ARYshoppingcart(cartUnitPrice,iCount) = ARYCartSub(ARYItemNo,zListPrice)
ARYshoppingcart(cartProductID,iCount) = ARYCartSub(ARYItemNo,zItemNum)
ARYshoppingcart(cartMinQty,iCount) = CInt(ARYCartSub(ARYItemNo,zMinQty))
w9=CInt(ARYCartSub(ARYItemNo,zMinQty))
ARYshoppingcart(cartMaxQty,iCount) = CInt(ARYCartSub(ARYItemNo,zMaxQty))
Session("EPCMyShoppingCart") = ARYshoppingcart
End If
End If
End If
OrderSubTotal = 0.00
Action2Do=ReqForm("Action")
If Action2Do="Update" Then
Action2Do="Recalculate"
End If
If Action2Do="" Then
If ReqString("Action")="View" Then
Action2Do=""
Else
If iCount > 0 Then
If ItemRef="" Then
'Action2Do="Recalculate"
End If
End If
End If
End If
ChkPt=Action2Do
SELECT CASE Action2Do
CASE "Shop for More"
ChkPt="ShopForMore"
For i = 1 to iCount
Quantity = ReqForm("Quantity" & CStr(i))
'If InStr(1,LimitQty1Str,ARYshoppingcart(cartProductID,i)) > 0 Then
If LimitQtyTo1Ck(ARYshoppingcart(cartProductID,i)) = True Then
Quantity=1
End If
If IsNumeric(Quantity) Then
ARYshoppingcart(cartItemQuantity,i) = abs(CLng(Quantity))
Else
ARYshoppingcart(cartItemQuantity,i) = 1
End If
Next
Session("EPCMyShoppingCart") = ARYshoppingcart
Response.Redirect ShopFromPage
CASE "Recalculate"
ChkPt="Recalculate"
For i = 1 to iCount
Quantity = ReqForm("Quantity" & CStr(i))
If i = 1 then
QtyCk=Quantity
w1=QtyCk
End If
'If InStr(1,LimitQty1Str,ARYshoppingcart(cartProductID,i)) > 0 Then
If LimitQtyTo1Ck(ARYshoppingcart(cartProductID,i)) = True Then
Quantity=1
w2=Quantity
End If
If IsNumeric(Quantity) Then
Quantity=Fix(Quantity)
w3=Quantity
MaxVal = Fix(ARYshoppingcart(cartMaxQty,i))
w4=MaxVal
MinVal = Fix(ARYshoppingcart(cartMinQty,i))
w5=MinVal
If Quantity <= MaxVal Then
If Quantity >= MinVal Then
ARYshoppingcart(cartItemQuantity,i) = Quantity
Else
ARYshoppingcart(cartItemQuantity,i) = MinVal
End If
Else
ARYshoppingcart(cartItemQuantity,i) = MaxVal
End If
Else
ARYshoppingcart(cartItemQuantity,i) = 1
End If
Next
For i = 1 to iCount
Quantity = ReqForm("Quantity" & CStr(i))
If (ReqForm("Confirm" & CStr(i)) = "") OR (Quantity=0) Then
iCount = iCount - 1
For x = 1 to UBound(ARYshoppingcart,1)
ARYshoppingcart(x,i) = ""
Next
n = i
while n < UBound(ARYshoppingcart,2)
For x = 1 to UBound(ARYshoppingcart,1)
ARYshoppingcart(x,n) = ARYshoppingcart(x,n + 1)
ARYshoppingcart(x,n + 1) = ""
Next
n = n + 1
wend
End If
Next
ChkPt="Recalculate"&QtyCk
Session("EPCMyShoppingCart") = ARYshoppingcart
Session("EPCItemCount") = iCount
%>
<%
CASE "Cancel Order"
ChkPt="CancelOrder"
iCount = 0
Session("EPCItemCount") = iCount
Response.Redirect "Package.asp"
CASE "Click to Pay"
ChkPt="ClickToPay"
%><%
Quantity = ReqForm("Quantity" & CStr(i))
'If InStr(1,LimitQty1Str,ARYshoppingcart(cartProductID,i)) > 0 Then
If LimitQtyTo1Ck(ARYshoppingcart(cartProductID,i)) = True Then
Quantity=1
End If
If IsNumeric(Quantity) Then
If CLng(Quantity) <= ARYshoppingcart(cartMaxQty,i) Then
ARYshoppingcart(cartItemQuantity,i) = abs(CLng(Quantity))
End If
Else
ARYshoppingcart(cartItemQuantity,i) = 1
End If
Session("EPCMyShoppingCart") = ARYshoppingcart
'Store ref fields in TempOrder Table for passage to HTTPS side of house:
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Session("RackSpaceMyEPC")
'CustomerID = Session("EPCCustomerID")
If IsNull(CustomerID) Then
CustomerID=0
End If
imSubtotal=0
minOrderMet=FALSE
For i = 1 to iCount
If (ARYshoppingcart(cartUnitPrice,i)) <> "" Then
imSubtotal=imSubtotal+ (ARYshoppingcart(cartUnitPrice,i) * ARYshoppingcart(cartItemQuantity,i))
End If
Next
If imSubtotal=0 Then
Else
minOrderMet=TRUE
CustID=CustomerID
InsertCustID=CustID
%>
<%
Conn.Close
End If
If minOrderMet=FALSE Then
ErrMsg2="
Minimum Order Must Be Met"
Else
CustomerID = CLng(Session("EPCCustomerID"))
if CustomerID = 0 then ' new customer
Response.Redirect "GetCustomer.asp"
else
' First check to ensure that the customer was not removed from the database
Conn.Open Session("RackSpaceMyEPC")
Set rs = Conn.Execute( _
"select CompanyName FROM Customers where CustomerID = " & CustomerID & _
" and ContactFirstName = '" & Session("EPCCustomerFirstName") & "'")
If Conn.Errors.Count > 0 Then
Response.Write "
sql: " & sql & "
"
SQLProcessOK = FALSE
sqlErrRef=ThisPage & " 1"
%>
<%
End If
If PromoCode<>"" Then
CustID=CustomerID
PromoOK2Process=TRUE
If PromoOK2Process=TRUE Then
URL = "https://www.rels.com/secure2016/ANetshipping.asp?ShipMethod=1&PromoCode=" & PromoCode & "&CustomerID=" & Session("EPCCustomerID")
Else
URL = "OrderExceedsLimits.asp"
End If
Else
URL = "https://www.rels.com/secure2016/ANETshipping.asp?ShipMethod=1&CustomerID="&Session("EPCCustomerID")
End If
If rs.EOF Then
Session("EPCCustomerID") = -1 ' This means the user WAS in the database at one time, but isn't now
URL ="GetCustomer.asp"
End If
rs.Close
Conn.Close
If TestMode Then
Response.Write "Ready to Redirect to: " & URL & "
"
Else
Response.Redirect URL
End If
End If
End If
END SELECT
%>
|
|||||
<%For x = 1 to RowPadLoop
Response.Write" " Next %> |
|||||