Jump to content

[SOLVED] Where is the html code for subcategories unordered list located?


Recommended Posts

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,
Honzikec

P.S. I hope you understood my poor English...
Link to comment
Share on other sites

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...