How to Disable Advanced Search in Magento

advanced-search

How can I disable advanced search feature in Magento?

Even you remove the links from frontend using layouts, if someone who knows Magento URL's accesses /catalogsearch/advanced will get the Advanced Search page.

I discovered some visitors are accessing catalogsearch/advanced/ directly. Why they are doing this? I found that using Advanced Search feature can provide to your competition, very easy and fast, information about how many products you have enabled from each brand/category/in total.

For example in Advanced Search just search for price between 0 and 1000000 and you will get for sure all products as number. Search for all manufacturers and you will get the number of all products in your store too. In my opinion this should be protected. In this case Advanced Search feature should be used but with precaution.

Back to main question how to Enable/Disable Advanced Search for the issue I mentioned above. First I was thinking to rewrite a rule for /catalogsearch/avanced link. The redirect page could have a pretty nice banner.

Thank you.

Best Answer

If you want to remove the links you can via the Layout XML:

<layout version="0.1.0">
    <default>
        <reference name="footer_links">
             <!-- Remove 'Advanced Search' -->
            <action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl" /></action>
    </reference>
 </default>
</layout>

To disable the controller itself (while not the cleanest approach is the quickest) create a copy of:

app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php

Into the local code pool app/code/local/Mage/CatalogSearch/controllers/AdvancedController.php

And overwrite the local copy to:

class Mage_CatalogSearch_AdvancedController extends Mage_Core_Controller_Front_Action
{

    public function indexAction()
    {
         $this->_redirectUrl('/');
    }

    public function resultAction()
    {
         $this->_redirectUrl('/');
    }
}

Any requests will be redirected to home.

Related Topic