Search the Community
Showing results for tags 'active state'.
-
Hi I am trying to make a change to the blockcategories menu. As for now the currently active category link ( li > a ) gets "class=selected". This is the original code from category-tree-branch.tpl: <a href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} title="{$node.desc|strip_tags|trim|escape:'html':'UTF-8'}"> {$node.name|escape:'html':'UTF-8'} </a> What I am trying to achieve is to have EVERY parent category of the current category also get a "class=selected" or similar. (I have a 4-level deep category tree) I already found a snippet of code in this forum and currently have changed the above code to this: <a href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} {foreach from=$node.children item=child name=categoryTreeBranch}{if $child.id == $currentCategoryId}class="selected-parent"{/if}{/foreach} title="{$node.desc|strip_tags|trim|escape:'html':'UTF-8'}"> {$node.name|escape:'html':'UTF-8'} </a> (so I added the part with foreach...) This gives me a "class=selected-parent" on the DIRECT parent category, which is already quite nice and close to what I want to achieve. The only thing I would like to change, is that EACH and EVERY parent category above my current category is marked with "class=selected-parent", not only the direct parent. Can anyone point me in the right direction on how I should change this part of the code...? {foreach from=$node.children item=child name=categoryTreeBranch}{if $child.id == $currentCategoryId}class="selected-parent"{/if}{/foreach} Thanks very much.
- 1 reply
-
- blockcategories
- parents active
- (and 7 more)
-
Hello, I followed the tutorial from neomps for Prestashop top menu: add active state for current page http://nemops.com/prestashop-top-menu-current-state/. It worked perfertly but has one minor problem. For the home buton ( i created a csm name home that redirects users to homepage) it doesn't work. What i would like is when users acces the homeurl to triger active state for the home buton. Hope you understand what i ment.
-
Hello all, I've looked for days on forums to find an answer to this question, found posts with same question but never with an effective answer. I'm using the sfHoverForce class in the blockTopmenu module to apply a specific color to the active page category in my top menu. The problem is when the current page is a sub-category, the color is applied to the sub-category and not the Parent category... I would like both parent and sub-category to be considered selected in order to have the sfHoverForce class applied to both of them... I suppose it's got to do with this line in the blockTopMenu.php : $children = Category::getChildren((int)$id_category, (int)$id_lang, true, (int)$id_shop); $selected = ($this->page_name == 'category' && ((int)Tools::getValue('id_category') == $id_category)) ? ' class="sfHoverForce"' : ''; Is there a way to extend the selected state to both active category and parent category ? In advance thank you for your help, I'm stuck ... Olivier
- 3 replies
-
- parent category;
- active state
- (and 3 more)