Function genCatInfor(tmp_IDCAT,tmp_CatName) Dim tmp_showIcon,k,pcv_first,pcv_prdcount,pcv_back,pcv_end,tsT,tmp_query,pcv_CatName,pcv_prds1,tmp1,tmp2 tmp1=0 tmp2=0 tmp_showIcon=0 pcv_first=0 pcv_prdcount=0 maxProNameL = 22 pcv_CatName=ClearHTMLTags2(tmp_CatName,0) If maxProNameL<len(pcv_CatName) then pcv_CatName=trim(left(pcv_CatName,maxProNameL)) & "..." End If if (pcv_exportType="0" or pcv_exportType="2") then pcv_end=intCount tmp1=0 For k=0 to intCount pcv_back=pcv_end-k if cint(pcv_cats1(2,k))=tmp_IDCAT then tmp1=1 exit for end if if pcv_cats1(2,pcv_back)=tmp_IDCAT then tmp1=1 exit for end if Next end if if (pcv_exportType="1" or pcv_exportType="2") then tmp_query="SELECT products.idProduct,products.description FROM products INNER JOIN categories_products ON (products.idProduct=categories_products.idProduct AND products.removed=0 AND products.active=-1 AND products.configOnly=0) WHERE categories_products.idcategory=" & tmp_IDCAT & " ORDER BY categories_products.POrder asc,products.description ASC;" set rsT=connTemp.execute(tmp_query) if not rsT.eof then tmp2=1 pcv_prds1=rsT.getRows() set rsT=nothing else tmp2=0 end if set rsT=nothing end if if ((tmp1=1) and (pcv_exportType="0" or pcv_exportType="2")) or ((tmp2=1) and (pcv_exportType="1" or pcv_exportType="2")) then tmp_showIcon=1 end if pcv_strTmpCat=pcv_strTmpCat & "<tr><td valign=""middle"">" if tmp_showIcon=1 then pcv_strTmpCat=pcv_strTmpCat & "<img align=""absmiddle"" name=""IMGCAT" & tmp_IDCAT & """ border=""0"" src=""images/btn_expand.gif"" onclick=""javascript:UpDown(" & tmp_IDCAT & ");"">" else pcv_strTmpCat=pcv_strTmpCat & " " end if pcv_strTmpCat=pcv_strTmpCat & "</td><td width=""100%"" valign=""top"" class="""&pcv_cssclass&"""><a href=""" & tempURL & "viewCategories.asp?idCategory=" & tmp_IDCAT & """> " & pcv_CatName & "</a>" & vbcrlf if tmp_showIcon=1 then pcv_strTmpCat=pcv_strTmpCat & "<table border=""0"" width=""100%"" cellpadding=""0"" cellspacing=""0"" id=""SUB" & tmp_IDCAT & """ style=""display:none"">" & vbcrlf if ((tmp1=1) and (pcv_exportType="0" or pcv_exportType="2")) then For k=0 to intCount if cint(pcv_cats1(2,k))=tmp_IDCAT then pcv_first=1 call genCatInfor(pcv_cats1(0,k),pcv_cats1(1,k)) else if pcv_first=1 then exit for end if end if Next end if if ((tmp2=1) and (pcv_exportType="1" or pcv_exportType="2")) then if ubound(pcv_prds1,2)>pcv_numprd-1 then pcv_prdcount=pcv_numprd-1 else pcv_prdcount=ubound(pcv_prds1,2) end if For k=0 to pcv_prdcount ProName=ClearHTMLTags2(pcv_prds1(1,k),0) If maxProNameL<len(ProName) then ProName=trim(left(ProName,maxProNameL)) & "..." End If pcv_strTmpCat=pcv_strTmpCat & "<tr><td> </td><td class="""&pcv_cssclass&"""><a href=""" & tempURL & "viewPrd.asp?idcategory=" & tmp_IDCAT & "&idproduct=" & pcv_prds1(0,k) & """>" & ProName & "</a></td></tr>" & vbcrlf Next if ubound(pcv_prds1,2)>pcv_numprd-1 then pcv_strTmpCat=pcv_strTmpCat & "<tr><td> </td><td class="""&pcv_cssclass&"""><a href=""" & tempURL & "viewCategories.asp?idCategory=" & tmp_IDCAT & """>More Products...</a></td></tr>" & vbcrlf end if end if pcv_strTmpCat=pcv_strTmpCat & "</table>" & vbcrlf end if pcv_strTmpCat=pcv_strTmpCat & "</td></tr>" & vbcrlf End Function |