Coder Social home page Coder Social logo

Comments (10)

hostep avatar hostep commented on June 19, 2024 1

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 magento/data-migration-tool@b5ad54f

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!

from magento2-module-url-data-integrity-checker.

eBusinessAtlantique avatar eBusinessAtlantique commented on June 19, 2024 1

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...

from magento2-module-url-data-integrity-checker.

hgati avatar hgati commented on June 19, 2024 1

https://github.com/elgentos/magento2-regenerate-catalog-urls#whats-the-difference-between-url_key-and-url_path

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.

from magento2-module-url-data-integrity-checker.

hostep avatar hostep commented on June 19, 2024

Closing, because of no feedback and not really a problem.

from magento2-module-url-data-integrity-checker.

hgati avatar hgati commented on June 19, 2024

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.

from magento2-module-url-data-integrity-checker.

hostep avatar hostep commented on June 19, 2024

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).

from magento2-module-url-data-integrity-checker.

hgati avatar hgati commented on June 19, 2024

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.

from magento2-module-url-data-integrity-checker.

hostep avatar hostep commented on June 19, 2024

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 🙂

from magento2-module-url-data-integrity-checker.

hgati avatar hgati commented on June 19, 2024

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?

from magento2-module-url-data-integrity-checker.

hgati avatar hgati commented on June 19, 2024

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. 😁

from magento2-module-url-data-integrity-checker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.