hello friends…
here is my code…
public function actionIndex()
{
$model = new ProductIndex();
$price = (isset($_GET['ProductIndex']['price'])) ? $_GET['ProductIndex']['price'] : array();
CVarDumper::dump($price);
$criteria = new CDbCriteria();
//take the other table column
$criteria->with = 'pricing';
if ( isset($_GET['ProductIndex']['price']) && ($price[0] == 0 ))
{
$results = pricing::model()->findAll(array( 'condition'=>'price>=:price AND price <= :price1',
'params'=>array(':price'=>0, ':price1'=>2000),
));
$values = array();
foreach($results as $r) $values[] = $r->price;
$criteria->addInCondition( 'pricing.price', $values );
}
if( isset($_GET['ProductIndex']['price']) && $price[0] == 1 )
{
$results = pricing::model()->findAll(array( 'condition'=>'price>=:price AND price <= :price1',
'params'=>array(':price'=>2001, ':price1'=>5000),));
$values = array();
foreach($results as $r) $values[] = $r->price;
$criteria->addInCondition( 'pricing.price', $values );
}
if( isset($_GET['ProductIndex']['price']) && $price[0] == 2 )
{
$results = pricing::model()->findAll(array( 'condition'=>'price>=:price AND price <= :price1',
'params'=>array(':price'=>5001, ':price1'=>10000),));
$values = array();
foreach($results as $r) $values[] = $r->price;
$criteria->addInCondition( 'pricing.price', $values );
}
here i use 3 conditions and 3 query individual,and it work fine for the individual operation.
now i want to these condition work togather.
please suggest me to any method in which i will do it.
thanks.