Commit d75b9d344d988e4bf57f845c52e35daaf0db6ed5
1 parent
00067cef
add variantSku
Showing
2 changed files
with
8 additions
and
5 deletions
Show diff stats
models/Product.php
models/ProductFrontendSearch.php
@@ -12,7 +12,8 @@ | @@ -12,7 +12,8 @@ | ||
12 | 12 | ||
13 | use artweb\artbox\ecommerce\models\Product; | 13 | use artweb\artbox\ecommerce\models\Product; |
14 | use artweb\artbox\ecommerce\models\ProductVariant; | 14 | use artweb\artbox\ecommerce\models\ProductVariant; |
15 | - | 15 | + use yii\helpers\ArrayHelper; |
16 | + | ||
16 | class ProductFrontendSearch extends Product | 17 | class ProductFrontendSearch extends Product |
17 | { | 18 | { |
18 | 19 | ||
@@ -196,6 +197,8 @@ | @@ -196,6 +197,8 @@ | ||
196 | } else { | 197 | } else { |
197 | $query = Product::find(); | 198 | $query = Product::find(); |
198 | } | 199 | } |
200 | + | ||
201 | + $query->select(['MAX('.ProductVariant::tableName() . '.price) as max', 'MIN('.ProductVariant::tableName() . '.price) as min']); | ||
199 | $query->joinWith('variant'); | 202 | $query->joinWith('variant'); |
200 | 203 | ||
201 | // Price filter fix | 204 | // Price filter fix |
@@ -209,9 +212,6 @@ | @@ -209,9 +212,6 @@ | ||
209 | 1, | 212 | 1, |
210 | ] | 213 | ] |
211 | ); | 214 | ); |
212 | - return [ | ||
213 | - 'min' => $query->min(ProductVariant::tableName() . '.price'), | ||
214 | - 'max' => $query->max(ProductVariant::tableName() . '.price'), | ||
215 | - ]; | 215 | + return $query->one(); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | \ No newline at end of file | 218 | \ No newline at end of file |