Forums / Extensions / eZ Find / Enable/disable the filter depending of a variable

Enable/disable the filter depending of a variable

Author Message

jul tonfa

Thursday 01 October 2009 1:47:41 am

Hi,

I'm working with eZ find and i want to process the search and find all the clients from a specified country.(ie $country). So i'm using the filter.

But i want also that if the country is not specify, ($country = -1 or $country=' ' ) meaning i want to search on all the countries, the search doesn't use the filter.
Because a filter on -1 or ' ' will return me nothing but i want everything.

    {set $search=fetch(ezfind,search,
                       hash(query,$search_text,
                            section_id,$search_section_id,
                            filter,concat('client/pays:',$country),
                            subtree_array,$search_sub_tree,
                            class_id,$search_contentclass_id,
                            class_attribute_id,$search_contentclass_attribute_id,
                            offset,$view_parameters.offset,
                            limit,$page_limit))}

If you have any ideas, I will be grateful.
Thanks

Paul Borgermans

Tuesday 20 October 2009 2:22:35 am

You should add template logic and construct a different query or if you use a select form element, let the value for any country be [* TO *]

hth
Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

jul tonfa

Monday 26 October 2009 8:54:46 am

Thanks paul, it works well like that :)
Jul