Esempio n. 1
0
 /**
  * Creates a new Producto model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Productop();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->codigoProducto]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Productop::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['precioProducto' => $this->precioProducto, 'cantidadProducto' => $this->cantidadProducto]);
     $query->andFilterWhere(['like', 'codigoProducto', $this->codigoProducto])->andFilterWhere(['like', 'nombreProducto', $this->nombreProducto])->andFilterWhere(['like', 'tipoProducto', $this->tipoProducto])->andFilterWhere(['like', 'marcaProducto', $this->marcaProducto])->andFilterWhere(['like', 'precioofertaProducto', $this->precioofertaProducto])->andFilterWhere(['like', 'colorProducto', $this->colorProducto])->andFilterWhere(['like', 'garantiaProducto', $this->garantiaProducto]);
     return $dataProvider;
 }