php - cakedc search plugin search in price range -
I am trying to search between two prices using the cakedc search plugin, this is my model code:
public $ worksAs = array ('Search.Searchable'); Public $ filterArgs = array ('value' = & gt; array ('type' = & gt; 'expression', 'method' => 'merange condition', 'field' => 'value. And?') ); Public functions makeRangeCondition ($ data = array ()) {if (stupus ($ data ['value'], '-') == incorrect) {$ tmp = explosion ('-', $ data ['value'] ); $ Tmp [0] = $ tmp [0]; $ Tmp [1] = $ tmp [1]; Return $ tmp; } Other {Return Array ($ minPrice, $ maxPrice); }}
Code for my controller:
Public function index () {$ this- & gt; Prg- & gt; Common practice (); $ Cond = $ this- & gt; Property- & gt; ParseCriteria ($ this-> passed); $ This- & gt; Set ('property', $ this- & gt; paginated ('property', $ cond)); }
Code for my idea:
& lt ;? Php echo $ this- & gt; Form- & gt; Create (); Copy $ this- & gt; Form- & gt; Input ('minPrice'); Copy $ this- & gt; Form- & gt; Input ('maxprice'); Echo $ the-> Form- & gt; Submit (__ ('Send')); Echo $ this- & gt; Form- & gt; the ending ();
?>
Table SQL:
If the property does not exist, create the table (
ID
varchar (36) tap, value
float DEFAULT NULL, primary key ( id
), unique key id
( id
)) Engine = MySam default charge = utf8; Instead, instead of the 'category' key in the 'filter' names, it's named as 'price' instead of 'price'.
Comments
Post a Comment