-
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
Cannot save category containing products linked to root category #7916
Comments
Hi @cykirsch |
@victor-v-rad Sure, I think the piece you're missing is that when I save category 3 (or any other that has products in both this category and category 1), it's actually failing via an observer while saving category 1. One way to do it from your current setup would be to take whatever product you have in category 1, go to another one of the categories that product is in, and save that category. Or to start fresh if nothing is currently assigned to category 1:
|
Got it! Thank you for the clarifications. Internal ticket MAGETWO-62729 to fix this through Data Migration Tool |
Fixed in Data Migration Tool 2.1.4 release |
i have same issue i am using magento 2.2.5 . can you please give me any solution? |
Tried your steps to reproduce but got no error |
Thanks @victor-v-rad . |
Hello @Abdulkadiragoliya , |
In My case issue was in server configuration i just follow this link |
…cope_29092022 [Hammer]_Platform_Health_246_Scope_29092022
Preconditions
Steps to reproduce
I copied my data from 1.7.0.2 using the provided data migration tool. Afterward, when trying to save a category, I would get the error "Something went wrong while saving the category.". Exception log stack trace:
The structure is a bit different (an EE difference I am guessing), but the method with the error is just like this one: https://github.com/magento/magento2/blob/develop/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php#L166
list(, $rootCategoryId)
fails with undefined offset because$category->getParentIds()
returns an empty array. It took me quite awhile, but I eventually found the cause. For each product in the category saved, it will call thisisCategoryProperForGenerating
method for each category that product happens to be in.It turns out I have several products assigned to the Root Catalog category. No idea why that is, but that's how it was in M1--the very first entry in
magento1.catalog_category_product
is our first product assigned to category_id 1.$category->getParentId()
for this product is0
, so it passes the!= TREE_ROOT_ID
(AKA 1) check and goes on to thelist
call, which breaks because the Root Catalog category has no parents. If it also checks!= ROOT_CATEGORY_ID
(AKA 0), it should work.Expected result
Actual result
Suggested solution
In
vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php
, change line 194 toBut in order to not modify core code myself, I'll just be clearing out the Root Category assignments:
The text was updated successfully, but these errors were encountered: