Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Quick Search in Magento 1.5 gives no search results but Advanced Search does
 
benz001
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-02-05
Sydney
 

This issue applies when you bring forward a 1.4 theme to 1.5, if your custom theme does not include the

<blocktype="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
block then you’ll get no results found for a search.

In version 1.5 it seems that the layered block needs to be instantiated before the search results will render - as long as the constructor is triggered it works.

If you don’t ever want to show the layered results block and just want search to work the way it did first include that block in your layout files then set System > Configuration > Catalog > Catalog Search > “Apply Layered Navigation if Search Results are Less Than” to -1.

This will allow the block to be instantiated but will make sure it never renders to page.

EDIT: Changed from 1 to -1, otherwise a search with exactly 1 result will still trigger the block to show

 
Magento Community Magento Community
Magento Community
Magento Community
 
onepack
Sr. Member
 
Total Posts:  98
Joined:  2008-06-02
Amsterdam
 

Wow.... you helped me a lot with this post!!
I noticed that my search wasn\’t working and found out that it had something to do with the custom made layout for my theme.
I removed the left side in the catalog.xml (where the layered nav resides). Putting it back in place solved the whole issue for the search.

The search really depends on the layered nav.!

Thanks for sharing!

 
Magento Community Magento Community
Magento Community
Magento Community
 
828LES
Jr. Member
 
Total Posts:  12
Joined:  2009-04-22
 

I tried this solution but I still get no search results.  I added the code in catalog.xml like this:

<catalog_category_layered>
        <
reference name="left">
            <
block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
            <
block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
        </
reference>

and set config Apply Layered Navigation if Search Results are Less Than to 1

I still get no results on search.

Has anyone found another solution?  I am using 1.5

 
Magento Community Magento Community
Magento Community
Magento Community
 
appien
Jr. Member
 
Total Posts:  11
Joined:  2011-01-03
 

Please not that this piece of code should be in the catalogsearch.xml.. Thanks for the solution. This was really a hard one.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Turnkeye
Enthusiast
 
Avatar
Total Posts:  908
Joined:  2008-12-20
URL: turnkeye.com
 

Full path to the XML file that should be modified in 1.5. version:
/app/design/frontend/default/blank/layout/catalogsearch.xml

The path could be different, check what theme is configured as default in you Magento:
System -> Design -> Current Package Name.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Netismine
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-10-28
 

I’ve just done a bit of testing and my uncached server gives about 400ms slower response when layered nav is on for 3500 results.. figure gonna increase threshold to like 4000 - 5000

 
Magento Community Magento Community
Magento Community
Magento Community
 
SkyBluePunk
Jr. Member
 
Total Posts:  2
Joined:  2009-11-27
 

I am running Magento 1.5.1.0, and have applied the Grayscale theme, which appears to have caused this problem wih the Search returning no reults.

I cannot locate the catalogsearch.xml file referred to in the posts above. 

Can anyone help me solve this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paul Bunkham
Jr. Member
 
Total Posts:  3
Joined:  2010-07-20
 

Thanks for this fix it really helped me, as I’d removed the search layered nav block in my layout.xml of my 1.5 theme. I wanted to tailor it, so I’ve just extended the catalogsearch/layer block and included that instead, which works fine.

However, I can’t understand it. Surely it’s a bug? Why should the display of layered navigation have any effect on the collection of products returned for a search?

 
Magento Community Magento Community
Magento Community
Magento Community
 
benz001
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-02-05
Sydney
 

I think it’s deliberate, but I’m not clear on the reasoning behind it.

The change appears to arise from the alteration to Mage_CatalogSearch_Block_Result. I haven’t chased all the code through but on quick inspection it looks like this means the current version relies on the layer block now to initialise the product collection.

I don’t recommend doing this because I don’t know why Magento moved away from this code, but if you revert a couple of methods back to the Magento 1.3.2.4 versions it will allow you to remove the block

/**
     * Set Search Result collection
     *
     * @return Mage_CatalogSearch_Block_Result
     */
    public function setListCollection()
    
{
        
//benz001  un-comment these two
        
$this->getListBlock()
           ->
setCollection($this->_getProductCollection());
       return 
$this;
    
}
    
/**
     * Retrieve loaded category collection
     *
     * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
     */
    
protected function _getProductCollection()
    
{
        
if (is_null($this->_productCollection)) {
            
//$this->_productCollection = $this->getListBlock()->getLoadedProductCollection(); benz001 comment out this
            
$this->_productCollection Mage::getSingleton('catalogsearch/layer')->getProductCollection();
        
}
        
        
return $this->_productCollection;
    
}

Personally I’m just going to use my first solution from the start of this thread and leave the layer block in the layout xml rather than override these blocks, but if anyone can see why they made this change I’d be interested to know.

 
Magento Community Magento Community
Magento Community
Magento Community
 
plu_australia
Sr. Member
 
Total Posts:  132
Joined:  2010-04-20
 

Hi sorry to sound so dumb, I have the problem where simple search 1.6 (just updated from 1.4.1.1) doesnt return any result but adanced search does.
Checking the file /app/design/frontend/default/default/mytheme/catalogsearch.xml
The code is as below- it seems to me my template already has this snippet referenced in the 1st post unless Im misunderstanding?

<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </
reference>
        <
reference name="left">
            <
block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
            <
remove name="catalogsearch.leftnav" />
        </
reference>
        <
reference name="content">
            <
block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
                <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
                    <
action method="setColumnCount"><count>3</count></action>
 
Magento Community Magento Community
Magento Community
Magento Community
 
junaidbhura
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2010-07-01
Bangalore, India
 

Adding

<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
fixed it for me! I upgraded from 1.4.1 to 1.6.1 !
 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  639
Joined:  2009-08-22
 

Hi all!

You can solve this problem using extension Search AutoComplete & Suggest Pro http://mirasvit.com/magento-extensions/search-autocomplete-suggestions.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top