justine123 Posted July 19, 2022 Share Posted July 19, 2022 Hi, So I added this code in the product.tpl to show the categories of the product but I only wanted to show the ones with id_parent of 3. I tried using {$cat.id_parent} but there was no display. I'd appreciate any help. Thank you. here is the code: <ul class="productcats"> {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat} <li><a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a></li> {/foreach} </ul> Link to comment Share on other sites More sharing options...
webprog Posted July 19, 2022 Share Posted July 19, 2022 Everything looks good in this code. Try to insert it into block - if you are using 1.7.x Link to comment Share on other sites More sharing options...
webprog Posted July 19, 2022 Share Posted July 19, 2022 Or if you want to see only category with id = 3 <ul class="productcats"> {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat} {if $cat.id_category == 3}<li><a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a></li>{/if} {$cat.id_category} {/foreach} </ul> 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