Commit f447738b4967fd104393bb66e467114854e2fd91
1 parent
f9ff89a8
add variantSku
Showing
12 changed files
with
16 additions
and
24 deletions
Show diff stats
models/Category.php
| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * @property TaxGroup[] $taxGroups |
| 33 | 33 | * @property Category[] $siblings |
| 34 | 34 | * @property Category $parentAR |
| 35 | - * @property Category $fullName | |
| 36 | - * @property Category $name | |
| 37 | 35 | * * From language behavior * |
| 38 | 36 | * @property CategoryLang $lang |
| 39 | 37 | * @property CategoryLang[] $langs |
| ... | ... | @@ -92,19 +90,7 @@ |
| 92 | 90 | } |
| 93 | 91 | |
| 94 | 92 | |
| 95 | - public function getFullName(){ | |
| 96 | - if($this->parentAR != null){ | |
| 97 | - return $this->parentAR->name .' '.$this->name; | |
| 98 | - } else { | |
| 99 | - return $this->name; | |
| 100 | - } | |
| 101 | - | |
| 102 | - } | |
| 103 | 93 | |
| 104 | - | |
| 105 | - public function getName(){ | |
| 106 | - return !empty($this->lang->category_synonym) ?$this->lang->category_synonym : $this->lang->title; | |
| 107 | - } | |
| 108 | 94 | |
| 109 | 95 | /** |
| 110 | 96 | * @inheritdoc | ... | ... |
models/ProductFrontendSearch.php
| ... | ... | @@ -59,7 +59,7 @@ |
| 59 | 59 | * |
| 60 | 60 | * @param array $params |
| 61 | 61 | * |
| 62 | - * @return ArrayDataProvider | |
| 62 | + * @return ActiveDataProvider | |
| 63 | 63 | */ |
| 64 | 64 | public function search($category = null, $params = [], $in_stock = true) |
| 65 | 65 | { |
| ... | ... | @@ -68,26 +68,26 @@ |
| 68 | 68 | [ |
| 69 | 69 | 'attributes' => [ |
| 70 | 70 | 'name_asc' => [ |
| 71 | - 'asc' => [ 'lang.title' => SORT_ASC ], | |
| 72 | - 'desc' => [ 'lang.title' => SORT_ASC ], | |
| 71 | + 'asc' => [ 'product_lang.title' => SORT_ASC ], | |
| 72 | + 'desc' => [ 'product_lang.title' => SORT_ASC ], | |
| 73 | 73 | 'default' => SORT_ASC, |
| 74 | 74 | 'label' => 'имени от А до Я', |
| 75 | 75 | ], |
| 76 | 76 | 'name_desc' => [ |
| 77 | - 'asc' => [ 'lang.title' => SORT_DESC ], | |
| 78 | - 'desc' => [ 'lang.title' => SORT_DESC ], | |
| 77 | + 'asc' => [ 'product_lang.title' => SORT_DESC ], | |
| 78 | + 'desc' => [ 'product_lang.title' => SORT_DESC ], | |
| 79 | 79 | 'default' => SORT_DESC, |
| 80 | 80 | 'label' => 'имени от Я до А', |
| 81 | 81 | ], |
| 82 | 82 | 'price_asc' => [ |
| 83 | - 'asc' => [ 'enabledVariants.price' => SORT_ASC ], | |
| 84 | - 'desc' => [ 'enabledVariants.price' => SORT_ASC ], | |
| 83 | + 'asc' => [ 'product_variant.price' => SORT_ASC ], | |
| 84 | + 'desc' => [ 'product_variant.price' => SORT_ASC ], | |
| 85 | 85 | 'default' => SORT_ASC, |
| 86 | 86 | 'label' => 'по цене по возрастанию', |
| 87 | 87 | ], |
| 88 | 88 | 'price_desc' => [ |
| 89 | - 'asc' => [ 'enabledVariants.price' => SORT_DESC ], | |
| 90 | - 'desc' => [ 'enabledVariants.price' => SORT_DESC ], | |
| 89 | + 'asc' => [ 'product_variant.price' => SORT_DESC ], | |
| 90 | + 'desc' => [ 'product_variant.price' => SORT_DESC ], | |
| 91 | 91 | 'default' => SORT_DESC, |
| 92 | 92 | 'label' => 'по цене по уменшению', |
| 93 | 93 | ], |
| ... | ... | @@ -98,7 +98,13 @@ |
| 98 | 98 | $dataProvider = new ActiveDataProvider( |
| 99 | 99 | [ |
| 100 | 100 | 'query' => $this->getSearchQuery($category, $params, $in_stock) |
| 101 | - ->with('variant', 'videos'), | |
| 101 | + ->with('variant', 'videos') | |
| 102 | + ->groupBy( | |
| 103 | + [ | |
| 104 | + 'product_lang.title', | |
| 105 | + 'product_variant.price', | |
| 106 | + 'product.id' | |
| 107 | + ]), | |
| 102 | 108 | 'pagination' => [ |
| 103 | 109 | 'pageSize' => 12, |
| 104 | 110 | ], | ... | ... |