Advanced Search sidebar box
19 Comments 31st AUG 2009 | Posted by Ivan Weiler in Magento

I was playing a bit with that advanced search form in Magento, so i thought it would be nice touch to add it to left or right column of the store.
Since that multiple selects were causing problems and i also had to get rid of breadcrumb, i created block which extends Mage_CatalogSearch_Block_Advanced_Form functionality, added a little javascript and packed it all to small example module:
Unpack the rar, copy files at its appropriate place following directory structure, disable/enable cache to rebuild configs, layouts, blocks, and you’re on.

I left few comments in the code, thought someone may find them useful. Also be sure to modify
template/sidebarsearch/advanced/sidebar.phtml
and
layout/sidebarsearch.xml
to suit your shop needs, since css is hardcoded in template for example. Regards.
To post code in comments, place your code inside [code] and [/code] tags.


















September 1st, 2009 at 14:22
I don’t use yet …
But i think this module is a great idea.
tks u for this!
September 10th, 2009 at 19:43
Great job! Thanks
September 20th, 2009 at 22:31
Hi Great Tutorial and awesome blog. Is there a way just have selected search attributes?
Cheers,
Bruce
September 21st, 2009 at 7:13
There is “Use in advanced search” option for each attribute, if that’s what you mean. Navigate to Catalog->Attributes->Manage Attributes, click to edit attribute and you’ll see it.
September 21st, 2009 at 18:09
Thanks, but I need it the option in the side block to be different form the advanced search page. Any way of doing this?
Cheers,
Bruce
September 22nd, 2009 at 18:53
No, not without additional programming ..
The easiest way would be to configure Magento to use in search all attributes you need and then modify both templates to not display what you don’t need there.
September 25th, 2009 at 17:15
well…..this post is grate… there is just a little problem… if in your search you conffigurated with date it dosent work. i tryed to fix it but nothing…..any answear?
October 1st, 2009 at 13:48
Looks great, I would love to have this advanced search column only appear on the advanced search results page, while the advanced search link itself still takes me to the normal advanced search window. Ill try and work this out right now
October 29th, 2009 at 19:26
Is there any way to arrange the position of the attributes, like in layered navigation? I want the price to be at the end..
Any hint? Thank You.
October 29th, 2009 at 19:30
Found solution at official forum: Change the file \app\core\mage\catalogsearch\model\advanced.php at around line 47 to setOrder by “position” rather than by “attribute_id”. Then in the attribute settings use the position field as the order you want your fields to appear in.
Then it uses the position value of attribute.
Thanks any way for extension)
October 30th, 2009 at 4:15
Small bug when search by price and write in first input any price, to second input leave a blank box, I get an error:
Undefined index: to in app/code/core/Mage/CatalogSearch/Model/Advanced.php on line 176
November 5th, 2009 at 21:59
Is possible to unload the advanced sidebar just in the home page?.
Thanks
February 2nd, 2010 at 11:42
Same error:
Undefined index: to in app/code/core/Mage/CatalogSearch/Model/Advanced.php on line 176
In price range when for example fill only one field.
¿?
February 8th, 2010 at 11:53
@ Ups and Sergio, a simple sollution for this bug is to add the following line:
if (is_array($value) && !isset($value['to'])) $value['to'] = ”;
in app/code/coreMage/CatelogSearch/Model/Advanced.php
before the line:
if (is_array($value) && (isset($value['from']) || isset($value['to']))){
March 9th, 2010 at 7:32
Am I missing something? I’m using Magento 1.4. I followed the directions and nothing appears in the sidebar. Do I need to edit another file or something? Love this post if I could get it to work, thanks much.
May 27th, 2010 at 11:24
Mike Houtepen better solution copy paste form template in this block and all….
May 28th, 2010 at 4:57
Great tip with sorting the advanced search attributes, worked a treat in 1.3.2.4, thanks!
May 28th, 2010 at 10:57
@ Ups;
That was my first solutions and did not solve all of it, the solution i gave a few comments earlier was not that good either anyway…
Solved it an other way now
.. Anyways thanks
May 31st, 2010 at 11:35
@ Mike Houtepen ;
Hey, I’ve been having the same problem, if I leave forms empty, it just throws and error. I’d need advanced search on the left with category, but both this system here^^ and category-thing on the wiki just throws only errors to me. (http://www.magentocommerce.com/wiki/how-to/how_to_add_search_by_category_to_advanced_search) Could someone please upload a working sidebar on the left with category option? I’d be really thankful!