Commit 998b4c257dfa650797ba5beb9166a835ffbfd794

Authored by Administrator
1 parent 0893579c

add variantSku

Showing 2 changed files with 15 additions and 2 deletions   Show diff stats
models/ProductSearch.php
... ... @@ -16,7 +16,7 @@
16 16 public $categoryId;
17 17  
18 18 public $productName;
19   -
  19 + public $variantSku;
20 20 public $variantCount;
21 21  
22 22 public function behaviors()
... ... @@ -37,6 +37,7 @@
37 37 [
38 38 [
39 39 'productName',
  40 + 'variantSku'
40 41 ],
41 42 'safe',
42 43 ],
... ... @@ -132,6 +133,7 @@
132 133 'asc' => [ 'product_lang.title' => SORT_ASC ],
133 134 'desc' => [ 'product_lang.title' => SORT_DESC ],
134 135 ],
  136 + 'variantSku',
135 137 // 'brand_id' => [
136 138 // 'asc' => [ 'brand_lang.title' => SORT_ASC ],
137 139 // 'desc' => [ 'brand_lang.title' => SORT_DESC ],
... ... @@ -184,6 +186,13 @@
184 186 $this->productName,
185 187 ]
186 188 );
  189 + $query->andFilterWhere(
  190 + [
  191 + 'ilike',
  192 + 'product_variant.sku',
  193 + $this->variantSku
  194 + ]
  195 + );
187 196  
188 197 return $dataProvider;
189 198 }
... ...
views/manage/index.php
... ... @@ -32,7 +32,11 @@
32 32 'dataProvider' => $dataProvider,
33 33 'filterModel' => $searchModel,
34 34 'columns' => [
35   - 'id',
  35 + [
  36 + 'label' => Yii::t('product', 'SKU'),
  37 + 'attribute' => 'variantSku',
  38 + 'value' => 'variant.sku',
  39 + ],
36 40 [
37 41 'attribute' => 'productName',
38 42 'value' => 'lang.title',
... ...