<!-- #include file="../DatabaseInclude.asp" --> This include file is NOT output to debug file.<% if not Request.ServerVariables("HTTP_COOKIE") <> "" then Response.Redirect "cookiesOnOff.asp" end if
if ucase(Request.Form("Action")) = "CHECKOUT" then Response.Redirect "CustomerSignIn.asp" end if
if instr(ucase(Request.ServerVariables("HTTP_REFERER")),ucase("ADDP")) =0 then session("returnHere") = Request.ServerVariables("HTTP_REFERER") end if
error=0 Session("ErrorText") = "" Session("Warning") = ""
for i = 0 to 9 Session("compareCarterror" & Cstr(i)) = "" Session("cStockError" & Cstr(i)) = "" next
arrCartCheck = Session("MyCart") scartItemCheck = Session("cartItem")
if Session("CartItem") > 0 then CompareStringForm = "" CompareStringForm = CompareStringForm & Request.Form("fproductid") CompareStringForm = CompareStringForm & Request.Form("cUser0") CompareStringForm = CompareStringForm & Request.Form("cUser1") CompareStringForm = CompareStringForm & Request.Form("cUser2") CompareStringForm = CompareStringForm & Request.Form("cUser3") CompareStringForm = CompareStringForm & Request.Form("cUser4") CompareStringForm = CompareStringForm & Request.Form("cUser5") CompareStringForm = CompareStringForm & Request.Form("cUser6") CompareStringForm = CompareStringForm & Request.Form("cUser7") CompareStringForm = CompareStringForm & Request.Form("cUser8") CompareStringForm = CompareStringForm & Request.Form("cUser9") CompareStringForm = CompareStringForm & Request.Form("cLength") CompareStringForm = CompareStringForm & Request.Form("cWidth")
for i = 1 to scartItemCheck CompareStringArray = "" CompareStringArray = CompareStringArray & arrCartCheck (cProductid,i) for x = 0 to 9 CompareStringArray = CompareStringArray & arrCartCheck (cUser0 + x,i) next CompareStringArray = CompareStringArray & arrCartCheck (clength,i) CompareStringArray = CompareStringArray & arrCartCheck (cwidth,i) session("debug") = session("debug") & "<br><br>Item:" & i & "<br>CompareString ARRAY:" & ucase(CompareStringArray) & "<br>CompareString FORM:" & ucase(CompareStringForm) if ucase(CompareStringForm) = ucase(CompareStringArray) then Session("Warning")= Session("Warning") & "You already have item '" & arrCartCheck(cProductname,i) & "' with the same options in your cart. If you want more increase the QTY and recalculate the shopping cart. Thanks." response.redirect "../Warning.asp?Warning=" & Session("Warning") end if next
set CompareStringArray =nothing
end if
strCID = request.querystring("cid")
if error > 0 then ResPONSE.REDIRECT "../Error.asp?ID=83&Msg=" & Session("ErrorText") end if
strAction = UCase(Left(Request.Form("submit_category_changes"),2))
if session("cStockError") <> ""then set session("cStockError") = nothing end if
for count = 0 to 9 if UCase(left(request.form("cUser" & Cstr(count)),6)) = "SELECT" then Session("ErrorcUser" & Cstr(count))="yes" Session("ErrorText")= "(ID:94) " & Session("ErrorText") & request.form("cUser" & Cstr(count)) & "<br>" error=error+1 end if next
' Remove this for checking STOCK if Request.Form("cStock") = "" or IsNull(Request.Form("cStock")) or Clng(Request.Form("cStock")) < 0 then session("stockRequestForm") = Clng(Request.Form("cStock")) else if (Clng(Request.Form("cStock")) - Clng(request.Form("fquantity"))) < 0 then Session("cStockError") = "yes" error = error+1 Session("ErrorText") = "(ID:94) " & Session("ErrorText") & "Qty" Session("ErrorText") = Session("ErrorText") & " per Unit " & Request.Form("cStock") Session("ErrorText") = Session("ErrorText") & "Total " & request.Form("fquantity") & ". " end if end if
if error >0 then 'DATABASE NOT OPENED RESPONSE.REDIRECT Request.ServerVariables("HTTP_REFERER") end if
Session("ADDPRODUCT")= "Recalculation" Session("ADDPRODUCT")= "Recalculation" Session("ProductDisplay")= "yes"
prodid = (Request.Form("fproductid")) strCID = Request.QueryString("cid") strCatTrack = Request.QueryString("T") strCatLevel = Request.QueryString("L") strCatName = Request.QueryString("N") strCartSize = Request.QueryString("cz")
quantity = Request.Form("fquantity") arrCart = Session("MyCart") scartItem = Session("cartItem")
descriptionholder = Request.Form("cdescription") cUser0var = Request.Form("cUser0") cUser1var = Request.Form("cUser1") cUser2var = Request.Form("cUser2") cUser3var = Request.Form("cUser3") cUser4var = Request.Form("cUser4") cUser5var = Request.Form("cUser5") cUser6var = Request.Form("cUser6") cUser7var = Request.Form("cUser7") cUser8var = Request.Form("cUser8") cUser9var = Request.Form("cUser9")
cLengthvar = Request.Form("cLength") cWidthvar = Request.Form("cWidth")
cdateAvailablevar = Request.Form("cdateAvailable") cStockvar = cint(Request.Form("cStock")) cCostvar = Request.Form("realCost")
PriceAddon = 0
for PriceBump= 0 to 9 if instr(Request.Form("cUser" & PriceBump),"(+") > 0 or instr(Request.Form("cUser" & PriceBump),"(-") > 0 then strSplit = split(Request.Form("cUser" & PriceBump),"(") 'format can be + $1.00 (+1), (+1.00), (+ $ 1.00), the + triggers the split 'spaces ) $ removed before the addition strSplit(1) = replace(replace(replace(strSplit(1),")",""),"$","")," ","") if left(strSplit(1),1) <> "-" then strSplit(1) = replace(strSplit(1),"+","") PriceAddon = PriceAddon + cDBL(strSplit(1)) else strSplit(1) = replace(strSplit(1),"-","") PriceAddon = PriceAddon - cDBL(strSplit(1)) end if end if next
cPricevar = PriceAddon + Request.Form("realPrice") cWeightvar= Request.Form("cWeight")
strCkeckcUser0 = UCase(Left(Request.Form("cUser0"),2)) strCkeckcUser1 = UCase(Left(Request.Form("cUser1"),2)) strCkeckcUser2 = UCase(Left(Request.Form("cUser2"),2)) strCkeckcUser3 = UCase(Left(Request.Form("cUser3"),2)) strCkeckcUser4 = UCase(Left(Request.Form("cUser4"),2)) strCkeckcUser5 = UCase(Left(Request.Form("cUser5"),2)) strCkeckcUser6 = UCase(Left(Request.Form("cUser6"),2)) strCkeckcUser7 = UCase(Left(Request.Form("cUser7"),2)) strCkeckcUser8 = UCase(Left(Request.Form("cUser8"),2)) strCkeckcUser9 = UCase(Left(Request.Form("cUser9"),2)) strCkeckcLength = UCase(Left(Request.Form("cLength"),2)) strCkeckcWidth = UCase(Left(Request.Form("cWidth"),2))
If prodid <> "" Then ' Clear Stock Error for i = 0 to 9 Session("cStockError" & Cstr(i)) = "" next
If scartItem < maxCartItems Then scartItem = scartItem + 1 End If Session("cartItem") = scartItem 'Defined above dim rsProducts Set rsProducts = Server.CreateObject("ADODB.Recordset") rsProducts.Open "products", dbc, adOpenForwardOnly,adLockReadOnly,adCmdTable rsProducts.Filter = "SupplierSKU= '" & prodid & "'" If Not rsProducts.EOF Then arrCart(cProductid,scartItem) = rsProducts("SupplierSKU") arrCart(cProductCode,scartItem) = rsProducts("ccode") arrCart(cProductname,scartItem) = rsProducts("cname") arrCart(cQuantity,scartItem) = Clng(quantity) arrCart(cdescription,scartItem) = (descriptionholder) arrCart(cUser0,scartItem) = (cUser0var) arrCart(cUser1,scartItem) = (cUser1var) arrCart(cUser2,scartItem) = (cUser2var) arrCart(cUser3,scartItem) = (cUser3var) arrCart(cUser4,scartItem) = (cUser4var) arrCart(cUser5,scartItem) = (cUser5var) arrCart(cUser6,scartItem) = (cUser6var) arrCart(cUser7,scartItem) = (cUser7var) arrCart(cUser8,scartItem) = (cUser8var) arrCart(cUser9,scartItem) = (cUser9var) arrCart(cLength,scartItem) = (cLengthvar) arrCart(cWidth,scartItem) = (cWidthvar) arrCart(cStock,scartItem) = (cStockvar) arrCart(cdateAvailable,scartItem) = (cdateAvailablevar) arrCart(cCost,scartItem) = (cCostvar) arrCart(cWeight,scartItem) = (cWeightvar) arrCart(cUnitPrice,scartItem) = (cPricevar) Session("MyCart") = arrCart if Session("ProductDisplay") = "yes" then Session("ProductDisplay") = "no" rsProducts.close set rsProducts= nothing dbc.close set dbc= nothing end if 'Not rsProducts.EOF End If ' prodid <> "" Else Else strAction = UCase(Left(Request.Form("action"),4)) Select Case strAction Case "SHOP" RESPONSE.REDIRECT "ShoppingCartAnalysis.asp" Case "CONT" Session("keyword") = "" dbc.close set dbc= nothing Case ucase(left("Recalculate Shopping Cart",4)) 'Case "RECAL" ' Clear Stock Error for i = 0 to 9 Session("cStockError" & Cstr(i)) = "" next For i = 1 To scartItem if Request.Form("Quantity" & Cstr(i)) = "" then else 'text if -1 < 2 and (cstr(-1) <> "" and cstr(-1) <> cstr(-1)) then if (arrCart(cStock,i) < cint(Request.Form("Quantity" & Cstr(i)))) and ((cstr(arrCart(cStock,i)) <> "" and cstr(arrCart(cStock,i)) <> cstr(-1))) then Session("cStockError" & Cstr(i)) = Request.Form("Quantity" & Cstr(i)) session("arrCart(cStock,i)" & cstr(i))= arrCart(cStock,i) else Session("cStockError" & Cstr(i)) = "" end if end if tquantity = Request.Form("Quantity" & Cstr(i)) 'Version 6.2 if Request.Form("Quantity" & Cstr(i)) = "" then tquantity =0 else if Request.Form("Quantity" & Cstr(i)) = 0 then tquantity =0 end if end if if Clng(tquantity) > Clng(Request.Form("cStock" & Cstr(i))) and Clng(Request.Form("cStock" & Cstr(i))) <> -1 then arrCart(cQuantity,i) = Clng(Request.Form("cStock" & Cstr(i))) else arrCart(cQuantity,i) = Clng(tquantity) end if Next For i = 1 to scartItem confirm = Request.Form("selected" & CStr(i)) If confirm <> "yes" or tquantity = 0 Then scartItem = scartItem - 1 For x = 1 to UBound(arrCart,1) arrCart(x,i) = "" Next n = i while n < UBound(arrCart,2) For x = 1 to UBound(arrCart,1) arrCart(x,n) = arrCart(x,n + 1) arrCart(x,n + 1) = "" Next n = n + 1 wend end If Next Session("cartItem") = scartItem Session("MyCart") = arrCart if Session("ProductDisplay")= "yes" then Session("ProductDisplay")= "no" dbc.close set dbc= nothing end if Case "PROCE" Session("keyword") = "" If scartItem = 0 Then rsProducts.close set rsProducts= nothing dbc.close set dbc= nothing RESPONSE.REDIRECT "../Error.asp?ID=374&msg=" & Server.URLEncode ("Your shopping cart appears to be empty, you need to select an item for purchase to Checkout.") End If rsProducts.close set rsProducts= nothing dbc.close set dbc= nothing RESPONSE.REDIRECT "CustomerSignIn.asp" End Select End If
checkOutFunction = Request.QueryString("Function")
if checkOutFunction = "CheckOut" then Session("keyword") = "" If scartItem = 0 Then RESPONSE.REDIRECT "../Error.asp?ID=390&msg=" & Server.URLEncode ("Your shopping cart appears to be empty, you need to select an item for purchase to Checkout.") End If RESPONSE.REDIRECT "CheckOut.asp" end if
%>
<% 'Don't show anything if the Cart is Empty if scartItem <> 0 then %>
<FORM class="FromSkins" action="AddProduct.asp" method="POST" style="margin-top: 0; margin-bottom: 0">
<%if 100>50 then 'if Session("FullCartView") = "yes" then%>
<table class="TableSkins"> <tr> <td class="TDSkins">Shopping Cart Items </td> <td class="TDSkins">Qty </td> <td class="TDSkins">Unit<%'=" per Unit "%> <%=Session("CompanyCurrencyText")%> </td> <td class="TDSkins">Total <%=Session("CompanyCurrencyText")%></td> <%if instr(ucase(Session("CompanyUser0")),ucase("SkipEuro")) = 0 then%> <%end if%> </tr> <% isubtotal = 0 For i = 1 to scartItem showOptions = 0%> <tr> <td class="TDSkins" valign="bottom" align="left" style="padding: 0"> <% if Session("ADDPRODUCT") <> "noRecalculation" then %> <img border="0" src="../images/SymbolDelete.gif"><input class="InputSkins" name="selected<%= Cstr(i)%>" type="checkbox" value="yes" checked> <%end if%> <a href="DisplayProductIndividualFrames.asp?T=0&L=0&N=<%=Server.URLEncode(arrCart(cProductid,i))%>"> <%=arrCart(cProductname,i) %></a> <br> <%For u = cUser0 to cUser9 if arrCart(u,i) <> "" then if showOptions = 0 then showOptions = showOptions + 1%> Euro(est) <%end if%> <%=arrCart(u,i)%> - <%end if next%> <%if arrCart(cLength,i) > 0 then%> <%if showOptions = 0 then %> <%showOptions = showOptions + 1%> Euro(est) <%end if%> <%= formatnumber(arrCart(cLength,i),2) %> Measure(s) @ <%=formatnumber(arrCart(cUnitPrice,i),2,0,0,0)%> /Measure (<%= formatnumber(arrCart(cLength,i) * arrCart(cUnitPrice,i),2,0,0,0)%> ) - <%end if%> <%if showOptions > 0 then %> <%end if%> <%if arrCart(cStock,i) < 0 or arrCart(cStock,i) = "" or IsNull(arrCart(cStock,i)) then %> <%else%> <br>Number In Stock: <%=arrCart(cStock,i)%> <%if Session("cStockError" & Cstr(i)) <> "" then%> <img border="0" src="../images/MiniRedArrow.gif"> Qty Edit of <%=Session("cStockError" & Cstr(i))%> exceeds stock. <%end if%> <%end if%> </td> <td class="TDSkins"> <% if Session("ADDPRODUCT") <> "noRecalculation" then %> <input class="InputSkins" type="hidden" name="cStock<%= CStr(i) %>" value="<%=arrCart(cStock,i)%>" size="3" align="center"> <%if Session("cStockError" & Cstr(i)) = "" then%> <input class="InputSkins" type="text" name="quantity<%= CStr(i) %>" value="<%= arrCart(cQuantity,i) %>" size="3" align="center"> <%else arrCart(cQuantity,i) = arrCart(cStock,i)%> <input class="InputSkins" type="text" name="quantity<%= CStr(i) %>" value="<%= arrCart(cStock,i) %>" size="3" align="center"> <%end if%> <img border="0" src="../images/SymbolEdit.gif" width="13" height="14"> <%if (arrCart(cproductid,i)) = (Session("SesProdID")) then%> <%if Session("compareCarterror" & Cstr(i)) = "yes" then%> <br> <img border="0" src="../images/Number1AnimatedRedWhite.gif" width="18" height="18"> <%end if%> <%end if%> <%else%> <%= arrCart(cQuantity,i) %>? <%end if %> </td> <td class="TDSkinsRight"> <%if arrCart(cLength,i) >0 then%> <%= formatnumber(arrCart(cLength,i) * arrCart(cUnitPrice,i),2,0,0,0)%> <%else%> <%= FormatNumber(arrCart(cUnitPrice,i),2,0,0,0)%> <%end if%> </td> <td class="TDSkinsRight"> <%if arrCart(cLength,i) >0 then%> <%= FormatNumber(arrCart(cLength,i) * arrCart(cUnitPrice,i) * arrCart(cQuantity,i),2,0,0,0) %> <%else%> <%= FormatNumber(arrCart(cUnitPrice,i) * arrCart(cQuantity,i),2,0,0,0)%> <%end if%></td> <%if instr(ucase(Session("CompanyUser0")),ucase("SkipEuro")) = 0 then%> <%end if%> </tr> <% if arrCart(cLength,i) >0 then isubtotal = isubtotal + (arrCart(cLength,i) * arrCart(cUnitPrice,i) *arrCart(cQuantity,i)) else isubtotal = isubtotal + (arrCart(cUnitPrice,i) * arrCart(cQuantity,i)) end if Next stateTax=0 if ucase(Session("cpi.card-state")) = ucase("AZ") or ucase(Session("cpi.card-state")) = ucase("arizona") then stateTax = isubtotal * .085 end if 'Shipping Calculation ishipping = isubtotal * .08 if ishipping < 5.95 then ishipping = 5.95 end if irealtotal = isubtotal + stateTax + ishipping %> <tr> <td class="TDSkins"> <% if Session("ADDPRODUCT") <> "noRecalculation" then %> <img border="0" src="../images/SymbolDelete.gif" width="13" height="14"> Uncheck to remove an item and <% if Session("ADDPRODUCT") <> "noRecalculation" then %> <%if Session("errorText") <> "" then%> <%end if%> <input class="InputSkins" name="action" type="submit" value="Recalculate<%'="Recalculate Shopping Cart"%>" style="width=100"> <img border="0" src="../images/SymbolEdit.gif" width="13" height="14"> Edit Qty & Recalculate <%if Session("errorText") <> "" then%> <%end if%> <% end if%> <%if Session("OrderHasBeenProcessed") = "no" then%><br> <%end if%> <%if Session("errorText") <> "" then%> <img border="0" src="../images/Number2AnimatedRedWhite.gif" width="18" height="18"> <%end if%> <% end if%> </td> <td class="TDSkins"> </td> <td class="TDSkinsRight">Subtotal </td> <td class="TDSkinsRight"> <%= FormatNumber(isubtotal,2,0,0,0)%> </td> <%if instr(ucase(Session("CompanyUser0")),ucase("SkipEuro")) = 0 then%> <%end if%> </tr> <tr> <td class="TDSkinsRight"> </td> <td class="TDSkins"> </td> <td class="TDSkinsRight">Shipping </td> <td class="TDSkinsRight"> <%= FormatNumber(ishipping,2,0,0,0)%></td> <%if instr(ucase(Session("CompanyUser0")),ucase("SkipEuro")) = 0 then%> <%end if%> </tr> <tr> <td class="TDSkinsRight"> <input class="InputSkins" type="submit" value="CheckOut" name="action"> <img border="0" src="../images/ShoppingCartOnlyTiny.gif"> </td> <td class="TDSkins"> </td> <td class="TDSkinsRight">Total </td> <td class="TDSkinsRight"> <%= FormatNumber(irealtotal,2,0,0,0)%></td> </tr> <input class="InputSkins" type="hidden" hidden name="ordertotal" value="<%=irealtotal %>" size="4"> </table> </form> <% Session("ordertotal") = irealtotal Session("totalstatetax") = stateTax Session("totalShipping") = ishipping else itemCount = 0
For i = 1 to scartItem if arrCart(cLength,i) >0 then isubtotal = isubtotal + (arrCart(cLength,i) * arrCart(cUnitPrice,i) *arrCart(cQuantity,i)) else isubtotal = isubtotal + (arrCart(cUnitPrice,i) * arrCart(cQuantity,i)) end if itemCount = itemCount + arrCart(cQuantity,i) Next irealtotal = isubtotal + stateTax + ishipping
%>
<table CLASS="TableSkins"> <tr> <td class="CellSkins"> <%if itemcount > Session("cartItem") then%> <%=itemcount%> item(s) <%end if%> in cart. Total <%=Session("CompanyCurrencyText")%> <%=formatnumber(irealtotal,2)%> </td> </tr> </table> </form> <%'END IF FOR FULL DISPLAY end if 'ELSE FOR CART EMPTY else %> <table border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse" bordercolor="#111111" class="TableSkins"> <tr> <td class="CellSkins"> <p>Your Shopping Cart is Empty! <img border="0" src="../images/ShoppingCartOnlyTiny.gif"> </td> </tr> </table> </form> <% 'END IF FOR CART EMPTY end if %></body><!-- #include file="../ReadFile.asp" --> This include file is NOT output to debug file.
|