-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[TASK] Always setSaveRewritesHistory to 1 for API calls so there will… #18408
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
[TASK] Always setSaveRewritesHistory to 1 for API calls so there will… #18408
Conversation
14ee2fe
to
457c94c
Compare
… be created a SEO rewrite for the old url
457c94c
to
a1de534
Compare
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.
Why do we need to create a new observer here? How it works in admin?
@orlangur in adminhtml a plugin is defined https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml#L23 however, the key 'url_key_create_redirect' has do be set on the product in order to trigger history saving, which might not be possible without changes to the product api? EDIT1: also, the method, the plugin is on, is not executed in an api request. So it can't be handled with the same plugin EDIT2: The correct change would probably be, to have this logic in 1 plugin on the productreposítory. But, I'm not sure, that the product in adminhtml is saved via repository. Also, a question would be, if this key in the product should be set to trigger the history saving, or the configuration under catalog -> catalog -> seo should handle it for the api |
In my opinion, this should work the same as with the product importer or the adminhtml. Has it already been tested if it works by simply providing that There was recently a PR (#20344) submitted which fixed this in the product importer, maybe this can help as inspiration for how this can be implemented on the API side if it turns out this doesn't already work? |
Agree with @hostep, we should take into account all scenarios. Closing due to inactivity. Feel free to reach me out anytime later if you wish to continue work on this pull request and it will be reopened. |
Hi @lewisvoncken, thank you for your contribution! |
… be created a SEO rewrite for the old url
Description
Permanent Redirect for old URL missing via API
Fixed Issues (if relevant)
Manual testing scenarios
Apply Changes and the URL Rewrite History will successfully be updated. See screenshots for more information:
Before:

Incorrect Result After Update Call:

After Fix:

Contribution checklist