-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Remove URL rewrites when changing product from visible to not visible #19294
Remove URL rewrites when changing product from visible to not visible #19294
Conversation
…ched from visible to not visible.
Hi @dverkade. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @VladimirZaets, thank you for the review. |
Such change is not correct. URL Rewrites are intentionally created in advance so that product may become visible at any moment without any conflict. |
@orlangur unfortunately you are not correct. When you create a new product and set it to "Not visible", then the URL rewrites are not created in the URL rewrite table. So your comment about creating them in advance is false. What happens if you first create the product where the product is visible on the frontend and then switch the product to become not visible, the generated URL keys are staying in the URL rewrite table. This can cause all kinds of issues, for instance when you create another new product with the same URL key it says that the URL key is already taken. Then you go into the first product, change the URL key, but this is not being updated because the product is not visible, so the product keeps the old URL key in the URL rewrite database and will only change this when the product is set to visible again. This PR resolves this issue, by removing the generated URL keys for the product when you switch a product from visible to not visible. |
@dverkade this is probably not correct behavior if I'm not mixing it up with enable/disable product.
This is what I was talking about. Product may become visible again at any moment, showing validation message for colliding product is OK.
And this does not seem to be correct behavior. |
Hi @dverkade, I am closing this PR now due to inactivity. |
Hi @dverkade, thank you for your contribution! |
This issue was labeled "Needs update" 19 days ago, but I really don't know what kind of updates you're expecting here? The PR works as described |
@davidverholen @VladimirZaets PR updated, please review. |
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.
@dverkade implementation is incorrect. First please adjust issue according to comments (#19293 (comment)), then change implementation accordingly.
@dverkade unfortunately, only members of the maintainers team are allowed to assign developers to the pull request |
No, this is incorrect. When the product is created with visibility invisible the URL key is not created. It should be deleted when a product visibility is changed. Magento already approved / reviewed this requests, so no need to change the behaviour of this PR. |
It must be created.
Issue mentioned in this PR is not confirmed, please provide some links. Probably those changes must be reverted as they introduced undesired system behavior. |
@piotrekkaminski @chernenm can you please share your opinion from the product side: |
Context: URL rewrites were created for disabled and not visible individually products initially so that they may be enabled or made visible without collision afterwards. |
Incorrect. When a product has a visibility of "Not visible individually" no entries are created for this product in the URL rewrite table. Entries for URL rewrites are only created once the visibility of the product has been changed. If you the product has been visible and the entries in the URL Rewrite table are present they are not updated or deleted once the visibility of the product will be changed again to "Not visible individually". This PR resolves this issue by deleting the URL rewrites once is set to "Not visible individually" |
And this is a bug which needs to be actually fixed... Instead of removing what is not supposed to be removed. |
That's just your opinion. It's up to Magento product owners to determine the expected behaviour. That's not something for you to decide. There's a valid use case for not having the entries for the URL rewrites. If the URL rewrites are stored for products which are not visible this can create collisions when adding or changing products with the same URL key as the one which is not visible. Expected behaviour from a merchant's perspective would be that this URL key is still available, because when he visits the URL of the invisible product on the frontend this will result in a 404 page. By not having this URL key available can be unexpected behaviour for this user. |
Nope 🤣 Me and the team actually implemented this functionality and I'm saying how it is intended to work. Of course, business requirements could be changed later but for now it looks to me that just some random PRs were merged which broke system behavior.
No, if it gives a proper error message. |
All, thanks for your input. In this case I think URL rewrites should be created for invisible product. A reasonable use case would be you prepare a promo CMS page, you need to know the final URL the product will have - but want to have the product invisible unless you publish the promo CMS page. The current behavior seems inconsistent and should be fixed - URL rewrites for non-visible products should behave exactly like for visible, created on creation, updated on url key change. |
I'm closing this PR since this is not the desired behaviour as documented by the Magento product owner. |
Hi @dverkade, thank you for your contribution! |
@dverkade this PR can still be adjusted to a defined requirements. Could you please adjust bug report accordingly? |
Description
Fix for #19293 deletes url rewrite data when a product is switched from visible to not visible.
I don't think we still want to have URL rewrites of not visible products in the url rewrite table. This PR makes sure that data that is present in the URL rewrite table will be removed when a product changes visibility.
Fixed Issues
Manual testing scenarios (*)