Magento – How to hide the Catalog Advanced Search in magento version 1.9

advanced-searchcatalogsearchmagento-1.9

I am working on a Magento e-commerce site.
I need to disable the Catalog Advanced Search.
I checked with source code available in the stackexchange but its not working.

Best Answer

To remove the link to advanced search edit app/design/frontend/{package}/{theme}/layout/catalogsearch.xml.
If the file does not exist in your theme, copy it from base/default. Then remove this from the file:

<action method="addLink" translate="label title" module="catalogsearch">
    <label>Advanced Search</label>
    <url helper="catalogsearch/getAdvancedSearchUrl" />
    <title>Advanced Search</title>
</action>

But this will still leave your controller active, and anyone with a link can access it.
To restrict this, create an observer for the events controller_action_predispatch_catalogsearch_advanced_index and controller_action_predispatch_catalogsearch_advanced_result with this code:

public function restrictAccess($observer)
{
    $url = Mage::getUrl('no-route');
    Mage::app()->getResponse()->setRedirect($url);
    Mage::app()->getResponse()->sendResponse();
}

This will redirect the users to a 404 page when trying to access the advanced search form or result page.

Related Topic