<%@ Language=VBScript %><% '************************************************************ '* * '* By Downloading or using this software, you agree to * '* the terms and conditions as stated in the Software * '* License Agreement. An updated copy of this agreement * '* can be seen at http://www.pagedowntech.com/terms. * '* * '* NOTICE: We do not recommend changing the code below * '* as it may interfere with future updates/upgrades. * '* * '* PageDown Technology, LLC., Copyright 2004. * '* www.pagedowntech.com * '* * '************************************************************ %> [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] <% cartid = Request.Cookies("cartid") fromrev=request("fromrev") refer=request("refer") itemid=request("itemid") qty=request("qty") task=request("task") recid=request("recid") optaid=request("optaid") optbid=request("optbid") optcid=request("optcid") 'Check new additions to cart for errors if task="addnew" then if isNumeric(qty)=False then response.redirect("item.asp?error=y&itemid=" & itemid) else if qty<1 then response.redirect("item.asp?error=y&itemid=" & itemid) end if end if 'Check for cart session id, if none then create one. if cartid="" and task<>"" then Randomize Dim MyNum temp1 = replace(Time, " ", "") temp1 = replace(temp1, ":", "") temp2 = replace(date, " ", "") temp2 = replace(temp2, "/", "") temp2 = replace(temp2, ".", "") cartid = temp2 & temp1 & Int((9999999999- 5 + 1) * Rnd + 5) Response.Cookies("cartid")= cartid end if 'If carrier already setup, and user is adding items, remove carrier so they can reselect it. carrier=request.cookies("carrier") if task<>"" then Response.cookies("carrier")="redo" carrier="redo" end if 'Determine what link will be used for "checkout" button (fromrev is from order review). if fromrev="yes" then checkoutlink="orderreview.asp?refer=" & refer Else if refer="" or refer=NULL then checkoutlink="checkout1.asp?cartid=" & cartid & "&carrier=" & carrier else checkoutlink=refer & "?cartid=" & cartid & "&carrier=" & carrier end if End If 'If new item is added to cart. if task="addnew" then 'SQL checks call checksqln(itemid) set rs=opendb("SELECT * FROM items WHERE id=" & itemid) if NOT rs.EOF then itemweight=rs("weight") onsale=rs("onsale") if onsale="Yes" then price=rs("saleprice") else price=rs("price") end if 'Calculate changes due to Option A selected. if isnumeric(optaid) then if optaid>0 then set rs2=openrs2("SELECT * FROM itemopt WHERE id=" & optaid) optiondesc=optiondesc & rs2("name") if rs2("pricecalc")=1 then price=price + rs2("price") if rs2("pricecalc")=2 then price=price - rs2("price") if rs2("weightcalc")=1 then itemweight=itemweight + rs2("weight") if rs2("weightcalc")=2 then itemweight=itemweight - rs2("weight") rs2.close set rs2=nothing end if end if 'Calculate changes due to Option B selected. if isnumeric(optbid) then if optbid>0 then set rs2=openrs2("SELECT * FROM itemopt WHERE id=" & optbid) if len(optiondesc)>0 then optiondesc=optiondesc & ", " optiondesc=optiondesc & rs2("name") if rs2("pricecalc")=1 then price=price + rs2("price") if rs2("pricecalc")=2 then price=price - rs2("price") if rs2("weightcalc")=1 then itemweight=itemweight + rs2("weight") if rs2("weightcalc")=2 then itemweight=itemweight - rs2("weight") rs2.close set rs2=nothing end if end if 'Calculate changes due to Option C selected. if isnumeric(optcid) then if optcid>0 then set rs2=openrs2("SELECT * FROM itemopt WHERE id=" & optcid) if len(optiondesc)>0 then optiondesc=optiondesc & ", " optiondesc=optiondesc & rs2("name") if rs2("pricecalc")=1 then price=price + rs2("price") if rs2("pricecalc")=2 then price=price - rs2("price") if rs2("weightcalc")=1 then itemweight=itemweight + rs2("weight") if rs2("weightcalc")=2 then itemweight=itemweight - rs2("weight") rs2.close set rs2=nothing end if end if if len(optiondesc)>0 then optiondesc="Options: " & optiondesc end if rs.close set rs=nothing Set rsmod = Server.CreateObject("ADODB.Recordset") rsmod.Open "Select * From orderdetail", DB, 1, 3 rsmod.AddNew rsmod("cartid") = cartid rsmod("itemno") = itemid rsmod("price") = saveCurr(price) rsmod("qty") = saveNum(qty) rsmod("weight") = saveNum(itemweight) rsmod("optiondesc") = optiondesc rsmod.Update rsmod.Close set rsmod=nothing end if 'If item is changed. if task="update" then 'SQL checks call checksqln(recid) call checksqlt(cartid) Set rsmod = Server.CreateObject("ADODB.Recordset") rsmod.Open "Select * From orderdetail WHERE cartid='" & cartid & "' AND id=" & recid, DB, 1, 3 if not rsmod.eof then rsmod("qty") = saveNum(qty) rsmod.Update else message="Item is no longer in your cart!" end if rsmod.Close set rsmod=nothing end if 'If item is deleted. if task="remove" then 'SQL checks call checksqln(recid) call checksqlt(cartid) Set rsmod = Server.CreateObject("ADODB.Recordset") rsmod.Open "Select * From orderdetail WHERE cartid='" & cartid & "' AND id=" & recid, DB, 1, 3 if not rsmod.eof then rsmod.Delete else message="Item not found, or already deleted!" end if rsmod.Close set rsmod=nothing end if %> [an error occurred while processing this directive]
<% getHeading "Checkout Help", "", "comess" %>
<% getHeading "Shopping Cart", "", "" %>
Once you are ready to checkout, click the checkout button below to begin the order process.  You may also alter the quantity.
<%=formerror%>
     
 
SHOPPING CART CONTENTS:
<% 'Display users shopping cart. set rs=opendb("SELECT * FROM orderdetail WHERE cartid='" & fixAP(cartid) & "'") totalqty=0 subtotal=0 if cartid<>"" and not rs.eof then rs.movefirst while not rs.eof itemid=rs("itemno") price=rs("price") itemoptdesc=rs("optiondesc") itemweight=rs("weight") pricefixed=showCurr(price) qty=rs("qty") itemsub=showCurr(price*qty) if qty>1 then nexttask="update" else nexttask="remove" end if recid=rs("id") 'Get item name. set rs2=openrs2("SELECT * FROM items WHERE id=" & itemid) if NOT rs2.EOF then itemno=rs2("itemno") itemname=rs2("name") end if rs2.close set rs2=nothing %>
 
