Add to model conditions

2010-07-08 Thread viciat
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 cr

Re: 3 models and search condition

2010-06-13 Thread viciat
Solution After reading this: http://bakery.cakephp.org/articles/view/get-the-find-query-sql-rather-than-query-result First get the id's of the locations from the offers corresponding to a certain category $this->Offer->recursive = 0;

Re: 3 models and search condition

2010-06-12 Thread viciat
Tried that: $locations = $this->Location->find( 'all', array( 'contain' => array( 'Offer' => array( 'conditions' => array('Offer.category_

Re: 3 models and search condition

2010-06-12 Thread viciat
True. Tried that. But, like I said, it gets the location_id of every offer. If there are 10 offers for a location, it will get all 10 location_id's. On top of that, it won't get the information for the Location model, since the Location model is related to the Offer model. Settings recursive to 2

Re: 3 models and search condition

2010-06-12 Thread viciat
Yeap, I know about the Containable behaviour. The problem with retrieving the categories is another. If I get all the categories, I'm gonna probably need to retrieve the location from the offers associated with the Category. If I have 100 offers for a category (with the same location), I'm gonna

Re: 3 models and search condition

2010-06-12 Thread viciat
Yes. I want to display the locations that are found in the offers of a particular category. When the user selects the Category with, let's say id 3, I want to display the locations that are found in the offers of that category and I don't know how. -- View this message in context: http://old.n

3 models and search condition

2010-06-12 Thread viciat
I have 3 tables (travel agency): Categories (Mountain, Sea etc.) Locations (London, Paris etc.) Offers (id,category_id,location_id) When I select a category, I want to display the locations that are found in the offers of that category. Categories and Locations are not related. -- View this me