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