// product import multishop fix with category default

This commit is contained in:
vChabot
2012-03-28 12:43:47 +00:00
parent fc3df92e22
commit 200e0bf4bf
3 changed files with 7 additions and 12 deletions
+5 -11
View File
@@ -4875,19 +4875,13 @@ class ProductCore extends ObjectModel
WHERE `id_product` = '.(int)$id_product);
}
public function updateCategoryDefault($shop = null, $insert = false)
public function updateCategoryDefault($shop = null)
{
if (is_null($shop))
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
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);
return Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'product_shop`
VALUES ('.(int)$this->id.', '.(int)$shop->id.', '.(int)$this->id_category_default.')
ON DUPLICATE KEY UPDATE `id_category_default` = '.(int)$this->id_category_default);
}
}