从1.4升级到1.5后,快速搜索将返回所有产品.高级搜索工作得很好.我已经清除了缓存并重新索引了所有内容,但仍然没有.有什么想法吗?
搜索也不会应用管理员中设置的最小查询长度(即,我可以不输入任何内容并仍然显示所有内容).在LIKE或FULLTEXT搜索之间切换似乎什么都不做.
我已经看到这个Magento Search返回所有产品,但我的所有插件都是最新的(我没有任何搜索插件).
Rai*_*tef 15
我为此奋斗了好几天,事实证明,catalogsearch/layer块最终会调用搜索引擎并将结果存储在catalogsearch_results表中.
搜索结果列表块只是对product_id列(以及LIKE或FULLTEXT过滤器)上的catalogsearch_results表连接的产品集合的简单查询.
因此,简而言之,在您的一个布局XML文件(或您的local.xml)中,请确保您拥有以下代码:
<catalogsearch_result_index>
<reference name="left">
<block type="catalogsearch/layer" name="catalogsearch.leftnav" template="catalog/layer/view.phtml"/>
</reference>
</catalogsearch_result_index>
Run Code Online (Sandbox Code Playgroud)
当然,您可以将它放在任何其他块(不仅仅是左侧)中,但要确保在catalogsearch/result块(XML中的别名为"search.result")之前在句柄中的某处引用它.
如果使用remove标记删除了图层导航,则必须为块使用不同的名称(而不是"catalogsearch.leftnav").
如果您甚至需要从搜索结果页面隐藏它,请将其保留在XML中,但使用CSS隐藏它:
.block-layered-nav {
display: none;
}
Run Code Online (Sandbox Code Playgroud)
我希望这可以帮助一些其他可怜的灵魂受到这种设计模式的憎恶折磨.
小智 8
我通过编辑app/code/core/Mage/CatalogSearch/Block Result.php来解决问题
取消注释149和150行
$this->getListBlock()
->setCollection($this->_getProductCollection());
Run Code Online (Sandbox Code Playgroud)
并改变第172行:
$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
Run Code Online (Sandbox Code Playgroud)
至:
$this->_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
Run Code Online (Sandbox Code Playgroud)
您是否使用带有分层搜索结果的 2 列布局...catalog/layer/view.phtml ?当我切换到 1 列布局并删除分层导航时,我注意到结果返回了与我的搜索查询不匹配的所有产品。