I have disabled a category of products that are only for Christmas, but if I use the search engine, the products appear although the category is disabled. How can I do so that the products are also hidden? Do I have to disable the products one by one?
Make an observer on the
catalog_category_save_after event for the adminhtml. In the observer you can retrieve the category object and write your logic there. In general;
- Create Event
- Retrieve category that is saved in observer.
- Retrieve all products from this category and based on the status of the category you can loop through these products to set them enabled/disabled.
If you don't know how to create an event: