<%@ CodePage=65001 %> <% call connect() %> <% search=Trim(request.Querystring("txtsearch")) if search <>"" then Categoryname="Search Results" else 'strauth=trim(request.QueryString("auth")) 'id = request_equerystring(decrypt(strauth),"id") id=Replace(Trim(Request.QueryString("id")),"'","''") if not isnumeric(id) then response.Redirect("index.asp") end if 'CategoryId=cint(id)' Session("CategoryId")=cint(id) '******************************************** 'FOR CATEGORY TITLE '******************************************** sql = "SELECT * FROM product_category where id=" & id set rs_category=cnn.execute(sql) if not rs_category.eof then categoryname=StrReplace(rs_category("categoryname")) end if set rs_category=nothing '******************************************** 'FOR FEATURED PRODUCT AT TOP '******************************************** if id<>4 then sql = "SELECT top 1 * FROM products where categoryid="& id &" and isFeaturedPRoduct='Y' order by SortOrder desc" else sql = "SELECT top 4 * FROM products where categoryid="& id &" and isFeaturedPRoduct='Y' order by SortOrder desc" end if set rs_featuredproduct=cnn.execute(sql) end if '******************************************** 'FOR PRODUCT LISTING '******************************************** set rs_product=Server.CreateObject("ADODB.Recordset") if search="" then sql = "SELECT * FROM products where categoryid="& id &" and categoryid<>4 order by SortOrder desc" else sql = "SELECT P.* FROM products P,product_category C where P.categoryid=C.id and P.categoryid<>4 and (C.categoryname like '%" & search &"%' OR P.title like '%" & search &"%' OR short_description like '%" & search &"%' OR description like '%" & search &"%' ) order by SortOrder desc" end if rs_product.open sql,cnn,1,3 product_cnt=rs_product.recordcount 'FOR PAGINATION dim rs1, sql1 set rs1 = server.createobject("ADODB.recordset") sql1 = sql rs1.open sql1, cnn pageNumber=Trim(Request.QueryString("page")) if pageNumber = "" then pageNumber=1 end if 'BOOKS (ID-1) , MUSIC (ID-3) , DIGITAL DOWNLOAD (ID-4) RECORDS PER PAGE IS 4 'SERMONS (ID-2) RECORDS PER PAGE IS 6 dim perPage, perBook if cint(id)=2 then perPage = 6 else perPage = 6 end if perBook = 10 'NO.OF PAGES PER BOOK dim startRecord, endRecord, startBook, endBook validDisplay = 0 lastNext = false firstPrevious = false if pageNumber = 1 then pageNumber = 1 startRecord = 1 endRecord = perPage else getStartEndRecord(pageNumber) end if i=1 j = 0 While Not rs1.EOF j = j + 1 if j >= startRecord then if j <= endRecord then validDisplay = validDisplay + 1 end if end if rs1.movenext i=i+1 wend rs1.close set rs1= nothing totalPage = calcNumberOfPage(j) totalBook = calcNumberOfBook(totalPage) getStartEndBook(pageNumber) displayPage = "" for r = CInt(startBook) to CInt(endBook) if CStr(pageNumber) = CStr(r) then 'if r = totalPage then ' display = "["&CStr((r*perPage)-(perPage-1))&"-"&CStr(r*perPage)&"]" 'else ' display = "["&CStr((r*perPage)-(perPage-1))&"-"&CStr(r*perPage)&"]" 'end if if r = totalPage then display = ""&CStr(r)&"" else display = ""&CStr(r)&"" end if else if r = totalPage then display = ""&CStr(r)&"" else display = ""&CStr(r)&"" end if end if displayPage = displayPage + display if r<>endbook then displayPage = displayPage + "  |  " end if next %> Lighthouse Online
    <% else %> <% End If %>
