<% discountInEffect = False discountRate = .10 action = Request("action") If Session("customerid") = "" Then sSQL = "set rowcount 1 select customerID from customerID" set rs = Conn.Execute(sSQL) Session("customerid") = rs("customerID") cid = rs("customerID") rs.Close set rs = Nothing Conn.Execute "update customerID set customerID=customerID+1" Else cid = Session("customerid") End If If ucase(action) = "ADD" Then sSQL = "set rowcount 1 select id from product where sku='" & Request("sku") & "'" set rs = Conn.Execute(sSQL) If Not rs.EOF Then strSQL = "insert into cart (customerid, productid, qty) values ('" & cid & "'," & makeNumeric(rs("id")) & ",1)" Conn.Execute strSQL End If rs.Close set rs = Nothing Elseif action = "Update Quantities" Then i = 1 While Request("id" & i) <> "" If Int(makeNumeric(Request("qty" & i))) = 0 Then Conn.Execute "delete cart where id=" & Request("id" &i) Else Conn.Execute "update cart set qty=" & makeNumeric(Request("qty" & i)) & " where id=" & Request("id" & i) End If i = i + 1 Wend Elseif action = "Empty Cart" Then Conn.Execute "delete cart where customerid='" & cid & "'" Elseif action = "Checkout" Then ' response.redirect "https://www.futurepopshop.com:4753/checkout/shipping.asp?cid=" & cid response.redirect "/tbcheckout/shipframe.asp?cid=" & cid End If %> shopping CART
    <% strSQL = "select count(id) as nCart from cart where customerid='" & cid & "'" set rs = Conn.Execute(strSQL) nCart = rs("nCart") %> <% If Int(nCart) > 0 Then%>
<% End If rs.Close set rs = Nothing %>
       
  <% If nCart = 0 Then %>You have no items in your shopping cart. <% Else %>You have chosen <% = nCart %> item<% If nCart > 1 Then%>s<% End If %> to buy. To delete an item or increase the quantity, just type the change in the QTY box next to the item & hit UPDATE. You can remove all the items by hitting EMPTY CART. CHECKOUT to complete your order or <% End IF %>CONTINUE SHOPPING.
    <% strSQL = "set rowcount 1000 select cart.id, productid, qty, product, title, defSubcategory.subcategory as category, price, inStock from cart inner join (product left join defSubCategory on product.catid=defSubCategory.id) on cart.productid=product.id where customerid='" & cid & "'" set rs = Conn.Execute(strSQL) If Not rs.EOF Then subtotal = 0 i = 1 While Not rs.EOF subTotal = subTotal + (rs("price") * rs("qty")) %> VALUE="<% = rs("id")%>"> <% i = i + 1 rs.MoveNext Wend End If %>
QTY
ITEM PRICE  
TOTAL
"> <% = rs("product") & " - " & rs("title") & " " %> <% = rs("category")%> <% = formatCurrency(rs("price"))%>  
<% = FormatCurrency(rs("price") * rs("qty"))%>
SUBTOTAL
   
<% = formatCurrency(subtotal)%>