Magento2: Product import doesn't allow empty attribute values for non-static attributes

Created on 20 Jun 2017  路  5Comments  路  Source: magento/magento2


Preconditions


  1. Magento 2.1.8
  2. Product attribute has non-empty value in the DB
  3. In the import file product attribute's value is empty

Steps to reproduce

  1. Run product import
  2. Check product attribute's value in the DB

Expected result

  1. Product attribute's value is empty after the import

Actual result

  1. Product attribute's value is not updated to empty

Seems bit odd behaviour that attribute's value cannot be updated to empty via product import. System doesn't allow empty values to be set for non-static attributes.

MagentoCatalogImportExportModelImportProductTypeAbstractType:

public function clearEmptyData(array $rowData)
{
    foreach ($this->_getProductAttributes($rowData) as $attrCode => $attrParams) {
        if (!$attrParams['is_static'] && empty($rowData[$attrCode])) {
            unset($rowData[$attrCode]);
        }
    }
    return $rowData;
}

My suggestion is that shouldn't the product import check allowed values for the attribute instead of just checking if attribute is static or non-empty. This prevents also updating zero integer as a value, obviously.

ImportExport Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x bug report

All 5 comments

@jarnooravainen thank you for your feedback.
Please provide exact detailed steps, with attributes examples.
Please also specify exact Magento version you are using.

@jarnooravainen We added Magento version into preconditions.

@jarnooravainen, thank you for your report.
We've created internal ticket(s) MAGETWO-75556 to track progress on the issue.

This issue was moved to magento-engcom/import-export-improvements#86

Was this page helpful?
0 / 5 - 0 ratings