PDA

View Full Version : Use a different frontend product template for products in a certain category


Hansville
2015-06-10, 10:22 PM
Hello,
I want to use a different frontend product template for viewing products but only if they are in a category with an ID 243 (for example, the category could have any ID)? Other products would use the normal product template.

Is this possible - if so can someone give me some advice how to do this please?

thanks

Harney
2015-06-10, 10:23 PM
Displaying a different product template is very easy to do. But you need a "trigger" in order to know when to switch the template. In your case the trigger is the categoryid.

Thankfully the main category id for the current product page is stored in the $product array. So you can switch templates based on some code like this:


{if $product.categoryid eq '243'}
Do this
{else}
Do that
{/if}


A brief visual overview of how to determine what variable to use can be seen in this tutorial: http://www.youtube.com/watch?v=lSb0dBP6I98