[-] BO : Fix #PSCFV-4949 position updating after deleting a category from a product
This commit is contained in:
1 parent
891666cf4a
commit
b0d9e82260
1 file changed
+4
-4
+4
-4
@@ -849,18 +849,18 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteCategories($clean_positions = false)
|
public function deleteCategories($clean_positions = false)
|
||||||
{
|
{
|
||||||
$return = Db::getInstance()->delete('category_product', 'id_product = '.(int)$this->id);
|
|
||||||
if ($clean_positions === true)
|
if ($clean_positions === true)
|
||||||
{
|
|
||||||
$result = Db::getInstance()->executeS(
|
$result = Db::getInstance()->executeS(
|
||||||
'SELECT `id_category`
|
'SELECT `id_category`
|
||||||
FROM `'._DB_PREFIX_.'category_product`
|
FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE `id_product` = '.(int)$this->id
|
WHERE `id_product` = '.(int)$this->id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$return = Db::getInstance()->delete('category_product', 'id_product = '.(int)$this->id);
|
||||||
|
if ($clean_positions === true)
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$this->cleanPositions((int)$row['id_category']);
|
$return &= $this->cleanPositions((int)$row['id_category']);
|
||||||
}
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user