Skip to content

[Issue] Ensure that previously existing records in catalog_url_rewrite_produc… #34210

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

Closed
2 of 5 tasks
m2-assistant bot opened this issue Sep 30, 2021 · 2 comments · Fixed by #34791
Closed
2 of 5 tasks

[Issue] Ensure that previously existing records in catalog_url_rewrite_produc… #34210

m2-assistant bot opened this issue Sep 30, 2021 · 2 comments · Fixed by #34791
Assignees
Labels
Area: Import / export Component: CatalogUrlRewrite Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done 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

@m2-assistant
Copy link

m2-assistant bot commented Sep 30, 2021

This issue is automatically created based on existing pull request: #34209: Ensure that previously existing records in catalog_url_rewrite_produc…


Ensure that previously existing records in catalog_url_rewrite_product_category are deleted before trying to insert them again.

Description (*)

Changes

Delete existing records in the catalog_url_rewrite_product_category table before inserting the same ones.

Why

This change will avoid the following exception during multi store product import :

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '74583' for key 'PRIMARY', query was: INSERT INTO catalog_url_rewrite_product_category (url_rewrite_id,category_id,product_id) VALUES (?, ?, ?), ...

The problem is that catalog_url_rewrite_product_category records are not created storewise for a given request_path. On the other side, url_rewrite records are created storewise.
If, during the same import, a product and its url_rewrite records are created for stores A and B in the first batch and then for store C in a second batch and if product url keys and category name are the same for all those stores, an insert try for duplicated catalog_url_rewrite_product_category records will cause the mentioned issue.

Related Pull Requests

None

Fixed Issues (if relevant)

Not relevant

Manual testing scenarios (*)

  1. Install a fresh Magento instance
  2. Create che website with de_ch, en_ch, es_ch, fr_ch, zh_ch store views
  3. Create exp website with de_ex, en_ex, es_ex, fr_ex, zh_ex store views
  4. Create the Products category
  5. Go on the admin panel under System > Import
  6. Choose Products entity type with Add/Update behaviour and let default settings for the rest
  7. Upload this file and launch the import
  8. General system exception happened
  9. Make the PR changes
  10. Repeat steps 5 to 7
  11. Import works fine

Questions or comments

I am not sure if an additional test is needed for that. Please, tell me if it is the case.

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Oct 8, 2021
@m2-community-project m2-community-project bot added the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Dec 20, 2021
amenk added a commit to amenk/magento2 that referenced this issue Dec 21, 2021
@engcom-Delta engcom-Delta added Area: Import / export Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jan 11, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-2096 is successfully created for this GitHub issue.

@m2-assistant
Copy link
Author

m2-assistant bot commented Jan 11, 2022

✅ Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Import / export Component: CatalogUrlRewrite Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done 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
3 participants