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 | 12 | |
| 13 | 13 | use artweb\artbox\ecommerce\models\Product; |
| 14 | 14 | use artweb\artbox\ecommerce\models\ProductVariant; |
| 15 | - | |
| 15 | + use yii\helpers\ArrayHelper; | |
| 16 | + | |
| 16 | 17 | class ProductFrontendSearch extends Product |
| 17 | 18 | { |
| 18 | 19 | |
| ... | ... | @@ -196,6 +197,8 @@ |
| 196 | 197 | } else { |
| 197 | 198 | $query = Product::find(); |
| 198 | 199 | } |
| 200 | + | |
| 201 | + $query->select(['MAX('.ProductVariant::tableName() . '.price) as max', 'MIN('.ProductVariant::tableName() . '.price) as min']); | |
| 199 | 202 | $query->joinWith('variant'); |
| 200 | 203 | |
| 201 | 204 | // Price filter fix |
| ... | ... | @@ -209,9 +212,6 @@ |
| 209 | 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 | 218 | \ No newline at end of file | ... | ... |