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 .= '
  • '.Tools::safeOutput($link[0]['label']).'
  • '.PHP_EOL; + $this->_menu .= '
  • '.Tools::safeOutput($link[0]['label']).'
  • '.PHP_EOL; } break; } @@ -581,8 +598,8 @@ class Blocktopmenu extends Module protected function getCacheId($name = null) { parent::getCacheId($name); - - $page_name = in_array($this->page_name, array('category', 'supplier', 'manufacturer', 'cms', 'product')) ? $this->page_name : 'index'; + //$page_name = in_array($this->page_name, array('category', 'supplier', 'manufacturer', 'cms', 'product')) ? $this->page_name : 'index'; + $page_name = Context::getContext()->cookie->topMenu; return 'blocktopmenu|'.(int)Tools::usingSecureMode().'|'.$page_name.'|'.(int)$this->context->shop->id.'|'.implode(',',$this->user_groups).'|'.(int)$this->context->language->id.'|'.(int)Tools::getValue('id_category').'|'.(int)Tools::getValue('id_manufacturer').'|'.(int)Tools::getValue('id_supplier').'|'.(int)Tools::getValue('id_cms').'|'.(int)Tools::getValue('id_product'); } diff --git a/themes/site/modules/blocktopmenu/blocktopmenu.tpl b/themes/site/modules/blocktopmenu/blocktopmenu.tpl index 328d3743..26cecd3a 100755 --- a/themes/site/modules/blocktopmenu/blocktopmenu.tpl +++ b/themes/site/modules/blocktopmenu/blocktopmenu.tpl @@ -22,7 +22,7 @@ {/if} - +{* {literal} {/literal} - +*} {*{if $page_name == "module-privatesales-home"} {literal}