Commit 6041d68e7961e68ef1aebd1306cb2a10f24edf19
Merge remote-tracking branch 'origin/master'
Showing
12 changed files
with
16 additions
and
24 deletions
Show diff stats
models/Category.php
| @@ -32,8 +32,6 @@ | @@ -32,8 +32,6 @@ | ||
| 32 | * @property TaxGroup[] $taxGroups | 32 | * @property TaxGroup[] $taxGroups |
| 33 | * @property Category[] $siblings | 33 | * @property Category[] $siblings |
| 34 | * @property Category $parentAR | 34 | * @property Category $parentAR |
| 35 | - * @property Category $fullName | ||
| 36 | - * @property Category $name | ||
| 37 | * * From language behavior * | 35 | * * From language behavior * |
| 38 | * @property CategoryLang $lang | 36 | * @property CategoryLang $lang |
| 39 | * @property CategoryLang[] $langs | 37 | * @property CategoryLang[] $langs |
| @@ -92,19 +90,7 @@ | @@ -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 | * @inheritdoc | 96 | * @inheritdoc |
models/ProductFrontendSearch.php
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | * | 59 | * |
| 60 | * @param array $params | 60 | * @param array $params |
| 61 | * | 61 | * |
| 62 | - * @return ArrayDataProvider | 62 | + * @return ActiveDataProvider |
| 63 | */ | 63 | */ |
| 64 | public function search($category = null, $params = [], $in_stock = true) | 64 | public function search($category = null, $params = [], $in_stock = true) |
| 65 | { | 65 | { |
| @@ -68,26 +68,26 @@ | @@ -68,26 +68,26 @@ | ||
| 68 | [ | 68 | [ |
| 69 | 'attributes' => [ | 69 | 'attributes' => [ |
| 70 | 'name_asc' => [ | 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 | 'default' => SORT_ASC, | 73 | 'default' => SORT_ASC, |
| 74 | 'label' => 'имени от А до Я', | 74 | 'label' => 'имени от А до Я', |
| 75 | ], | 75 | ], |
| 76 | 'name_desc' => [ | 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 | 'default' => SORT_DESC, | 79 | 'default' => SORT_DESC, |
| 80 | 'label' => 'имени от Я до А', | 80 | 'label' => 'имени от Я до А', |
| 81 | ], | 81 | ], |
| 82 | 'price_asc' => [ | 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 | 'default' => SORT_ASC, | 85 | 'default' => SORT_ASC, |
| 86 | 'label' => 'по цене по возрастанию', | 86 | 'label' => 'по цене по возрастанию', |
| 87 | ], | 87 | ], |
| 88 | 'price_desc' => [ | 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 | 'default' => SORT_DESC, | 91 | 'default' => SORT_DESC, |
| 92 | 'label' => 'по цене по уменшению', | 92 | 'label' => 'по цене по уменшению', |
| 93 | ], | 93 | ], |
| @@ -98,7 +98,13 @@ | @@ -98,7 +98,13 @@ | ||
| 98 | $dataProvider = new ActiveDataProvider( | 98 | $dataProvider = new ActiveDataProvider( |
| 99 | [ | 99 | [ |
| 100 | 'query' => $this->getSearchQuery($category, $params, $in_stock) | 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 | 'pagination' => [ | 108 | 'pagination' => [ |
| 103 | 'pageSize' => 12, | 109 | 'pageSize' => 12, |
| 104 | ], | 110 | ], |