Commit 6a1bfd8a363a76dfc8d2a5e3ffa0fe87738c60c0
1 parent
230c9115
-Crazy group by fixes
Showing
3 changed files
with
4 additions
and
8 deletions
Show diff stats
common/modules/product/models/BrandSearch.php
@@ -101,13 +101,13 @@ class BrandSearch extends Brand | @@ -101,13 +101,13 @@ class BrandSearch extends Brand | ||
101 | 101 | ||
102 | $query->innerJoin('product_variant', 'product_variant.product_id = '. Product::tableName() .'.product_id'); | 102 | $query->innerJoin('product_variant', 'product_variant.product_id = '. Product::tableName() .'.product_id'); |
103 | $query->where(['!=', 'product_variant.status', 1]); | 103 | $query->where(['!=', 'product_variant.status', 1]); |
104 | - $query->groupBy(Product::tableName() .'.product_id'); | 104 | +// $query->groupBy(Product::tableName() .'.product_id'); |
105 | if (!empty($category)) { | 105 | if (!empty($category)) { |
106 | $query->andWhere([ | 106 | $query->andWhere([ |
107 | ProductCategory::tableName() .'.category_id' => $category->category_id | 107 | ProductCategory::tableName() .'.category_id' => $category->category_id |
108 | ]); | 108 | ]); |
109 | } | 109 | } |
110 | - $query->groupBy(Brand::tableName() .'.brand_id'); | 110 | +// $query->groupBy(Brand::tableName() .'.brand_id'); |
111 | 111 | ||
112 | return $query; | 112 | return $query; |
113 | } | 113 | } |
frontend/controllers/AjaxController.php
@@ -93,7 +93,7 @@ class AjaxController extends Controller | @@ -93,7 +93,7 @@ class AjaxController extends Controller | ||
93 | $query->select(['product.*']); | 93 | $query->select(['product.*']); |
94 | $query->joinWith(['enabledVariants','brand','options', 'category']); | 94 | $query->joinWith(['enabledVariants','brand','options', 'category']); |
95 | 95 | ||
96 | - $query->groupBy(['product.product_id', 'product_variant.price']); | 96 | +// $query->groupBy(['product.product_id', 'product_variant.price']); |
97 | 97 | ||
98 | ProductHelper::_setQueryParams($query, $params); | 98 | ProductHelper::_setQueryParams($query, $params); |
99 | 99 |
frontend/models/ProductFrontendSearch.php
@@ -81,10 +81,6 @@ class ProductFrontendSearch extends Product { | @@ -81,10 +81,6 @@ class ProductFrontendSearch extends Product { | ||
81 | ] | 81 | ] |
82 | ]); | 82 | ]); |
83 | 83 | ||
84 | - | ||
85 | - | ||
86 | - | ||
87 | - | ||
88 | return $dataProvider; | 84 | return $dataProvider; |
89 | } | 85 | } |
90 | 86 | ||
@@ -102,7 +98,7 @@ class ProductFrontendSearch extends Product { | @@ -102,7 +98,7 @@ class ProductFrontendSearch extends Product { | ||
102 | $query->select(['product.*']); | 98 | $query->select(['product.*']); |
103 | $query->joinWith(['enabledVariants','brand','options', 'category']); | 99 | $query->joinWith(['enabledVariants','brand','options', 'category']); |
104 | 100 | ||
105 | - $query->groupBy(['product.product_id', 'product_variant.price', 'product_variant.stock']); | 101 | +// $query->groupBy(['product.product_id', 'product_variant.price', 'product_variant.stock']); |
106 | $query->orderBy(['product_variant.stock' => SORT_DESC]); | 102 | $query->orderBy(['product_variant.stock' => SORT_DESC]); |
107 | ProductHelper::_setQueryParams($query, $params); | 103 | ProductHelper::_setQueryParams($query, $params); |
108 | if($in_stock){ | 104 | if($in_stock){ |