4

I figured there'd be an easy way to pull entry values via a field. I'm building a site that has a basic search for a price (for property) and was hoping to do something like:

{exp:channel:entries channel="property" search="price < 200000"}
  <blah />
{exp:channel:entries}

However it seems I can only search for a value equal or not equal to a field value. Is that right or am I being particularly thick this weekend? I'm relatively new to EE, so apologies if it's a stupid question ...

Assuming I'm not being thick, are there any plug ins that would do that?

(Originally asked on StackOverflow; was suggested I asked here).

3

There is no search="" parameter in the channel:entries tag. There's only search:custom_field="" parameters, and those won't take less/greater than values (or in other words: ranges) in EE 2.6.1 or lower. They only accept (sub)string matching.

Add-ons that will give you support for filtering by range would be Solspace's Super Search or Low Search by yours truly.

1
  • 1
    or a custom query with the query-module
    – GDmac
    Jan 28 '13 at 9:46
1

The question wasn't about ranges exactly, the example was about a "less than a numeric value" query which according to the docs is possible? - http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#numeric-matching

1
  • Yep, I guess that's new in 2.6 or 2.7. I'm fairly sure it didn't work in 2.4 and possibly 2.5.5, but glad to see it's been added, since it caused much query module pain. Aug 30 '13 at 12:14
1

Numeric Matching was added for the search:field_name="" parameter as of EE2.7.0:

From the Change Log:

Added <, >, <=, and >= numeric comparison operators to the Channel Entries search parameter.

From the Docs:

If you have a field containing numeric data, you may use greater-than or less-than operators to search through them.

search:numeric_field="<20"
search:numeric_field=">20"
search:numeric_field="<=20"
search:numeric_field=">=20"

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.