Skip to content

Commit 8d72601

Browse files
fixed multiple value parser
1 parent b07f7c0 commit 8d72601

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
*/
4747
class Product extends AbstractEntity
4848
{
49+
private const DEFAULT_GLOBAL_MULTIPLE_VALUE_SEPARATOR = ',';
4950
public const CONFIG_KEY_PRODUCT_TYPES = 'global/importexport/import_product_types';
5051
private const HASH_ALGORITHM = 'sha256';
5152

@@ -2841,6 +2842,10 @@ private function parseAttributesWithWrappedValues($attributesData)
28412842
public function parseMultiselectValues($values, $delimiter = self::PSEUDO_MULTI_LINE_SEPARATOR)
28422843
{
28432844
if (empty($this->_parameters[Import::FIELDS_ENCLOSURE])) {
2845+
if ($this->getMultipleValueSeparator() !== self::DEFAULT_GLOBAL_MULTIPLE_VALUE_SEPARATOR) {
2846+
$delimiter = $this->getMultipleValueSeparator();
2847+
}
2848+
28442849
return explode($delimiter, $values);
28452850
}
28462851
if (preg_match_all('~"((?:[^"]|"")*)"~', $values, $matches)) {

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*/
1818
class Validator extends AbstractValidator implements RowValidatorInterface
1919
{
20-
private const DEFAULT_GLOBAL_MULTIPLE_VALUE_SEPARATOR = ',';
21-
2220
/**
2321
* @var RowValidatorInterface[]|AbstractValidator[]
2422
*/
@@ -229,12 +227,7 @@ public function isAttributeValid($attrCode, array $attrParams, array $rowData)
229227
$valid = $this->validateOption($attrCode, $attrParams['options'], $rowData[$attrCode]);
230228
break;
231229
case 'multiselect':
232-
$separator = $this->context->getMultipleValueSeparator();
233-
// added to prevent backward compatibility since before we didn't use separator param value
234-
$values = $separator === self::DEFAULT_GLOBAL_MULTIPLE_VALUE_SEPARATOR
235-
? $this->context->parseMultiselectValues($rowData[$attrCode])
236-
: $this->context->parseMultiselectValues($rowData[$attrCode], $separator);
237-
230+
$values = $this->context->parseMultiselectValues($rowData[$attrCode]);
238231
foreach ($values as $value) {
239232
$valid = $this->validateOption($attrCode, $attrParams['options'], $value);
240233
if (!$valid) {

0 commit comments

Comments
 (0)