%@ 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 *
'* *
'************************************************************
itemid=request("itemid")
error=request("error")
wlistrec=request.querystring("wlistrec")
'newaddqty=request.form("qty")
newaddqty=request("qty")
task=request.form("task")
edititemid=request("edititemid")
chgcartitem=request("chgcartitem")
%>
<%
if error="y" then
errormessage=geterrtext("err47")
end if
if itemid="" or isnull(itemid) or not isnumeric(itemid) then
pdredirect("features.asp")
end if
'Open database get Item details.
set rs=openrs("SELECT * FROM items WHERE active='Yes' AND id=" & itemid)
if rs.EOF then
pdredirect("features.asp")
end if
name=rs("name")
imgresize=rs("imgresize")
if imgresize="ON" then
width="width=150"
else
width=""
end if
price=rs("price")
saleprice=rs("saleprice")
onsale=rs("onsale")
'Determine price to show.
if onsale="Yes" then
theprice=saleprice
else
theprice=price
end if
itemno=rs("itemno")
hideprice=rs("hideprice")
if hideprice="ON" then
hideprice=1
else
hideprice=0
end if
hidehead=rs("hidehead")
if hidehead="ON" then
hidehead=1
else
hidehead=0
end if
if newaddqty="" or isnumeric(newaddqty)=False then
addqty=rs("addqty")
if addqty>1 then
else
addqty=1
end if
else
addqty=newaddqty
end if
largeimage=rs("largeimage")
'If no picture.
if largeimage="" or isnull(largeimage) then
imagefound="no"
else
popimgfile=replace(largeimage, "&",":::")
end if
description=rs("description")
'Determine if item is out of stock.
hidecobutt=0
if rs("qty")<=oosthresh then
if showoos="ON" then
showoosmess="YES"
end if
if stopoos="ON" then
hidecobutt=1
end if
end if
pgvisitson=rs("pgvisitson")
pgvisits=rs("pgvisits")
shortdesc=rs("shortdesc")
custom1=rs("custom1")
custom2=rs("custom2")
custom3=rs("custom3")
imgwrap=rs("imgwrap")
rs.close
set rs=nothing
if pgvisitson="1" then
itemvisits=request.cookies("itemvisits")
if instr(itemvisits,":" & itemid & ":")>0 then
else
Set rsmod = Server.CreateObject("ADODB.Recordset")
on error resume next
rsmod.Open "Select pgvisits From items WHERE id=" & itemid, DB, 1, 3
rsmod("pgvisits") = fixNum(pgvisits) + 1
rsmod.update
rsmod.close
on error goto 0
response.cookies("itemvisits")=itemvisits & ":" & itemid & ":"
set rsmod=nothing
end if
end if
'check to see if item has options.
'Get category info on the item.
set rs=openrs("SELECT id FROM optioncat WHERE itemid=" & itemid)
if not rs.eof then
hasoptions="yes"
end if
rs.close
set rs=nothing
'Set Metatags for this item. Primary storefront keywords are used.
if shortdesc="" or isnull(shortdesc) then
else
sitedesc=server.htmlencode(shortdesc)
end if
if name="" or isnull(name) then
else
title=server.htmlencode(name)
keywords=replace(server.htmlencode(name), " ", ", ") & ", " & keywords
if right(keywords,2)=", " then
keywords=left(keywords,len(keywords)-2)
end if
end if
'Get Cart options/text for this item if editing.
wlist=request("wlist")
if isnumeric(edititemid) and edititemid<>"" then
'Editing Wlist
if wlist="Y" then
cartid=Request.Cookies("customerid")
if cartid="" then
pdredirect("wlistreg.asp")
end if
sqltable="wlistdetail"
'Viewing List
elseif wlist="V" then
cartid=request.querystring("wlistcustid")
sqltable="wlistdetail"
else
cartid=request.querystring("cartid")
sqltable="orderdetail"
end if
set rs=openrs("SELECT * FROM " & sqltable & " WHERE cartid='" & cartid & "' AND subof=" & edititemid)
if cartid<>"" and not rs.eof then
editcartopt="Y"
cartoptid=Array(optid)
cartopttxt=Array(optiontext)
rs.movefirst
while not rs.eof
Addarray cartoptid,rs("optid")
Addarray cartopttxt,rs("optiontext")
rs.movenext
wend
end if
rs.close
set rs=nothing
'If Error was detected while adding or updating item, delete it from cart.
if error="y" then
Set rsmod = Server.CreateObject("ADODB.Recordset")
rsmod.Open "Select * From " & sqltable & " WHERE cartid='" & cartid & "' AND id=" & edititemid, DB, 1, 3
if not rsmod.eof then
rsmod.Delete
end if
rsmod.Close
set rsmod=nothing
Set rs5 = db.Execute("DELETE FROM " & sqltable & " WHERE cartid='" & cartid & "' AND subof=" & edititemid)
set rs5 = nothing
end if
end if
'Define Post URL
if wlist="Y" then
nextposturl=shopurl & "shop/wlistcart.asp"
else
nextposturl=shopcarturl
end if
'function for displaying Item Price Discounts.
function getitemprice()
set rs=openrs("SELECT * FROM itemprices WHERE itemid=" & itemid & " ORDER BY fromqty")
if not rs.eof then
rs.movefirst
while not rs.eof
recid=rs("id")
if rs("method")=0 then
if onsale="Yes" then
showitemprice=rs("saleprice")
else
showitemprice=rs("price")
end if
else
temppct=rs("discpct")
tempper=(theprice * (temppct*.01))
showitemprice=theprice-tempper
end if
tempmessage=rs("message")
if tempmessage="" or isnull(tempmessage) then
tempmessage=rs("fromqty") & " - " & rs("toqty")
else
end if
%>
<%=showCurr(showitemprice) & " (" & tempmessage & ")
"%>
<%
rs.movenext
wend
end if
rs.close
set rs=nothing
end function
zpage=pg6
%>
|