akeneo / magento2-connector-community

Akeneo Connector for Magento 2
Open Software License 3.0
82 stars 88 forks source link

Products images not mapped are deleted at the end of the product import #268

Open ericmorand opened 4 years ago

ericmorand commented 4 years ago

Environment and configuration

  1. Akeneo Connector 100.5.6

Steps to reproduce

  1. Create an attribute of type "Media image"
  2. Run a Product import
  3. Assign an image to the attribute created in step 1. to one of the imported products using Magento back-office
  4. Enable "Import Image Attributes" setting
  5. Add an Akeneo attribute that is present in your Akeneo backend in "Akeneo Images Attributes"
  6. Let "Product Images Mapping" empty
  7. Run a Product import again

Expected result

The image assigned to the product is still present in the product form.

Actual result

The image assigned to the product is not present in the product form.

Conclusion

Looks like it's all or nothing when the "Import Image Attributes" setting is enabled. All products Media attributes needs to be mapped to an Akeneo attributes. Those that are not mapped are removed by the importer.

ericmorand commented 4 years ago

The issue seems to be coming from the code that starts there:

https://github.com/akeneo/magento2-connector-community/blob/2996d9278fd10f2ccbe510d75cef6e33270c3d91/Job/Product.php#L2551

It removes all the attribute values that are not equal to one of the files downloaded by the importer. Which means that it removes the value of all the attributes that are not mapped to an Akeneo attribute.

It prevents webmasters to have some medias coming from Akeneo and some others managed in the Magento back-office or from some other PIM that would also import medias into Magento.