Reputation: 83
I am getting this object on list page
$_productCollection=$this->getLoadedProductCollection();
//return 3 records
now I applied filter as
$_productCollection=$_productCollection->addFieldToFilter('genre', array('finset' => '126'));
//now it should return 1 record
but it gives me a count of 3. Now, if I run the query in database by getting the query using echo $_productCollection->getSelect();
it returns 1 record.
Can anybody help me to resolve this?
Upvotes: 2
Views: 2085
Reputation: 12727
Most likely this doesn't work because $this->getLoadedProductCollection()
returns a collection which already has been loaded by the catalog/layer
singleton.
But you could override Mage_Catalog_Model_Layer::prepareProductCollection()
to get in control and add the custom filters you want.
Upvotes: 4