%option explicit%> <% '**************************************************************** ' VP-ASP Display shop categories ' displays a list of categories from Shopping Database ' Version 6.50 ' Support images for each category and multiple columns per listing ' Now allows product displays or subcategory displays ' Sub hide for categories ' add template handling ' July 5, 2004 ' April 26, 2005 ad translate facility ' Dec 31, 2005 put back 6.50 category template formatting '**************************************************************** dim colcount, ycatmaxcolumns, totalcolumncount Dim strcatImage dim lngcatid 'dim strcategory dim strcathide Dim Mylink, dbc dim highercategoryid dim strcatmemo, strcatextra,strcatproducttemplate '********************************************************** ' main program flow '************************************************************ setsess "currenturl","shopdisplaycategories.asp" highercategoryid=request("id") If not isnumeric(highercategoryid) then highercategoryid="" end if if highercategoryid="" then highercategoryid=0 end if InitializeSystem ShopOpenDatabaseP dbc CheckDatabaseOpen dbc ycatmaxcolumns=clng(getconfig("xcatmaxcolumns")) SetupdynamicCategory dbc, highercategoryid ShopPageHeader ' Page header for shop CategoryHeader ' category header on this page Showcategories ' format categories on this page ShopCloseDatabase dbc ShopPageTrailer ' shop page trailer '*************************************************************** ' Format all categories ' generate SQL ' loop through all categories found '***********************************************************' ' Show Categories Sub ShowCategories() Dim rs dim categoryid colcount=0 totalcolumncount=0 SQL="Select * from categories " sql = Sql & " where highercategoryid=" & highercategoryid if getconfig("xproductmatch")="Yes" then 'VP-ASP 6.50 - enhanced product matching 'sql=sql & " and (productmatch='" & xproductmatch & "' or productmatch='' or productmatch is null)" sql=sql & " and " generateProductmatchsqlsubscat sql ' in shopproductsubs end if '*********************************************************** ' VPASP 600 ' Use customer matching in same was as shopdisplayproducts.asp '***********************************************************' if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then sql=sql & " and (customermatch like '%" & getsess("customerProductgroup") & "%'" sql=sql & " or customermatch is null)" else sql=sql & " and customermatch is null" end if end if '***********************************************************' Handle_selectcategoriesbylanguage sql=sql & " order by " & Getconfig("xsortcategories") OpenRecordSet dbc, rs, sql While Not rs.EOF categoryid=rs("categoryid") strcatmemo=rs("catmemo") strcatextra=rs("catextra") lngcatid=rs("categoryid") strcategory=rs("catdescription") strsubcategory=rs("hassubcategory") strcatimage=rs("catimage") ' image strcathide=rs("cathide") ' hide field strcatproducttemplate = rs("catproducttemplate") if isnull(strcathide) then 'VP-ASP 6.09 - change to use lang variable strcathide=trim(lcase(getlang("langcommonno"))) end if if isNull(strcatimage) then strcatimage="" end if if isNULL(strsubcategory) then strsubcategory="" end if If isnull(strcategory) then 'VP-ASP 6.09 - change to use lang variable strcathide=trim(getlang("langcommonyes")) else strcategory=translatelanguage(dbc, "categories", "catdescription","categoryid", categoryid, strcategory) end if If isnull(strcatextra) then strcatextra="" end if If isnull(strcatmemo) then strcatmemo="" end if If getconfig("xcategoryusetemplate")= "Yes" then FormatCategoryTemplate lngcatid, strcategory,rs else FormatCategory lngcatid, strcategory End if rs.MoveNext Wend if colcount> 0 then FillRemainingcolumns end if response.write "" CloseRecordSet rs end sub '************************************* ' Used only if template formatting is used '************************************************* Sub FormatCategoryTemplate(lngcatid, strcategory, objrs) dim template, rc template=getconfig("xcategorydisplaytemplate") If Template="" then Serror=getlang("LangExdNoTemplate") shoperror serror end if 'VP-ASP 6.09 - change to use lang variable if ucase(strcathide)=ucase(trim(getlang("langcommonyes"))) then exit sub end if if colcount=0 then Response.write CatRow end if response.write CatColumn ShopTemplateWrite template, objRs, rc Response.write CatColumnEnd colcount=colcount+1 totalcolumncount=totalcolumncount+1 if colcount>= yCatMaxColumns then response.write "" colcount=0 end if End Sub '************************************************** ' writes out header '****************************************************** Sub CategoryHeader dim header If highercategoryid<>0 then Generatecategorylinks header else 'VP-ASP 6.09 - added breadcrumb / VP-ASP 6.50 - added config option to turn breadcrumb on/off if getconfig("xbreadcrumbs") = "Yes" then response.write "