Magento Forum

   
Search returns empty result
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

If your search always return empty result for both quick search and advanced search:
Your search returns no results.
No items were found using the following search criteria. Modify your search

Then go to app/code/core/Mage/Catalog/Model/Product/Visibility.php and change the following from

/**
     * Add visibility in searchfilter to collection
     *
     * @deprecated
     * @param Mage_Eav_Model_Entity_Collection_Abstract $collection
     * @return Mage_Catalog_Model_Product_Visibility
     */
    public function addVisibleInSearchFilterToCollection(Mage_Eav_Model_Entity_Collection_Abstract $collection)
    
{
        $collection
->setVisibility($this->getVisibleInSearchIds());
        
//$collection->addAttributeToFilter('visibility', array('in'=>$this->getVisibleInSearchIds()));
        
return $this;
    
}

to

/**
     * Add visibility in searchfilter to collection
     *
     * @deprecated
     * @param Mage_Eav_Model_Entity_Collection_Abstract $collection
     * @return Mage_Catalog_Model_Product_Visibility
     */
    public function addVisibleInSearchFilterToCollection(Mage_Eav_Model_Entity_Collection_Abstract $collection)
    
{
        
//$collection->setVisibility($this->getVisibleInSearchIds()); //comment this
        
$collection->addAttributeToFilter('visibility', array('in'=>$this->getVisibleInSearchIds())); //uncomment this
        
return $this;
    
}

This happened to me on ver 1.7.0.2, but cannot be reproduced in the demo store. Please let me know if you know why.

 
Magento Community Magento Community
Magento Community
Magento Community
 
martijn819
Jr. Member
 
Total Posts:  5
Joined:  2010-09-24
 

Thanks—this just save me. I couldn’t get any search results, now I have them again.

I am using the BoostMyShop Embedded ERP module, so that might influence visibility in an unexpected way.

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