Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product images are being duplicated on import #21885

Closed
simonworkhouse opened this issue Mar 22, 2019 · 78 comments
Closed

Product images are being duplicated on import #21885

simonworkhouse opened this issue Mar 22, 2019 · 78 comments
Assignees
Labels
Component: CatalogImportExport Event: dmcdindia1 Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.4.x The issue has been fixed in 2.4-develop branch help wanted Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@simonworkhouse
Copy link

simonworkhouse commented Mar 22, 2019

When importing product data the product images are being duplicated for each import run.

Preconditions

  1. Magento 2.4-develop
  2. PHP 7.3
  3. MySQL 5.7.25

Steps to reproduce

  1. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install dir>
  2. cd <install dir>
  3. ./bin/magento setup:install --backend-frontname=? --db-host=? --db-name=? --db-user=? --db-password=? --base-url=? --admin-user=? --admin-password=? --admin-email=? --admin-firstname=? --admin-lastname=?
  4. mkdir var/import-images
  5. Add images test-1.jpg, test-2.jpg, test-3.jpg and test-4.jpg inside the path <install dir>/var/import-images. Any valid jpeg will do.
  6. Import the product CSV data below twice
"sku","product_online","website_id","store_view_code","attribute_set_code","product_type","categories","name","description","short_description","visibility","price","special_price","special_price_from_date","special_price_to_date","url_key","meta_title","meta_keywords","meta_description","display_product_options_in","msrp_display_actual_price_type","additional_attributes","qty","out_of_stock_qty","use_config_min_qty","is_qty_decimal","allow_backorders","use_config_backorders","min_cart_qty","use_config_min_sale_qty","max_cart_qty","use_config_max_sale_qty","is_in_stock","use_config_notify_stock_qty","manage_stock","use_config_manage_stock","use_config_qty_increments","qty_increments","use_config_enable_qty_inc","enable_qty_increments","is_decimal_divided","deferred_stock_update","use_config_deferred_stock_update","related_skus","crosssell_skus","upsell_skus","custom_options","bundle_price_type","bundle_sku_type","bundle_price_view","bundle_weight_type","bundle_values","associated_skus","base_image","base_image_label","small_image","small_image_label","thumbnail_image","thumbnail_image_label","swatch_image","swatch_image_label","additional_images","additional_image_labels","configurable_variations"
"some-test-product",1,1,,"Default","simple","Default Category/Some Category/Some Test Product","Some test product","This is just some test product",,"Catalog, Search",2999,,,,"some-test-product","Some test product",,,"Block after Info Column","Use config",,100,0,1,0,0,1,1,0,0,1,1,1,0,1,1,0,1,0,0,0,1,,,,,,,,,,,"test-1.jpg",,"test-1.jpg",,"test-1.jpg",,"test-1.jpg",,"test-3.jpg",,
"another-test-product",1,1,,"Default","simple","Default Category/Some Category/Some Test Product","Some test product","This is just some test product",,"Catalog, Search",2999,,,,"another-test-product","Another test product",,,"Block after Info Column","Use config",,100,0,1,0,0,1,1,0,0,1,1,1,0,1,1,0,1,0,0,0,1,,,,,,,,,,,"test-2.jpg",,"test-2.jpg",,"test-2.jpg",,"test-2.jpg",,"test-4.jpg",,

Import settings

  • Entity Type: Products
  • Import Behavior: Add/Update
  • Stop on Error (default)
  • Allowed Errors Count: 10 (default)
  • Field separator: , (default)
  • Multiple value separator: , (default)
  • Empty attribute value constant: __EMPTY__VALUE__ (default)
  • Fields Enclosure: Not checked (default)
  • Images File Directory: var/import/images/import-images

Expected result

Products end up with each product image only attached once.

Actual result

Products end up with all product images duplicated.

2020-09-23_16-35

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Mar 22, 2019
@magento-engcom-team
Copy link
Contributor

Hi @simonworkhouse. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@simonworkhouse do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@ghost ghost self-assigned this Mar 22, 2019
@magento-engcom-team
Copy link
Contributor

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • Next steps are available in case you are a member of Community Maintainers.

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@dipti2jcommerce
Copy link

