%Option Explicit%>
<%
'******************************************************************
' Version 4.50 June 2, 2002
' filtering two sort fields and no display fields
' Main program logic for displaying products.
' actual formatting is done in shopproductformat or shopproductformat_withhtml
'******************************************************************
dim search
Dim dbc
Dim PRODUCTNAME, CATALOGID
Dim ProductFields ' fields being displayed in order
Dim ProductCaptions ' Product column captions
Dim ProductFieldCount ' count of fields
Dim ProductSelect
Dim level3, level4, level5
Dim Colcount, totalcolcount
dim ProductMaxColumns, Productwithhtml
' Mod
dim yfieldnames,Sortnames, yfieldcount, sortcount
dim displayfields, displayfieldcount, displaycaptions
dim sortcaptions, yfieldcaptions
dim sortupdownnames(3),sortupdownvalues(3), sortupdowncount
dim sortfield, sortupdown, selectfield, i
dim sortfield2, sortupdown2
' end mod
'*****************************************************
' open database and see if we are doing with html or not
' See if this is a next page request or first time
'******************************************************
shopopendatabase dbc
ProductmaxColumns=Getconfig("xproductcolumns")
ProductwithHtml=Getconfig("xProductwithhtml")
If productmaxcolumns="" then
productmaxcolumns=1
end if
productmaxcolumns=clng(productmaxcolumns)
If Productmaxcolumns>1 then
Productwithhtml="Yes"
end if
ProductSelect=getconfig("xProductSelect")
SetSess "CurrentUrl","shopdisplayproducts.asp"
mypage=request.querystring("page")
mypagesize=getconfig("xProductsPerPage")
If getconfig("xproductfiltering")="Yes" then
GetFilteringfields
SetupFiltering
end if
' If there is no page, then we must generate sql otherwise sqlis in Session(sqlQuery)
if mypage= "" then
mypage=1 ' first time through
ProcessFirst ' get input variables
CreateSql ' generate sql
else
sql=GetSess("sqlquery") ' on recursive calls we stored sql in sessikon variable
Category=GetSess("Category") ' see what previous one was
Subcat=getsess("Subcat")
cat_id=getsess("Cat_id")
' GetFilteringfields
end if
ShopPageHeader ' normal page header
DisplayProducts ' display products
ShopPageTrailer ' normal trailer
shopclosedatabase dbc
' Process first time
Sub ProcessFirst()
CAT_ID = Request("id") ' category id
If not isnumeric(CAT_ID) then CAT_ID=""
CATEGORY = Request("cat") ' category name
SUBCAT=Request("subcat") ' subcategory id
PRODUCTNAME=Request("PRODUCT") ' product name
CATALOGID=Request("CATALOGID") ' catalogid
SetSess "Category",CATEGORY 'remember category see what previous one was
setsess "Subcat",subcat
setsess "cat_id",cat_id
LEVEL3=Request("L3")
LEVEL4=Request("L4")
LEVEL5=Request("L5")
end sub
'
'*******************************************************
' product loop logic is here
' Put out headers, category image, open recordset
' SQL already exists so we simply loop through the products
'********************************************************
Sub DisplayProducts()
Dim header
Dim recordcount
dim words
dim wordcount
dim i
dim msg
dim rc, url, stayonpage
header=Prodheaderfont & ""
If category <> "" Then
header = header & Category
else
header= header & LangProduct01
End If
header = header & ""
response.write header
ShowCategoryImage
'debugwrite sql
ShopOpenRecordSet SQL,objRS, mypagesize, mypage
if objRS.eof then
objRS.Close
set objRS=nothing
response.write "
" & getconfig("xfont") & langProductSearch & ""
exit sub
end if
recordcount=0
response.write "
" & getconfig("xfont") & LangCommonPage & mypage & LangCommonOf & maxpages & "" If ProductSelect="Yes" then Response.Write("
" end if response.write("") end if if getconfig("xproductpagingnextprevious")="Yes" then PageNavBarNext SQL else PageNavBar SQL end if objRS.Close set objRS=nothing If getconfig("xproductfiltering")="Yes" then DisplayFiltering end if end sub '****************************** ' Sub ShowCategoryImage ' ===================== ' If DisplayCategoryImages is set to Yes ' Displays the CatImage if there are not subcategories ' Displays the SubCatImage if there is '****************************** Sub ShowCategoryImage Dim ImageFileName Dim rs Dim query imagefilename="" If getconfig("xDisplayCategoryImages") <> "Yes" Then exit sub If SubCat="" and cat_id="" then exit sub If subcat<>"" Then query = "select subcatimage from subcategories where subcategoryid = " & subcat query=query & " AND categoryid=" & cat_id set rs = dbc.execute(query) If not rs.EOF Then ImageFileName = rs("SubCatImage") if isnull(imagefilename) then imagefilename="" end if end if rs.close set rs=nothing end if if imagefilename="" then query = "select catimage from categories where categoryid = " & cat_id set rs = dbc.execute(query) If not rs.EOF Then imagefilename = rs("catimage") if isnull(imagefilename) then imagefilename="" end if end if rs.close set rs=nothing End if If ImageFileName="" then exit sub %>