In the default Flare search output, it is not possible to see what filter was applied.
I can probably solve this myself in Javascript by looking for the value of the 'f' query parameter in the URL, but before I go that way I'm hoping there is a built-in solution
For example, in the SearchResults Skin I can set the UI text of the Search Heading to Showing {total_results} results for {query}
Perhaps there apart from the supported meta values {total_results} and {query} there is something like {filter}
(I did try {filter} - nope...)
Any other ideas on how to show the user which filter is active?
Thanks
getting the filter value into the Search Heading
-
- Propeller Head
- Posts: 51
- Joined: Mon Sep 18, 2017 6:14 am
-
- Propeller Head
- Posts: 85
- Joined: Tue Jun 04, 2013 9:49 am
- Location: Arkansas, U.S.A.
Re: getting the filter value into the Search Heading
In the output, Flare generates this code for selected filter. Could you use the "selected" class to grab the title value, store as a variable, and then include the variable on your custom search results page?
Code: Select all
<div class="search-filter selected" aria-haspopup="true" aria-controls="sf-content" aria-expanded="false" aria-label="Search Filter" role="button" tabindex="0" title="NewFilter"></div>
-
- Propeller Head
- Posts: 85
- Joined: Tue Jun 04, 2013 9:49 am
- Location: Arkansas, U.S.A.
Re: getting the filter value into the Search Heading
Or, it might be easier to grab the selected value from Flare's search filter form?
Re: getting the filter value into the Search Heading
I'm not aware of any {filter} parameter, and there probably isn't one because it's not included in any messages.
Quite easy to get the selected filter name though:
Might be better to use that method, as getting the 'f' parameter value will presumably include "%20" instead of spaces?
Quite easy to get the selected filter name though:
Code: Select all
var selectedFilter = $(".search-filter.selected").attr("title");
-
- Propeller Head
- Posts: 85
- Joined: Tue Jun 04, 2013 9:49 am
- Location: Arkansas, U.S.A.
Re: getting the filter value into the Search Heading
Thanks! I'll be using the method you mentioned.