Example #1
0
 /**
  * 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 $id the ID of the model to be loaded
  * @return ProductGroup the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ProductGroup::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #2
0
 private function setPG($id,$val,$prod=0) {
    $found=ProductgroupId::model()->findByPk(array('ckey'=>$val->par,'db'=>1));
     if($found)
     {
      if($prod==0)
          $pg= ProductGroup::model()->findByPk($id);
     else
          $pg= Product::model()->findByPk($id);
        if($pg)
          {
       if($prod!=0)
           $pg->it=(int)$val->it;
           $pg->cgr=$found->id;
           $pg->save();
          }
      }
 }