Displaying different content depending on which category is shown

What if you wanted to change elements of your store design (e.g. navigation, graphics, etc.) depending on which category the customer is viewing? You can do so by using conditional statements based on the category ID. You can find out the ID of a category in many ways. For example, when editing the category in the Control Panel, look at the number that follows ?idcategory= in the browser address field.

In the storefront, the category ID is loaded onto the page (viewcategories.asp) before header.asp and footer.asp are invoked. Therefore, you can place conditional statements in those files with the assumption that the category ID is known.

Here is a simple example. Let's assume you want to show something different when category number 100 is shown:

 <% if pIdCategory=100 then %>
   Show special content to be displayed when category 100 is shown
 <% else %>
   Show something else
 <% end if %>

This article can certainly be expanded with additional, more complex examples.


Personal Tools