Skip to content

Commit d5b596a

Browse files
committed
#11897: Catalog product list widget not working with multiple sku
1 parent 8d62341 commit d5b596a

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,9 @@ public function getBindArgumentValue()
611611
)->__toString()
612612
);
613613
} elseif ($this->getAttribute() === 'sku') {
614-
$this->isMultipleSku();
614+
$value = $this->getData('value');
615+
$value = preg_split('#\s*[,;]\s*#', $value, null, PREG_SPLIT_NO_EMPTY);
616+
$this->setValueParsed($value);
615617
}
616618

617619
return parent::getBindArgumentValue();
@@ -711,7 +713,7 @@ protected function _getAttributeSetId($productId)
711713
public function getOperatorForValidate()
712714
{
713715
$operator = $this->getOperator();
714-
if ($this->getInputType() == 'category' || $this->isMultipleSku()) {
716+
if (in_array($this->getInputType(), ['category', 'sku'])) {
715717
if ($operator == '==') {
716718
$operator = '{}';
717719
} elseif ($operator == '!=') {
@@ -760,31 +762,4 @@ private function removeTagsFromLabel(array $selectOptions)
760762

761763
return $selectOptions;
762764
}
763-
764-
/**
765-
* Check condition contains multiple sku.
766-
*
767-
* @return bool
768-
*/
769-
private function isMultipleSku()
770-
{
771-
$result = false;
772-
if ($this->getInputType() === 'sku') {
773-
if ($this->hasValueParsed()) {
774-
$value = $this->getData('value_parsed');
775-
if (count($value > 1)) {
776-
$result = true;
777-
}
778-
} else {
779-
$value = $this->getData('value');
780-
$value = preg_split('#\s*[,;]\s*#', $value, null, PREG_SPLIT_NO_EMPTY);
781-
if (count($value > 1)) {
782-
$this->setValueParsed($value);
783-
$result = true;
784-
}
785-
}
786-
}
787-
788-
return $result;
789-
}
790765
}

0 commit comments

Comments
 (0)