Commit d75b9d344d988e4bf57f845c52e35daaf0db6ed5

Authored by Administrator
1 parent 00067cef

add variantSku

Showing 2 changed files with 8 additions and 5 deletions   Show diff stats
models/Product.php
... ... @@ -101,6 +101,9 @@
101 101 */
102 102 class Product extends ActiveRecord
103 103 {
  104 +
  105 + public $min;
  106 + public $max;
104 107  
105 108 public $imagesUpload = [];
106 109  
... ...
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
... ...