Reputation: 7588
This is my code:
$catalogSearchModel = Mage::getModel('catalogsearch/query')->setQueryText($q);
$catalogSearchModelCollection = $catalogSearchModel->getResultCollection();
$catalogSearchModelCollection->getSelect()->limit(5);
$results = $catalogSearchModelCollection->getData();
What should I add to this to only find products with images?
Upvotes: 0
Views: 930
Reputation: 624
Use following code for product which have images.
$catalogSearchModel = Mage::getModel('catalogsearch/query')->setQueryText($q);
$catalogSearchModelCollection = $catalogSearchModel->getResultCollection();
$catalogSearchModelCollection->addAttributeToFilter('image', array('neq' => 'no_selection');
$catalogSearchModelCollection->getSelect()->limit(5);
$results = $catalogSearchModelCollection->getData();
Upvotes: 2