<%
if request("keyword")<> "" then
'response.write(request("keyword"))
keyWord = replace(request("keyword"), """", "'")
keyWordarr1 = split(keyWord, "'")
for each i in keywordarr1
if trim(i) > "" then
'strEqualCon=""
strEqualCon=strEqualCon+"productCategory.name like '%"+ trim(i) + "%' or "
' strEqualCon=strEqualCon+"productSubCategory.name like '%"+ trim(i) + "%' or "
strEqualCon=strEqualCon+"product.modelNo like '%"+ trim(i) + "%' or "
strEqualCon=strEqualCon+"product.description like '%"+ trim(i) + "%' or "
strEqualCon=strEqualCon+"product.features like '%"+ trim(i) + "%' or "
end if
next
if instr(keyWord, "'") = 0 then
keyWordarr2 = split(replace(keyWord, "'", " "), " ")
for each i in keyWordarr2
if trim(i) > "" then
'strEqualCon=""
strEqualCon=strEqualCon+"(productCategory.name like '%"+ trim(i) + "%' or "
' strEqualCon=strEqualCon+"productSubCategory.name like '%"+ trim(i) + "%' or "
strEqualCon=strEqualCon+"product.modelNo like '%"+ trim(i) + "%' or "
strEqualCon=strEqualCon+"product.description like '%"+ trim(i) + "%' or "
strEqualCon=strEqualCon+"product.features like '%"+ trim(i) + "%') and"
end if
next
end if
if len(strEqualCon) > "" then
strEqualCon = left(strEqualCon, len(strEqualCon)-3)
end if
strSQLCnt="select count(*) as cnt from product,productSubCategory,productCategory "
strSQLCnt=strSQLCnt+"where "
strSQLCnt=strSQLCnt+"productSubCategory.subgroupid=product.subgroupid "
strSQLCnt=strSQLCnt+"and "
strSQLCnt=strSQLCnt+"productSubCategory.groupid=productCategory.groupid "
strSQLCnt=strSQLCnt+"and product.modelNo in"
strSQLCnt=strSQLCnt+"(select distinct product.modelNo as modelNo from product,productSubCategory,productCategory "
strSQLCnt=strSQLCnt+"where "
strSQLCnt=strSQLCnt+"productSubCategory.subgroupid=product.subgroupid and productSubCategory.groupid=productCategory.groupid and "
if strEqualCon > "" then
strSQLCnt=strSQLCnt+strEqualCon +")"
end if
sql="select product.subgroupid as subgroupid,product.modelNo as modelNo,product.productID as pid,product.features as features,"
sql=sql+"SUBSTRING(product.description,1,100) as description,productCategory.name as cat,productSubCategory.name as subcat "
sql=sql+"from product,productSubCategory,productCategory where "
sql=sql+"productSubCategory.subgroupid=product.subgroupid and productSubCategory.groupid=productCategory.groupid and product.modelNo in "
sql=sql+"(select distinct product.modelNo as modelNo from product,productSubCategory,productCategory where "
sql=sql+"productSubCategory.subgroupid=product.subgroupid and productSubCategory.groupid=productCategory.groupid and "
if strEqualCon > "" then
sql=sql+strEqualCon +")"
end if
'response.write strSQLCnt
maxperpage = 10
if request.querystring("p") = "" then
currentpage = 1
session("kw")=request("keyword")
else
currentpage = request("p")
end if
set rs=db.execute(strSQLCnt)
totalCount=rs("cnt")
set rs = nothing
%>
<%if totalCount> 0 then%>
|
<%
if totalCount > 10 then
if (currentpage*maxperpage) > totalCount then
response.write(totalCount)
else
response.write(currentpage*maxperpage)
end if
else
response.write(totalCount)
end if
%>
of <%=totalCount%> Documents (<%=session("kw")%>) |
<%end if%>
| |
<%
set rs=db.execute(sql)
if not rs.eof then
counter=0
while not rs.eof
counter=counter+1
if maxperpage * currentpage >= counter and (maxperpage * (currentpage-1))+1 <= counter then
%>
| <%=counter%>. |
&pid=<%=Server.URLEncode(rs("pid"))%>&sname=<%=Server.URLEncode(rs("subcat"))%>"><%=rs("cat")%> <%=rs("subcat")%> Model No : <%=rs("modelNo")%>
|
| |
<%
if rs("description")<>"" then
response.write(rs("description")+".........")
end if
%>
|
<%
end if
rs.movenext
wend
totalCount=counter
else
response.write("No matching result | ")
end if
%>
| |
|
<%if (totalCount > maxperpage) then%>
Page
<%end if%>
<%
if (totalCount > maxperpage) then
for i = 0 to (totalCount-1)/maxperpage
%>
| "><%=i+1%>
<%
next
end if
else
response.write(" | Please enter a keyword. | ")
end if
%>
|
|