====== Jumping to a "brand" page ====== ===== Creating a "Select a Brand" jump menu ===== It might be useful to be able to add a "Jump Menu" that takes the customer to a page that shows products by the selected brand. The customer clicks on the drop-down, selects a brand from the menu, and "jumps" to it. In ProductCart v3.x, a "Brand" page shows all products associated with that brand in the Control Panel. The feature relies on the search functionality. That is: products for a brand are displayed as search results where the filter is the brand itself. So to create a "Jump Menu" that loads all products associated with a brand, we use a customized version of the search form. Here we go. <% '// EI-MOD START = Brands Jump Menu %>
Search by brand
<% query="Select IDBrand, BrandName from Brands order by BrandName asc" set rs=Server.CreateObject("ADODB.Recordset") set rs=conlayout.execute(query) if not rs.eof then Dim brandArray2, brandCount2, brandTotal2 brandArray2 = rs.getRows() brandCount2 = 0 brandTotal2 = ubound(brandArray2,2) %> <% end if set rs = nothing %>
<% '// EI-MOD END = Brands Jump Menu %>
* Place this code in either **header.asp** or **footer.asp** * Change the number of results to be returned from "20" shown above (//name="resultCnt" value="20"//) to your preferred value * Change the text used in the code above (i.e. "Search by brand" and "-- Select a brand --") * To style the form, we recommend adding a custom class to it (e.g. class="myJumpMenu") and define that class in pcStorefront.css ===== Listing links to each brand ===== If instead you simply want to show a list of brand names with links to the corresponding brand page, here is the code to use. Note that the class "myBrands" is just a placeholder. You can of course use any class you want to style the list using your Cascading Style Sheets (CSS), or you could use an in-line style. As for the code above, this code snippet must be used on either **header.asp** or **footer.asp**. <% query="Select IDBrand, BrandName from Brands order by BrandName asc" set rs=Server.CreateObject("ADODB.Recordset") set rs=conlayout.execute(query) if not rs.eof then Dim brandArray2, brandCount2, brandTotal2 brandArray2 = rs.getRows() brandCount2 = 0 brandTotal2 = ubound(brandArray2,2) do while (brandCount2 <= brandTotal2) %>
<%=brandArray2(1, brandCount2)%>
<% brandCount2 = brandCount2 + 1 loop end if set rs = nothing %>