/** * Update price and max_price for configurable product */ public function updatePrices(StoreProduct $model) { // Get min and max prices $query = Yii::app()->db->createCommand()->select('MIN(t.price) as min_price, MAX(t.price) as max_price')->from('StoreProduct t')->where(array('in', 't.id', $model->getConfigurations(true)))->queryRow(); // Update Yii::app()->db->createCommand()->update('StoreProduct', array('price' => $query['min_price'], 'max_price' => $query['max_price']), 'id=:id', array(':id' => $model->id)); }