1

I want to use the numeric matching possibility of EE with 2 conditions to only show entries that are in a certain range of values.

I tried these two but none of them works (it just shows nothing) :

search:cost=">={embed:the_cost-from}" search:cost="<={embed:the_cost-to}"

search:cost=">={embed:the_cost-from}|<={embed:the_cost-to}"

If I ask just for one search:cost numeric matching (search:cost=">={embed:the_cost-from}" or search:cost=">={embed:the_cost-to}") it displays something but not what I want because I want something from a range.

Is this a EE bug or simply not intended or I just do it wrong?

EE 2.9.2

1 Answer 1

1

EE doesn't support that range syntax out of the box. It expects a single numeric value after the operator.

You'd need either the Query module or an add-on like Solspace Super Search or Low Search, by yours truly. With the latter, you can use this syntax:

{exp:low_search:results search:cost=">=10|<=20"}

Or use the Ranges filter, like so:

{exp:low_search:results range:cost="10|20"}

...or split up into two parameters:

{exp:low_search:results range-from:cost="10" range-to:cost="20"}

Note that the {exp:low_search:results} tag is interchangeable with the {exp:channel:entries} tag.

4
  • 1
    One clarifying addendum I'd add is that EE only supports multiple search parameters on different fields - so including search:cost twice does not result in two WHERE statements in the query - only one will be used. Commented Feb 20, 2015 at 12:53
  • 1
    Indeed, this is true for any parameter. Tags accept only unique parameter names, and uses the last one on the tag if multiple of the same param are given.
    – Low
    Commented Feb 20, 2015 at 13:25
  • @Derek Hogue Absolutely, that is what I noticed, the second crushes the first one.
    – pikarge
    Commented Feb 27, 2015 at 9:58
  • @Low Thanks for your answer. In fact I already use Supersearch for this project so I'm gonna use the customfield-from and customfield-to but I was thinking about using the simple {exp:channel:entries} tags so I could use these parameters : display_by="week" limit="1" because I don't see how to mimic this in {exp:super_search:results} to only show results that have been added whithin the last 7 days.
    – pikarge
    Commented Feb 27, 2015 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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