1

When we create / edit product, then we select category and website, for store views whose category is not selected, the visibility should be set to "not visible".

Is it possible by default?

2 Answers 2

2

Not possible by default, no. You could try to write an observer for catalog_product_prepare_save, which is dispatched from the product save controller and receives the parameters product and request.

But with a single save, only one store view can be saved, so you cannot achieve what you want with manipulating the product object alone. You have to save the visibility attribute directly. Fortunately, there is a method for it:

addAttributeUpdate($code, $value, $store)

$product->addAttributeUpdate('visibility', false, $storeId);
1

Yes it is by default in magento. if you don't select any category for product then this product will not appear in frontend.

1
  • Wrong, you can still search it. Commented Jul 19, 2016 at 6:19

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.