Commit b929fe29240b4ff5ef47fc062bd19aab4db519fb

Authored by Administrator
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,7 +146,7 @@
146 $product_categories[] = $category->category_id; 146 $product_categories[] = $category->category_id;
147 } 147 }
148 $query = Product::find() 148 $query = Product::find()
149 - ->select('product.product_id') 149 +
150 ->innerJoinWith('variant') 150 ->innerJoinWith('variant')
151 ->joinWith('category') 151 ->joinWith('category')
152 ->where([ 152 ->where([
@@ -175,11 +175,9 @@ @@ -175,11 +175,9 @@
175 ]); 175 ]);
176 $query->groupBy('product.product_id'); 176 $query->groupBy('product.product_id');
177 $query->limit($count); 177 $query->limit($count);
178 - $products = $query->asArray() 178 + $products = $query
179 ->all(); 179 ->all();
180 - foreach($products as &$_product) {  
181 - $_product = Product::findOne($_product[ 'product_id' ]);  
182 - } 180 +
183 return $products; 181 return $products;
184 } 182 }
185 183