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

#21737 Duplicating product with translated url keys over multiple sto… #22178

Conversation

yvechirko
Copy link
Contributor

@yvechirko yvechirko commented Apr 5, 2019

…reviews causes non-unique url keys to be generated

Description (*)

When a product is duplicated, only one URL key is used(from scope where was clicked the button "Save & Duplicate"), it is modified and set for all store views. I've added generation and saving unique URL keys from URL keys of the source product for all store views.

Fixed Issues (if relevant)

  1. Duplicating product with translated url keys over multiple storeviews causes non-unique url keys to be generated #21737: Duplicating product with translated url keys over multiple storeviews causes non-unique url keys to be generated

Manual testing scenarios (*)

  1. Make sure you have 2 storeviews, I've opted for the names 'English' and 'French'
  2. Create a category "Test"
  3. Create a product:
    Name: Default
    Sku: Default
    Price: 123
    Qty: 9999
    Category: Test
    Url key: default
  4. Switch to the English storeview, and change the url key of the product to 'english', uncheck 'Create Permanent Redirect for old URL', save changes
  5. Switch to the French storeview, and change the url key of the product to 'french', uncheck 'Create Permanent Redirect for old URL', save changes
  6. Back on the 'All Store Views' scope, open the product and click the dropdown next to the Save button and choose 'Save & Duplicate'
  7. Take a look in the database at the various url keys and url rewrites which got generated, they all unique

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

…ple storeviews causes non-unique url keys to be generated
@m2-assistant
Copy link

m2-assistant bot commented Apr 5, 2019

Hi @yvechirko. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

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

@aleron75 aleron75 self-assigned this Apr 15, 2019
@magento-engcom-team
Copy link
Contributor

Hi @aleron75, thank you for the review.
ENGCOM-4776 has been created to process this Pull Request

@VasylShvorak
Copy link
Contributor

✔️ QA passed

@hostep
Copy link
Contributor

hostep commented Apr 19, 2019

Thanks for the changes @yvechirko! Not tested yet, but code looks promising.

A side effect of this PR is that #9466 will probably also get fixed, maybe @VasylShvorak can check that as well (steps to reproduce: #9466 (comment)) and then we can add #9466 in the "Fixed issues" list as well.

@hostep
Copy link
Contributor

hostep commented Apr 20, 2019

Hi folks

I just tested this PR in scope of #21737 and #9466
It looks like it completely fixes #21737, so that's really nice!
Also #9466 gets fixed, but only when the product has a url key defined in the default values, not when it has overwritten url key's on different storeviews. In that case the problem reported in #9466 is even getting worse now unfortunately. This is a regression in my opinion.

Here are steps to reproduce this regression:

  1. Make sure you have 2 store views, I've opted for the names 'English' and 'French'
  2. Create a product:
    • Name: Default
    • Sku: Default
    • Price: 123
    • Qty: 9999
    • Url key: default
    • Also add one single image
  3. Switch to the English storeview, and change the url key of the product to 'english', uncheck 'Create Permanent Redirect for old URL'
  4. Switch to the French storeview, and change the url key of the product to 'french', uncheck 'Create Permanent Redirect for old URL'
  5. Up until now, everything is perfectly fine.
  6. Back on the 'All Store Views' scope, open the product and click the dropdown next to the Save button and choose 'Save & Duplicate'
  7. Take a look at the images in the new product, there are suddenly 3 images connected to this product instead of 1. This is probably caused by the 3 save calls on the product entity?

We should probably try to figure out how Magento determines that an image was already saved on the product and mark that as done after the first save call? So the next calls won't save it again on the product?

I think we should block this PR for approval until this regression gets fixed? Or should we consider this a new/different bug which needs to be fixed in a new PR?

@m2-assistant
Copy link

m2-assistant bot commented Apr 26, 2019

Hi @yvechirko, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

magento-engcom-team pushed a commit that referenced this pull request Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants