<% 'This code is copyright (c) Internet Business Solutions SL, all rights reserved. 'The contents of this file are protect under law as the intellectual property 'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying 'of any kind without the express and written permission of Internet Business 'Solutions SL is forbidden. 'Author: Vince Reid, vince@virtualred.net Dim sSQL,rs,rs2,alldata,cnn,rowcounter,success,Count,startlink,endlink,weburl,CurPage,iNumOfPages,netnav,subCats,lasttsid,sText,index,sJoin,aText,aFields(3),currFormat1,currFormat2,currFormat3,aOption(),aDiscSection() catid="0" showcategories=FALSE gotcriteria=FALSE isrootsection=FALSE topsectionids="0" Redim aOption(2,maxprodopts) netnav = true thecat = request("scat") if Left(request("scat"),2)="ms" then thecat = Right(request("scat"),Len(request("scat"))-2) thecat = replace(thecat,"'","") catarr = split(thecat,",") catzero = "" if UBOUND(catarr)>=0 then if IsNumeric(catarr(0)) then catzero=Int(catarr(0)) end if WSP = "" OWSP = "" TWSP = "pPrice" minprice = "" maxprice = "" if Trim(request("sminprice"))<>"" AND IsNumeric(Trim(request("sminprice"))) then minprice = cDbl(replace(request("sminprice"),"$","")) if Trim(request("sprice"))<>"" AND IsNumeric(Trim(request("sprice"))) then maxprice = cDbl(replace(request("sprice"),"$","")) if instr(Request.ServerVariables("HTTP_USER_AGENT"), "compatible") > 0 OR instr(Request.ServerVariables("HTTP_USER_AGENT"), "Gecko") > 0 then netnav = false function atb(size) if netnav then atb = CInt(size / 2 + 1) else atb = size end if end function Sub writemenulevel(id,itlevel) Dim wmlindex if itlevel<10 then FOR wmlindex=0 TO ubound(alldata,2) if alldata(2,wmlindex)=id then response.write "" & vbCrLf if alldata(3,wmlindex)=0 then call writemenulevel(alldata(0,wmlindex),itlevel+1) end if NEXT end if end Sub Function writepagebar(CurPage, iNumPages) Dim sLink, i, sStr, startPage, endPage sLink = "« " & sLink & CurPage-1 & "'>"&xxPrev&" | " else sStr = "« "&xxPrev&" | " end if for i=startPage to endPage if i=CurPage then sStr = sStr & i & " | " else sStr = sStr & sLink & i & "'>" if i=startPage AND i > 1 then sStr=sStr&"..." sStr = sStr & i if i=endPage AND i < iNumPages then sStr=sStr&"..." sStr = sStr & " | " end if next if CurPage < iNumPages then writepagebar = sStr & sLink & CurPage+1 & "'>"&xxNext&" " & sLink & iNumPages & "'>»" else writepagebar = sStr & " "&xxNext&" »" end if End function Set rs = Server.CreateObject("ADODB.RecordSet") Set rs2 = Server.CreateObject("ADODB.RecordSet") Set cnn=Server.CreateObject("ADODB.Connection") cnn.open sDSN alreadygotadmin = getadminsettings() Redim aDiscSection(2,adminProdsPerPage) Call checkCurrencyRates(currConvUser,currConvPw,currLastUpdate,currRate1,currSymbol1,currRate2,currSymbol2,currRate3,currSymbol3) if Session("clientUser")<>"" then if (Session("clientActions") AND 8) = 8 then WSP = "pWholesalePrice AS " TWSP = "pWholesalePrice" if wholesaleoptionpricediff=TRUE then OWSP = "optWholesalePriceDiff AS " end if if (Session("clientActions") AND 16) = 16 then Session.LCID = 1033 WSP = Session("clientPercentDiscount") & "*pPrice AS " TWSP = Session("clientPercentDiscount") & "*pPrice" if wholesaleoptionpricediff=TRUE then OWSP = Session("clientPercentDiscount") & "*optPriceDiff AS " Session.LCID = saveLCID end if end if if Session("clientLoginLevel")<>"" then minloglevel=Session("clientLoginLevel") else minloglevel=0 sSQL = "SELECT sectionID,"&getlangid("sectionName",256)&",topSection,rootSection FROM sections WHERE sectionDisabled<="&minloglevel&" " if onlysubcats=true then sSQL = sSQL & "AND rootSection=1 ORDER BY " & getlangid("sectionName",256) else sSQL = sSQL & "ORDER BY sectionOrder" end if rs.Open sSQL,cnn,0,1 if rs.eof or rs.bof then success=false else alldata=rs.getrows success=true end if rs.Close if Request.Form("posted")="1" OR Request.QueryString("pg")<>"" then if thecat<>"" then sSQL = "SELECT DISTINCT products.pId,"&getlangid("pName",1)&","&WSP&"pPrice FROM multisections RIGHT JOIN products ON products.pId=multisections.pId WHERE pDisplay <> 0 " gotcriteria=true sectionids = getsectionids(thecat, false) if sectionids<>"" then sSQL = sSQL & "AND (products.pSection IN (" & sectionids & ") OR multisections.pSection IN (" & sectionids & ")) " else sSQL = "SELECT products.pId,"&getlangid("pName",1)&","&WSP&"pPrice FROM products WHERE pDisplay <> 0 " end if session.LCID = 1033 if Trim(request("sprice"))<>"" AND IsNumeric(Trim(request("sprice"))) then gotcriteria=true sSQL = sSQL & "AND "&TWSP&"<="&cDbl(replace(request("sprice"),"$",""))&" " end if if minprice<>"" then gotcriteria=true sSQL = sSQL & "AND "&TWSP&">="&minprice&" " end if session.LCID = saveLCID if Trim(request("stext"))<>"" then gotcriteria=true sText = replace(Trim(request("stext")),"'","''") aText = Split(sText) aFields(0)="products.pId" aFields(1)=getlangid("pName",1) aFields(2)=getlangid("pDescription",2) aFields(3)=getlangid("pLongDescription",4) if request("stype")="exact" then sSQL=sSQL & "AND (products.pId LIKE '%"&sText&"%' OR "&getlangid("pName",1)&" LIKE '%"&sText&"%' OR "&getlangid("pDescription",2)&" LIKE '%"&sText&"%' OR "&getlangid("pLongDescription",2)&" LIKE '%"&sText&"%') " else sJoin="AND " if request("stype")="any" then sJoin="OR " sSQL=sSQL & "AND (" for index=0 to 3 sSQL=sSQL & "(" for rowcounter=0 to UBOUND(aText) sSQL=sSQL & aFields(index) & " LIKE '%"&aText(rowcounter)&"%' " if rowcounter"&minloglevel,cnn,0,1 do while NOT rs.EOF disabledsections = disabledsections & addcomma & rs("sectionID") addcomma="," rs.MoveNext loop rs.Close if disabledsections<>"" then sSQL = sSQL & " AND NOT products.pSection IN (" & getsectionids(disabledsections, true) & ")" rs.CursorLocation = 3 ' adUseClient rs.CacheSize = adminProdsPerPage rs.Open sSQL & sSortBy, cnn if rs.eof or rs.bof then success=false iNumOfPages=0 else success=true rs.MoveFirst rs.PageSize = adminProdsPerPage If Request.QueryString("pg") = "" Then CurPage = 1 Else CurPage = Int(Request.QueryString("pg")) End If iNumOfPages = Int((rs.RecordCount + (adminProdsPerPage-1)) / adminProdsPerPage) rs.AbsolutePage = CurPage end if Count = 0 if NOT rs.EOF then prodlist = "" addcomma="" Do While Not rs.EOF And Count < rs.PageSize prodlist = prodlist & addcomma & "'" & rs("pId") & "'" rs.MoveNext Count = Count + 1 addcomma="," loop rs.Close Count = 0 sSQL = "SELECT pId,"&getlangid("pName",1)&",pImage,"&WSP&"pPrice,pListPrice,pSection,pSell,pInStock,pExemptions,pLargeImage,"&getlangid("pDescription",2)&","&getlangid("pLongDescription",4)&" FROM products WHERE pId IN (" & prodlist & ")" & sSortBy rs.Open sSQL, cnn, 0, 1 end if end if Session("frompage")=Request.ServerVariables("URL")&IIfVr(Trim(Request.ServerVariables("QUERY_STRING"))<>"","?","")&Request.ServerVariables("QUERY_STRING") if request("nobox")<>"true" then %>
<%=xxSrchPr%>
<%=xxSrchFr%>: " /> <%=xxSrchMx%>: " />
<%=xxSrchTp%>: <%=xxSrchCt%>:
 
<% end if if request.form("posted")="1" OR Request.QueryString("pg")<>"" then %> <% if rs.EOF then %> <% else %> <% end if %>

 

<%=xxSrchNM%>

 

<% if usesearchbodyformat=2 then %> <% else %> <% end if %>
<% rs.Close end if cnn.Close set rs = nothing set rs2 = nothing set cnn = nothing %>