网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   X-Cart (https://www.0058.net/forumdisplay.php?f=70)
-   -   Use a different frontend product template for products in a certain category (https://www.0058.net/showthread.php?t=5158)

Hansville 2015-06-10 10:22 PM

Use a different frontend product template for products in a certain category
 
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:

Code:

{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


All times are GMT +8. The time now is 02:06 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.