Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento:如何使用catalogsearch/query模型查找没有图像的产品?_Magento_Search - Fatal编程技术网

Magento:如何使用catalogsearch/query模型查找没有图像的产品?

Magento:如何使用catalogsearch/query模型查找没有图像的产品?,magento,search,Magento,Search,这是我的代码: $catalogSearchModel = Mage::getModel('catalogsearch/query')->setQueryText($q); $catalogSearchModelCollection = $catalogSearchModel->getResultCollection(); $catalogSearchModelCollection->getSelect()->limit(5); $results = $catalogSe

这是我的代码:

$catalogSearchModel = Mage::getModel('catalogsearch/query')->setQueryText($q);
$catalogSearchModelCollection = $catalogSearchModel->getResultCollection();
$catalogSearchModelCollection->getSelect()->limit(5);
$results = $catalogSearchModelCollection->getData();

我应该添加什么才能只查找带有图像的产品?

对带有图像的产品使用以下代码

$catalogSearchModel = Mage::getModel('catalogsearch/query')->setQueryText($q);
 $catalogSearchModelCollection = $catalogSearchModel->getResultCollection();
 $catalogSearchModelCollection->addAttributeToFilter('image', array('neq' => 'no_selection');
 $catalogSearchModelCollection->getSelect()->limit(5);
 $results = $catalogSearchModelCollection->getData();

我想你的问题的答案可以在。