/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ProductTranslation::find(); if (!empty($params['product_id'])) { $query->where(['product_id' => $params['product_id']]); } $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); $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(['id' => $this->id, 'product_id' => $this->product_id, 'language_id' => $this->language_id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'detail', $this->detail])->andFilterWhere(['like', 'shipping_detail', $this->shipping_detail])->andFilterWhere(['like', 'search_text', $this->search_text])->andFilterWhere(['like', 'page_title', $this->page_title])->andFilterWhere(['like', 'h1', $this->h1])->andFilterWhere(['like', 'meta_title', $this->meta_title])->andFilterWhere(['like', 'meta_description', $this->meta_description])->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords])->andFilterWhere(['like', 'image_path', $this->image_path]); return $dataProvider; }
?> <div class="col-md-6"> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->widget(CKEditor::className(), ['preset' => 'standard', 'clientOptions' => ['height' => 200, 'language' => 'vi', 'uiColor' => '#E4E4E4', 'image_previewText' => ' ', 'filebrowserUploadUrl' => Url::to(['file/ckeditor-upload-image'], true)]]); ?> <?php echo $form->field($model, 'detail')->widget(CKEditor::className(), ['preset' => 'standard', 'clientOptions' => ['height' => 200, 'language' => 'vi', 'uiColor' => '#E4E4E4', 'image_previewText' => ' ', 'filebrowserUploadUrl' => Url::to(['file/ckeditor-upload-image'], true)]]); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'language_id')->dropDownList(array_diff_key($this->context->languages_idToName, ArrayHelper::map(ProductTranslation::find()->where(['product_id' => $model->product_id])->andWhere(['<>', 'id', (int) $model->id])->all(), 'language_id', 'language_id'))); ?> <?php echo $form->field($model, 'page_title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'h1')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'meta_title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'meta_description')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'meta_keywords')->textInput(['maxlength' => true]);