{low_search_category} not returning anything
Hi Low,
I'm using Low Search for the first time, so I may be doing something wrong, but {low_search_category} doesn't return anything form me.
I'm using it in the search form like your advanced example.
{exp:low_search:form collection="bibliographies" search_mode="all" result_page="bibliography/search" form_class="search"}
debug category:{low_search_category}
Category:
All categories
{exp:channel:categories channel="bibliographies" style="linear" show_empty="no"}
{category_name}
{/exp:channel:categories}
{/exp:low_search:form}
I include this form on the search results page (outside of the {exp:low_search:results} tag). I'm expecting that {low_search_category} to return the category that was searched on, but it just returns an empty string.
Am I doing something wrong?
I'm using Low Search 1.0.7.
Thanks.
Replies
Low 2 Dec 2011 18:35
Hi Jason,
Do you have an input field with name="category" or name="category[]" in your search form?
siffring 2 Dec 2011 19:38
Yeah. GS stripped out my html. Let me try again.
{exp:low_search:form collection="bibliographies" search_mode="all" result_page="bibliography/search" form_class="search"}
debug category:{low_search_category}
<fieldset>
<label>Category:</label>
<select name="category">
<option value="">All categories</option>
{exp:channel:categories channel="bibliographies" style="linear" show_empty="no"}
<option value="{category_id}"{if category_id IN ({low_search_category})} selected="selected"{/if}>
{if '{parent_id}' != '0'} {/if}{category_name}
</option>
{/exp:channel:categories}
</select>
<input type="text" name="keywords" id="keywords" value="{low_search_keywords}"/>
<input type="submit" class="submit" value="Search">
</fieldset>
{/exp:low_search:form}
Low 2 Dec 2011 22:39
Oh right, you might want to add the query="" parameter to the {exp:low_search:form} tag, so it knows what's been submitted.