How do i show the Categories where is searched for?
Hi,
I want to achieve the following: In my header i have a single search form. This form only contains a keywords field.
On the search results i have on the left an advanced search form with the availible categories (in radio button, the customer wants to search in one category at the time). When someone search again with the advanced search and uses the categories, i wanna show on the results page, on witch categories is searched. Also i want to set a selected state on that category.
I thought this would be possible but at this moment i do not get the searched categories back from the {low_search_category} tag.
Am I doing something wrong?
Kind regards,
Paul
Replies
Low 5 Dec 2012 14:46
Have you added the query="" parameter to the Form tag?
Paul Stolk 5 Dec 2012 14:50
Thanks for the reply. I have added the query="{segment_3}" tag and the query is in segment 3
Low 5 Dec 2012 14:52
Then what's the template code for the Form tag? Use pastie.org for large bits of code, as GetSat may choke on it...
Paul Stolk 5 Dec 2012 14:57
{exp:low_search:form collection="aanbiedingen" search_mode="all" query="{segment_3}" result_page="zoeken/aanbiedingen" form_class="search_on_top"}
Categories
{exp:channel:categories channel="aanbiedingen" style="linear" category_group="2"}
{category_name}
{/exp:channel:categories}
Categories
{exp:channel:categories channel="aanbiedingen" style="linear" category_group="3"}
{category_name}
{/exp:channel:categories}
Search
{/exp:low_search:form}
Low 5 Dec 2012 15:01
I think GetSat ate some of your code. Can you try again and link to pastie.org, please?
Paul Stolk 5 Dec 2012 15:02
http://pastie.org/5484158
Low 5 Dec 2012 15:09
Try changing this:
to this:
Paul Stolk 5 Dec 2012 15:13
Thanks that is fixed now but the {low_search_keywords} tag is renderd empty instead of the filled in keywords
Low 5 Dec 2012 15:15
And where in the template are you putting the {low_search_keywords} variable? In which tag pair?
Paul Stolk 5 Dec 2012 15:18
http://pastie.org/5484219
That is so the user can easily search again with the previous searched keywords, but with different categories
Low 5 Dec 2012 15:22
What version of LS are you using?
Paul Stolk 5 Dec 2012 15:23
LS: 2.1.0
EE v2.5.3 - Build Date: 20120911
Low 5 Dec 2012 15:28
Try using {keywords} instead; the prefixed version was added in 2.1.1. Or update to 2.1.2. :)
Paul Stolk 5 Dec 2012 15:33
Thanks!
That works like a charm. Is the {if low_search_keywords}Je hebt gezocht op : {low_search_keywords}.{/if} also available in the no results tag?
Low 5 Dec 2012 15:34
Alas, no. Use the {exp:low_search:keywords} tag for that instead.
Paul Stolk 5 Dec 2012 15:38
I Tried, but renders empty
Low 5 Dec 2012 15:39
Don't forget the query param there, too.
Paul Stolk 5 Dec 2012 15:42
Your my hero!
Thanks