Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

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

Closed
piotrekkaminski opened this issue Jan 3, 2018 · 5 comments
Assignees

Comments

@piotrekkaminski
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

From @koenner01 on June 23, 2017 11:27

@jarnooravainen magento/magento2#10006, magento/magento2#7468

@piotrekkaminski
Copy link
Contributor Author

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

@jarnooravainen We added Magento version into preconditions.

@piotrekkaminski
Copy link
Contributor Author

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
Copy link
Contributor

Duplicate of #49

@dmanners dmanners marked this as a duplicate of #49 Jan 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants