public function searchEmptyBrand($params) { $query = RivegaucheProduct::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50]]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->where('brand is null or brand =""'); $query->andFilterWhere(['like', 'article', $this->article])->andFilterWhere(['like', 'link', $this->link])->andFilterWhere(['like', 'group', $this->group])->andFilterWhere(['like', 'category', $this->category])->andFilterWhere(['like', 'sub_category', $this->sub_category])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'price', $this->price])->andFilterWhere(['like', 'gold_price', $this->gold_price])->andFilterWhere(['like', 'blue_price', $this->blue_price])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'image_link', $this->image_link]); return $dataProvider; }
/** * @return string */ public function actionArticleUpdate() { if ($pArticle = reset($_POST['PodruzkaProduct'])['article']) { if ($pp = PodruzkaProduct::find()->where(['article' => $pArticle])->one()) { if (!empty($_POST['l_id'])) { if ($lp = LetualProduct::find()->where(['article' => $_POST['l_id']])->one()) { $pp->l_id = $lp->id; } } else { $pp->l_id = null; } if (!empty($_POST['r_id'])) { if ($rp = RivegaucheProduct::find()->where(['article' => $_POST['r_id']])->one()) { $pp->r_id = $rp->id; } } else { $pp->r_id = null; } if (!empty($_POST['i_id'])) { if ($ip = IledebeauteProduct::find()->where(['article' => $_POST['i_id']])->one()) { $pp->i_id = $ip->id; } } else { $pp->i_id = null; } if (!empty($_POST['e_id'])) { if ($ep = ElizeProduct::find()->where(['article' => $_POST['e_id']])->one()) { $pp->e_id = $ep->id; } } else { $pp->e_id = null; } $pp->save(); return json_encode(['result' => true]); } } return json_encode(['result' => false]); }
/** * Возвращает строку с инпутами для таблицы с формой сопоставления * * @param $model * * @return string */ public static function getArticleMatchingForm($model) { $result = Html::activeLabel($model, 'l_id'); $result .= Html::input('', 'l_id', !empty($lp = LetualProduct::find()->where(['id' => $model->l_id])->one()) ? $lp->article : '', ['class' => 'kv-editable-input form-control']); $result .= Html::activeLabel($model, 'r_id'); $result .= Html::input('', 'r_id', !empty($lp = RivegaucheProduct::find()->where(['id' => $model->r_id])->one()) ? $lp->article : '', ['class' => 'kv-editable-input form-control']); $result .= Html::activeLabel($model, 'e_id'); $result .= Html::input('', 'e_id', !empty($ep = ElizeProduct::find()->where(['id' => $model->e_id])->one()) ? $ep->article : '', ['class' => 'kv-editable-input form-control']); $result .= Html::activeLabel($model, 'i_id'); $result .= Html::input('', 'i_id', !empty($lp = IledebeauteProduct::find()->where(['id' => $model->i_id])->one()) ? $lp->article : '', ['class' => 'kv-editable-input form-control']); return $result; }