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

Don't migrate the attribute url_path from product entities #541

Closed
hostep opened this issue Jun 17, 2018 · 11 comments
Closed

Don't migrate the attribute url_path from product entities #541

hostep opened this issue Jun 17, 2018 · 11 comments

Comments

@hostep
Copy link

hostep commented Jun 17, 2018

Hi!

Disclaimer: I haven't tested if this is already fixed or not, but lately I've been involved in cleaning up incorrect url rewrites from 2 shops where the url_path for product entities was filled in and both of those shops were migrations from Magento 1 where this tool was used, but I wasn't directly involved with the migration itself. I have the suspicion that this tool transferred those attributes over. Anyway, if I'm mistaken, feel free to close this ticket.

So: when you create a product in Magento 2 using the backend, or using the API, it will never fill in the attribute url_path. Feel free to double check this, because last time I did it was already a couple of months ago.

But when this attribute is filled in, it is actually being used by Magento's Url Rewrite mechanism and that can lead to significant problems with those url rewrites.
In our case, deleting all those url_path attributes and then re-generating the url rewrites using some third party tool fixed our issues.

So, if this tool transfers that url_path attribute over for product entities, you might need to change that, so it doesn't get transferred over.
Be aware, for categories the url_path attribute needs to be transferred over, because that one is very important to exist in Magento 2

Thanks!

@victor-v-rad
Copy link
Collaborator

Thank you @hostep for the extended explanation of the issue. I will check it

@victor-v-rad
Copy link
Collaborator

#462 seems the same issue

@hostep
Copy link
Author

hostep commented Jun 19, 2018

Yes, sounds like the same problem indeed.

@Loop-Ben
Copy link

Loop-Ben commented Oct 3, 2018

Hello hostep,

I have been hounding this issue for quite some time. The major issue for me has been that url_path is not updated or regenerated when the url_key field is updated or generated. I don't know if they're related fields or if there is a relationship between the two fields. I can confirm on 2.2.5 that this issue persists. Whatever url_path attributes came over from M1 persist and no amount of updating the url_key field will fix the url rewrite table. If you manually delete all rewrites for a given entity_id and resave the product, with an updated url key (which triggers the now inaccessible core url rewrites regeneration logic) the url rewrite will still be wrong.

As you pointed out, the issue is that url_path, if it exists, is still populated with the old key. It seems like this is a perfect storm between the url_key/url_path issue and needing to go to a third party to expose logic to regenerate url_rewrites which was exposed via the index in Magento 1.

@hostep
Copy link
Author

hostep commented Oct 3, 2018

@Loop-Ben: In my testing, I found out that the url_path attribute is always empty in Magento 2 if you create products manually over there. In my opinion the attribute should be removed entirely from Magento 2's database, I don't know why it still exists if it isn't being used if you use M2 features out of the box.

You are right by indicating that the url_path gets populated when migrating from M1 to M2. And that is a problem that needs to be solved in this module. I don't think it has been handled yet @victor-v-rad?

The best way to solve it on your instance is to make all url_path attributes empty in your M2 shop. That should solve most problems.
And indeed, regenerating url rewrites is no longer a core feature of M2 unfortunately. I've been complaining about that for a while now and have seen no movement yet in that direction. I hope one day it will be added again.

@hostep
Copy link
Author

hostep commented Dec 4, 2018

@victor-v-rad: closed because it's fixed, or closed because it's a duplicate of #462 ?

@victor-v-rad
Copy link
Collaborator

Yes because of duplicate. But maybe it is better to have it open until the fix implemented

@IbrahimS2
Copy link

@hostep Just had the exact same problem!

@hostep
Copy link
Author

hostep commented Feb 17, 2020

@MageSuper: damn is this still not fixed? This is causing countless of url rewrite issues in Magento 2.

@victor-v-rad: any idea why this hasn't been looked at yet? It's probably 15 minutes of work for you to make sure the url_path for product entities gets imported as an empty value in Magento 2, and to not take over the value from Magento 1, it's this simple.

I haven't used this tool in a couple of years, otherwise I would have send in a PR already to have this fixed.

@victor-v-rad
Copy link
Collaborator

@hostep sorry it's taken so long to fix it. Please test it on the latest 2.3-develop branch or
b5ad54f

@hostep
Copy link
Author

hostep commented Feb 29, 2020

Thanks @victor-v-rad !

Looks good at first sight.
Unfortunately we no longer use this tool for migrating M1 to M2 databases, we have our own scripts for that. So I will not be able to test it I'm afraid.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants