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

Can anyone see the bug?

For some products i get this error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '47893-0-6-8' for key 'FA0D1FDA369EC09AFFDA36F11B04E66B'

1 Answer 1

  • The product - category relation s global.
  • It does not depend on the store view or website.
  • What you can do is to have a different category tree on the second website.
  • But this will result in duplicate categories.

When you see catalog_category_product table, and it only has category_id and product_id not store_id

  • you are always welcome @fatkid
    – Divyesh
    May 16, 2018 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.