magento-engcom / import-export-improvements

Open Software License 3.0
31 stars 29 forks source link

Product import doesn't allow empty attribute values for non-static attributes #86

Closed piotrekkaminski closed 6 years ago

piotrekkaminski commented 6 years ago

From @jarnooravainen on June 20, 2017 9:29

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.

\Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType:

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.

Copied from original issue: magento/magento2#9990

piotrekkaminski commented 6 years ago

From @veloraven on June 21, 2017 13:15

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

piotrekkaminski commented 6 years ago

From @koenner01 on June 23, 2017 11:27

@jarnooravainen https://github.com/magento/magento2/issues/10006, https://github.com/magento/magento2/issues/7468

piotrekkaminski commented 6 years ago

From @magento-engcom-team on September 20, 2017 8:59

@jarnooravainen We added Magento version into preconditions.

piotrekkaminski commented 6 years ago

From @magento-engcom-team on September 20, 2017 9:2

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

dmanners commented 6 years ago

Duplicate of https://github.com/magento-engcom/import-export-improvements/issues/49