Commit 8e0b062316db3e43c36f3f3c6cca8d9d4432eb82

Authored by Karnovsky A
1 parent 4c6e124a

Sort by price

frontend/models/ProductFrontendSearch.php
... ... @@ -54,9 +54,10 @@ class ProductFrontendSearch extends Product {
54 54 } else {
55 55 $query = Product::find();
56 56 }
  57 + $query->select(['product.*']);
57 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 62 $dataProvider = new ActiveDataProvider([
62 63 'query' => $query,
... ...
frontend/views/catalog/products.php
... ... @@ -157,7 +157,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[
157 157 <div class="content">
158 158 <h1><?= $category->name ?></h1>
159 159 <div class="sort_menu">
160   -<?php /*
  160 +
161 161 <div class="sort_block">
162 162 <span>Сортировка:</span>
163 163 <?= \yii\widgets\LinkSorter::widget([
... ... @@ -168,7 +168,7 @@ $this-&gt;registerJsFile(Yii::getAlias(&#39;@web/js/ion.rangeSlider.js&#39;),[
168 168 ]);
169 169 ?>
170 170 </div>
171   - */?>
  171 +
172 172 </div>
173 173 <div class="products pn">
174 174 <ul>
... ...