From 17be5368c7c4123647883dae7e531938eee29c4c Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Jan 2013 15:41:13 +0100 Subject: [PATCH] [*] BO : Fix #PSCFI-6225 for 1.5.X --- controllers/admin/AdminProductsController.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 42c027e72..201e39d3d 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -989,7 +989,12 @@ class AdminProductsControllerCore extends AdminController elseif (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position'))) $this->errors[] = Tools::displayError('Failed to update the position.'); else - $this->redirect_after = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&action=Customization&conf=5'.(($id_category = (Tools::getIsset('id_category') ? (int)Tools::getValue('id_category') : '')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminProducts'); + { + $category = new Category((int)tools::getValue('id_category')); + if (Validate::isLoadedObject($category)) + Hook::exec('actionCategoryUpdate', array('category' => $category)); + $this->redirect_after = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&action=Customization&conf=5'.(($id_category = (Tools::getIsset('id_category') ? (int)Tools::getValue('id_category') : '')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminProducts'); + } } public function initProcess() @@ -4212,7 +4217,12 @@ class AdminProductsControllerCore extends AdminController { if ($product = new Product((int)$pos[2])) if (isset($position) && $product->updatePosition($way, $position)) - echo 'ok position '.(int)$position.' for product '.(int)$pos[2].'\r\n'; + { + $category = new Category((int)$id_category); + if (Validate::isLoadedObject($category)) + hook::Exec('categoryUpdate', array('category' => $category)); + echo 'ok position '.(int)$position.' for product '.(int)$pos[2]."\r\n"; + } else echo '{"hasError" : true, "errors" : "Can not update product '.(int)$id_product.' to position '.(int)$position.' "}'; else @@ -4249,5 +4259,4 @@ class AdminProductsControllerCore extends AdminController } } } -} - +} \ No newline at end of file