Closed senders closed 3 years ago
Hi @senders
The problem with the url_path
attribute for products is that it influences the url rewrites, but you can't manipulate the value of that attribute using the backend of Magento.
Which means that if you want to change the url_key
and thus the url rewrite of a product using the backend of Magento, it won't be possible because the "hidden" url_path
attribute has precedence over the url_key
attribute.
The url_path
attribute for products is a remainder from the old Magento 1 days where it behaved a bit differently. Somehow it was included in Magento 2, even though the behavior changed and it actually never gets filled up with data if you create a product using the backend of Magento. Thus it's a bit a meaningless field, even though it's still being used in generating url rewrites, which is very weird and can probably be considered as a bug in Magento 2.
So the recommendation is to always have the url_path
attribute of products as empty.
We've seen that url_path
attribute getting filled up many times in the past for shops that were migrated from Magento 1 to Magento 2 using the magento data migration tool, it was a bug for a long time in that tool, but was fixed in version 2.3.5 of that tool by https://github.com/magento/data-migration-tool/commit/b5ad54f6a086ad0a0150fabd8c0a33cf3a416890
In your case, if you see this problem pop up even after new products are created, then it probably means that these products aren't being created in the backend of Magento, but by some sort of script that explicitly sets the url_path
attribute of products. I would advise you to find how this happens and disable this and only use the url_key
attribute in the future and make sure the values of the url_path
attribute of products gets removed.
Please make sure to test these changes very well before executing this on production of course 🙂
I hope this helps!
Closing, because of no feedback and not really a problem.
Got that problem and indexing didn't run correctly. Some products disappeared in categories. Randomly. Solution : Search your url_path attribute in eav_attribute table. Find all the lines with it in your catalog_product_entity_varchar table. Delete all entries with this attribute.
Hope this helps...
All products have been automatically uploaded using the script below. I have only stored the url_key attribute as below, and I'm not sure what the url_path attribute is as it seems unfamiliar to me.
You can just delete the values for the product attribute url_path
in your database, that should solve the things the report mentions. It's probably some left over from a Magento 1 to Magento 2 migration.
Just be aware that your url rewrites might generate differently after doing so, it will now use the url_key
instead of the url_path
to generate url rewrites for products (which should be a good thing, since that's what you want).
That's strange. There are two instances of the url_path and url_key attributes in the database. I have never migrated from Magento 1 to 2, and I have never set up Magento 1. I started with Magento 2.
It's not strange, because both products & categories have a url_path
and url_key
attribute.
Also, you shouldn't delete the attribute itself, but the attribute values for the url_path
attribute of the product entities, which are stored in the catalog_product_entity_varchar
db table.
See here for an SQL query to delete them (I wouldn't hardcode the entity_type_id
to '4' though, in most cases it will be 4, but maybe in specific cases it might be something else)
If you didn't start from M1, then I have no idea where those url_path
entries for products came from, that is indeed strange 🙂
Ahh, so the entity_type_code distinguishes whether it's a category or a product, right? That's why there are two of them for each. In the catalog_product_entity_varchar table, are you saying should delete the url_path? In Magento 1, It used url_path, but in Magento 2, It should only use url_key, is that correct?
I originally started configuring Magento 2 in single-store mode. However, I later switched to multi-store mode and encountered some issues related to store codes. I vaguely remember that there was an issue where product changes were not reflecting, and after struggling for a few days, I found out that some data from the single-store mode was still present, causing the problem with data not being displayed. It's possible that the url_path might be related to the data from the single-store mode. 😁
I think the article you recommended will be really helpful. I wasn't quite sure about the concept of url_path, but as I read through this post, I'm starting to grasp it better. Thank you.
What does the message "Product has a non-null url_path attribute, this is known to cause problems with url rewrites in Magento. It's advised to remove this value from the database." mean? How to fix it?
I can't find any problems.
Also new created products are listed when running catalog:product:integrity:urlpath.
I have this on different Magento installations.