Commit b929fe29240b4ff5ef47fc062bd19aab4db519fb
1 parent
079f016c
14.09.16
Showing
1 changed file
with
3 additions
and
5 deletions
Show diff stats
common/modules/product/helpers/ProductHelper.php
| ... | ... | @@ -146,7 +146,7 @@ |
| 146 | 146 | $product_categories[] = $category->category_id; |
| 147 | 147 | } |
| 148 | 148 | $query = Product::find() |
| 149 | - ->select('product.product_id') | |
| 149 | + | |
| 150 | 150 | ->innerJoinWith('variant') |
| 151 | 151 | ->joinWith('category') |
| 152 | 152 | ->where([ |
| ... | ... | @@ -175,11 +175,9 @@ |
| 175 | 175 | ]); |
| 176 | 176 | $query->groupBy('product.product_id'); |
| 177 | 177 | $query->limit($count); |
| 178 | - $products = $query->asArray() | |
| 178 | + $products = $query | |
| 179 | 179 | ->all(); |
| 180 | - foreach($products as &$_product) { | |
| 181 | - $_product = Product::findOne($_product[ 'product_id' ]); | |
| 182 | - } | |
| 180 | + | |
| 183 | 181 | return $products; |
| 184 | 182 | } |
| 185 | 183 | ... | ... |