diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php index ead371d8..6e543202 100755 --- a/modules/blocktopmenu/blocktopmenu.php +++ b/modules/blocktopmenu/blocktopmenu.php @@ -61,6 +61,19 @@ class Blocktopmenu extends Module $this->displayName = $this->l('Top horizontal menu'); $this->description = $this->l('Adds a new horizontal menu to the top of your e-commerce website.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); + + if (!isset(Context::getContext()->cookie->topMenu)){ + Context::getContext()->cookie->topMenu = md5('/'); + } + + if ($_SERVER['REQUEST_URI']=='/') { + Context::getContext()->cookie->topMenu = md5('/'); + } + + $topl = Tools::getValue('topl', ''); + if (!empty($topl)) { + Context::getContext()->cookie->topMenu = $topl; + } } public function install() @@ -437,9 +450,13 @@ class Blocktopmenu extends Module $link = MenuTopLinks::get($link[0]['id_linksmenutop'], $default_language, (int)Shop::getContextShopID()); } // antadis 12360 - define "active" menu here rather than in JS - //$active = (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI']==$link[0]['link']) ? ' class=\'active\'' : ''; + $active = ''; + $topl = md5($link[0]['link']); + if (Context::getContext()->cookie->topMenu == $topl) { + $active = ' class=\'active\''; + } - $this->_menu .= '