Fixed: Unable to update the position of the services in the back office

This commit is contained in:
vishalsingh.qlo325
2025-11-18 12:39:03 +05:30
parent 41f97a6b9e
commit 06cd40ead9

View File

@@ -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));