20, // ]; $this->load($params); if ( !$this->validate() ) { $query->where('0=1'); } $query->andFilterWhere([ 'name' => $this->name, 'brand' => $this->brand, ]); $query->andWhere(['or', 'box > 0', 'add_box > 0']); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'key' => 'name', 'sort' => [ 'attributes' => [ 'box', 'delivery', 'price' ], ], ]); return $dataProvider; } public function searchCrosses($params) { $query = GoodsView::find()->innerJoin('w_details_crosses', '`w_details_crosses`.`CROSS_ARTICLE` = `name` and `w_details_crosses`.`CROSS_BRAND` = w_goods_view.`brand`'); // ->select([ // 'name' => 'Name', // 'brand' => 'w_details_crosses.CROSS_BRAND', // 'box' => 'Box', // 'add_box' => 'add_box', // 'importer_id' => 'importer_id', // 'importer_name' => 'importer_name', // 'rate' => 'Rate', // 'currency_id' => 'currency_id', // 'delivery' => 'Delivery', // 'description' => 'Description', // 'article' => 'w_details_crosses.CROSS_ARTICLE', // 'ID' => 'w_goods_view.ID', // 'image' => 'Image', // 'tecdoc_id' => 'tecdoc_id', // 'price' => 'Price', // 'brand_id' => 'brand_id', // ]); // $pagination = [ // 'pageSize' => 20, // ]; $this->load($params); if ( !$this->validate() ) { $query->where('0=1'); } $query->andFilterWhere([ 'w_details_crosses.ARTICLE' => $this->name, 'w_details_crosses.BRAND' => $this->brand, ]); $query->andWhere(['or', 'box > 0', 'add_box > 0']); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'key' => 'name', 'sort' => [ 'attributes' => [ 'box', 'delivery', 'price' ], ], ]); return $dataProvider; } }