I need to add a icon instead the search input form and when I click on this icon to display the search input form? something like minicart.
Best Answer
1.Go to your custom theme like Package/Theme and create directory Magento_Search.
2.Copy form-mini.phtml from vendor/magento/module-search/view/frontend/templates.
3.I changed some piece of code in template please focus on line with comment "changes done here"
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();
}
Best Answer
1.Go to your custom theme like Package/Theme and create directory Magento_Search. 2.Copy form-mini.phtml from vendor/magento/module-search/view/frontend/templates. 3.I changed some piece of code in template please focus on line with comment "changes done here"
Now there will display a link "Search" and when you will click search box will show and when you will again click it will hide.