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

Support archive

AND search with Low Options

Neil 28 Nov 2012 15:30 question, complete

Hey Low,

I've got a search form to search hotels as follows;

 
{exp:low_search:form
query="{segment_2}"
collection="stay"
search_mode="all"
result_page="/stay/results"
}

<h3>Accommodation Type</h3>
<ul class="accomtype">
{exp:channel:categories channel="stay" category_group="4" style="linear"}
<li><input type="checkbox" name="category[]" id="category-{category_id}" value="{category_id}"{if category_id IN ({low_search_category})} checked="checked"{/if} /><label for="category-{category_id}">{category_name}</label></li>
{/exp:channel:categories}

<h3>Facilities</h3>
<ul>
{exp:low_options:placetostay_facilities}
{options}
<li><input type="checkbox"
name="search:placetostay_facilities[]"
id="{option:value}"
value="{option:value}"
{if '{option:value}' IN ({low_search_search:placetostay_facilities})}
checked="checked"
{/if} /> <label for="{option:value}">{option:label}</label></li>
{/options}
{/exp:low_options:placetostay_facilities}
</ul>

{/exp:low_search:form}


The problem I have is that when checking a number of facilities, it's doing an OR search, rather than and AND search to find only entries that have all facilities that the user has selected.

Is it possible to get this behaviour?

Thank you.
Neil

Replies

  1. Low 28 Nov 2012 15:33

    Yep, just add this parameter to the Form tag:

    require_all="search:placetostay_facilities"

  2. Neil 28 Nov 2012 15:48

    Sweet, thanks man. :D