I want to let the user select the parameters he wants to search for.
There are 4 different types of values he can select.
stars, category, price and date.
But I want to give him the opportunity to search for only one of those. For
example, if he selects 0 for stars, I want to disregard that criteria. If he
selects Whatever from categories, I also want to disregard that criteria.
The same for the price and period. How can I build this?
How to I build the search function ?
$results = $this->Offer->find('all', array(
'conditions' => array(
'Offer.flag_stars' =>
$this->data['Search']['stars'],
'Offer.location_id' =>
$this->data['Search']['location_id'],
'NOW() between ? and ?' =>
array($this->data['Search']['starts'],
$this->data['Search']['expires'])
),
'fields' =>
array('Offer.id','Offer.name','Offer.description','Offer.flag_stars','Offer.flag_stars_plus','Offer.flag_starting_price','Offer.flag_price_currency','Offer.description_sejour','Offer.countries','Offer.duration','Offer.type','Offer.created','Offer.starts','Offer.expires'),
'order' => 'Offer.flag_stars ASC',
));
--
View this message in context:
http://old.nabble.com/Add-to-model-conditions-tp29103124p29103124.html
Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en