-
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
Prevent empty string as useless product URL key on product imports #17563
Conversation
Using the given class for product import processes leads to comulative problems of handling product url key related processes. Since 2.4 at least the url key for the sku, which is given in an import file's row, is set to an empty string, if there is no corresponding url key or name column given. This leads to a variety of problems: a) if no url key is given on import, it leads to changing the url key to Magento 2 standards by using the value in the name column. this totally ignores the fact that url keys get customized a lot of times and overwrites all efforts before. furthermore causing SEO problems, if as a consequence the url rewrites get adjusted accordingly. a product, which was exported to google shopping may not be reachable anymore by the link given to google or loose all linked SEO data by the next export given (if no 301 redirect is given). b) if nor url key or name column is given on import, the url key is set as an empty string, which is even worse. this leads to several products having the same empty string as an url key, causing problems, when regenerating or reindexing url rewrites, because of duplicate entries. and so on and so on. furthermore an empty string as an url key is just useless. synopsis: if no url key or name column is given in the import file, this change prevents any url key to be set as or updated to an empty string, which is useless and causes even more problems in the aftermath.
Hi @jhruehl. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@dmanners could you review this PR? |
Hi @jhruehl thanks for this pull request. Let me take a look at it today and get back to you on this. |
Hi @jhruehl we have run the following cases: Case 1:
Result: Product url key is unchanged 👍 Case 2:
Result: Product url key is changed and contain Product Name value Case 3:
Result: Product url key is changed and contain Product Name value. What do you think of the results for case 2 & 3? For me if the |
@dmanners I agree. If there is no url_key colum present, the url key should no be updated. It's as easy as that. Though if the product is newly created via the import and there is no url_key column present, the url key should probably be created by using the name column. BUT with the standard functionality of creating URL Keys, so that existing plugins and/or observers to customize the url key generation process can kick in. If none of those columns are present, no url key should be added or at least something unique and not an empty string. Overwriting existing url keys with empty strings.. wow.. this stupidity still bedazzles me. I don't know, but in all our supervised stores CSVs are used in daily and hourly crons to update stocks, special prices and so on. Everything else will probably result in nightmares for the responsible SEO folks and as a consequence we, the developers, have to clean the mess up. Repairing url keys, url rewrites and creating 301 redirects where still possible. I can't remember the last time I had so much fun. ;) |
Anyway. My current pull request doesn't change anything. If a url key can be generated, it still will be set. |
It looks like there is a competing PR which tries to solve the same issue I think: #17882 Not sure which one of the two is the better one @jhruehl: I feel your pain, have been there many many times, url_key and url rewrite problems in Magento are really not fun to deal with and do still happen way too many times. |
@hostep Yeah. It's the same issue, though the guy's solution seems kinda overcoded. |
Hi @jhruehl I just reviewing similar PR. I will check the both implementations one more time and will come back to you :-) |
Thanks a lot for your contribution. I'm closing this PR cause other was already merged |
Using the given class for product import processes leads to comulative problems of handling product url key related processes.
Description
Since 2.4 at least the url key for the sku, which is given in an import file's row, is set to an empty string, if there is no corresponding url key or name column given. This leads to a variety of problems:
a) if no url key is given on import, it leads to changing the url key to Magento 2 standards by using the value in the name column. this totally ignores the fact that url keys get customized a lot of times and overwrites all efforts before. furthermore causing SEO problems, if as a consequence the url rewrites get adjusted accordingly. a product, which was exported to google shopping may not be reachable anymore by the link given to google or loose all linked SEO data by the next export given (if no 301 redirect is given).
b) if nor url key or name column is given on import, the url key is set as an empty string, which is even worse. this leads to several products having the same empty string as an url key, causing problems, when regenerating or reindexing url rewrites, because of duplicate entries. and so on and so on. furthermore an empty string as an url key is just useless.
Fixed Issue
if no url key or name column is given in the import file, this change prevents any url key to be set as or updated to an empty string, which is useless and causes even more problems in the aftermath.
Manual testing scenarios
Contribution checklist