I have a custom product attribute soldby
which is a dropdown attribute.
I am making a custom product grid. In that grid, I want to display products where soldby
=abc.
I have written the following code in Grid.php.
prepareCollection()
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('soldby');
$collection->addFieldToFilter(array(
array('attribute'=>'soldby','eq'=>'abc'),
));
But this doesnot work. Now, no products are shown even though there are products with attribute soldby
=abc.
How can I achieve this ?
addAttributeToFilter('soldby', array('eq' => 'abc'))