I want to hide products, which don't have value of a particular attribute, from every page of my website. for this I have used observer on event catalog_product_collection_load_after
and catalog_product_load_after
and here is my observer function:
public function customFilter(Varien_Event_Observer $observer)
{
$collection = $observer->getEvent()->getCollection();
$collection->addAttributeToFilter('seller', array('neq' => 'NULL'));
return $collection;
}
If I print the sql query and run it into my database it returns proper results. But the filter applied here does not reflect in frontend.
Is there any other way to do this?