<% ''FREATURED PRODUCT IS TO DISPLAY ONLY IN FIRST PAGE If pageNumber =1 and search="" Then %> <% If not rs_featuredproduct.eof Then %> <% If search ="" Then %> <% If id<>4 Then %> <% Else %> <% End If %> <% End If %> <% End If %> <% End If ''IF FIRST PAGE %> <% if not rs_product.eof then if Pagenumber<>"1" then rs_product.move (Pagenumber-1)*(perpage) end if %> <% rows=perpage/2 for r=1 to rows %> <%next%> <% rs_product.close set rs_product=nothing %>
<%= categoryname %>
-
">" border="0" class="img-resize" />
-
<%if rs_featuredproduct("categoryid")<>4 then%> ">Add to cart <%else%> Not available for sale <%end if%>
-
<%= StrReplace(rs_featuredproduct("title")) %>
<%= StrReplace(rs_featuredproduct("short_description")) %> ">more
-
<% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title2"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink2"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title3"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink3"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title4"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink4"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title5"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink5"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title6"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink6"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title7"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink7"))<>"" Then %> <% End If %> <% If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title8"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink8"))<>"" Then %> <% End If %> <%If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title9"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink9"))<>"" Then %> <% End If %> <%If StrReplace(rs_FeaturedPRoduct("footer_hyperlink_title10"))<>"" and StrReplace(rs_FeaturedPRoduct("footer_hyperlink10"))<>"" Then %> <% End If %>
Price: $<%= StrReplace(rs_featuredproduct("price")) %>
<% for i=1 to 4 if not rs_featuredproduct.eof then %> <% end if if not rs_featuredproduct.eof then rs_featuredproduct.movenext end if next %>
">" class="img-resize" />
-
<%= StrReplace(rs_featuredproduct("title")) %>
 
-
<%If rs_featuredproduct("categoryid")<>4 Then %> ">Add to cart <%else%> Not available for sale. <%end if%>
<% for i=1 to 2 if not rs_product.eof then %> <%else if i=2 then %> <% End If %> <% end if if not rs_product.eof then rs_product.movenext end if next %>
">" class="img-resize" />
-
<%if rs_product("categoryid")<>4 then%> ">Add to cart <%else%> Not available for sale <%end if%>
 
<% If StrReplace(rs_product("footer_hyperlink_title"))<>"" and StrReplace(rs_product("footer_hyperlink"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title2"))<>"" and StrReplace(rs_product("footer_hyperlink2"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title3"))<>"" and StrReplace(rs_product("footer_hyperlink3"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title4"))<>"" and StrReplace(rs_product("footer_hyperlink4"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title5"))<>"" and StrReplace(rs_product("footer_hyperlink5"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title6"))<>"" and StrReplace(rs_product("footer_hyperlink6"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title7"))<>"" and StrReplace(rs_product("footer_hyperlink7"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title8"))<>"" and StrReplace(rs_product("footer_hyperlink8"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title9"))<>"" and StrReplace(rs_product("footer_hyperlink9"))<>"" Then %> <% End If %> <% If StrReplace(rs_product("footer_hyperlink_title10"))<>"" and StrReplace(rs_product("footer_hyperlink10"))<>"" Then %> <% End If %>
<%= StrReplace(rs_product("title")) %>
<%= StrReplace(rs_product("short_description")) %> ">more
 
Price: $<%= StrReplace(rs_product("price")) %>
 
 
 
<%if pageNumber>1 then%> &page=1"><< <%else%>   <%end if%> <%if pageNumber>1 then%> &page=<%=pageNumber-1%>">< <% End If %>   <%=displayPage%>   <%if cint(pageNumber) &page=<%=pageNumber+1%>">> <% End If %> <%if cint(pageNumber) &page=<%=totalPage%>">>> <%else%>   <%end if%>
Look out for more details coming your way soon.
-
<% function calcNumberOfPage(iteration) tempPages = 0 tempPages = CInt(iteration/perPage) if ( (tempPages*perPage) < (iteration) ) then tempPages = tempPages + 1 end if calcNumberOfPage = tempPages end function function calcNumberOfBook(calcPages) tempBooks = 0 tempBooks = CInt(calcPages/perBook) if ( (tempBooks*perBook) < (calcPages) ) then tempBooks = tempBooks + 1 end if calcNumberOfBook = tempBooks end function sub getStartEndRecord(pageNumber) startRecord = ((pageNumber - 1) * perPage) + 1 endRecord = pageNumber * perPage 'response.write("
startRecord:"&startRecord) 'response.write("
endRecord:"&endRecord) end sub sub getStartEndBook(pageNumber) for m = 1 to totalBook startBook = ((m - 1) * perBook) + 1 endBook = m * perBook if (CInt(pageNumber) >= CInt(pageNumber)) and (CInt(pageNumber) <= CInt(endBook)) then if CInt(endBook) >= totalPage then endBook = totalPage lastNext = true end if if CInt(startBook) = 1 then firstPrevious = true end if 'Response.write("
m:"&m&":page:"&startBook&":to:"&endBook&"") Exit for end if next end sub sub getNextStartEndBook(pageNumber) for m = 1 to totalBook startBook = ((m - 1) * perBook) + 1 endBook = m * perBook if (CInt(pageNumber) >= CInt(pageNumber)) and (CInt(pageNumber) <= CInt(endBook)) then 'Response.write("
m:"&m&":page:"&startBook&":to:"&endBook&"") startBook = (m * perBook) + 1 endBook = (m + 1) * perBook Exit for end if next end sub %>