noesac Posted July 9, 2011 Share Posted July 9, 2011 I have the following piece of code which displays all Parent categories: {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $smarty.foreach.blockCategTree.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child} {/if} {/foreach} I want to display all Subcategories, but only for one specific CategoryAnyone know how I can do this? Link to comment Share on other sites More sharing options...
vivek tripathi Posted July 11, 2011 Share Posted July 11, 2011 To display a list of sub-categories (from only one category)replace following code of block in file modules --> blockcategories-->blockcategories.tpl {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $smarty.foreach.blockCategTree.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child} {/if} {/foreach} replace with the code {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $child.name==iPods} // or you can check by id {if $child.id==2} //{if $child.name=='categoriename'} // or you can check by id {if $child.id==categorieId} {if $smarty.foreach.blockCategTree.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child} {/if} {/if} {/foreach} Link to comment Share on other sites More sharing options...
noesac Posted July 11, 2011 Author Share Posted July 11, 2011 It didn't work unfortunately, when I remove lines 2 and 8, it just shows all the parent level categories, are you sure that's right? {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $child.id==18} {if $smarty.foreach.blockCategTree.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child} {/if} {/if} {/foreach} Link to comment Share on other sites More sharing options...
vivek tripathi Posted August 3, 2011 Share Posted August 3, 2011 {if $child.name=='categoriename'} // or you can check by id {if $child.id==categorieId} replace categoriename with your desired catergory Ex. ipod then complete syntax will be look lik {if $child.name=='ipos'} 2- If you want to display by category Ex if ipod category id=2 then you syntax should like {if $child.id==2} tested on prestashop v1.4+ Link to comment Share on other sites More sharing options...
CamelotWeb Posted January 28, 2012 Share Posted January 28, 2012 Thanks Vivek I found your knowledge so useful Link to comment Share on other sites More sharing options...
RodgerFox Posted April 25, 2012 Share Posted April 25, 2012 pls ask me, how output in any place for temple? How to display subcategories of Category ID=5? p.s. sorry for my bad English. Link to comment Share on other sites More sharing options...
vekia Posted June 24, 2014 Share Posted June 24, 2014 it's not possible to just display it anywhere you want without touching core. in this case it's necessary to create function in controller 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