honzikec Posted May 24, 2010 Share Posted May 24, 2010 Hi,I need help...I have to modify the html code in blockcategories module, but all i find is this code in category-tree-branch.tpl {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='true'} {else} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='false'} {/if} {/foreach} and I cannot find where the html for subcategories "thanks,HonzikecP.S. I hope you understood my poor English... Link to comment Share on other sites More sharing options...
honzikec Posted May 24, 2010 Author Share Posted May 24, 2010 and pls if you didn't get my question, ask me to clarify :-) Link to comment Share on other sites More sharing options...
rocky Posted May 25, 2010 Share Posted May 25, 2010 That TPL uses recursion to display the list items. It is the first line that does every <li> and the second line that does every <a>. Your modules/blockcategories/category-tree-branch.tpl should look like this: > {$node.name|escape:html:'UTF-8'} {if $node.children|@count > 0} </pre> <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child last='false'} {/if} {/foreach} </ul> <br> {/if}<br Link to comment Share on other sites More sharing options...
honzikec Posted May 25, 2010 Author Share Posted May 25, 2010 thank you for your answer, what I need to achieve is to have the category name in H4 tag and the subcategory in unordered list under it...so my code looks like this: > {$node.name|escape:htmlall:'UTF-8'} {if $node.children|@count > 0} </pre> <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='true'} {else} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='false'} {/if} {/foreach} </ul> <br> which works fine but I also need to add a ">" sign after the text in each subcategory link...so the html output should look like: > Category 1 </pre> <ul> Subcategory1 > Subcategory2 > </ul> <br><br><h4>Category 2</h4> <br><ul> Subcategory1 > Subcategory2 > Subcategory3 > </ul> any ideas? :-) Link to comment Share on other sites More sharing options...
honzikec Posted May 25, 2010 Author Share Posted May 25, 2010 OK, I finally figured this out thanks to your answer :-) I noticed that the file modules/blockcategories/category-tree-branch.tpl calls file themes/actual theme/category-tree-branch.tpl for the subcategories, so I just modified the tpl file in my theme folder and added the ">" into the {$node.name|escape:html:'UTF-8'} like this: {$node.name|escape:html:'UTF-8'} > Thanks again for the answer, it actually helped a lot:-) Link to comment Share on other sites More sharing options...
rocky Posted May 25, 2010 Share Posted May 25, 2010 It is good you found a solution. Please note that you are exploiting a bug in PrestaShop v1.2.5 that was fixed in PrestaShop v1.3. In PrestaShop v1.3, modules/blockcategories/category-tree-branch.tpl is called in the recursion instead of themes/yourtheme/category-tree-branch.tpl, which is supposed to be used for the sitemap only. You should check sitemap.php on your site to make sure you haven't made an unintentional change there. 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