From d5b596a1c832a7919438b8711a8a048b3a7129da Mon Sep 17 00:00:00 2001
From: nmalevanec <mikola.malevanec@transoftgroup.com>
Date: Wed, 20 Dec 2017 16:15:26 +0200
Subject: [PATCH] magento/magento2#11897: Catalog product list widget not
 working with multiple sku

---
 .../Condition/Product/AbstractProduct.php     | 33 +++----------------
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
index 10da7c7a65e..c02bbd64e7c 100644
--- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
+++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
@@ -611,7 +611,9 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon
                 )->__toString()
             );
         } elseif ($this->getAttribute() === 'sku') {
-            $this->isMultipleSku();
+            $value = $this->getData('value');
+            $value = preg_split('#\s*[,;]\s*#', $value, null, PREG_SPLIT_NO_EMPTY);
+            $this->setValueParsed($value);
         }
 
         return parent::getBindArgumentValue();
@@ -711,7 +713,7 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon
     public function getOperatorForValidate()
     {
         $operator = $this->getOperator();
-        if ($this->getInputType() == 'category' || $this->isMultipleSku()) {
+        if (in_array($this->getInputType(), ['category', 'sku'])) {
             if ($operator == '==') {
                 $operator = '{}';
             } elseif ($operator == '!=') {
@@ -760,31 +762,4 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon
 
         return $selectOptions;
     }
-
-    /**
-     * Check condition contains multiple sku.
-     *
-     * @return bool
-     */
-    private function isMultipleSku()
-    {
-        $result = false;
-        if ($this->getInputType() === 'sku') {
-            if ($this->hasValueParsed()) {
-                $value = $this->getData('value_parsed');
-                if (count($value > 1)) {
-                    $result = true;
-                }
-            } else {
-                $value = $this->getData('value');
-                $value = preg_split('#\s*[,;]\s*#', $value, null, PREG_SPLIT_NO_EMPTY);
-                if (count($value > 1)) {
-                    $this->setValueParsed($value);
-                    $result = true;
-                }
-            }
-        }
-
-        return $result;
-    }
 }
-- 
GitLab