All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Allowing user to specify category search type

Jason 26 Jan 2013 03:30 problem, complete

The require_all="category" returns results that are in all selected categories. Thats great.

However I want to allow the user to choose whether this is enabled or not.

My form is pretty standard.

 
{exp:low_search:form collection="products"}

{exp:channel:categories channel="products"}
<input type="checkbox" name="category[]" value="{category_id}" {if category_id IN ({low_search_category})}checked{/if} /> {category_name}<br />
{/exp:channel:categories}

<input type="radio" name="require_all" value="category" {if low_search_require_all == "category"}checked{/if} /> Match all selected categories<br />
<input type="radio" name="require_all" value="" {if low_search_require_all == ""}checked{/if} /> Match any selected categories

<input type="submit" />

{/exp:low_search:form}


However the {low_search_require_all} variable never returns anything.
Is this a bug? In your docs it says: {low_search_param}: Any additional parameters posted via the search form are available as a {low_search_param} variables.

Replies

  1. Low 26 Jan 2013 08:55

    Ah, you're right. Seems I'm a bit overzealous with cleaning the params.

    Open up mod.low_search.php and check line #1201, which says:

    unset($data['require_all']);


    ...and remove/comment it. That should fix it.

  2. Jason 26 Jan 2013 13:53

    Yes it fixed it. Thanks.