[Issue] Prevent Category URL Rewrites generation when no Store Group assigned #32952
Labels
Component: CatalogUrlRewrite
Fixed in 2.4.x
The issue has been fixed in 2.4-develop branch
Issue: ready for confirmation
Priority: P2
A defect with this priority could have functionality issues which are not to expectations.
Progress: done
Progress: PR in progress
Severity: S2
Major restrictions or short-term circumventions are required until a fix is available.
This issue is automatically created based on existing pull request: #32790: Prevent Category URL Rewrites generation when no Store Group assigned
Description (*)
During creating new website, Store Group and Store view using
php bin/magento setup:upgrade
- we got the following issue:exception was thrown while it was trying to create a new store view that later on will be assigned to Store group, and as result - later on we should generate URLs for this specific store.
This issue happened because, for some reason, we
$rootCategoryId
as 0 because we don't have any assigned Store Group:magento2/app/code/Magento/Store/Model/Store.php
Lines 1023 to 1029 in 95819f2
In this case, it was generating URL rewrites for Root categories, that the same URL keys.
Example:
In this case, it will try to generate URL rewrites for Root Category 1 and all their children categories + URL rewrites for Root Category 2 and all it's children and will have a conflict due to the same URL key
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
php bin/magento app:config:dump scopes
commandphp bin/magento app:config:dump scopes
commandphp bin/magento setup:upgrade
Expected result:
✔ 3rd website, store group, store view should be created
Actual result:

❌ We have an exception
Import failed: URL key for specified store already exists.
Questions or comments
Contribution checklist (*)
The text was updated successfully, but these errors were encountered: