// id_category_default fix
This commit is contained in:
+11
-6
@@ -4830,14 +4830,19 @@ class ProductCore extends ObjectModel
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
}
|
||||
|
||||
public function updateCategoryDefault($shop = null)
|
||||
public function updateCategoryDefault($shop = null, $insert = false)
|
||||
{
|
||||
if (is_null($shop))
|
||||
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product_shop`
|
||||
SET `id_category_default` = '.(int)$this->id_category_default.'
|
||||
WHERE `id_shop` = '.(int)$shop->id.'
|
||||
AND `id_product` = '.(int)$this->id);
|
||||
if ($insert)
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_shop`
|
||||
VALUES ('.(int)$this->id.', '.(int)$shop->id.', '.(int)$this->id_category_default.')');
|
||||
else
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product_shop`
|
||||
SET `id_category_default` = '.(int)$this->id_category_default.'
|
||||
WHERE `id_shop` = '.(int)$shop->id.'
|
||||
AND `id_product` = '.(int)$this->id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user