public function actionGetSubProductlist(){ $postedData = $this->getPostedData(); $productdata = Product::model()->findByPk( $postedData['productId'] ); if(count($productdata) > 0) { $criteria = new CDbCriteria; $condition = 'product_id='.$postedData['productId']; $criteria->condition = $condition; $productprice = Subproductprice::model()->findAll($criteria); } $json = new CArJSON; $relations = array(); $attributes = array( 'root' => array() ); $isarray = true; $product = $json->toJSON($productdata, $relations, $attributes, $isarray); $relations = array(); $attributes = array( 'root' => array() ); $isarray = true; $productprice = $json->toJSON($productprice, $relations, $attributes, $isarray); $rtnCode = Helper::CONST_Error_None; $message = Helper::CONST_NotFound_Message; $criteria = new CDbCriteria; $criteria->select = array('id','taxname'); $taxrates = Taxrate::model()->findAll($criteria); $json = new CArJSON; $relations = array(); $attributes = array( 'root' => array() ); $isarray = true; $taxrates = $json->toJSON($taxrates, $relations, $attributes, $isarray); $data = array( //Helper::CONST_prdskuToIdMap => $prdskuToIdMap, Helper::CONST_allproducts_short => $product, Helper::CONST_sec_cat_products => $productprice,'tax'=>$taxrates); $this->returnJsonResponse($rtnCode, $data, $message); }
public function setTaxratesLookupInState() { $taxrates = Taxrate::model()->findAll(); $taxrates = CHtml::listData($taxrates, 'id', 'display'); Yii::app()->user->setState('taxrates', $taxrates); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model=Taxrate::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }