<%@ Language="VBScript" %> <% server.ScriptTimeout =56400 Session("NextURL") = "" Dim SubTotal, SubTotal2 Dim dictCart ' as dictionary Dim sAction ' as string Dim sKey ' as string Dim sItem ' as string Dim DiscQty 'discount qty Set rs = Server.CreateObject ("ADODB.RecordSet") Set rs99 = Server.CreateObject ("ADODB.RecordSet") Set conn = Server.CreateObject("ADODB.Connection") conn.Open DBConn 'create an cart object in the session If IsObject(Session("Cart")) Then Set dictCart = Session("cart") 'use session object Else Set dictCart = Server.CreateObject("Scripting.Dictionary") 'create new cart object End If sAction = CStr(Request("Action")) SubTotal2 = 0 'Application.Lock If sAction <> "" Then If sAction = "add" Then ItemCode = killChars(Request.Form("ItemCode")) ItemCode = ItemCode & Left(killChars(Request.Form("select_length")),2) Qty = killChars(Request.Form("choose_qty")) If ItemCode <> "" Then 'add qty if same item For Each Key In dictCart aryProd = Split(dictCart(Key), "|") 'assign product info into aryProd array If Trim(aryProd(0)) = ItemCode And Qty <> "" Then If sAction = "add" Then Qty = Int(aryProd(1)) + Int(Qty) End If dictCart.Remove Key End If Next If Int(Qty) < 0 Then Qty = 0 sItem = ItemCode & "|" & Qty If Qty <> "0" And Qty <> "" Then Randomize sKey = CStr(Rnd) 'generate a unique key to add 'dictCart.Add sKey, sItem On Error Resume Next dictCart.add sKey, sItem while err.number <> 0 Randomize sKey = CStr(Rnd) err.Clear dictCart.add sKey, sItem wend On Error goto 0 End If End If ElseIf sAction = "checkout" Then ItemCodes = killChars(Request("ItemCode")) Qtys = Request("Qty") aryItemCode = Split (ItemCodes, ",") aryQty = Split (Qtys, ",") dictCart.RemoveAll For i = 0 To UBound(aryItemCode) If trim(aryItemCode(i)) <> "" Then Qty = trim(aryQty(i)) If Int(Qty) < 0 Then Qty = 0 sItem = trim(aryItemCode(i)) & "|" & Qty If Qty <> "0" And Qty <> "" Then Randomize sKey = CStr(Rnd) 'generate a unique key to add 'dictCart.Add sKey, sItem On Error Resume Next dictCart.add sKey, sItem while err.number <> 0 Randomize sKey = CStr(Rnd) err.Clear dictCart.add sKey, sItem wend On Error goto 0 End If End If Next ElseIf sAction = "del" Then sKey = CStr(Request ("KeyID")) 'otherwise use existing key to delete dictCart.Remove sKey ElseIf sAction = "clear" Then dictCart.RemoveAll set Session("Cart")= nothing End If Set Session("cart") = dictCart End If if sAction = "checkout" then If Session("CustID") <> 0 Then Response.Redirect SecureURL & "/checkout1.asp" Else Session("NextURL") = SecureURL & "/checkout1.asp" Response.Redirect SecureURL & "/login.asp" End If end if %> GolfTopSpin.com - Experience the innovative putter TopSpin
My Cart
<%=SuccInfo%>
<% k = 0 If IsObject(Session("Cart")) Then Set dictCart = Session("cart") 'use session object For Each Key In dictCart aryItem = Split(dictCart(Key), "|") 'assign product info into aryProd array tt = "Select i.ixItem, i.ItemCode, i.ItemDesc, i.ItemMaterial, inv.InStock, i.SellPrice2, i.ItemWeight FROM Items i inner join tInventory inv on i.ixItem=inv.ixItem WHERE inv.ixStockArea = 1 and ItemCode = '" & aryItem(0) & "'" response.write tt rs99.Open tt, conn, adOpenStatic, adLockReadOnly if not rs99.EOF then k = k + 1 If k Mod 2 = 0 Then classstr = "odd" Else classstr = "odd" End If if rs99("InStock") < Int(aryItem(1)) then aryItem(1) = rs99("InStock") end if LineAmt = Int(aryItem(1)) * rs99("SellPrice2") SubTotal = SubTotal + LineAmt TotalWeight = TotalWeight + (Int(aryItem(1)) * Csng(rs99("ItemWeight"))) %> "> "> "> <% end if rs99.Close Next Set dictCart = Nothing End If conn.Close Set rs = nothing Set rs2 = nothing Set rs99 = nothing Set conn = nothing %>
X Item Description Quantity Price Amount
Click here to remove this item from cart <%=aryItem(0)%> <%=rs99("ItemDesc")%>
<%=rs99("ItemMaterial")%>
" readonly class="Trans" tabindex="9999">
<% 'if no items in shopping cart... If k = 0 Then show "

 

No items found in your shopping cart.

 

" show "
" End If %> <% End If %>
<% If k > 0 Then %> click  to remove the unwanted item.
Clear all shopping cart items
Sub Total :

<% If k > 0 Then %> <% End If %>