SkyHiRider Posted December 18, 2013 Share Posted December 18, 2013 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 More sharing options...
CartExpert.net Posted December 19, 2013 Share Posted December 19, 2013 Hi. Did you pass the $category variable to smarty? Regards.Robin.The CartExpert Team Link to comment Share on other sites More sharing options...
vekia Posted December 19, 2013 Share Posted December 19, 2013 and what if product will be associated with several categories, for which you create different layouts? it's necessary to clarify idea first Link to comment Share on other sites More sharing options...
SkyHiRider Posted December 20, 2013 Author Share Posted December 20, 2013 {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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now