<% Dim conn, rsProd, rsList, strSQL Dim arProd IF Request.ServerVariables("HTTPS")="on" Then Else Response.Redirect("https://www.stephenspeaks.com/cart.asp") End IF Call OpenDB() If Request("cartrow")<>"" THen If IsNumeric(Request("cartrow")) Then strSQL = "DELETE FROM cartrows WHERE idOrder = " & Request.Cookies("cartid") & " AND idcartrow=" & CINT(Request("cartrow")) & "" 'Response.Write(strSQL) conn.Execute strSQL Else 'Response.Write(strSQL) End IF End IF If Request.Form("dowhat")="Checkout" Then Response.Redirect("checkout.asp") End IF Set rsList = Server.CreateObject("ADODB.REcordset") If Request.Cookies("cartid")<>"" Then intCartID=Request.Cookies("cartid") blnIsCart = "Y" strSQL = "SELECT idproduct, quantity FROM cartrows WHERE idOrder = " & intCartID & " " rsList.Open strSQL, conn If Not rsList.EOF Then arCartRows = rsList.GetRows() Else blnIsCart = "N" End If rsList.Close 'REsponse.Write("Cart ID is " & intCartID & "
") strSQL = "SELECT shippingzip FROM carthead WHERE idOrder=" & intCartID & " " rsList.Open strSQL, conn 'Response.Write(strSQL) If Not rsList.EOF Then 'response.Write("There is record") shipzip=rsList("shippingzip") 'Response.Write("
" & shipzip & "
") End If rsList.Close Else ' Create New Cart strSQL = "INSERT INTO carthead(orderdate) VALUES(#" & Now() & "#)" 'Response.Write(strSQL) conn.Execute(strSQL) ' Get the inserted ID strSQL = "SELECT idOrder FROM carthead ORDER BY idOrder DESC" rsList.Open strSQL, conn intCartID = rsList("idOrder") Response.Cookies("cartid") = intCartID rsList.Close ' Response.Write("
" & newCartID & "
") End If ' Get Product Array strSQL = "SELECT productid, productname, productdesc, prodprice, prodxtra, sku, shipfee FROM product ORDER BY productid ASC" 'Response.Write(strSQL & "
") rsList.Open strSQL, conn IF not rsList.EOF THen arProd = rsList.GetRows() ENd IF rsList.Close Function CheckAlbumID(albumid) End Function Function CheckID(prodid) strCheck="NONE" For i = 0 to UBOUND(arProd, 2) If CINT(arProd(0,i))=CINT(prodid) Then strCheck=arProd(1,i) & "|" & arProd(3,i) & "|" & arProd(0,i) & "|" & arProd(5,i) & "|" & arProd(6,i) End IF Next CheckID=strCheck End Function If Request.Form("dowhat")="add" Then strChck = CheckID(Request.form("prodid")) intQty = CINT(Request.Form("quantity")) If strChck<>"NONE" THen ' Insert into cart arChk = Split(strChck, "|") strProdName=arChk(0) intprice = arChk(1) intProdID = arChk(2) strSKU = SQLClean(arChk(3)) intWeight = arChk(4) strSQL = "INSERT INTO cartrows(idOrder, idProduct, description, quantity, unitprice, handlingfee, sku) VALUES(" & intCartID & ", " & intProdID & ", '" & SQLClean(strProdName) & "', " & intQty & ", " & intprice & ", " & intWeight & ", '" & strSKU & "') " conn.Execute strSQL Else Response.Redirect("list_items.asp") End IF ' check id exists End IF If Request.Form("dowhat")="add album" Then Response.Write("

WE ADD ALBUM HERE " & Request("albumid") & "

") strSQL = "SELECT albumid, productname, productdesc, prodphoto, prodthumb, prodprice, prodxtra, shipfee, sku, pricetype, outlink1, outlink2, outlink3 FROM albums p ORDER BY productname ASC " Set rsProd = Server.CreateObject("ADODB.Recordset") rsProd.Open strSQL, conn IF Not rsProd.EOF THen noArray=0 arAlbum=rsProd.GetRows() Else noArray=1 End If rsProd.Close If noArray=0 Then For a = 0 to UBOUND(arAlbum, 2) if CInt(Request("albumid"))=CINT(arAlbum(0,a)) Then downloadcode = generatePassword(len(arAlbum(1,a))) ' Insert into cart intQty = 1 strProdName= arAlbum(1,a) if arAlbum(9,a)="minimum" Then If Isnumeric(Request("nyp")) Then If Request("nyp")>arAlbum(5,a) Then intprice=Cdbl(Request("nyp")) Else intprice = 0 End IF Else intprice = arAlbum(5,a) End IF else intprice = arAlbum(5,a) end if intProdID = arAlbum(0,a) intWeight = 0 strSQL = "INSERT INTO cartrows(idOrder, idProduct, description, quantity, unitprice, handlingfee, prodtype, downloadcode) " _ & "VALUES(" & intCartID & ", " & intProdID & ", '" & SQLClean(strProdName) & "', " & intQty & ", " & intprice & ", " & intWeight & ", '" & arAlbum(9,a) & "', '" & SQLClean(downloadcode) & "') " conn.Execute strSQL end if Next Else Response.Redirect("music.asp") End IF End IF If Request.Form("dowhat")="Update Cart" Then IF Request("shipzip")<>"" Then strSQL = "SELECT state FROM zipcodes WHERE zip='" & SQLClean(Request("shipzip")) & "' " rsList.Open strSQL, conn If Not rsList.EOF Then strShipState = rsList("state") Else strShipState = "" End If rsList.Close shipzip=Request("shipzip") 'REsponse.WRite("||" & strShipState & "||") If strShipState="OK" Then strSQL = "UPDATE carthead SET taxrate=0.0625,shippingzip='" & SQLClean(Request("shipzip")) & "' WHERE idOrder=" & intCartID & " " intTax=0.0625 Else strSQL = "UPDATE carthead SET taxrate=0,shippingzip='" & SQLClean(Request("shipzip")) & "' WHERE idOrder=" & intCartID & " " intTax = 0 End If conn.Execute strSQL End IF strSQL = "SELECT idCartRow,quantity, description, sku, unitprice, idproduct, handlingfee FROM cartrows WHERE idOrder = " & intCartID & " " rsList.Open strSQL, conn If Not rsList.EOF Then arCartRows = rsList.GetRows() Else blnIsCart = "N" End If rsList.Close If blnIsCart = "N" Then Else For i = 0 to UBOUND(arCartRows, 2) If Request.Form("quant_" & arCartRows(0,i))="0" THen strSQL = "DELETE FROM cartrows WHERE idcartrow=" & arCartRows(0,i) & " " conn.Execute strSQL Else If IsNumeric(Request.Form("quant_" & arCartRows(0,i))) Then If CInt(Request.Form("quant_" & arCartRows(0,i))) Then strSQL = "UPDATE cartrows SET quantity=" & Request.Form("quant_" & arCartRows(0,i)) & " WHERE idCartRow=" & arCartRows(0,i) conn.Execute strSQL End IF End IF End IF Next End If End IF strSQL = "SELECT idCartRow, quantity, description, sku, unitprice, idproduct, handlingfee, downloadcode, prodtype FROM cartrows WHERE idOrder = " & intCartID & " " rsList.Open strSQL, conn If Not rsList.EOF Then arCartRows = rsList.GetRows() blnIsCart = "Y" Else blnIsCart = "N" End If rsList.Close totalShipPrice = 0 mySQL="SELECT a.idCartRow, a.quantity, handlingfee " _ & "FROM cartRows a " _ & "WHERE a.idOrder = " & intCartID & " " rsList.Open strSQL, conn do while not rsList.EOF 'Response.Write(rsList("handlingfee") & "}:" & rsList("quantity") & "
") intHFee = rsList("handlingfee") if Trim(intHFee)="" THen intHFee=0 End IF 'totalShipPrice = Cdbl(totalShipPrice + cartTotal(idOrder,rsList("idCartRow"))) totalShipPrice = Cdbl(totalShipPrice + (CInt(rsList("quantity"))*intHFee)) 'totalShipItems = Cdbl(totalShipItems + rsList("quantity")) rsList.MoveNext loop rsList.Close strSQL = "UPDATE carthead SET handlingfeetotal=" & totalShipPrice & " WHERE idOrder = " & intCartID & " " conn.Execute strSQL 'Current API Login ID: 4F6R3vD6Kgnv 'Current Transaction Key: 4rsvD563G6DgB5vC %> Shop Shirts, Music and More - Stephen Speaks

Age of the Underdog - Album Release

your shopping cart

<% If blnIsCart = "N" Then %> <% Else intTotal = 0 For i = 0 to UBOUND(arCartRows, 2) intTotal = intTotal + (arCartRows(1,i)*arCartRows(4,i)) ' idproduct, quantity, description, sku, unitprice Response.Write("" & vbCrLf) Else Response.Write("" & vbCrLf) End IF Response.Write("") Next End IF %>
QUANTITY DESCRIPTION UNIT PRICE ITEM TOTAL REMOVE
Your Cart Is Empty
") If arCartRows(7,i)<>"" Then Response.Write("" & arCartRows(2,i) & " ") Response.Write(FormatCurrency(arCartRows(4,i)) & " " & FormatCurrency(arCartRows(1,i)*arCartRows(4,i)) & "Remove