From ec7a709c0acec06ab6da7b5937ae3173fa3ae63d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 6 Sep 2019 15:32:47 +0200 Subject: [PATCH] wip #3010 @0.5 --- app/Models/Product.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Models/Product.php b/app/Models/Product.php index 995ad63..729f937 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -419,9 +419,12 @@ class Product extends CubistMagicPageModel if ($data->type == 'list') { $options = []; $values = []; + foreach ($products as $product) { + $v = $product->get($spec_name); - if (!$v) { + $allv[$product->id] = $v; + if (null === $v) { $v = '-'; } if (!isset($values[$v])) { @@ -435,7 +438,11 @@ class Product extends CubistMagicPageModel $matching[] = $product->id; } } + } + + + foreach ($data->options as $index => $option) { if (is_scalar($option)) { $o = $option; @@ -467,7 +474,7 @@ class Product extends CubistMagicPageModel foreach ($products as $product) { $v = $product->get($spec_name); - if(null===$v){ + if (null === $v) { $matching[] = $product->id; continue; } @@ -480,7 +487,7 @@ class Product extends CubistMagicPageModel $min = min($v['first'], $v['second']); $max = max($v['first'], $v['second']); - if (null===$v || ($min <= $filter_value[1] && $max >= $filter_value[0])) { + if (null === $v || ($min <= $filter_value[1] && $max >= $filter_value[0])) { $matching[] = $product->id; } } @@ -488,7 +495,7 @@ class Product extends CubistMagicPageModel $f['min'] = min($f['min'], $v); $f['max'] = min($f['max'], $v); if (null !== $filter_value) { - if (null===$v || ($v >= $filter_value[0] && $v <= $filter_value[0])) { + if (null === $v || ($v >= $filter_value[0] && $v <= $filter_value[0])) { $matching[] = $product->id; } } -- 2.39.5