Commit 50dacceeaf49dfc668946c09e577bc0c07d4cd4d
1 parent
cbcfc70c
Sort asc
Showing
2 changed files
with
13 additions
and
7 deletions
Show diff stats
common/config/main.php
@@ -9,7 +9,7 @@ return [ | @@ -9,7 +9,7 @@ return [ | ||
9 | ], | 9 | ], |
10 | 'components' => [ | 10 | 'components' => [ |
11 | 'cache' => [ | 11 | 'cache' => [ |
12 | - 'class' => 'yii\caching\MemCache', | 12 | + 'class' => 'yii\caching\DummyCache', |
13 | 'keyPrefix' => 'linija_' | 13 | 'keyPrefix' => 'linija_' |
14 | ], | 14 | ], |
15 | 'sms' => [ | 15 | 'sms' => [ |
frontend/models/ProductFrontendSearch.php
@@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
71 | 'pageSize' => 15, | 71 | 'pageSize' => 15, |
72 | ], | 72 | ], |
73 | 'sort' => [ | 73 | 'sort' => [ |
74 | - 'attributes' => [ | 74 | + 'attributes' => [ |
75 | 'name' => [ | 75 | 'name' => [ |
76 | 'asc' => [ 'name' => SORT_ASC ], | 76 | 'asc' => [ 'name' => SORT_ASC ], |
77 | 'desc' => [ 'name' => SORT_DESC ], | 77 | 'desc' => [ 'name' => SORT_DESC ], |
@@ -85,6 +85,9 @@ | @@ -85,6 +85,9 @@ | ||
85 | 'label' => 'по цене', | 85 | 'label' => 'по цене', |
86 | ], | 86 | ], |
87 | ], | 87 | ], |
88 | + 'defaultOrder' => [ | ||
89 | + 'price' => SORT_ASC, | ||
90 | + ], | ||
88 | ], | 91 | ], |
89 | ] | 92 | ] |
90 | ); | 93 | ); |
@@ -115,10 +118,12 @@ | @@ -115,10 +118,12 @@ | ||
115 | ); | 118 | ); |
116 | 119 | ||
117 | // $query->groupBy(['product.product_id', 'product_variant.price', 'product_variant.stock']); | 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 | ProductHelper::_setQueryParams($query, $params); | 127 | ProductHelper::_setQueryParams($query, $params); |
123 | if ($in_stock) { | 128 | if ($in_stock) { |
124 | $query->andWhere( | 129 | $query->andWhere( |
@@ -143,7 +148,8 @@ | @@ -143,7 +148,8 @@ | ||
143 | ->innerJoin( | 148 | ->innerJoin( |
144 | 'event', | 149 | 'event', |
145 | 'event.event_id=events_to_products.event_id' | 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 | ); |