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

Support archive

Searching Across Multiple Categories

Gary Fannon 28 Oct 2014 04:35 question, complete

I am new to Low Search and just cannot quite figure out how to have three drop down menus for three different categories that will allow a visitor to select one, two or three categories to narrow down their search to the results they desire.

Here is my form tag:

{exp:low_search:form
collection="ministry_job"
form_id="search"
search_mode="all"
result_page="ministry_jobs/results"
loose_ends="yes"
require_all="category"
}

-- Select Position --
{exp:channel:categories channel="ministry_job" style="linear" category_group="2"}
{category_name}
{/exp:channel:categories}

-- Select State --
{exp:channel:categories channel="ministry_job" style="linear" category_group="1"}
{category_name}
{/exp:channel:categories}

-- Select Status --
{exp:channel:categories channel="ministry_job" style="linear" category_group="4"}
{category_name}
{/exp:channel:categories}

{/exp:low_search:form}

And here is my result tag:

{exp:low_search:results
query="{segment_3}"
limit="300"
status="not closed"
disable="member_data"
}



{entry_date format="%m/%d/%y"}

{if position != ""}{position}{if:else}{title}{/if}

{church}..................
............
{/exp:low_search:results}

Will return results correctly when only one drop down is selected. When more than one drop down is selected the results are not true.

Any help will be greatly appreciated. I have gotten this far with the help of a bottle of Tylenol.

Replies

  1. Low 28 Oct 2014 08:03

    You're close. You just need to move all filter-parameters from the Form tag to the Results tag. Also, make sure the name="" attribute of the select-elements (which I can't see here, because GetSat strips them out, annoyingly) is name="category[]".

  2. Gary Fannon 28 Oct 2014 12:12

    Working like a charm. Thanks!

  3. Gary Fannon 30 Oct 2014 03:02

    Low,
    I have the following form tag. I would like for -- All Positions -- which is the option value displayed in the drop down menu by default. When you submit the form with the default option values it is return results from all channels. I understand that it is not wrapped with EE tag, but how do I get it to return only the values from the "ministry_job" channel? I want visitors to be able to search All Positions, Any State, and Any Status.

    {exp:low_search:form
    collection="ministry_job"
    form_id="search"
    search_mode="all"
    result_page="mobile__ministry_jobs/results"
    loose_ends="yes"
    require_all="category"
    }

    -- All Positions --
    {exp:channel:categories channel="ministry_job" style="linear" category_group="2"}
    {category_name}
    {/exp:channel:categories}

    -- Any State --
    {exp:channel:categories channel="ministry_job" style="linear" category_group="1"}
    {category_name}
    {/exp:channel:categories}

    -- Any Status --
    {exp:channel:categories channel="ministry_job" style="linear" category_group="4"}
    {category_name}
    {/exp:channel:categories}

    {/exp:low_search:form}

  4. Low 30 Oct 2014 08:40

    GetSat strips out the html code. Can you try and use http://pastie.org/ or http://pastebin.com/ for large chunks of code?

  5. Gary Fannon 30 Oct 2014 12:17

    Low,
    I have the following form tag. I would like for -- All Positions -- which is the option value displayed in the drop down menu by default. When you submit the form with the default option values it is return results from all channels. I understand that it is not wrapped with EE tag, but how do I get it to return only the values from the "ministry_job" channel? I want visitors to be able to search All Positions, Any State, and Any Status.

    http://pastie.org/9685380

  6. Low 30 Oct 2014 12:34

    You should move all filter parameters from the Form tag to the Results tag. In your case, the only ones that are valid are form_id and result_page.

    You're trying to use parameters that belong to the Keywords filter (collection, search_mode and loose_ends), but you don't have a keywords-field in the form. If you're not filtering by keyword, remove these parameters.

    You've got a hidden input field with name="require_all[]" in your form. You're not using multiple values for that field, so you can remove it, and instead add it to the Results tag.

    To limit search results to the ministry_job channel, add the channel="" parameter to the Results tag.

    Follow these four steps, and you should be good.

  7. Gary Fannon 30 Oct 2014 12:38

    Great. Thank you.

    Also, I wanted to tell you that Low Search is wonderful. I tried to use Solspace Super Search, but was way too complicated. Low Search is much easier and does exactly what I want.

    Your response time is unbelievable. Wish other software companies offered such customer service.

  8. Low 30 Oct 2014 12:40

    Thank you, Gary. Happy to help.