Commit 14a26e7259b9f1f5c2ffda251e2d0dc5986cc016
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 | 132 | if(!is_object($product)) { |
133 | 133 | $product = Product::find() |
134 | 134 | ->where([ 'product_id' => $product ]) |
135 | - ->with('enabledVariants') | |
135 | + ->with([ | |
136 | + 'enabledVariants', | |
137 | + 'variant', | |
138 | + ]) | |
136 | 139 | ->one(); |
137 | 140 | } |
138 | 141 | |
... | ... | @@ -153,8 +156,8 @@ |
153 | 156 | 1, |
154 | 157 | ]) |
155 | 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 | 162 | $query->innerJoin('product_option', 'product_option.product_id = product.product_id'); |
160 | 163 | $where = [ ]; |
... | ... | @@ -192,7 +195,6 @@ |
192 | 195 | /** |
193 | 196 | * @param ActiveQuery $query |
194 | 197 | * @param $params |
195 | - * @param bool $setPriceLimits | |
196 | 198 | */ |
197 | 199 | public static function _setQueryParams(&$query, $params) |
198 | 200 | { | ... | ... |