tozi Posted May 1, 2014 Share Posted May 1, 2014 (edited) Hi all i need active class in some item eg.Sortiment, aktuality. How to do it? My web: http://presta.simplydesign.sk/ Edited May 4, 2014 by tozi (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 1, 2014 Share Posted May 1, 2014 you mean that you want to add class="active" for these two <li> items? Link to comment Share on other sites More sharing options...
tozi Posted May 1, 2014 Author Share Posted May 1, 2014 Yes that correct. Link to comment Share on other sites More sharing options...
vekia Posted May 1, 2014 Share Posted May 1, 2014 how you added aktuality menu item? Link to comment Share on other sites More sharing options...
tozi Posted May 1, 2014 Author Share Posted May 1, 2014 (edited) In modul blocktopmenu. And i have presta 1.5.6.1. Edited May 1, 2014 by tozi (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 1, 2014 Share Posted May 1, 2014 in blocktopmenu.php you can find code: case 'LNK': $link = MenuTopLinks::get((int)$id, (int)$id_lang, (int)$id_shop); if (count($link)) { if (!isset($link[0]['label']) || ($link[0]['label'] == '')) { $default_language = Configuration::get('PS_LANG_DEFAULT'); $link = MenuTopLinks::get($link[0]['id_linksmenutop'], $default_language, (int)Shop::getContextShopID()); } $this->_menu .= '<li><a href="'.Tools::HtmlEntitiesUTF8($link[0]['link']).'"'.(($link[0]['new_window']) ? ' target="_blank"': '').'>'.$link[0]['label'].'</a></li>'.PHP_EOL; } break; change it to: case 'LNK': $link = MenuTopLinks::get((int)$id, (int)$id_lang, (int)$id_shop); if (count($link)) { if (!isset($link[0]['label']) || ($link[0]['label'] == '')) { $default_language = Configuration::get('PS_LANG_DEFAULT'); $link = MenuTopLinks::get($link[0]['id_linksmenutop'], $default_language, (int)Shop::getContextShopID()); } $this->_menu .= '<li class="'.($link[0]['id_linksmenutop']==2 || $link[0]['id_linksmenutop']==1 ? 'class="active"':'').'"><a href="'.Tools::HtmlEntitiesUTF8($link[0]['link']).'"'.(($link[0]['new_window']) ? ' target="_blank"': '').'>'.$link[0]['label'].'</a></li>'.PHP_EOL; } break; Link to comment Share on other sites More sharing options...
tozi Posted May 2, 2014 Author Share Posted May 2, 2014 (edited) Thanks Milos, but doesnt work correct. Look Aktuality and Sortiment. <li class="class=" active""=""> Edited May 2, 2014 by tozi (see edit history) Link to comment Share on other sites More sharing options...
tozi Posted May 3, 2014 Author Share Posted May 3, 2014 Any idea? Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2014 Share Posted May 3, 2014 oops my code is bad instead of line: $this->_menu .= '<li class="'.($link[0]['id_linksmenutop']==2 || $link[0]['id_linksmenutop']==1 ? 'class="active"':'').'"><a href="'.Tools::HtmlEntitiesUTF8($link[0]['link']).'"'.(($link[0]['new_window']) ? ' target="_blank"': '').'>'.$link[0]['label'].'</a></li>'.PHP_EOL; use $this->_menu .= '<li class="'.($link[0]['id_linksmenutop']==2 || $link[0]['id_linksmenutop']==1 ? 'active':'').'"><a href="'.Tools::HtmlEntitiesUTF8($link[0]['link']).'"'.(($link[0]['new_window']) ? ' target="_blank"': '').'>'.$link[0]['label'].'</a></li>'.PHP_EOL; Link to comment Share on other sites More sharing options...
tozi Posted May 3, 2014 Author Share Posted May 3, 2014 Milos, this modification completely knocked me add links through the module. Thank you for trying. Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2014 Share Posted May 3, 2014 can you show how the link looks like at the moment? Link to comment Share on other sites More sharing options...
tozi Posted May 3, 2014 Author Share Posted May 3, 2014 Here http://presta.simplydesign.sk/ <li class="class=" active""=""><a href="http://presta.simplydesign.sk/index.php?fc=module&module=newsiw&controller=news">Aktuality</a></li> Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2014 Share Posted May 3, 2014 hello it looks the same as before you changed code as i suggested? btw. menu module needs to be recompiled, because it uses caching, moreover module contents is generated in php file (not in tpl as it is in other modules). THis is why it's worth to open module configuration page, and just hit save there, module will be regenerated with new code Link to comment Share on other sites More sharing options...
tozi Posted May 4, 2014 Author Share Posted May 4, 2014 You're right. It's working. Thanks a lot. Link to comment Share on other sites More sharing options...
tozi Posted May 4, 2014 Author Share Posted May 4, 2014 One little problem. Selector "active" is active permanently. Link to comment Share on other sites More sharing options...
vekia Posted May 4, 2014 Share Posted May 4, 2014 and it shouldn't? when it should be applied? Link to comment Share on other sites More sharing options...
tozi Posted May 4, 2014 Author Share Posted May 4, 2014 No. I need to be added when the selector is clicked on an item in the menu. 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