<%@ Language=VBScript %> <%Option Explicit%> <% Dim PageName PageName = "Catalogue" %> <% Dim Category, SubCategory, RecordCount, PageCount, PageCounter, PageNo, ItemCount, ItemDescription Dim SubCategoryHeader, SubCategoryMessage, ItemSide, PageCategory, PageSubCategory Const ItemsPerPage = 10 If Request.Cookies("SessionID") = "" Then Response.Cookies("SessionID") = Session.SessionID Category = Trim(Request("Category")) SubCategory = Trim(Request("SubCategory")) If Category = "" Then Set Conn = Nothing Response.Redirect "catalogue.asp" End If PageCategory = Split(Category, " - ")(0) If Ubound(Split(Category, " - ")) = 1 Then PageSubCategory = Split(Category, " - ")(1) Else PageSubCategory = "" End If If Trim(Request("PageNo")) <> "" Then PageNo = Cint(Trim(Request("PageNo"))) Else PageNo = 1 End If Conn.open strConn strSQL = "SELECT DISTINCT Category.Category " strSQL = strSQL & "FROM Category INNER JOIN Product ON Category.Category = Product.Category " strSQL = strSQL & "WHERE Category.Category = " & FormatSQLText(Category) & " " strSQL = strSQL & "AND Product.Published <> 0" Set RS = Server.CreateObject("ADODB.Recordset") Set RS.ActiveConnection = Conn RS.Open strSQL If RS.EOF Then Set RS = Nothing Set Conn = Nothing Response.Redirect "catalogue.asp" End If Set RS = Nothing %> Majestic Products - <%=PageName%>
<% If PageSubCategory <> "" Then %> <% Else %> <% End If %>
Catalogue > <%=PageCategory%> > <%=SubCategory%>Catalogue > <%=Category%>
<% strSQL = "SELECT CategoryHeader, CategoryMessage FROM Category WHERE Category = " & FormatSQLText(Category) & " " strSQL = strSQL & "AND (CategoryHeader IS NOT Null OR CategoryMessage IS NOT Null) " Set RS = Server.CreateObject("ADODB.Recordset") Set RS.ActiveConnection = Conn RS.Open strSQL If Not RS.EOF Then %><% SubCategoryHeader = RS("SubCategoryHeader") If SubCategoryHeader <> "" Then %><% End If SubCategoryMessage = RS("SubCategoryMessage") If SubCategoryMessage <> "" Then %><% End If %>
<%=Replace(SubCategoryHeader, vbCrLf, "
")%>
<%=Replace(SubCategoryMessage, vbCrLf, "
")%>
<% End If Set RS = Nothing %>
<% strSQL = "SELECT Product.* " strSQL = strSQL & "FROM Category INNER JOIN Product ON Category.Category = Product.Category " strSQL = strSQL & "WHERE Product.Published <> 0 And Product.Category = " & FormatSQLText(Category) & " " strSQL = strSQL & "Order By Product.ProductName " Set RS = Server.CreateObject("ADODB.Recordset") Set RS.ActiveConnection = Conn 'RS.CursorType = adOpenStatic 'RS.CursorLocation = adUseServer RS.CursorLocation = adUseClient RS.Open strSQL If Not RS.EOF Then RS.PageSize = ItemsPerPage RecordCount = RS.RecordCount PageCount = RS.PageCount RS.AbsolutePage = PageNo %> <% If PageCount > 1 Then %> <% End If %>
Found: <%=RecordCount%> Items
<%If PageNo = 1 Then%> « Previous Page | <%Else%> « Previous Page | <%End If%> <% For PageCounter = 1 TO PageCount If PageNo = PageCounter Then %> <%=PageCounter%> | <% Else %> <%=PageCounter%> | <% End If Next %> <% If PageNo = PageCount Then %> Next Page » <% Else %> Next Page » <% End If %>
<% ItemCount = 0 ItemSide = "Left" While Not RS.EOF And ItemCount < ItemsPerPage ItemCount = ItemCount + 1 If ItemSide = "Left" Then %> <% End If %> <% If ItemSide = "Left" Then ItemSide = "Right" Else ItemSide = "Left" %>
<% If Not IsNull(RS("ThumbnailImageLink")) Then %> "><%=RS(" src="<%=RS("ThumbnailImageLink")%>" width="125" border=1> <% ElseIf Not IsNull(RS("ThumbnailImage")) Then %> "><%=RS(" src="shop_images/thumbnail/<%=RS("ThumbnailImage")%>" width="125" border=1> <% ElseIf Not IsNull(RS("LargeImageLink")) Then %> "><%=RS(" src="<%=RS("LargeImageLink")%>" width="125" border=1> <% ElseIf Not IsNull(RS("LargeImage")) Then %> "><%=RS(" src="shop_images/large/<%=RS("LargeImage")%>" width="125" border=1> <% Else %> "> <% End If %>
<%=RS("ProductCode") & " - " & RS("ProductName")%>
<% End If %> <% RS.MoveNext Wend %> <% If ItemSide = "Right" Then %>
<% End If %> <% If PageCount > 1 Then %>
Found: <%=RecordCount%> Items
<%If PageNo = 1 Then%> « Previous Page | <%Else%> « Previous Page | <%End If%> <% For PageCounter = 1 TO PageCount If PageNo = PageCounter Then %> <%=PageCounter%> | <% Else %> <%=PageCounter%> | <% End If Next %> <% If PageNo = PageCount Then %> Next Page » <% Else %> Next Page » <% End If %>
<% End If %> <%Else%>


Items could not be found.

<%End If Set RS = Nothing %>
<%Set Conn = Nothing%>