Jump to content

Product page layout depending on category ID


Recommended Posts

I tried using 

{if $category->id == 7}
<p>This content only showed if product is in category ID 7</p>
{/if}

and nothing happens - the paragraph does not show.

 

 

I need this for a custom product.tpl file that shows a different product page depending on the category it is in. My solution is one large product.tpl file that has a lot of ifs for each product page inside.

 

Link to comment
Share on other sites


{if in_array("colop",$product->tags[6])}
custom product tpl
{/if}

The smarty code above works. I can filter products by tags - if a product has the colop tag then compile a different smarty template inside the product.tpl file.

 

One problem is that I will end up with one hell of a large product.tpl file if I make too many custom product pages :/

 

As a side note I was really surprised that the tags are stored in an array that is in another array. $product has an array called tags which contains the array 6 which has the tags. I know there's probably a good reason for this but I am too tired to think.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...