Skip to content

Commit 6f59c55

Browse files
author
Bohdan Korablov
committed
MAGETWO-71922: Error in Import Customers Main File with custom attribute.
1 parent 94d793c commit 6f59c55

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\CustomerImportExport\Model\Import;
77

8+
use Magento\ImportExport\Model\Import;
89
use Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage;
910
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
1011

@@ -262,4 +263,16 @@ protected function getSelectAttrIdByValue(array $attributeParameters, $value)
262263
? $attributeParameters['options'][strtolower($value)]
263264
: 0;
264265
}
266+
267+
/**
268+
* Returns multiple value separator
269+
*
270+
* @return string
271+
*/
272+
protected function getMultipleValueSeparator()
273+
{
274+
return isset($this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR])
275+
? $this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR]
276+
: Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR;
277+
}
265278
}

app/code/Magento/CustomerImportExport/Model/Import/Address.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\CustomerImportExport\Model\Import;
77

8-
use Magento\ImportExport\Model\Import;
98
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
109

1110
/**
@@ -486,9 +485,7 @@ protected function _mergeEntityAttributes(array $newAttributes, array $attribute
486485
*/
487486
protected function _prepareDataForUpdate(array $rowData)
488487
{
489-
$multiSeparator = isset($this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR])
490-
? $this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR]
491-
: Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR;
488+
$multiSeparator = $this->getMultipleValueSeparator();
492489
$email = strtolower($rowData[self::COLUMN_EMAIL]);
493490
$customerId = $this->_getCustomerId($email, $rowData[self::COLUMN_WEBSITE]);
494491
// entity table data
@@ -722,6 +719,7 @@ protected function _isOptionalAddressEmpty(array $rowData)
722719
*/
723720
protected function _validateRowForUpdate(array $rowData, $rowNumber)
724721
{
722+
$multiSeparator = $this->getMultipleValueSeparator();
725723
if ($this->_checkUniqueKey($rowData, $rowNumber)) {
726724
$email = strtolower($rowData[self::COLUMN_EMAIL]);
727725
$website = $rowData[self::COLUMN_WEBSITE];
@@ -740,9 +738,6 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
740738
continue;
741739
}
742740
if (isset($rowData[$attributeCode]) && strlen($rowData[$attributeCode])) {
743-
$multiSeparator = isset($this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR])
744-
? $this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR]
745-
: Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR;
746741
$this->isAttributeValid(
747742
$attributeCode,
748743
$attributeParams,

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,7 @@ protected function _getNextEntityId()
339339
*/
340340
protected function _prepareDataForUpdate(array $rowData)
341341
{
342-
$multiSeparator = isset($this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR])
343-
? $this->_parameters[Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR]
344-
: Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR;
342+
$multiSeparator = $this->getMultipleValueSeparator();
345343
$entitiesToCreate = [];
346344
$entitiesToUpdate = [];
347345
$attributesToSave = [];

0 commit comments

Comments
 (0)