-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Will replace images during CSV import #21855
Conversation
Hi @raivisdejus. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Thanks! Been bashing my head against these image duplicates for a while. Hopefully you can get this accepted. |
Hi @raivisdejus, Also, there is to lang value name at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @raivisdejus,
you must cover this with integration tests also the current tests are broken by this change see:
Hi @raivisdejus, there is not coverage by an extra test case pls add a test |
@larsroettig I have added a test case to test the update and removal of old media items. Also adjusted some of the existing tests. Please let me know if the tests need to be more explicit or cover something else. Any other comments are also welcome. |
Hi @raivisdejus , the tests are failing, looks like failures caused by provided implementation. Could you please take a look? |
Current Travis test is failing with error It seems it could be test environment, config or resources related. At some free moment I will debug it further, but maybe you @sidolov and @larsroettig have some ideas on what could be wrong or who to ask for assistance. |
Hello, has anyone created a patch with this pr? I tried to use it with composer patch and it fails in multiple places of the patch. Tried it on Magento 2.3.1 Thanks |
@galanis-a My solution for this problem in a real life project was to override the Patch was not tested but it might fail as the patch is formed against the upstream file in |
Thanks @raivisdejus , will try it! |
# Conflicts: # app/code/Magento/CatalogImportExport/Model/Import/Product.php # dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
# Conflicts: # dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
I have created a custom module that overrides the If you want to do the same, please note the following traps:
|
Hey @raivisdejus. Are you going to continue working on this PR? |
@slavvka If someone else can finish this, I would be only happy. Last time I tried to resolve issues in tests I was getting error in unrelated places that I do not know immediate solution for. I would like to see this finished, so some helping pointers to the right direction would be welcome |
@slavvka Also some hints on semantic version test failing would be welcome. Can I assume version bump? or should the failing code be fixed? |
@magento run all tests |
Hey @raivisdejus That time we had issues with Travis tests so you encountered the mentioned error. Now we started to use our internal test builds so they should show correct results. Please merge the latest mainline code and the tests will trigger automatically. After that we can see what issues you need to fix. |
@@ -1756,6 +1823,11 @@ protected function _saveProducts() | |||
} | |||
} | |||
|
|||
// 5.1 Items to remove phase | |||
if (isset($existingImages[$rowSku])) { | |||
$galleryItemsToRemove = \array_diff(\array_keys($existingImages[$rowSku]), $uploadedFiles); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code only removes the images of the last product because the $galleryItemsToRemove
variable is reassigned for each product.
I propose the use of array_merge
as follows:
$galleryItemsToRemove = \array_merge($galleryItemsToRemove, \array_diff(\array_keys($existingImages[$rowSku]), $uploadedFiles));
@raivisdejus , I am closing this PR now due to inactivity. |
Hi @raivisdejus, thank you for your contribution! |
Did you even publish a fix for the duplicate solution in your last magento released ? |
Description
Built on top of #21146
This PR adds image deletion so after import product will have images specified in the CSV. New images will be added, existing will not be duplicated and images not mentioned in the CSV will be removed
Fixed Issues
#14398: Images Not Replaced via CSV Import
Manual testing scenarios (*)
There's many testing scenario's actually. Some of them being: