need4speed Posted December 5, 2010 Share Posted December 5, 2010 Im not skilled PHP programmer.So I hope somebody can help me with my request.I want to add a ID tag to each category How can I do that?So I can style each category with CSS.This is the default code for the "blockcategories" module > {$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><br><br Link to comment Share on other sites More sharing options...
rocky Posted December 6, 2010 Share Posted December 6, 2010 Try: > <a href="{$node.link|escape:html:'UTF-8'}"class="selected" title="{$node.desc|escape:html:'UTF-8'}">{$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 Then you can use #cat2, #cat3, etc. Link to comment Share on other sites More sharing options...
need4speed Posted December 6, 2010 Author Share Posted December 6, 2010 But I think with this solution the SUB ´s will have the same ID as the main so they will get the same CSS style as the main and that will be a problem. Link to comment Share on other sites More sharing options...
rocky Posted December 6, 2010 Share Posted December 6, 2010 No, they should all have different IDs. You may also need to edit the category-tree-branch.tpl in your theme's directory too, depending on how old your PrestaShop version is. Link to comment Share on other sites More sharing options...
need4speed Posted December 6, 2010 Author Share Posted December 6, 2010 Im using the 1.3.1 I guess that isnt an old system ? Link to comment Share on other sites More sharing options...
rocky Posted December 6, 2010 Share Posted December 6, 2010 No, I think the bug was in PrestaShop v1.2.5. So the same IDs are appearing more than once? The $node variable should change with each recursion, causing a different ID to be displayed. I use this code in my category modules without any problems. Link to comment Share on other sites More sharing options...
need4speed Posted December 6, 2010 Author Share Posted December 6, 2010 Sorry it acually seems like your right. I guess the problem was how I styled the ´s 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