2

everyone.

I have a little problem, and I hope you can help me. Suppose I have a Site that has two Websites: Website1 and Website2. Respectively each has its StoreView1 and StoreView2:

--Website1
----StoreView1
--Website2
----StoreView2

And I haven the next Category structure:

--Default Category
----Shoes
----Outlet
------Shoes

So, if a Product is Shoes, It should be assigned to Category Shoes. In additional, if the product is Outlet, It should be assigned to Outlet > Shoes. But, a product can be Outlet in StoreView1 but not in StoreView2. So, I need that the product in StoreView1 to be assigned to Shoes and Outlet > Shoes, but in StoreView2 to be assigned only to Shoes.

But, when I try it:

$product = Mage::getModel('catalog/product')->setStoreId(<id of StoreView1>)->load(<Product Id>);
$product->setCategoryIds(array(<Shoes id>, <Outlet > Shoes Id>)->save();

$product = Mage::getModel('catalog/product')->setStoreId(<id of StoreView2>)->load(<Product Id>);
$product->setCategoryIds(array(<Shoes id>)->save();

The product always take the last categories I assigned. In other words, it assigns the categories to all stores equally, instead of assigning per store. I tried in Admin, changing product categories, positioned on the scope of the store view, but also the change is reflected in the other store view too. Are product categories always global? Is there no way to assign them for Store View?

Thanks for the help.

2

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.

  • You are right, I saw catalog_category_product table, and it only have category_id and product_id, not store_id... I think I will need to create two outlet categories, one for each store :/ Thanks! – Eliacim DAVILA - CENSERE Dec 16 '15 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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