Feature request from zinittest, posted on GitHub Apr 25, 2016
Steps to reproduce
- Create CSV file for customer import with gender fields filled with valid values (Male, Female, ...).
- Choose "Customers Main File", "Add/Update Complex Data" options.
- Import data.
Expected result
- Gender data is properly saved.
Actual result
- None of imported customers have gender info saved. DB fields in
customer_entity
.gender
column are filed with zeroes or nulls.
P. S. Probably error occurs because gender data are not replaced with corresponding constant values on data preparation step (https://github.com/magento/magento2/blob/develop/app/code/Magento/CustomerImportExport/Model/Import/...), so system is trying to insert string values to DB column of integer type. I was able to import gender data with following ugly piece of code inserted before new customer check https://github.com/magento/magento2/blob/develop/app/code/Magento/CustomerImportExport/Model/Import/...:
if (false !== strpos($entityRow['gender'], 'Male')) {
$entityRow['gender'] = 1;
} elseif (false !== strpos($entityRow['gender'], 'Female')) {
$entityRow['gender'] = 2;
} else {
$entityRow['gender'] = 3;
}
Of course it requires more proper fix.