Magento – Set Default Search Keyword Not to Display

catalogsearchsearch

how can i set the search keyword (input by customer) default display to "NO" in magento backend so i can moderate the suggested search keyword below the searchbar?

Best Answer

The quick and dirty way is to change the column display_in_terms of the catalogsearch_query table to default to 0 instead of 1.

The long and clean way is to rewrite the method Mage_CatalogSearch_ResultController::indexAction() and replace this:

if (!Mage::helper('catalogsearch')->isMinQueryLength()) {
    $query->save();
}

with this:

if (!Mage::helper('catalogsearch')->isMinQueryLength()) {
    if (!$query->getId()) { //if is a new search word
         $query->setDisplayInTerms(0); //don't display it in search terms.
    }
    $query->save();
}
Related Topic