<%=itemname%>
<% showbutton "More", "showcart.asp?recid=" & recid & "&qty=" & qty+1 & "&task=update&fromrev=" & fromrev & "&refer=" & refer, "" %> <% showbutton "Less", "showcart.asp?recid=" & recid & "&qty=" & qty-1 & "&task=" & nexttask & "&fromrev=" & fromrev & "&refer=" & refer, "" %> <% 'showbutton "X", "showcart.asp?recid=" & recid & "&task=remove&fromrev=" & fromrev & "&refer=" &refer, "" %>
<%=itemno%> <%=qty%> @ <%=pricefixed%> /ea.
<%=itemoptdesc%>
<% subtotal=subtotal+(price*qty) totalqty=totalqty+qty rs.movenext wend else cartempty="yes" end if rs.close set rs=nothing 'Calculate taxes for order. taxtotal=(subtotal * (salestax*.01)) 'Calculate grand total. grandtotal=subtotal + carrierrate + taxtotal %>
 
   <% if cartempty="yes" then%>
Your Shopping Cart is empty.
<% end if %>
 
 
 
 
     
Subtotal:   <%=showCurr(subtotal)%>
Total Items:   <%=totalqty%>
 
     
     
  <% showbutton "Checkout", shopsslurl & "shop/" & checkoutlink,"" %>
Or, you can...

<% showbutton "Keep Shopping", shopurl & "shop/","" %>
 
     
 
To continue without making changes, click here.
[an error occurred while processing this directive]