diff --git a/classes/module/Module.php b/classes/module/Module.php index 234897db7..83e197387 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -668,6 +668,7 @@ abstract class ModuleCore if ($alias = Hook::getRetroHookName($hook_name)) $hook_name = $alias; + Hook::exec('actionModuleRegisterHookBefore', array('object' => $this, 'hook_name' => $hook_name)); // Get hook id $id_hook = Hook::getIdByName($hook_name); @@ -714,6 +715,7 @@ abstract class ModuleCore )); } + Hook::exec('actionModuleRegisterHookAfter', array('object' => $this, 'hook_name' => $hook_name)); return $return; } diff --git a/install-dev/upgrade/sql/1.5.5.0.sql b/install-dev/upgrade/sql/1.5.5.0.sql index c0d8d4632..f4953cc04 100644 --- a/install-dev/upgrade/sql/1.5.5.0.sql +++ b/install-dev/upgrade/sql/1.5.5.0.sql @@ -15,5 +15,5 @@ CHANGE `module_name` `module_name` VARCHAR(64) NULL DEFAULT NULL; /* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */; /* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */; /* PHP:fix_download_product_feature_active(); */; - - +/* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */; diff --git a/modules/blockmyaccount/blockmyaccount.php b/modules/blockmyaccount/blockmyaccount.php index d16ca8e2e..a83e87ebd 100644 --- a/modules/blockmyaccount/blockmyaccount.php +++ b/modules/blockmyaccount/blockmyaccount.php @@ -48,7 +48,8 @@ class BlockMyAccount extends Module if (!$this->addMyAccountBlockHook() || !parent::install() || !$this->registerHook('displayLeftColumn') - || !$this->registerHook('displayHeader')) + || !$this->registerHook('displayHeader') + || !$this->registerHook('actionModuleRegisterHookAfter')) return false; return true; } @@ -58,6 +59,12 @@ class BlockMyAccount extends Module return (parent::uninstall() && $this->removeMyAccountBlockHook()); } + public function hookActionModuleRegisterHookAfter($params) + { + if ($params['hook_name'] == 'displayMyAccountBlock') + $this->_clearCache('blockmyaccount.tpl'); + } + public function hookDisplayLeftColumn($params) { if (!$this->context->customer->isLogged()) diff --git a/modules/blockmyaccountfooter/blockmyaccountfooter.php b/modules/blockmyaccountfooter/blockmyaccountfooter.php index 3d5cc91a7..538d4fe4d 100644 --- a/modules/blockmyaccountfooter/blockmyaccountfooter.php +++ b/modules/blockmyaccountfooter/blockmyaccountfooter.php @@ -33,7 +33,7 @@ class Blockmyaccountfooter extends Module { $this->name = 'blockmyaccountfooter'; $this->tab = 'front_office_features'; - $this->version = '1.2'; + $this->version = '1.3'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -45,7 +45,7 @@ class Blockmyaccountfooter extends Module public function install() { - if (!$this->addMyAccountBlockHook() || !parent::install() || !$this->registerHook('footer') || !$this->registerHook('header')) + if (!$this->addMyAccountBlockHook() || !parent::install() || !$this->registerHook('footer') || !$this->registerHook('header') || !$this->registerHook('actionModuleRegisterHookAfter')) return false; return true; } @@ -55,6 +55,12 @@ class Blockmyaccountfooter extends Module return parent::uninstall() && $this->removeMyAccountBlockHook(); } + public function hookActionModuleRegisterHookAfter($params) + { + if ($params['hook_name'] == 'displayMyAccountBlock') + $this->_clearCache('blockmyaccountfooter.tpl'); + } + public function hookLeftColumn($params) { global $smarty; @@ -97,7 +103,7 @@ class Blockmyaccountfooter extends Module $smarty->assign(array( 'voucherAllowed' => CartRule::isFeatureActive(), 'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')), - 'HOOK_BLOCK_MY_ACCOUNT' => Hook::exec('displayMyAccountBlock') + 'HOOK_BLOCK_MY_ACCOUNT' => Hook::exec('displayMyAccountBlockfooter') )); return $this->display(__FILE__, 'blockmyaccountfooter.tpl', $this->getCacheId()); }