%@ 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 2005. *
'* www.pagedowntech.com *
'* *
'************************************************************
%>
<%
sDBExtraPath = "../"
sExtraTemplatePath = "../"
sCurrentPage = "products"
%>
<%
public opttexterror
cartid = Request.cookies("cartid")
orderid=request.cookies("orderid")
buygc=request.cookies("buygc")
fromrev=request("fromrev")
refer=request("refer")
itemid=request("itemid")
qty=request("qty")
recid=request("recid")
optaid=request("optaid")
optbid=request("optbid")
optcid=request("optcid")
catcount=request("catcount")
updatedisc=request("updatedisc")
affillink=request.cookies("affillink")
tempsubtotal=request.form("tempsubtotal")
delcartitem=request.form("chgcartitem")
updatedisc2=request("updatedisc2")
updategift=request.form("updategift")
task=request.form("task")
'If adding to cart using link
if task="" then
tasktemp=request.querystring("task")
if tasktemp="" then
else
task=tasktemp
addvialink="Y"
end if
end if
'Check if adding via Javascript QuickAdd function.
if task="quickadd" then
task="addnew"
addvialink="Y"
end if
'Check new additions to cart for errors
if task="remove" then
response.write(recid)
response.write(task)
'response.end
end if
'Get Discount Codes
discamt=request.cookies("discamt")
discpct=request.cookies("discpct")
if updatedisc="Y" then
disccode=request.form("disccode")
else
disccode=request.cookies("disccode")
end if
if discamt="" then discamt=0 end if
if discpct="" then discpct=0 end if
'Get Gift Certificate
giftcode=request.cookies("giftcode")
giftamt=request.cookies("giftamt")
if giftamt="" then giftamt=0
'Check for cart session id, if none then create one.
if cartid="" 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
'Get Affiliate ID
affillink=request.cookies("affillink")
if affillink="" or isnull(affillink) then
affillink=request.form("affillink")
if affillink<>"" then
response.cookies("affillink")=affillink
response.cookies("affillink").expires=DateAdd("d", 365, Date)
end if
affillink=request.querystring("affillink")
if affillink<>"" then
response.cookies("affillink")=affillink
response.cookies("affillink").expires=DateAdd("d", 365, Date)
end if
end if
if task="remove" then
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open "Select * From orderdetail WHERE cartid='" & cartid & "' AND id=" & recid, DB, 3,1
if not rs2.eof then
giftid=rs2("giftid")
end if
rs2.Close
set rs2=nothing
Set rs6 = db.Execute("DELETE From orderdetail WHERE cartid='" & cartid & "' AND id=" & recid)
set rs6 = nothing
Set rs5 = db.Execute("DELETE FROM orderdetail WHERE cartid='" & cartid & "' AND subof=" & recid)
set rs5 = nothing
if giftid>0 then
Set rs5 = db.Execute("DELETE FROM giftcert WHERE id=" & giftid & " AND code='" & cartid & "'")
set rs5 = nothing
end if
pdredirect(shopcarturl)
end if
'If adding.
if task="addnew" then
%>
<%
end if
'If item is changed.
if task="update" then
%>
<%
end if
'Check if cart items require shipping.
if cartid="" or isnull(cartid) then
response.cookies("mustship")=""
else
set rs=openrs("SELECT id FROM orderdetail WHERE cartid='" & cartid & "' AND digital='' AND itemno>0 OR cartid='" & cartid & "' AND digital IS NULL AND itemno>0")
if not rs.eof then
response.cookies("mustship")="Y"
mustship="Y"
else
response.cookies("mustship")=""
mustship=""
end if
rs.close
set rs=nothing
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"
else
checkoutlink=refer
end if
End If
'Check for Gift Certificates in cart.
if buygc="Y" then
set rs=openrs("SELECT * FROM orderdetail WHERE giftid>0 AND cartid='" & cartid & "'")
if not rs.eof then
hasgcincart="Y"
if giftcode<>"" then
updategift="Y"
end if
if disccode<>"" then
updatedisc="Y"
end if
end if
rs.close
set rs=nothing
end if
'Apply Gift Certificate
if updategift="Y" then
%>
<%
end if
'Discounts.
if updatedisc="Y" then
%>
<%
end if
'Get Cart contents
%>
<%
'Check for Inventory Errors
if inverror="Y" then
message=geterrtext("err3")
end if
'Set page columns.
zpage=pg9
%>
<% getleftside(zpage)%>
<% getsecspace ()%>
<% getHeading "heads3", heads3, "", 2 %>
cellpadding="5" cellspacing="0" width="100%">
| <%=fixERR(message)%> |
|
|
<% getrightside(zpage)%>