Commit 8c0d4c195c420af2693bd41e81ece2dbcfb9a03c
1 parent
9bad9e51
-get similar method fix
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
common/modules/product/helpers/ProductHelper.php
| @@ -155,16 +155,18 @@ | @@ -155,16 +155,18 @@ | ||
| 155 | ->andWhere([ 'product_category.category_id' => $product_categories ]); | 155 | ->andWhere([ 'product_category.category_id' => $product_categories ]); |
| 156 | // $query->andWhere(['>=', 'product_variant.price', $product->enabledVariant->price * 0.7]); | 156 | // $query->andWhere(['>=', 'product_variant.price', $product->enabledVariant->price * 0.7]); |
| 157 | // $query->andWhere(['<=', 'product_variant.price', $product->enabledVariant->price * 1.3]); | 157 | // $query->andWhere(['<=', 'product_variant.price', $product->enabledVariant->price * 1.3]); |
| 158 | + | ||
| 159 | + $query->innerJoin('product_option', 'product_option.product_id = product.product_id'); | ||
| 160 | + $where = [ ]; | ||
| 158 | foreach($product->properties as $group) { | 161 | foreach($product->properties as $group) { |
| 159 | - $where = [ ]; | 162 | + |
| 160 | foreach($group->_options as $option) { | 163 | foreach($group->_options as $option) { |
| 161 | $where[] = $option->tax_option_id; | 164 | $where[] = $option->tax_option_id; |
| 162 | } | 165 | } |
| 163 | if(!$where) { | 166 | if(!$where) { |
| 164 | continue; | 167 | continue; |
| 165 | } | 168 | } |
| 166 | - $query->innerJoin('product_option to' . $group->tax_group_id, 'to' . $group->tax_group_id . '.product_id = product.product_id'); | ||
| 167 | - $query->andWhere([ 'to' . $group->tax_group_id . '.option_id' => $where ]); | 169 | + $query->andWhere([ 'option_id' => $where ]); |
| 168 | } | 170 | } |
| 169 | $query->andWhere([ | 171 | $query->andWhere([ |
| 170 | '!=', | 172 | '!=', |