markwelsum Posted July 26, 2012 Share Posted July 26, 2012 Dear, I have bought a template for prestashop. Now on each category page there is an image from 700 x 240 px. In my template, there is now the following code to show the image: {if $category->id_image} <div class="align_center"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </div> {/if} This shows the category image. What i want, is to hide the image if the category is an subcategory of a main category. For example: Home Shoes men woman On the page shoes the image has to show, but the subcategory men of woman, the image have to hide. Do you guys know if there is a function like: {if $category == subcategory} // no image // {else} {if $category->id_image} <div class="align_center"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </div {/if} {/if} Hope that someone can help me! Link to comment Share on other sites More sharing options...
faDdy Posted July 26, 2012 Share Posted July 26, 2012 Can you please post the link of your website ? Link to comment Share on other sites More sharing options...
markwelsum Posted July 26, 2012 Author Share Posted July 26, 2012 The website is https://www.buitenhuisstore.nl For example: http://www.buitenhuisstore.nl/fietskleding is a main category. You see the image http://www.buitenhuisstore.nl/helmen is a subcategory of http://www.buitenhuisstore.nl/fietskleding the image has to hide Link to comment Share on other sites More sharing options...
Médéric Posted July 26, 2012 Share Posted July 26, 2012 you can use this : {if $category->level_depth == 1} ... {else} ... {/if} Link to comment Share on other sites More sharing options...
markwelsum Posted July 26, 2012 Author Share Posted July 26, 2012 WHAA!!!! You are my hero of the day! I had to change it to {if $category->level_depth == 2} Is there also something like: {if $category->level_depth == 2 OR 3 OR 4 OR 5 OR 6} or does this not work? Link to comment Share on other sites More sharing options...
markwelsum Posted July 26, 2012 Author Share Posted July 26, 2012 Wall got it allready, changed it to: {if $category->level_depth > 1} Thank you very much Médéric Link to comment Share on other sites More sharing options...
Médéric Posted July 26, 2012 Share Posted July 26, 2012 You're welcome Link to comment Share on other sites More sharing options...
Gomlers Posted November 21, 2016 Share Posted November 21, 2016 (edited) Sorry to bump this old thread, but it's very near what I want to accomplish. I want to check if I am on a category id 150, or on a subcategory of category id 150. How can I do that? EDIT: FOUND A SOLUTION! Don't know if it qualifies as a great method, but it works anyway... I did it like this: {if $category->id AND $category->active} {if ($category->id_category == 150) OR ($category->id_parent == 150) OR ($category->id_parent == 330) OR ($category->id_parent == 167) OR ($category->id_parent == 155)} Edited November 22, 2016 by Gomlers (see edit history) 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