On search results page, show what filters were applied?
My search with filters works, but I'd like to report back to the user what filters they applied. (I used filters in my search solely, because one of the dropdown required a relationship field)
{exp:low_search:form}
<span>
State:
<select name="search:partner_org_bio_state">
<option value="">all states</option>
{exp:channel:entries channel='partner_org_bios' class='clearfix' dynamic="no" sort="asc" order_by="title"}
<option value="{partner_org_bio_state}">
{partner_org_bio_state}
</option>
{/exp:channel:entries}
</select>
</span>
<span>
Organization:
<select name="parent:partner_org_profile_bios">
<option value="">all Organizations</option>
{exp:channel:entries channel='partner_org_bios' class='clearfix' dynamic="no" sort="asc" order_by="title"}
{parents field="partner_org_profile_bios"}
<option value="{parents:entry_id}">{parents:title}</option>
{/parents}
{/exp:channel:entries}
</select>
</span>
<span>
Tags:
<select name="category:category_group">
<option value="">all Tags</option>
{exp:channel:categories category_group="29" style="linear"}
<option value="{category_id}">{category_name}</option>
{/exp:channel:categories}
</select>
</span>
<button type="submit">Go</button>
{/exp:low_search:form}
This search functions well! I just want to report back to the user that they chose "Hawaii," Category B and Organization C.
Note: LS is capturing what I want in the Search log: I just want to spit that value back.
Example:
https://www.dropbox.com/s/2i5r487ajva...
Replies
Low 19 Oct 2019 07:18
See https://gotolow.com/addons/low-search...
You can output the parameter values in the Form tag using {low_search_PARAM} as long as you make sure the query="" param is set.
Check the example page for examples on how to use conditionals to select the right options.
Paul Larson 21 Oct 2019 22:49
Low,
Thanks!
Sorry, I'm not quite grasping what your suggestion means.
My reduced form is
{exp:low_search:form}
<span>
Implementation Plan Action levels:
<select name="category:category_group[]" >
<option value="">all levels</option>
{exp:channel:categories channel='partner_org_profiles' status="open" show_empty="yes" class='clearfix' category_group='19' style='nested'}
<option value="{category_id}">{if parent_id != 0} {/if}{category_name}</option>
{/exp:channel:categories}
</select>
</span>
<button type="submit">Go</button>
{/exp:low_search:form}
My reduced result template is:
{exp:low_search:results
query="{segment_3}"
collection="1|2"
keywords:lang="en"
keywords:inflect="yes"
limit="10"
}
{if low_search_keywords_missing}<em>Keywords are required</em>
{if:else}
<p style="border-bottom: 1px solid #ccc; padding: 2px;" >Your search for "<strong>{low_search_partner_org_bio_state}{low_search_query_string} {low_search_keywords} {low_search_category_group}</strong>" received {absolute_results} results.</p>
{/exp:low_search:results}
{/if}
I suppose I don't know how to translate
category:category_group into {low_search_ category:category_group}
Low 22 Oct 2019 06:37
The {low_search_category:category_group} variable will return a pipe-separated list of category IDs. To output their corresponding names, use an {exp:channel:categories} tag, like so:
...similar to how you're using it to generate a list of categories in the Form tag.
By the way, the {low_search_..._missing} variables are only available in the Form tag. See https://gotolow.com/addons/low-search...
Paul Larson 25 Oct 2019 17:51
Low,
Thanks! Your original response was OK, in the end. I was being too literal, and figured a colon can't possible be a valid field in EE, e.g. {low_search_category:category_group}