public function processHook($hook = null) { $theme_name = Context::getContext()->shop->getTheme(); if (file_exists(_PS_ALL_THEMES_DIR_ . $theme_name . '/modules/' . $this->name . '/views/templates/hook/' . $hook . '/megamenu.tpl')) { $tpl = '/views/templates/hook/' . $hook . '/megamenu.tpl'; } elseif (file_exists(dirname(__FILE__) . '/views/templates/hook/' . $hook . '/megamenu.tpl')) { $tpl = 'views/templates/hook/' . $hook . '/megamenu.tpl'; } else { $tpl = 'views/templates/hook/megamenu.tpl'; } if (!$this->isCached($tpl, $this->getCacheId())) { $params = array(); $params['params'] = Configuration::get('LEO_MENUSIDEBAR_PARAMS'); if (isset($params['params']) && !empty($params['params'])) { $params['params'] = Tools::jsonDecode($params['params']); } $obj = new Sbmegamenu(); $obj->setModule($this); $typesub = Configuration::get('LEO_MENUSIDEBAR_TYPE'); $theme = Context::getContext()->shop->theme_name; if ($typesub == 'auto') { $layout_direction = Configuration::get('LEOBASIC_LAYOUT_DIRECTION'); $cookie = LeoSbmegamenuHelper::getCookie(); if ($hook && $hook == 'rightcolumn') { if (isset($cookie[$theme . '_layout_dir']) && $cookie[$theme . '_layout_dir']) { $layout = $cookie[$theme . '_layout_dir']; if ($layout == 'right-left-main' || $layout == 'right-main-left' || $layout == 'left-right-main') { $typesub = 'right'; } elseif ($layout == 'main-left-right') { $typesub = 'left'; } else { if ($layout_direction == 'left-right-main' || $layout_direction == 'main-left-right') { $typesub = 'right'; } else { $typesub = 'left'; } } } else { if ($layout_direction == 'left-right-main' || $layout_direction == 'main-left-right') { $typesub = 'right'; } else { $typesub = 'left'; } } } elseif ($hook && $hook == 'leftcolumn') { if (isset($cookie[$theme . '_layout_dir']) && $cookie[$theme . '_layout_dir']) { $layout = $cookie[$theme . '_layout_dir']; if ($layout == 'right-main-left' || $layout == 'main-left-right') { $typesub = 'left'; } elseif ($layout == 'left-right-main' || $layout == 'right-left-main') { $typesub = 'right'; } else { if ($layout_direction == 'right-left-main' || $layout_direction == 'right-main-left') { $typesub = 'left'; } else { $typesub = 'right'; } } } else { if ($layout_direction == 'right-left-main' || $layout_direction == 'right-main-left') { $typesub = 'left'; } else { $typesub = 'right'; } } } elseif ($this->context->language->is_rtl) { $typesub = 'left'; } else { $typesub = 'right'; } } $boostrapmenu = $obj->getFrontTree(1, false, $params['params'], $typesub); $this->smarty->assign('boostrapmenu', $boostrapmenu); return $this->display(__FILE__, $tpl, $this->getCacheId()); } return $this->display(__FILE__, $tpl, $this->getCacheId()); }