I'm displaying products that have a 'selected' attribute as 'Yes' on top of my homepage.
Thus far I tried:
$_productCollection = Mage::getModel('catalog/product') -> getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('selected',array('eq'=>'Yes'))
->setVisibility(array(2,3,4))
->setOrder('created_at', 'desc')
->setPage(1, 48);
And:
$_productCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('selected',array('eq'=>'Yes'))
->setVisibility(array(2,3,4))
->setOrder('created_at', 'desc')
->setPage(1, 48);
Yet as you can see, "There are no products matching the selection." But there are several products I've set the 'selected' attribute to 'Yes'.
Screenshot of my attribute: http://postimg.org/gallery/53wrrrhe/
However when I get rid of this line:
->addAttributeToFilter('selected',array('eq'=>'Yes'))
From them, they are both working fine and giving all the products as expected.
My take is I'm writing this addAttributeToFilter wrong but I'm not sure how. Any help would be appreciated!
Thanks!