我正在寻找一种在magento搜索中显示所有产品的方法。为了按属性进行快速搜索,我实现了GET过滤器,它将属性添加到过滤器的集合列表中,并且我想将它们应用于完整的产品集合。
if(count($_GET) > 0 && $isSearchPage){
$_productCollection = $_productCollection->clear()->addAttributeToSelect('*');
$suffix = array();
foreach($_GET as $filter => $value){
$suffix[$filter] = $value;
if($filter != 'q' && $filter != 'limit' && $filter != 'p'){
$_productCollection->addAttributeToFilter($filter,$value);
}
}
}
So far i tried
/catalogsearch/result/?q=%
/catalogsearch/result/?q=*
q=%返回结果,但不是全部。有什么方法可以达到我想达到的目标吗?还是我走错方向了
Magento已经有高级搜索功能,您可以根据属性搜索产品。您可以在这里看到此功能的演示。也许您可以根据您的需要扩展它。