Commit 50dacceeaf49dfc668946c09e577bc0c07d4cd4d
1 parent
cbcfc70c
Sort asc
Showing
2 changed files
with
13 additions
and
7 deletions
Show diff stats
common/config/main.php
frontend/models/ProductFrontendSearch.php
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | 'pageSize' => 15, |
72 | 72 | ], |
73 | 73 | 'sort' => [ |
74 | - 'attributes' => [ | |
74 | + 'attributes' => [ | |
75 | 75 | 'name' => [ |
76 | 76 | 'asc' => [ 'name' => SORT_ASC ], |
77 | 77 | 'desc' => [ 'name' => SORT_DESC ], |
... | ... | @@ -85,6 +85,9 @@ |
85 | 85 | 'label' => 'по цене', |
86 | 86 | ], |
87 | 87 | ], |
88 | + 'defaultOrder' => [ | |
89 | + 'price' => SORT_ASC, | |
90 | + ], | |
88 | 91 | ], |
89 | 92 | ] |
90 | 93 | ); |
... | ... | @@ -115,10 +118,12 @@ |
115 | 118 | ); |
116 | 119 | |
117 | 120 | // $query->groupBy(['product.product_id', 'product_variant.price', 'product_variant.stock']); |
118 | - $query->orderBy([ | |
119 | - 'brand.sort' => SORT_ASC, | |
120 | - 'product_variant.stock' => SORT_DESC, | |
121 | - ]); | |
121 | + $query->orderBy( | |
122 | + [ | |
123 | + 'brand.sort' => SORT_ASC, | |
124 | + 'product_variant.stock' => SORT_DESC, | |
125 | + ] | |
126 | + ); | |
122 | 127 | ProductHelper::_setQueryParams($query, $params); |
123 | 128 | if ($in_stock) { |
124 | 129 | $query->andWhere( |
... | ... | @@ -143,7 +148,8 @@ |
143 | 148 | ->innerJoin( |
144 | 149 | 'event', |
145 | 150 | 'event.event_id=events_to_products.event_id' |
146 | - )->where(['event.sale' => true]), | |
151 | + ) | |
152 | + ->where([ 'event.sale' => true ]), | |
147 | 153 | ], |
148 | 154 | ] |
149 | 155 | ); | ... | ... |