Commit 8e0b062316db3e43c36f3f3c6cca8d9d4432eb82
1 parent
4c6e124a
Sort by price
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
frontend/models/ProductFrontendSearch.php
@@ -54,9 +54,10 @@ class ProductFrontendSearch extends Product { | @@ -54,9 +54,10 @@ class ProductFrontendSearch extends Product { | ||
54 | } else { | 54 | } else { |
55 | $query = Product::find(); | 55 | $query = Product::find(); |
56 | } | 56 | } |
57 | + $query->select(['product.*']); | ||
57 | $query->joinWith(['variant', 'image', 'brand', 'brand.brandName', 'category', 'category.categoryName']); | 58 | $query->joinWith(['variant', 'image', 'brand', 'brand.brandName', 'category', 'category.categoryName']); |
58 | 59 | ||
59 | - $query->groupBy('product.product_id'); | 60 | + $query->groupBy(['product.product_id', 'product_variant.price']); |
60 | 61 | ||
61 | $dataProvider = new ActiveDataProvider([ | 62 | $dataProvider = new ActiveDataProvider([ |
62 | 'query' => $query, | 63 | 'query' => $query, |
frontend/views/catalog/products.php
@@ -157,7 +157,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[ | @@ -157,7 +157,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[ | ||
157 | <div class="content"> | 157 | <div class="content"> |
158 | <h1><?= $category->name ?></h1> | 158 | <h1><?= $category->name ?></h1> |
159 | <div class="sort_menu"> | 159 | <div class="sort_menu"> |
160 | -<?php /* | 160 | + |
161 | <div class="sort_block"> | 161 | <div class="sort_block"> |
162 | <span>Сортировка:</span> | 162 | <span>Сортировка:</span> |
163 | <?= \yii\widgets\LinkSorter::widget([ | 163 | <?= \yii\widgets\LinkSorter::widget([ |
@@ -168,7 +168,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[ | @@ -168,7 +168,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[ | ||
168 | ]); | 168 | ]); |
169 | ?> | 169 | ?> |
170 | </div> | 170 | </div> |
171 | - */?> | 171 | + |
172 | </div> | 172 | </div> |
173 | <div class="products pn"> | 173 | <div class="products pn"> |
174 | <ul> | 174 | <ul> |