diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index 10da7c7a65ebe..c02bbd64e7ca3 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 @@ public function getBindArgumentValue() )->__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 @@ protected function _getAttributeSetId($productId) 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 @@ private function removeTagsFromLabel(array $selectOptions) 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; - } }