diff --git a/classes/Tools.php b/classes/Tools.php index a66dc1456..782e4cae3 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1944,9 +1944,11 @@ FileETag INode MTime Size * * @param Smarty $smarty */ - public static function clearCache($smarty) - { - $smarty->clearAllCache(); + public static function clearCache($smarty, $tpl = false, $cache_id = null, $compile_id = null) + { + if (!$tpl) + return $smarty->clearAllCache(); + return $smarty->clearCache($tpl, $cache_id, $compile_id); } /** diff --git a/classes/module/Module.php b/classes/module/Module.php index ca192616c..775858d97 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -1545,9 +1545,11 @@ abstract class ModuleCore return $context->smarty->isCached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); } - protected function _clearCache($template, $cacheId = null, $compileId = null) + protected function _clearCache($template, $cache_id = null, $compile_id = null) { - Tools::clearCache(Context::getContext()->smarty); + Tools::enableCache(); + Tools::clearCache(Context::getContext()->smarty, $template, $cache_id, $compile_id); + Tools::restoreCacheSettings(); } protected function _generateConfigXml() diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php index 06a40c3e3..54077e327 100644 --- a/modules/blocktopmenu/blocktopmenu.php +++ b/modules/blocktopmenu/blocktopmenu.php @@ -68,6 +68,16 @@ class Blocktopmenu extends Module !$this->registerHook('top') || !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') || !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1') || + !$this->registerHook('categoryUpdate') || + !$this->registerHook('categoryDeletion') || + !$this->registerHook('cmsUpdate') || + !$this->registerHook('cmsDeletion') || + !$this->registerHook('supplierUpdate') || + !$this->registerHook('supplierDeletion') || + !$this->registerHook('manufacturerUpdate') || + !$this->registerHook('manufacturerDeletion') || + !$this->registerHook('productUpdate') || + !$this->registerHook('productDeletion') || !$this->installDB()) return false; return true; @@ -120,6 +130,8 @@ class Blocktopmenu extends Module $links_label = Tools::getValue('link') ? array_filter(Tools::getValue('link'), 'strlen') : array(); $spacer = str_repeat(' ', $this->spacer_size); $divLangName = 'link_label'; + + $update_cache = false; if (Tools::isSubmit('submitBlocktopmenu')) { @@ -128,6 +140,7 @@ class Blocktopmenu extends Module else $this->_html .= $this->displayError($this->l('Unable to update settings')); Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', (bool)Tools::getValue('search')); + $update_cache = true; } else if (Tools::isSubmit('submitBlocktopmenuLinks')) { @@ -145,6 +158,7 @@ class Blocktopmenu extends Module MenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int)Shop::getContextShopID()); $this->_html .= $this->displayConfirmation($this->l('The link has been added')); } + $update_cache = true; } else if (Tools::isSubmit('submitBlocktopmenuRemove')) { @@ -152,6 +166,7 @@ class Blocktopmenu extends Module MenuTopLinks::remove($id_linksmenutop, (int)Shop::getContextShopID()); Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK'.$id_linksmenutop.',', 'LNK'.$id_linksmenutop), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS'))); $this->_html .= $this->displayConfirmation($this->l('The link has been removed')); + $update_cache = true; } else if (Tools::isSubmit('submitBlocktopmenuEdit')) { @@ -170,8 +185,12 @@ class Blocktopmenu extends Module MenuTopLinks::update(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int)$id_shop, (int)$id_linksmenutop, (int)$id_linksmenutop); $this->_html .= $this->displayConfirmation($this->l('The link has been edited')); } + $update_cache = true; } - + + if ($update_cache) + $this->clearMenuCache(); + $this->_html .= '