%Option Explicit%> <% '****************************************************************** ' Version 3.0 ' This routine should not be changed by you. ' This routine handles all the database work ' To change product displays go to shopproductformat.asp. ' ' Logic ' if search is specified then sql is in session variable ' otherwise generated from ' id = category id the number in the database ' cat is a category name ' Product=name product name. cannot be used with id or cat ' l3= sub sub category ' l4= sub sub category ' l5= sub sub category ' page=x ' used when recusrsively called to display next page ' search=yes ' used when someone else created sql such as search.asp ' ' then sql in session variable SQL ' if xstockLow is set, then product will not display if stock limit has been reached ' Now support sub sub categories '****************************************************************** 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 ProdIndex Dim level3, level4, level5 ProductSelect=ucase(xProductSelect) SetSess "CurrentUrl","shopdisplayproducts.asp" ShopOpenDataBase dbc mypage=request.querystring("page") mypagesize=xProductsPerPage ' 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 end if ' Process first time Sub ProcessFirst() CAT_ID = Request("id") ' category 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 LEVEL3=Request("L3") LEVEL4=Request("L4") LEVEL5=Request("L5") end sub ' Sub CreateSQL() search=Request.querystring("Search") if search<>"" then SQL=GetSess("SQL") exit sub end if Sql = "select * from Products WHERE " if CAT_ID <> "" then sql = sql & " ccategory = " & cat_id else If catalogid<>"" Then sql = sql & " catalogid = " & catalogid else if Productname="" then sql = sql & "category LIKE '"& CATEGORY & "%'" else sql = sql & "cname LIKE '"& PRODUCTNAME & "%'" end if end if end if If Subcat<> "" then sql = sql & " AND SubcategoryID=" & Subcat end if If Level3<>"" then sql=sql & " AND Level3 LIKE '%" & LEVEL3 & "%'" end if If Level4<>"" then sql=sql & " AND Level4 LIKE '%" & LEVEL4 & "%'" end if If Level5<>"" then sql=sql & " AND Level5 LIKE '%" & LEVEL5 & "%'" end if if xstocklow<>"" then lngCStock= clng(xStockLow) Sql = sql & " AND cStock> " & lngCStock end if sql = sql & " Order By " & xsortproducts 'debugwrite sql end sub ' ****** Display Products Sub DisplayProducts() Dim header Dim recordcount dim words dim wordcount dim i dim msg dim rc header=Prodheaderfont & "" If category <> "" Then header = header & Category else header= header & LangProduct01 End If header = header & "" ShopOpenDatabase dbc ShopOpenRecordSet SQL,objRS, mypagesize, mypage if objRS.eof then objRS.Close set objRS=nothing ShopCloseDatabase dbc exit sub end if recordcount=0 If ProductSelect="YES" then Response.Write("
") end if objRS.Close set objRS=nothing ShopCloseDatabase dbc end sub %>|
© All Rights Reserved |
Cookie
Flavors | Cookie Pizzas Cookie Gift Packs | College Gift Packs |