collections - Magento - Add filter to getLoadedProductCollection() -
in magento store (ce-1.9.0) have setup custom product attribute:
custom_depth_check and attribute has setting of
used in product listing : yes used sorting in product listing : yes i need filter getloadedproductcollection() attribute. attribute either set at:
null 0 1 i need filter instances of getloadedproductcollection() exlcude products
custom_depth_check : 1 i have tried clear , reload so:
$_productcollection=$this->getloadedproductcollection() ->clear() ->addattributetofilter('custom_depth_check', array('neq' => 1)); but results in empty collection. tried adding ->load() @ end again nothing comes up.
the collection loaded in file: app/code/mage/catalog/block/product/list.php in function: _getproductcollection()
do local ovveride copyng file in local folder app/code/local/mage/catalog/block/product/list.php
and add new filters before line
$this->preparesortablefieldsbycategory($layer->getcurrentcategory()); your code like:
$this->_productcollection->addattributetofilter('custom_depth_check', array('neq' => 1)); //your new filter $this->preparesortablefieldsbycategory($layer->getcurrentcategory()); best regards giuseppe
Comments
Post a Comment