-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Detaching category from product causes massive product url regeneration #18144
Comments
Hi @bartoszkubicki. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @bartoszkubicki do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
Same issue, if you change something on a category (fx. meta description) with a good amount of products on a storeview. |
@magento-engcom-team If you tell me how to fix it I could prepare pull request. I need information how te rearrange events or observers, because maybe sometimes this operation should be done (i mean regeneration of product urls). Maybe if we can do it in 2.3 we could put url regeneration on queue? Anyway, I think we should remove all-product regeneration from category save and add that observer maybe to more accurate operations and events. |
@bartoszkubicki: great idea! It would also be great if Magento devs could shed some light on plans in that direction, maybe this is already been worked on internally, but we don't know it yet... |
@hostep, the main problem with async url rewrite is it cannot resolve conflict immediately and as a result, you will gets inconsistency and some products/categories will not have valid url |
Also, you can use patch that change the way how url rewrites is generated |
@kandy: makes sense, but the async process could then skip the product/categories with conflicting values. Next to that, a grid in the backend of Magento could be added to give a very user friendly overview of all conflicting url_key values of products/categories, and could allow the shop owner to manually correct those one by one. A feature like that would be awesome I think. |
@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets |
The fact that some non-related actions will change a product's url without creating a valid url redirect is a major(ish) issue. Having 404 pages as a search result will be punished by google and thus will reduce our sales. |
I'm having an issue where we reorganized categories and now when we export products, the URL_KEY column is blank on most products. Is this related you think? |
I wonder how some big projects with Mangrove 2 have a good experience. And what ability to actually work with a large number of products and categories in the open source version. |
hi @bartoszkubicki we're about to do this in 2.3.1 |
@cpartica I think all question you've asked have been already resolved while describing the issue:
|
I also have huge load times when trying to attach a product to a category through API on 2.2.6. I have a category with a few thousand products and it takes nearly 90s to add another product through the category link repository API (POST to catalogCategoryLinkRepositoryV1). |
Hi @Jakhotiya. Thank you for working on this issue.
|
@cpartica Are you working on this? I was thinking, if it is possible to leverage "Use Categories Path for Product URLs" setting. If it's set to No, can we skip URL rewrite generation for products when they are detached from a category?? While looking into the default url_rewrite table I saw that no matter what the configuration is "category path product URL's" are always generated. This also leads to unnecessarily large url_rewrite table. This table is optimised for read operations but as a result of using unique indexes "INSERT" queries become slow. |
@Jakhotiya: that's not a good idea with the current state of Magento where there is no official way to regenerate url rewrites, please see my comment in: #15086 (comment) |
Hello @bartoszkubicki @jakoblundsted @pemann @Jakhotiya @hostep Thank you for contribution and collaboration! The corresponding internal ticket Please see details in the next commits: |
Preconditions
Steps to reproduce
Expected result
Actual result
Actually I have debug it and this is trace to track the problem
https://github.com/magento/magento2/blob/2.2/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php:113
https://github.com/magento/magento2/blob/2.2/app/code/Magento/Catalog/Model/CategoryLinkManagement.php:assignProductToCategories()
https://github.com/magento/magento2/blob/2.2/app/code/Magento/Catalog/Model/CategoryLinkRepository.php:deleteByIds() -> which triggers event
catalog_category_save_after
Observer https://github.com/magento/magento2/blob/2.2/app/code/Magento/CatalogUrlRewrite/Observer/CategoryProcessUrlRewriteSavingObserver.php - lines 112-3 triggers regeneration of all saved category's products. For example for first level category of catalog having 30k products it can be 5-10k products.
Whole process is completely pointless - removing category from one product triggers massive url rewrites regeneration, which is processed during http request.
The text was updated successfully, but these errors were encountered: