Commit 879394e30e695daa464734509eb672147b55f223
1 parent
cb55aee8
add variantSku
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
helpers/FilterHelper.php
... | ... | @@ -215,10 +215,11 @@ |
215 | 215 | * |
216 | 216 | * @param string[] $params |
217 | 217 | * @param \yii\db\Query|null $last_query |
218 | + * @param bool $in_stock | |
218 | 219 | * |
219 | - * @return Query | |
220 | + * @return \yii\db\Query | |
220 | 221 | */ |
221 | - private static function filterOptions(array $params, Query $last_query = null): Query | |
222 | + private static function filterOptions(array $params, Query $last_query = null, bool $in_stock = true): Query | |
222 | 223 | { |
223 | 224 | |
224 | 225 | $variant_query = ( new Query() )->distinct() |
... | ... | @@ -237,6 +238,9 @@ |
237 | 238 | 'tax_option_lang.tax_option_id = tax_option.id' |
238 | 239 | ) |
239 | 240 | ->where([ 'tax_option_lang.alias' => $params ]); |
241 | + if($in_stock) { | |
242 | + $variant_query->andWhere(['!=', 'product_variant.stock', 0]); | |
243 | + } | |
240 | 244 | $product_query = ( new Query() )->distinct() |
241 | 245 | ->select('product_option.product_id as products') |
242 | 246 | ->from('product_option') | ... | ... |