Comments (14)
@amenk yes, see the faq
from magento2-regenerate-catalog-urls.
@amenk: Magento always writes the url_path
for categories to the database, but never for products.
The url_path
for a category consists of all the parent categories url_key
's + its own url_key
, all concatenated with a /
.
The url_path
for products was a left over from Magento 1 that for some reason didn't get removed in Magento 2 and when it's filled up will cause issues when you try to update the url_key
of a product. So it's best to delete all of them.
Hope this makes it a bit more clear.
@peterjaap: maybe you should update the title What's the difference between url_key and url_path?
to What's the difference between url_key and url_path for products?
on the FAQ section of the README file? I believe it causes a bit confusion because @amenk seems to think it applies to category entities as well.
Also the section underneath Why are my category rewrites for a non-default storeview in the default storeview's language?
is very incorrect in my opinion, you'd probably best delete it, don't you think?
from magento2-regenerate-catalog-urls.
The fact that that command is there doesn't say anything because the bin/magento regenerate:product:path
used to be there as well ;)
I updated the readme accordingly :) ed2ed37
from magento2-regenerate-catalog-urls.
Unless you're running a very old Magento version (<=2.1), you don't need the path commands. See https://github.com/elgentos/regenerate-catalog-urls#whats-the-difference-between-url_key-and-url_path
Otherwise, first keys, then paths, because;
The url_path is generated by taking the url_key and adding the suffix
But make sure you have removed the paths if they're there, because Magento still uses them when they're present.
from magento2-regenerate-catalog-urls.
We are at 2.4.3 but I believe we have a lot of trash in the database from old version :-(
from magento2-regenerate-catalog-urls.
Ah, we can remove the paths? like from the EAV table?
from magento2-regenerate-catalog-urls.
Then I'd suggest cleaning up the database first. Garbage in is garbage out.
from magento2-regenerate-catalog-urls.
@peterjaap can you confirm, also the category's url_paths should be deleted?
Had this discussion with @hostep baldwin-agency/magento2-module-url-data-integrity-checker#14 (comment)
And on our staging where I deleted both, category's + product's url_path magento still seems to write them, but not all (after delete + rebuild I see 59 rows for
select * from catalog_category_entity_varchar WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'url_path' AND entity_type_id = 3);
while before we had 5623 rows
We did not spot other url problems though...
We have 1415 categories and 5 stores.
from magento2-regenerate-catalog-urls.
@hostep so you're saying the url_path
values are still used for categories? Apparently I decided otherwise when I wrote that README but I could indeed be very wrong. Do you have a code reference to see where/how it is used?
from magento2-regenerate-catalog-urls.
Yes exactly.
Code reference, hmm, this class sounds related probably: https://github.com/magento/magento2/blob/7996e89bc5420220eae5d8b755e6e0f839cbd94a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php
But the easiest way to tell is:
- Setup a clean Magento
- Using the backoffice: create one product and create one category
- Inspect the
catalog_product_entity_varchar
andcatalog_category_entity_varchar
database tables - Notice that for the product, no entry was created for the
url_path
attribute, and for category an entry did get created
Also, don't forget that this very module has a command to regenerate url_path's for category's: bin/magento regenerate:category:path
😉
from magento2-regenerate-catalog-urls.
Okay great, thanks! 🙂
from magento2-regenerate-catalog-urls.
For the record concerning my original question:
This does not fix all URLs:
regenerate:category:url for all stores?
regenerate:category:path for all stores?
regenerate:product:url for all stores?
This does:
regenerate:category:path for all stores
regenerate:category:url for all stores
regenerate:product:url for all stores
from magento2-regenerate-catalog-urls.
Exactly, always generate paths before url rewrites (for categories)!
A month or so ago, I ran into a strange case when I needed to execute regenerate:category:path
multiple times (up to 3 times) until everything was fixed, unfortunately I didn't have time to look into it back then ...
from magento2-regenerate-catalog-urls.
Oh wow, so I am not sure if the run-again fixed it in my case or the new order.
from magento2-regenerate-catalog-urls.
Related Issues (20)
- Compatibility with Magento 2.4.0 HOT 3
- Multi Store site magento 2.3.3 not generate the url correctly HOT 20
- Categories in different categorie roots. HOT 2
- The "categoryIds" argument does not exist. HOT 1
- elgentos/regenerate-catalog-urls 0.2.9 requires magento/module-url-rewrite ^102.0 HOT 2
- Feature-Request: Execute command for all store views HOT 4
- Missing rewrite for overwritten url_key HOT 4
- Fix inconsistencies between arguments for the different commands HOT 2
- Some URL's use path from wrong store view HOT 10
- Typed property error on adminhtml regenerate urls
- Empty array productIDs HOT 3
- Bulk product url update not working correctly HOT 3
- Duplicated url for store ID, product - URL key for specified store already exists. HOT 1
- Use category path for product URLs HOT 1
- Emulation dependency injected in the console commands through DI, tries to connect to database HOT 2
- URL key for specified store already exists when using multiple root categories with same subcategory name HOT 3
- 0.4.0 doesnt work with single-store mode HOT 2
- Support and Bump version for PHP 8.2 HOT 1
- [Feature Request] Separate batching while replacing Urls, and allow logging to detect Duplicated url on current product
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento2-regenerate-catalog-urls.