I've been trying for a while now to assign a product to a new category. We are running multiple store views, but when i try to assign the products to the new category IDs the original product is also affected.
$newProduct = Mage::getModel('catalog/product')->setStoreId($this->_targetStoreId)->load($productId); $newProduct->setCategoryIds($newCategoryIds); $newProduct->getResource()->save($newProduct);
Can anyone see the bug?
For some products i get this error:
SQLSTATE: Integrity constraint violation: 1062 Duplicate entry '47893-0-6-8' for key 'FA0D1FDA369EC09AFFDA36F11B04E66B'