1

I need to find some solution to implement the filter for channel entries.I have a mock-up like you can see at screenshot.

enter image description here

User can select more than one options.

I tried to use Low Search plugin, and my first idea was to form url according to selected options. But I don't understand how can I do this. Especially as I know url must be encoded.

May be anyone can give me some idea about solution for my task?

3

With Low Search, you do not "form a URL", but rather you create a search form that you can submit, which will generate the URL for you. How you create the elements in your form depends on what types of filters you will need and how you set up your channels and fields.

For the alphabet, you can use the Field Search filter, but you'd have to hard-code the options yourself. Here I'm targetting the title, but you can target a custom field, too.

<select name="search:title[]" multiple>
    <option value="a">A</option>
    <option value="b">B</option>
    ...
</select>
<input type="hidden" name="starts_with" value="search:title">

For the style, if that is a custom field, also use the Field Search filter:

<select name="search:my_style_field[]" multiple>
    <option value="Style 1">Style 1</option>
    <option value="Style 2">Style 2</option>
    ...
</select>
<input type="hidden" name="exact" value="search:my_style_field">

For the country, if that is a category group, use the Categories filter:

<select name="category[]" multiple>
    {exp:channel:categories style="linear"}
    <option value="{category_id}">{category_name}</option>
    {/exp:channel:categories}
</select>
<input type="hidden" name="require_all" value="category">

And put all that inside the Form.

Be sure to read all the docs on Parameters, Filters, and Template Tags before checking out the example page.

| improve this answer | |
  • Low, thank you! That's rigth. And one more question. Can I get the selected options from my low_search form inside exp:low_search:results after user submit form? – Alur Feb 14 '14 at 5:33
  • 1
    Sure. As explained in the docs, you can use {low_search_*param_name*}, for example: {low_search_search:title}, {low_search_search:my_style_field} and {low_search_category}. – Low Feb 14 '14 at 9:56
  • Low, I have the final question to be fully happy. I need to order result data by non-channel field. So I know where I can find this one field values in database for every channel entry. But how to use these values for ordering result data? Is it possible? – Alur Feb 14 '14 at 11:40
  • You can use the orderby="" parameter to order search results any way you want. – Low Feb 16 '14 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.