1779 Posts in 582 Topics by 556 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1237 Views |
-
SearchContext filters and WithinRangeFilter

22 March 2010 at 12:37pm
I've seen this listed in most places as being Incomplete...but I was wondering if someone can tell me if it actually works...and if so, how do I implement it?
If it's not ready, can someone tell me how to use the filters that are in place to mimic this? I have to add to a search I currently have something that will require this. I need to be able to search for properties that are between two given input fields:
Square Feet Range: High (input box) and Low (input box).
-
Re: SearchContext filters and WithinRangeFilter

23 March 2010 at 6:13am
Is there a simple way to modify this in the $searchCriteria?
this is what the actual $query looks like:
SELECT `Property`.*, `Property`.ID, if(`Property`.ClassName,`Property`.ClassName,'Property') AS RecordClassName
FROM `Property`
WHERE (`Property`.`SQFTRangeLow` > '200') AND (`Property`.`SQFTRangeHigh` < '500')and this is what I need it to look like:
SELECT `Property`.*, `Property`.ID, if(`Property`.ClassName,`Property`.ClassName,'Property') AS RecordClassName
FROM `Property`
WHERE (`Property`.`SQFTRangeLow` >= '200' AND `Property`.`SQFTRangeHigh` <= '500')wish there was an easy way to make this a BETWEEN clause.
-
Re: SearchContext filters and WithinRangeFilter

23 March 2010 at 12:03pm
Someone has to know a way to do what I want to do here...or know how to use the WithinRangeFilter...
-
Re: SearchContext filters and WithinRangeFilter

14 January 2012 at 4:20am
Hi Terry !
I was wondering if you managed to use that WithinRangeFilter.
I have trouble doing a "GreaterThan or equal filter" in my search form
... and a Lessthan or equal as well !
That filter would be of great use !
-
Re: SearchContext filters and WithinRangeFilter

25 January 2012 at 7:51pm
I haven't used the WithinRangeFilter before but by looking at the code, sapphire/search/filters/WithinRangeFilter.php you will probably need to do something like:
//setup within range filter 200 - 500
$within_range_filter = new WithinRangeFilter('SQFTRangeLow');
$within_range_filter->setMin(200);
$within_range_filter->setMax(500);//then perhaps do something like this.
$filters = array(
'SQFTRangeLow' => $within_range_filter
);return new SearchContext(
$this->class,
$fields,
$filters
);
| 1237 Views | ||
|
Page:
1
|
Go to Top |


