<%Dim sSQL,rs,alldata,cnn,rowcounter,success,startlink,secdesc
theid=Trim(Replace(Request.QueryString("id"),"'",""))
if Trim(Replace(Request.QueryString("cat"),"'",""))<>"" then theid=Trim(Replace(Request.QueryString("cat"),"'",""))
if theid="" OR theid="ALL" OR NOT IsNumeric(theid) then theid="0"
if explicitid<>"" AND IsNumeric(explicitid) then theid=explicitid
if NOT IsNumeric(categorycolumns) OR categorycolumns="" then categorycolumns=1
cellwidth = Int(100/categorycolumns)
if usecategoryformat=3 then
afterimage="
"
beforedesc=""
elseif usecategoryformat=2 then
afterimage=""
beforedesc=""
else
usecategoryformat=1
afterimage=""
beforedesc="
"
end if
border=0
if IsEmpty(catseparator) then catseparator = " "
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
Session("frompage")=Request.ServerVariables("URL")&IIfVr(Trim(Request.ServerVariables("QUERY_STRING"))<>"","?","")&Request.ServerVariables("QUERY_STRING")
tslist = ""
thetopts = theid
topsectionids = theid
for index=0 to 10
if thetopts=0 then
if theid="0" then
tslist = xxHome & " " & tslist
else
tslist = ""&xxHome&" " & tslist
end if
exit for
elseif index=10 then
tslist = "Loop" & tslist
else
sSQL = "SELECT sectionID,topSection,sectionName,rootSection FROM sections WHERE sectionID=" & thetopts
rs.Open sSQL,cnn,0,1
if NOT rs.EOF then
if rs("sectionID")=Int(theid) then
tslist = " » " & rs("sectionName") & tslist
elseif rs("rootSection")=1 then
tslist = " » " & rs("sectionName") & "" & tslist
else
tslist = " » " & rs("sectionName") & "" & tslist
end if
thetopts = rs("topSection")
topsectionids = topsectionids & "," & thetopts
else
tslist = "Top Section Deleted" & tslist
rs.Close
exit for
end if
rs.Close
end if
next
if theid="0" then
tslist = tslist & " » "&xxAlProd&""
else
tslist = tslist & " » "&xxAlProd&""
end if
sSQL = "SELECT sectionID,sectionName,rootSection,sectionImage,sectionOrder,sectionDescription FROM sections WHERE topSection=" & theid & " ORDER BY sectionOrder"
rs.Open sSQL,cnn,0,1
if rs.eof or rs.bof then
success=false
mess1 = " " & xxNoCats
else
alldata=rs.getrows
success=true
mess1 = xxClkPrd & " "
end if
rs.Close
if (usecategoryformat=1 OR usecategoryformat=2) then numcolumns=2*categorycolumns else numcolumns=categorycolumns
%>
| 1 then response.write " colspan='"&numcolumns&"'"%>>
<%=mess1%> |
<%
tdt = Date()
if noshowdiscounts<>true then
if theid="0" then
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons WHERE (cpnSitewide=1 OR cpnSitewide=2) AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&DatePart("m",tdt) & "/" & DatePart("d",tdt) & "/" & DatePart("yyyy",tdt)&datedelim&" AND cpnIsCoupon=0"
else
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE ((cpnSitewide=0 AND cpaType=1 AND cpaAssignment IN ('"&Replace(topsectionids,",","','")&"')) OR cpnSitewide=1 OR cpnSitewide=2) AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&DatePart("m",tdt) & "/" & DatePart("d",tdt) & "/" & DatePart("yyyy",tdt)&datedelim&" AND cpnIsCoupon=0"
end if
rs.Open sSQL,cnn,0,1
if NOT rs.EOF then %>
| 2 then response.write " colspan='"&numcolumns&"'"%>>
<%=xxDsCat%>
<% do while NOT rs.EOF
response.write rs("cpnWorkingName") & " "
rs.MoveNext
loop %> |
<% end if
rs.Close
end if
response.write " "
if success then
response.write ""
if allproductsimage<>"" then response.write " " & afterimage & " | "
response.write ""
response.write " " & tslist & " "
response.write "" & xxAlPrCa & catseparator & " "
response.write " | " & vbCrLf
response.write " 1,0,innertablespacing)&""" cellpadding="""&IIfVr(usecategoryformat=1 AND categorycolumns>1,0,innertablepadding)&""" bgcolor="""&innertablebg&""">"
tdt = Date()
columncount=0
FOR rowcounter= 0 TO ubound(alldata,2)
if alldata(2,rowcounter)=0 then
startlink=""
else
startlink=""
end if
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE cpnSitewide=0 AND cpnNumAvail>0 AND cpnEndDate>="&datedelim&DatePart("m",tdt) & "/" & DatePart("d",tdt) & "/" & DatePart("yyyy",tdt)&datedelim&" AND cpnIsCoupon=0 AND cpaType=1 AND cpaAssignment='"&alldata(0,rowcounter)&"'"
alldiscounts = ""
if noshowdiscounts<>true then
rs.Open sSQL,cnn,0,1
do while NOT rs.EOF
alldiscounts = alldiscounts & rs("cpnWorkingName") & " "
rs.MoveNext
loop
rs.Close
end if
secdesc = Trim(alldata(5,rowcounter))
noimage = (Trim(alldata(3,rowcounter))="" OR IsNull(alldata(3,rowcounter)))
if columncount=0 then response.write ""
if usecategoryformat=1 AND categorycolumns>1 then response.write ""
if (usecategoryformat=1 OR usecategoryformat=2) AND NOT noimage then
cellwidth = cellwidth - 5
response.write "" & startlink&" " & afterimage & " | "
end if
response.write "1,95,cellwidth) & "%""" & IIfVr((usecategoryformat=1 OR usecategoryformat=2) AND noimage," colspan='2'","") & ">"
if (usecategoryformat=1 OR usecategoryformat=2) AND NOT noimage then cellwidth = cellwidth + 5
if usecategoryformat<>1 AND usecategoryformat<>2 AND NOT noimage then response.write startlink&" " & afterimage
response.write ""&startlink&alldata(1,rowcounter)&""&xxDot&""
if alldiscounts<>"" then response.write " "&xxDsApp&" " & alldiscounts & ""
if secdesc <> "" then response.write " " else response.write catseparator & ""
if secdesc <> "" then response.write beforedesc & "" & secdesc & catseparator & " "
response.write " | " & vbCrLf
if usecategoryformat=1 AND categorycolumns>1 then response.write "
| "
columncount = columncount + 1
if columncount=categorycolumns then
response.write " "
columncount=0
end if
next
if columncount0 then
do while columncount "
columncount = columncount + 1
loop
response.write ""
end if
end if
cnn.Close
response.write " "
response.write "![]() | "
%>
|
|