Jump to content

Help needed to add ‘active’ state for category menu in product page for blockTopMenu


bomby

Recommended Posts

Hi,

 

I'm using the module called blockTopMenu. The category gets 'active' state in category page, but when I enter a product inside a category, that category no longers get the 'active' state in product page.

 

Prestashop Version 1.6.0.14

Top horizontal menu v2.2.0 - by PrestaShop

 

 

When in a category page, the category's <li> has class sfHoverForce:

<ul class="sf-menu clearfix menu-content sf-js-enabled sf-arrows">
<li class="sfHoverForce">Cat1</li>
<li>Cat2</li>
<li>Cat2</li>
</ul>

Which is good and exactly what is needed!

 

 

However, when I enter say a product A in Cat1, the menu becomes like this:

<ul class="sf-menu clearfix menu-content sf-js-enabled sf-arrows">
<li>Cat1</li>
<li>Cat2</li>
<li>Cat2</li>
</ul>

As you can see, the Cat1 is not assigned the 'active' state.

 

 

 

I have looked up on http://nemops.com/prestashop-top-menu-current-state/ but it doesn't work.

 

 

 

I am looking at modules/blocktopmenu/blocktopmenu.php around this code of line but am not sure what to edit

$html .= '<li'.(($this->page_name == 'category'
&& (int)Tools::getValue('id_category') == (int)$category['id_category']) ? ' class="sfHoverForce"' : '').'>';
$html .= '<a href="'.$link.'" title="'.$category['name'].'">'.$category['name'].'</a>';

Any guidance would be good. Much appreciated.

Edited by bomby (see edit history)
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...