12630 - fix current selected menu item with param in url
This commit is contained in:
parent
f9eb8a9ac0
commit
3272832fd9
@ -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 .= '<li><a href="'.Tools::HtmlEntitiesUTF8($link[0]['link']).'"'.(($link[0]['new_window']) ? ' onclick="return !window.open(this.href);"': '').' title="'.Tools::safeOutput($link[0]['label']).'">'.Tools::safeOutput($link[0]['label']).'<span class="icon-square"></span></a></li>'.PHP_EOL;
|
||||
$this->_menu .= '<li '.$active.'><a href="'.Tools::HtmlEntitiesUTF8($link[0]['link']).'?topl='.$topl.'"'.(($link[0]['new_window']) ? ' onclick="return !window.open(this.href);"': '').' title="'.Tools::safeOutput($link[0]['label']).'">'.Tools::safeOutput($link[0]['label']).'<span class="icon-square"></span></a></li>'.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');
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
<!--/ Menu -->
|
||||
{/if}
|
||||
|
||||
{*
|
||||
{literal}
|
||||
<script>
|
||||
if($('body').attr('id') == 'module-privatesales-home'){
|
||||
@ -42,7 +42,7 @@
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
*}
|
||||
|
||||
{*{if $page_name == "module-privatesales-home"}
|
||||
{literal}
|
||||
|
Loading…
Reference in New Issue
Block a user