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
%>
<div id="pcBrandsJumpMenu">
<div>Search by brand</div>
<form name="brandSearch" method="get" action="showsearchresults.asp">
<input type="hidden" name="resultCnt" value="20">
<input type="hidden" name="idcategory" value="0">
<input type="hidden" name="idSupplier" value="10">
<input type="hidden" name="customfield" value="0">
<%
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)
%>
<select name="IDBrand" onChange="this.form.submit();">
<option value="0">-- Select a brand --</option>
<%
do while (brandCount2 <= brandTotal2)
%>
<option value="<%=brandArray2(0, brandCount2)%>"<%if int(idbrand)=int(brandArray2(0, brandCount2)) then%> selected<%end if%>><%=brandArray2(1, brandCount2)%></option>
<%
brandCount2 = brandCount2 + 1
loop
%>
</select>
<%
end if
set rs = nothing
%>
</form>
</div>
<%
'// EI-MOD END = Brands Jump Menu
%>
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.
<!-- LIST all brands -->
<%
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)
%>
<div class="myBrands">
<a href="showsearchresults.asp?idbrand=<%=brandArray2(0, brandCount2)%>">
<%=brandArray2(1, brandCount2)%>
</a>
</div>
<%
brandCount2 = brandCount2 + 1
loop
end if
set rs = nothing
%>
<!-- END LIST all brands -->