magento - 快速搜索返回所有产品

发布于 2024-10-20 02:02:43 字数 317 浏览 3 评论 0原文

从 1.4 升级到 1.5 后,快速搜索会返回所有产品。高级搜索效果很好。我已经清除了缓存并重新索引了所有内容,但仍然一无所获。有什么想法吗?

搜索也不应用管理员中设置的最小查询长度(即,我可以输入任何内容,但仍会显示所有内容)。在 LIKE 或 FULLTEXT 搜索之间切换似乎没有任何作用。

我已经看到这个 Magento 搜索返回所有产品,但我的所有插件都是最新的(而且我没有任何搜索插件)。

After upgrading from 1.4 to 1.5 the quick search returns all products. The advanced search works just fine. I've cleared the cache and re-indexed everything but still nothing. Any ideas why?

The search also doesn't apply the minimum query length set in the admin (ie, I can enter nothing and still be shown everything). Switching between LIKE or FULLTEXT search seems to do nothing.

I've seen this Magento Search returns All Products but all my plugins are up to date (and I don't have any search plugins).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

魂归处 2024-10-27 02:02:43

我为此苦苦思索了好几天,结果发现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>

当然,您可以将其放在任何其他块中(不仅仅是 left),但请确保它在 catalogsearch/result 块(在 XML 中别名为“search.result”)之前的句柄中的某个位置被引用。

如果您使用 remove 标记删除了图层导航,则必须为该块使用不同的名称(而不是“catalogsearch.leftnav”)。

如果您甚至需要在搜索结果页面中隐藏它,请在 XML 中保留它的引用,但使用 CSS 隐藏它:

.block-layered-nav {
    display: none;
}

我希望这可以帮助其他一些被这种令人厌恶的设计模式折磨的可怜人。

I wrestled for this for days, it turns out the catalogsearch/layer block is what eventually calls into the search engine and stores the results in the catalogsearch_results table.

The search results list block is just a simple query over the products collection joined with the catalogsearch_results table on the product_id column (and the LIKE or FULLTEXT filter).

So, in short in one of your layout XML files (or your local.xml) make sure you have this code:

<catalogsearch_result_index>
    <reference name="left">
      <block type="catalogsearch/layer" name="catalogsearch.leftnav" template="catalog/layer/view.phtml"/>
    </reference>
</catalogsearch_result_index>

Of course you can put it in any other block (not just left) but make sure it is referenced somewhere in the handle before the catalogsearch/result block (which is aliased "search.result" in the XML).

If you removed layer navigation by using the remove tag, you'll have to use a different name for the block (instead of "catalogsearch.leftnav").

If you need to hide it even from the search results page, keep it referenced in the XML but hide it with CSS:

.block-layered-nav {
    display: none;
}

I hope this helps some other poor soul tortured by this design pattern abomination.

混吃等死 2024-10-27 02:02:43

我通过编辑 app/code/core/Mage/CatalogSearch/Block Result.php 取消

注释第 149 行和 150 行

$this->getListBlock()
           ->setCollection($this->_getProductCollection());

并将第 172 行从: 更改

$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();

为:

$this->_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();

I fixed the problem by edit the app/code/core/Mage/CatalogSearch/Block Result.php

Uncomment the line 149 and 150

$this->getListBlock()
           ->setCollection($this->_getProductCollection());

And change line 172 from:

$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();

to:

$this->_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
悸初 2024-10-27 02:02:43

您是否使用带有分层搜索结果的 2 列布局...catalog/layer/view.phtml ?当我切换到 1 列布局并删除分层导航时,我注意到结果返回了与我的搜索查询不匹配的所有产品。

Are you using a 2-column layout with layered search results ... catalog/layer/view.phtml ? I noticed on when I switched to a 1-column layout and removed the layered navigation that the results returned all products not matching results to my search query.

野稚 2024-10-27 02:02:43

请访问此链接

http://www.learnmagento。 org/magento-bug-fixes/magento-search-showing-all-products/

如果您的 Magento 搜索正在为搜索结果页面上的所有产品建立索引,并且搜索过滤器无法按您的需要工作,那么这里是解决方案:

转到您的模板文件夹,app/design/frontend/default/your-theme/
在这里您将找到一个名为 /template/ 的文件夹。里面会有另一个文件夹, /catalogsearch/

只需将其重命名为 /catalogsearch.bak/

现在转到 app/design/frontend/base/template/catalogsearch / 。复制此文件夹并将其复制到 app/design/frontend/default/your-theme/template/

还要从 app/design/frontend/ 复制 catalogsearch.xml基础/布局/到应用程序/设计/前端/默认/默认/布局/

Please visit this link

http://www.learnmagento.org/magento-bug-fixes/magento-search-showing-all-products/

If your Magento search is indexing all products on the search results page and the search filter is not working as you need, then here is the solution :

Goto your template folder, app/design/frontend/default/your-theme/
Here you will find a folder called /template/ . Inside it another folder will be there, /catalogsearch/

Just rename it to /catalogsearch.bak/

Now goto app/design/frontend/base/template/catalogsearch/ . Copy this folder and copy it to app/design/frontend/default/your-theme/template/

Also copy catalogsearch.xml from app/design/frontend/base/layout/ to app/design/frontend/default/default/layout/

最舍不得你 2024-10-27 02:02:43

我今天遇到了这个问题,可能不是您问题的原因,但我的 Aitoc Layered Navigation Pro Extension 需要升级。

我可以看到分层导航显示了正确的过滤器,但产品是错误的,一旦我单击过滤器,它就会自行纠正。

Aitoc 的问题是,如果您在 6 个月前购买了扩展,则必须支付升级费用。

它非常笨重,但作为紧急的快速修复,我只是调用了 adj_nav_make_request();页面加载后刷新产品列表的 javascript 函数。

希望这对某人有帮助...

I came across this problem today, may not have been the cause of your problem but my Aitoc Layered Navigation Pro Extension needed upgrading.

I could see that the layered navigation was showing the correct filters but the products were wrong, as soon as I clicked a filter it corrected itself.

The problem with Aitoc is that if you purchased the extension more than 6 months ago you have to pay for the upgrade.

It's clunky as hell but as an urgent quick fix I just called the adj_nav_make_request(); javascript function after the page had loaded to refresh the list of products.

Hope this helps someone...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文