Show All Results or Remove Applied Filters in Low Search
Hi,
I am using Low Search to return a set of entries based on relationships. I am also using filters to allow the user to filter the returned results. I wanted to know if there is a way to tell the filter tag to make an option to remove all filtering or return all related entries so that if a user applies a filter and then wants to go back to seeing the full results they can click the "All" link and have it return the non-filtered results again.
Can you tell me if there is away to do this or what I would need to set the url for the filter link to to accomplish this?
Thanks!
Brian
Replies
Low 27 Oct 2016 07:39
To remove a parameter, set it to an empty string. Inside the Filters tag, you could use something like
Brian Rivet 28 Oct 2016 14:22
Hi Low,
I think I may still have something wrong. Here's my code:
{exp:low_search:filters query="{segment_3}" result_page="/login/announcements/%s"}
<li>
<a href="{low_search:url toggle:child:announcement_related_customers=''}">All Customers Assigned to Rep</a>
</li>
{exp:zoo_visitor:details}
{visitor:rep_customers}
<li>
<a href="{low_search:url toggle:child:announcement_related_customers='{visitor:rep_customers:entry_id}'}">{visitor:rep_customers:title}</a>
</li>
{/visitor:rep_customers}
{/exp:zoo_visitor:details}
{/exp:low_search:filters}
I have 2 child customers that come up so the filter menu list has a link to remove all filters and show all the entries related to all the relevant customers, and one that should show just the entries related to customer 1 and one that shows just entries related to customer 2.
However, when I click the option for all customers' entries it returns nothing, when I click the option to see just customer 1 entries, I get all the entries, when I click for customer 2 entries it does what it is supposed to and shows me just customer 2 related entries.
Any idea what I may be doing wrong here? If you need login info let me know and I can give you instructions for how to see this.
Low 28 Oct 2016 15:17
Don't use the toggle: prefix if you're forcefully setting a value (the empty string).
Using toggle: will add the given value to the query string if it isn't there, and remove it if it is. If you want to clear the parameter altogether, just use
Brian Rivet 28 Oct 2016 15:24
ah ok. Thanks that worked!