diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 28d360e21..43838ccc8 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -2605,6 +2605,7 @@ class AdminNormalProductsControllerCore extends AdminController ->setSelectedCategories(array((int)$id_category)); $this->tpl_list_vars['category_tree'] = $tree->render(); + $this->context->smarty->assign('token', $this->token);// as tree updates the token from the smarty context // used to build the new url when changing category $this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token; } @@ -4513,7 +4514,7 @@ class AdminNormalProductsControllerCore extends AdminController if ($this->tabAccess['edit'] === 1) { $way = (int)(Tools::getValue('way')); $id_product = (int)Tools::getValue('id_product'); - $id_category = (int)Tools::getValue('id_category'); + $id_category = (int)Tools::getValue('id_category_hotel'); $positions = Tools::getValue('product'); $page = (int)Tools::getValue('page'); $selected_pagination = (int)Tools::getValue('selected_pagination'); @@ -4521,14 +4522,13 @@ class AdminNormalProductsControllerCore extends AdminController if (is_array($positions)) { foreach ($positions as $position => $value) { $pos = explode('_', $value); - if ((isset($pos[1]) && isset($pos[2])) && ($pos[1] == $id_category && (int)$pos[2] === $id_product)) { if ($page > 1) { $position = $position + (($page - 1) * $selected_pagination); } if ($product = new Product((int)$pos[2])) { - if (isset($position) && $product->updatePosition($way, $position)) { + if (isset($position) && $product->updatePosition($way, $position, $id_category)) { $category = new Category((int)$id_category); if (Validate::isLoadedObject($category)) { hook::Exec('categoryUpdate', array('category' => $category));