cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Import - Gender is not imported

0 Kudos

Customer Import - Gender is not imported

Feature request from zinittest, posted on GitHub Apr 25, 2016

Steps to reproduce

  1. Create CSV file for customer import with gender fields filled with valid values (Male, Female, ...).
  2. Choose "Customers Main File", "Add/Update Complex Data" options.
  3. Import data.

Expected result

  1. Gender data is properly saved.

Actual result

  1. 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.

1 Comment
Not applicable

Comment from piotrekkaminski, posted on GitHub May 23, 2016

The export file includes same numerical values so it is consistent. @ilol what do you think?