Advanced search in Magento and how to use it in your own way

Advanced search in Magento and how to use it in your own way

Magento’s default catalog search can be a powerful tool. It’s versatility is something every customer can appreciate.

One of the coolest features of the built-in advanced search is the ability to search by attributes assigned to a product. But what if your client’s plans for search are a bit different, and advanced search is too cluttered for his or her needs?

Let’s say your client wants his customers to be able to search by brand or SKU, with all other fields removed from the search, and wishes for custom URL for each one of those search types.

The solution

Attached in this article is a little “module” that enables you to use your custom URL for advanced search.

This means that instead of you could use for advanced search.

Not only that, but you can specify a single attribute you want to search by!

You could even use this to implement search by brand or SKU. In any case, the search form action URL is e.g., which can be useful and very SEO-friendly.

Keep in mind, though, that this is a custom developed module, without admin options, so everything you want to do with this search module has to be done by code.


I’ll walk you through a few basic modifications to this module.

Changing the URL of your advanced search

  • in app\code\community\Inchoo\Search\etc\config.xml replace ‘search‘ with your desired url

Replacing SKU (default in this module) with another attribute

  • in app\design\frontend\base\default\template\inchoo\search\form.phtml change the condition (‘sku‘) to attribute of your desire. Note that the attribute must be set as visible and searchable in Admin->Catalog->Attributes->Manage attributes
<?php if($_code == 'sku'):>
  • open app\code\community\Inchoo\Search\Block\Results.php and change attribute ‘sku‘ to the attribute of your desire
$title = $this->__("Search results for: '%s'", $this->getRequest()->getQuery('sku'));

And you are done! Now you have somewhat more custom url, and only one custom field displayed on your advanced search.

Download zipped source or view this module on GitHub.

Note: This is a revamp of the article originally written in November 2008.

You made it all the way down here so you must have enjoyed this post! You may also like:

Add Pagination to Custom Collection in Magento Dario Trbovic
Dario Trbovic, | 7

Add Pagination to Custom Collection in Magento

Optimize Elasticsearch autocomplete URL for Google Analytics Matej Djakovic
Matej Djakovic, | 2

Optimize Elasticsearch autocomplete URL for Google Analytics

3 things you should do today with your Magento store to improve your sales Toni Anicic
Toni Anicic, | 10

3 things you should do today with your Magento store to improve your sales


  1. thanks !!! how do I add more attributes, I would like more than one attribute to be the search criteria

  2. Hi, I tried installing the module but it seems to be giving me 404 error. I checked in Disable Modules Output, the module is “Enabled”. Any idea why my URL is not working?

  3. Good day, thanks it WORKS!!! I would like to ask how do I add more attributes, I would like more than one attribute to be the search criteria

  4. Great wee bit of code for a newbe programmer! Thanks
    I do have one question – I used your code to search a custome attribute (works GREAT) but issue I have is sometimes I want to do an OR search on that field ( .. search field for att1 OR att2 ) – The search works if I manually type it into the search bar but I cant get the code to work as the URL always has att1+att2 – with the ‘=’ sign I think being the issue and I dont understand how to, or where to change the code to say OR ( I have also tried || ) any ideas?


  5. Invaluable analysis , I was enlightened by the information ! Does anyone know if I could possibly locate a fillable 2008 VA Authorization to Use and Exchange Information form to use ?

  6. This extension rocks and very useful. Can I customized this? for example.
    How can I I add additional radio button search filters? For example, I want to add radio button (male and female) also a radio button for metric (foot, meter, yard) and finally input box that accepts a numeric range. The logic is, when user clicked the button the system will check if the user select either male or female, check also what metric is chosen and finally get the input box and look for specific product attribute. In short (SELECT* FROM attribute WHERE gender == “$gender” and metric == “$metric” and range == “$range”). Is it possible? Thanks!

  7. Hi we are testig your extension but we have some problem with magento pagination that doesn’t work on your resoult page (“an error has occurred” is displayed after page number click and nothing happens)
    Any suggestion?

  8. Use this code in your homepgae.

    {{block type=”catalogsearch/advanced_form” name=”catalogsearch_advanced_form” template=”catalogsearch/advanced/form.phtml”}}

  9. Without this extension you can use advance search on your home page. just copy and past this code in your home page.

    {{block type=”catalogsearch/advanced_form” name=”catalogsearch_advanced_form” template=”catalogsearch/advanced/form.phtml”}}


    1. but need to edit in form.phtml
      <form action="getSearchPostUrl() ?>” method=”get” id=”form-validate”> to <form action="getUrl(‘catalogsearch/advanced/result’) ?>”

  10. Hello
    I am using your extension in magento 1.9. I want to use the form on home page but it doesn’t appear. Here is the code which i am using to show the form on home page.

    {{block type=”inchoo_search/form” name=”inchoo_search_form” template=”inchoo/search/form.phtml”}}

    but unfortunetly form is not showing on home.

    Please suggest me

    1. Add this to Design XML Update to home page cms page:



    2. I am having the same problem, I want to display the search box on my custom page, but unable to load the block. Any help would be appreciated.

      I tried this but no results:
      {{block type=”inchoo_search/form” name=”inchoo_search_form” template=”inchoo/search/form.phtml”}}

      Couldn’t understand what Jacob Mahr said:
      “Add this to Design XML Update to home page cms page

      Unclear answer, As I am a beginner , looking for a nice support here.
      Thank you

  11. How can I disable advanced search feature in Magento? I tried to remove the link initially, but I discovered some visitors are using catalogsearch/advanced/ in link. I found that using Advanced Search feature you can provide to your competition, very easy and fast, information about how many products do you have enabled from each brand/category/in total. For example search for price between 0 and 1000000 and you will get for sure all products. Search for all manufacturers and you will the number of all products in your store. In my opinion this should be protected. Advanced Search feature could be used but with precaution. The main question is how to Enable/Disable Advanced Search (mainly as providing as I mentioned above, and as a special feature “Remove Advanced Search link” from frontend. Thank you.

  12. Hi, I have 4 tabs in a page (tab1, tab2, tab3, tab4).
    How can I place new product based on category only.(filter)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.