diff --git a/models/ProductSearch.php b/models/ProductSearch.php index c92ef20..64f139e 100755 --- a/models/ProductSearch.php +++ b/models/ProductSearch.php @@ -16,7 +16,7 @@ public $categoryId; public $productName; - + public $variantSku; public $variantCount; public function behaviors() @@ -37,6 +37,7 @@ [ [ 'productName', + 'variantSku' ], 'safe', ], @@ -132,6 +133,7 @@ 'asc' => [ 'product_lang.title' => SORT_ASC ], 'desc' => [ 'product_lang.title' => SORT_DESC ], ], + 'variantSku', // 'brand_id' => [ // 'asc' => [ 'brand_lang.title' => SORT_ASC ], // 'desc' => [ 'brand_lang.title' => SORT_DESC ], @@ -184,6 +186,13 @@ $this->productName, ] ); + $query->andFilterWhere( + [ + 'ilike', + 'product_variant.sku', + $this->variantSku + ] + ); return $dataProvider; } diff --git a/views/manage/index.php b/views/manage/index.php index 72c25e6..4dfbc66 100755 --- a/views/manage/index.php +++ b/views/manage/index.php @@ -32,7 +32,11 @@ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ - 'id', + [ + 'label' => Yii::t('product', 'SKU'), + 'attribute' => 'variantSku', + 'value' => 'variant.sku', + ], [ 'attribute' => 'productName', 'value' => 'lang.title', -- libgit2 0.21.4