magento - quick search returns all products
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-i开发者_如何学Cndexed 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).
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.
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();
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.
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/
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...
精彩评论