From faf0a3f3775ca6ad4bdb480f295ea8280bff943c Mon Sep 17 00:00:00 2001 From: Pierre RAMBAUD Date: Mon, 13 Dec 2021 14:02:03 +0100 Subject: [PATCH] Remove deprecated hooks and update to 2.1.2 --- config.xml | 2 +- ps_featuredproducts.php | 14 +++++++------- upgrade/upgrade-2.1.2.php | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 upgrade/upgrade-2.1.2.php diff --git a/config.xml b/config.xml index c0e8a9f..5bfb824 100755 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ ps_featuredproducts - + diff --git a/ps_featuredproducts.php b/ps_featuredproducts.php index 3e914e6..13e8a1b 100644 --- a/ps_featuredproducts.php +++ b/ps_featuredproducts.php @@ -41,7 +41,7 @@ public function __construct() { $this->name = 'ps_featuredproducts'; $this->author = 'PrestaShop'; - $this->version = '2.1.1'; + $this->version = '2.1.2'; $this->need_instance = 0; $this->ps_versions_compliancy = [ @@ -67,9 +67,9 @@ public function install() Configuration::updateValue('HOME_FEATURED_RANDOMIZE', false); return parent::install() - && $this->registerHook('addproduct') - && $this->registerHook('updateproduct') - && $this->registerHook('deleteproduct') + && $this->registerHook('actionProductAdd') + && $this->registerHook('actionProductUpdate') + && $this->registerHook('actionProductDelete') && $this->registerHook('displayHome') && $this->registerHook('displayOrderConfirmation2') && $this->registerHook('displayCrossSellingShoppingCart') @@ -85,17 +85,17 @@ public function uninstall() return parent::uninstall(); } - public function hookAddProduct($params) + public function hookActionProductAdd($params) { $this->_clearCache('*'); } - public function hookUpdateProduct($params) + public function hookActionProductUpdate($params) { $this->_clearCache('*'); } - public function hookDeleteProduct($params) + public function hookActionProductDelete($params) { $this->_clearCache('*'); } diff --git a/upgrade/upgrade-2.1.2.php b/upgrade/upgrade-2.1.2.php new file mode 100644 index 0000000..2c5dac0 --- /dev/null +++ b/upgrade/upgrade-2.1.2.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_1_2($module) +{ + $module->unregisterHook('addproduct'); + $module->unregisterHook('updateproduct'); + $module->unregisterHook('deleteproduct'); + $module->registerHook('actionProductAdd'); + $module->registerHook('actionProductUpdate'); + $module->registerHook('actionProductDelete'); + + return true; +}