@magento-engcom-team give me 2.3-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @dipti2jcommerce. Thank you for your request. I'm working on Magento 2.3-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @dipti2jcommerce, here is your Magento instance.
Admin access: https://i-21885-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@ghost ghost added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Component: CatalogImportExport Fixed in 2.2.x The issue has been fixed in 2.2 release line Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release help wanted Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 22, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-backlog-nazar
Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-98840 were created

Issue Available: @engcom-backlog-nazar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Mar 22, 2019
@tnsezer
Copy link
Contributor

tnsezer commented Mar 28, 2019

I would like to share some point about the issue. It happens in Magento\CatalogImportExport\Model\Import\Product.php line 1772. If add a variable for exists images in mapper like _media_is_disabled, it should be fix it but the code try to match it with path. That why it doesn't work.

@dmanners
Copy link
Contributor

dmanners commented Apr 4, 2019

Thank you for the information @tnsezer

@erfanimani
Copy link
Contributor

Duplicate of #14398

See PR here: #21146

@erfanimani
Copy link
Contributor

Actually, there's a better PR here, based on mine but it also deals with image deletion: #21855

@dmanners
Copy link
Contributor

@erfanimani thanks for the update. Are the issues duplicated or the PRs?

@erfanimani
Copy link
Contributor

@dmanners Both actually — this issue is a duplicate of #14398

But then there are two open PRs (I referenced them both in case someone wants to create a patch for it):

@soundararajanm1990
Copy link

I am working on this at #dmcdindia1

@magento-engcom-team
Copy link
Contributor

@soundararajanm1990 thank you for joining. Please accept team invitation here and self-assign the issue.

@m2-assistant
Copy link

m2-assistant bot commented May 4, 2019

Hi @soundararajanm1990. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@yogeshkhasturi
Copy link

Hi @soundararajanm1990,

Have you fixed this issue? its also coming when trying to Duplicate product.

Thanks
Yogesh

@duckchip
Copy link
Contributor

duckchip commented Jun 7, 2019

what's the status on this issue?

@soundararajanm1990
Copy link

We can't solve this issue. Still now pending.

@m2-community-project m2-community-project bot added the Progress: PR Created Indicates that Pull Request has been created to fix issue label Sep 3, 2020
@engcom-Oscar engcom-Oscar added the Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch label Sep 9, 2020
@KBUnulleins
Copy link

Temporary solution to this issue:

1. Edit this file:
/vendor/magento/module-catalog-import-export/Model/Import/Uploader.php:134

2. Modify init() function:
Change line 134 in the init() function from

$this->setAllowRenameFiles(true);

to

$this->setAllowRenameFiles(false);

Result:
This will replace the product images instead of just renaming and duplicating them.

Keep in mind:
This is just a temporary solution and with the next magento-update you have to do this again.
To make the changes permanent you have to create a module that overrides this file.

This is my first comment on github. So please be kind with your feedback - thanks!


For the Magento dev team:

  • Would be great if you could set the default behavior through the magento backend.
  • Would be awesome to do a filesize comparison in /vendor/magento/module-catalog-import-export/Model/Import/Uploader.php getNewFileName() and just renameing it if the filesize has changed.

@m2-community-project m2-community-project bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Sep 24, 2020
@engcom-Alfa engcom-Alfa added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Oct 7, 2020
@m2-community-project m2-community-project bot added Progress: ready for dev and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Oct 7, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-38267 were created

Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@ghost ghost unassigned chandu-pinpoint Oct 8, 2020
@m2-community-project m2-community-project bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: ready for dev labels Oct 8, 2020
@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Oct 13, 2020
@m2-community-project m2-community-project bot added Progress: done and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Oct 13, 2020
@arunu
Copy link
Member

arunu commented Sep 7, 2021

MDVA-31021 patch available in Quality Patches Tool

@blakebauman
Copy link

@arunu MDVA-31021 patch does not fix this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CatalogImportExport Event: dmcdindia1 Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.4.x The issue has been fixed in 2.4-develop branch help wanted Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Archived in project
Development

No branches or pull requests