Skip to content

Commit 1921861

Browse files
committed
ACP2E-1391: Can't import exported products with comma in attributes
1 parent 6dbb7fc commit 1921861

File tree

1 file changed

+13
-0
lines changed
  • app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type

1 file changed

+13
-0
lines changed

app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ
157157
*
158158
* @var \Magento\Framework\DB\Adapter\AdapterInterface
159159
* @deprecated 100.2.0
160+
* @see No longer used
160161
*/
161162
protected $_connection;
162163

@@ -563,6 +564,18 @@ protected function _parseVariations($rowData)
563564

564565
$fieldAndValuePairs = [];
565566
foreach ($fieldAndValuePairsText as $nameAndValue) {
567+
// If field value contains comma. For example: sku=C100-10,2cm,size=10,2cm
568+
// then this results in $fieldAndValuePairsText = ["sku=C100-10", "2cm", "size=10", "2cm"]
569+
// This code block makes sure that the array element that do not contain the equal sign "="
570+
// will be appended to the preceding element value.
571+
// As a result $fieldAndValuePairs = ["sku" => "C100-10,2cm", "size" => "10,2cm"]
572+
if (strpos($nameAndValue, ImportProduct::PAIR_NAME_VALUE_SEPARATOR) === false
573+
&& isset($fieldName)
574+
&& isset($fieldAndValuePairs[$fieldName])
575+
) {
576+
$fieldAndValuePairs[$fieldName] .= $this->_entityModel->getMultipleValueSeparator() . $nameAndValue;
577+
continue;
578+
}
566579
$nameAndValue = explode(ImportProduct::PAIR_NAME_VALUE_SEPARATOR, $nameAndValue, 2);
567580
if ($nameAndValue) {
568581
$value = isset($nameAndValue[1]) ? trim($nameAndValue[1]) : '';

0 commit comments

Comments
 (0)