Commit 14a26e7259b9f1f5c2ffda251e2d0dc5986cc016

Authored by Alexey Boroda
1 parent 01b711c8

-Empty enabled variant in similar

Showing 1 changed file with 6 additions and 4 deletions   Show diff stats
common/modules/product/helpers/ProductHelper.php
@@ -132,7 +132,10 @@ @@ -132,7 +132,10 @@
132 if(!is_object($product)) { 132 if(!is_object($product)) {
133 $product = Product::find() 133 $product = Product::find()
134 ->where([ 'product_id' => $product ]) 134 ->where([ 'product_id' => $product ])
135 - ->with('enabledVariants') 135 + ->with([
  136 + 'enabledVariants',
  137 + 'variant',
  138 + ])
136 ->one(); 139 ->one();
137 } 140 }
138 141
@@ -153,8 +156,8 @@ @@ -153,8 +156,8 @@
153 1, 156 1,
154 ]) 157 ])
155 ->andWhere([ 'product_category.category_id' => $product_categories ]); 158 ->andWhere([ 'product_category.category_id' => $product_categories ]);
156 - $query->andWhere(['>=', 'product_variant.price', $product->enabledVariant->price * 0.7]);  
157 - $query->andWhere(['<=', 'product_variant.price', $product->enabledVariant->price * 1.3]); 159 + $query->andWhere(['>=', 'product_variant.price', $product->variant->price * 0.7]);
  160 + $query->andWhere(['<=', 'product_variant.price', $product->variant->price * 1.3]);
158 161
159 $query->innerJoin('product_option', 'product_option.product_id = product.product_id'); 162 $query->innerJoin('product_option', 'product_option.product_id = product.product_id');
160 $where = [ ]; 163 $where = [ ];
@@ -192,7 +195,6 @@ @@ -192,7 +195,6 @@
192 /** 195 /**
193 * @param ActiveQuery $query 196 * @param ActiveQuery $query
194 * @param $params 197 * @param $params
195 - * @param bool $setPriceLimits  
196 */ 198 */
197 public static function _setQueryParams(&$query, $params) 199 public static function _setQueryParams(&$query, $params)
198 { 200 {