Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?= $form->field($model, 'maincatalog')->dropDownList($maincatalog, ["prompt" => Yii::t('app', 'select_cat')])->label(false) ?>
- <?= $form->field($model, 'listproduct')->dropDownList($listproduct, ["prompt" => Yii::t('app', 'select_cat')])->label(false) ?>
- <?= $form->field($model, 'q')->textInput(['class' => 'input'])->label('')?>
- $query = Addproduct::find()
- ->where(['catalog' => $maincatalog])
- ->andWhere(['product' => $listproduct])
- ->andWhere(['like', 'titleru', $q])->all();
- $query = Addproduct::find();
- if ($maincatalog != NULL)
- $query->where(['catalog' => $maincatalog]);
- if ($listproduct != NULL)
- $query->andWhere(['product' => $listproduct]);
- $query->andWhere(['like', 'titleru', $q])->all();
- if($maincatalog == "" && $listproduct == "" && $q == ""){
- $query = "all empty";
- } elseif($maincatalog == "" && $listproduct != "" && $q == ""){
- $query = Addproduct::find()->where(['product' => $listproduct])
- ->andWhere(['like', 'titleru', $q])->all();
- } elseif($maincatalog != "" && $listproduct == "" && $q == "") {
- $query = Addproduct::find()->where(['catalog' => $maincatalog])
- ->andWhere(['like', 'titleru', $q])->all();
- } elseif($maincatalog == "" && $listproduct == "" && $q != "") {
- $query = Addproduct::find()->where(['like', 'titleru', $q])->all();
- } elseif($maincatalog == "" && $listproduct != "" && $q != "") {
- $query = Addproduct::find()->where(['product' => $listproduct])
- ->andWhere(['like', 'titleru', $q])->all();
- } elseif($maincatalog != "" && $listproduct == "" && $q != "") {
- $query = Addproduct::find()->where(['catalog' => $maincatalog])
- ->andWhere(['like', 'titleru', $q])->all();
- } else {
- $query = Addproduct::find()->where(['catalog' => $maincatalog])
- ->andWhere(['product' => $listproduct])->andWhere(['like', 'titleru', $q])->all();
- }
- $query = Addproduct::find();
- if ( $maincatalog != NULL )
- $query->where(['catalog' => $maincatalog]);
- $query->andWhere(['product' => $listproduct])
- ->andWhere(['like', 'titleru', $q])->all();
- if($maincatalog == "" && $listproduct == "" && $q == ""){
- $query = "all empty";
- } elseif($maincatalog == "" && $listproduct != "" && $q == ""){
- $query = Addproduct::find()->where(['product' => $listproduct])- >andWhere(['like', 'titleru', $q])->all();
- } elseif($maincatalog != "" && $listproduct == "" && $q == "") {
- $query = Addproduct::find()->where(['catalog' => $maincatalog])- >andWhere(['like', 'titleru', $q])->all();
- } elseif($maincatalog == "" && $listproduct == "" && $q != "") {
- $query = Addproduct::find()->where(['like', 'titleru', $q])->all();
- } elseif($maincatalog == "" && $listproduct != "" && $q != "") {
- $query = Addproduct::find()->where(['product' => $listproduct])->andWhere(['like', 'titleru', $q])->all();
- } elseif($maincatalog != "" && $listproduct == "" && $q != "") {
- $query = Addproduct::find()->where(['catalog' => $maincatalog])- >andWhere(['like', 'titleru', $q])->all();
- } else {
- $query = Addproduct::find()->where(['catalog' => $maincatalog])- >andWhere(['product' => $listproduct])->andWhere(['like', 'titleru', $q])- >all();
- }
- $query = Addproduct::find();
- if ($maincatalog != NULL)
- $query->where(['catalog' => $maincatalog]);
- if ($listproduct != NULL)
- $query->andWhere(['product' => $listproduct]);
- $query->andWhere(['like', 'titleru', $q])->all();
- $query = Addproduct::find()->where('***');
- $query->andFilterWhere(['catalog' => $maincatalog]);
- $query->all();
- public $q;
- public $listproduct;
- public $maincatalog;
- public function rules()
- {
- return [
- ['q', 'string'],
- ['listproduct', 'string'],
- ['maincatalog', 'string']
- ];
- }
Add Comment
Please, Sign In to add comment