% ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _ "DBQ= " & Server.MapPath("\cgi-bin\am_hobby.mdb") & _ ";UID=admin;PWD=;" iCount = Session("ItemCount") ARYshoppingcart = Session("MyShoppingCart") Set Conn = Server.CreateObject("ADODB.Connection") If Request.QueryString("ProductCode") <> "" Then If iCount < MaxShoppingCartItems Then iCount = iCount + 1 End if Session("ItemCount") = iCount Conn.Open ConnectionString SQLcatalog_item = "SELECT Type, ProductID, Code, Name, Description, Price FROM Products WHERE {fn UCASE(Code)} = '" & Ucase(Request.QueryString("ProductCode")) & "'" Set RS = Conn.Execute(SQLcatalog_item) If Not IsEmpty(RS) Then ARYshoppingcart(cartCHECKED,iCount) = "CHECKED" ARYshoppingcart(cartCode,iCount) = RS("Code") ARYshoppingcart(cartName,iCount) = RS("Name") ARYshoppingcart(cartDescription,iCount) = RS("Description") ARYshoppingcart(cartItemQuantity,iCount) = 1 ARYshoppingcart(cartPrice,iCount) = RS("Price") ARYshoppingcart(cartProductID,iCount) = RS("ProductID") Session("MyShoppingCart") = ARYshoppingcart History = RS("Type") 'we need this to redirect back to where 'the user came from on the catalog_item page RS.Close Conn.Close End If End If for i = 1 to icount 'icount will be already stored on the session 'and contains the number of items that the shopper has put in the cart 'we loop through and grab each item from the array. The first dimension 'contains the constant and never changes here. The second dimension 'contains the item number of the product being purchased I may be able 'to just pull these items - cartCatalogNumber cartItemQuantity ' this is the code that is beng used to go to the next page checkout.asp strTemp = strTemp & "," & ARYshoppingcart(cartCode,i) strTemp = strTemp & "," & ARYshoppingcart(cartName,i) ' strTemp = strTemp & "," & ARYshoppingcart(cartDescription,i) strTemp = strTemp & "," & ARYshoppingcart(cartItemQuantity,i) strTemp = strTemp & "," & ARYshoppingcart(cartPrice,i) ' strTemp = strTemp & "," & ARYshoppingcart(cartProductID,i) next SELECT CASE Request("Action") CASE "Click to Pay" Quantity = Request("Quantity" & CStr(i)) If IsNumeric(Quantity) Then ARYshoppingcart(cartItemQuantity,i) = abs(CLng(Quantity)) Else ARYshoppingcart(cartItemQuantity,i) = 1 End If 'send everything to checkout.asp Session("MyShoppingCart") = ARYshoppingcart for i = 1 to icount 'icount will be already stored on the session 'and contains the number of items that the shopper has put in the cart 'we loop through and grab each item from the array. The first dimension 'contains the constant and never changes here. The second dimension 'contains the item number of the product being purchased I may be able 'to just pull these items - cartCatalogNumber cartItemQuantity strTemp = strTemp & "," & ARYshoppingcart(cartCatalogNumber,i) strTemp = strTemp & "," & ARYshoppingcart(cartProductName,i) strTemp = strTemp & "," & ARYshoppingcart(cartProductDescription,i) strTemp = strTemp & "," & ARYshoppingcart(cartItemQuantity,i) strTemp = strTemp & "," & ARYshoppingcart(cartUnitPrice,i) strTemp = strTemp & "," & ARYshoppingcart(cartProductSize,i) strTemp = strTemp & "," & ARYshoppingcart(cartProductID,i) next URL = "/products/checkouttest.asp?info=" & strTemp ' Check if new customer ' CustomerID = Session("CustomerID") ' if CustomerID = 0 then ' new customer ' Response.Redirect "/products/GetCustomer.asp" ' else ' ' First check to ensure that the customer was not removed from the database ' Conn.Open ConnectionString ' Set rs = Conn.Execute( _ ' "select CompanyName FROM Customers where CustomerID = " & CustomerID & _ ' " and ContactFirstName = '" & Session("CustomerFirstName") & "'") ' URL = "/products/shipping.asp" ' If rs.EOF Then ' Session("CustomerID") = -1 ' This means the user WAS in the database at one time, but isn't now ' URL ="/products/GetCustomer.asp" ' End If ' rs.Close ' Conn.Close Response.Redirect URL CASE "Shop for More" For i = 1 to iCount Quantity = Request("Quantity" & CStr(i)) If IsNumeric(Quantity) Then ARYshoppingcart(cartItemQuantity,i) = abs(CLng(Quantity)) Else ARYshoppingcart(cartItemQuantity,i) = 1 End If Next Session("MyShoppingCart") = ARYshoppingcart Response.Redirect "/products/catalog_type.asp?ProductType=" & Request("History") CASE "Recalculate" For i = 1 to iCount Quantity = Request("Quantity" & CStr(i)) If IsNumeric(Quantity) Then ARYshoppingcart(cartItemQuantity,i) = abs(CLng(Quantity)) Else ARYshoppingcart(cartItemQuantity,i) = 1 End If Next For i = 1 to iCount If Request("Confirm" & CStr(i)) = "" 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 Session("MyShoppingCart") = ARYshoppingcart Session("ItemCount") = iCount CASE "Cancel Order" iCount = 0 Session("ItemCount") = iCount Response.Redirect "/products/default.asp" ' End If END SELECT %>
|
AmericanHobbyShop.com Check-Out page
|
|
<% REM Column Span Value %> <% HTML_CS = 5 %> <% HTML_INDENT = FALSE %> |