1

I was able to use low search to filter entries, by getting the values of the parameters in the URL, I set No for encode query setting in the low search module.

I set it back to Yes to and tested my sitewide search form, which it needs to be encoded.

is there an encode parameter in the form tag that I can set on the fly?

If I could get this (below) to work using the query="{segment_2}" then I won't need to set the encode setting on the fly:

<select name="store:price">
    <option value="0">PRICE</option>
    <option value="|10"{if get:price == "|10"} selected{/if}>up to $10</option>
    <option value="10|25"{if get:price == "10|25"} selected{/if}>$10 to $25</option>
    <option value="25|50"{if get:price == "25|50"} selected{/if}>$25 to $50</option>
    <option value="50|100"{if get:price == "50|100"} selected{/if}>$50 to $100</option>
    <option value="100|"{if get:price == "100|"} selected{/if}>$100 and up</option>
</select>
2

Right now, the Encode Query setting in Low Search is installation-wide.

However, with the right setup, you should be able to run all searches with the same setting. I can't think of a reason why you'd want one search encoded and not another.


To have the price option selected in the Form tag when encoding queries, use the following code:

{exp:low_search:form query="{segment_x}"}
    <select name="store:price">
        <option value="">PRICE</option>
        <option value="|10"{if low_search_store:price == "|10"} selected{/if}>up to $10</option>
        <option value="10|25"{if low_search_store:price == "10|25"} selected{/if}>$10 to $25</option>
        ...
    </select>
{/exp:low_search:form}

Make sure {segment_x} points to the encoded query in the URI. If you're not encoding queries, you can use the exact same code, and remove the query parameter.

Note that the principle of parameter names and corresponding variables applies here just as it does for any other filter.

2
  • I am fine with using it with encoding enabled, but I need to set the select option if this value then set it to selected, look at the html I have above and that should give you an idea of what I need to accomplish.
    – Brad
    Oct 20 '15 at 20:15
  • 1
    See my edit. Does that help?
    – Low
    Oct 20 '15 at 20:27

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.