[Magento] Default Search / Mini Search returns 0 results
Was debugging this weird problem with a client's Magento 1.5.1.0 site.
The Mini Search (and the default search - http://example.com/catalogsearch/result/?q=searchTerm) is not returning the correct result.
Surprisingly the advanced search is working fine.
After trying out all sort of methods, finding and editing the .phtml, .xml files. I found out that its one of the core files that causes this issue.
Solution
Open up app/code/core/Mage/CatalogSearch/Block/Result.php
Uncomment line 149 and 150
Then change line 172
That solves the search problem.
:)
The Mini Search (and the default search - http://example.com/catalogsearch/result/?q=searchTerm) is not returning the correct result.
Surprisingly the advanced search is working fine.
After trying out all sort of methods, finding and editing the .phtml, .xml files. I found out that its one of the core files that causes this issue.
Solution
Open up app/code/core/Mage/CatalogSearch/Block/Result.php
Uncomment line 149 and 150
// $this->getListBlock()
// ->setCollection($this->_getProductCollection());
Then change line 172
$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();to
$this->_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
That solves the search problem.
:)
Awesome! Searched everywhere for a solution and this worked perfectly. Thanks so much!
ReplyDeleteThank you. You have saved my life (well, more or less ;-) )
ReplyDeleteSearched for a solution so long, finally found this. Works perfectly.
Great Deal! :D
A quick thanks from me too. The change worked perfectly.
ReplyDeleteSorry, Your given solution is not working for me. I am using magento1.7 kindly provide some more solutions.
ReplyDeleteYou are a life saver.... millions thankssss
ReplyDelete