-
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 assign products to categories not under tree root #8970
Comments
Would be great to hear what the core team has to say about this, because it's kind of an edgy case.. |
The issue has been fixed and deliverd to 2.2-develop branch. Will be available with 2.2.2 release |
Internal ticket to track issue progress: MAGETWO-82972 |
Hi @marius-bica. Thank you for your report.
The fix will be available with the upcoming patch release. |
I am getting this after updating to 2.2.4 |
Perhaps a similar error in 2.2.3 Desired state remove Parent Cat: Result: Could not save product "205" with position 0 to category 3 I can move the product freely in subcategories. I just cant remove it from from the root. |
I am getting this on Magento 2.2.3
|
Best, Same issue on version 2.2.5 |
magento 2.2.4 Could not save product with position to category it accrues after trying to remove categories from a product |
Still happens to me with magento 2.2.5 |
same issue here @ 2.2.4 |
same issue here @ 2.2.6 |
Issue still persisting 2.2.4 |
How can close this issue, even this issue already existing in magento 2.2.6. |
Hello @graffxdesign @inkobject @harshvardhanmalpani @koopjesboom @salehawal @tukker01 @AlexanderHuyghebaert @digvijay2017 First of all, thank you all for the feedback, comments and collaboration! We have investigated this issue and defined: The issue and the fix details
Current Situation
And as result:
Solution Based on all of mentioned above:
Unfortunately, I am not able to reproduce error that was mentioned in the comments and because of that cannot create a new issue by myself. I suppose a proposed solution could make you sad. |
The changes are already in 2.2.4 but i receive same error when unassigned any product from root category. How i will solve this? |
@sdzhepa to continue the "respond to comments one year later" trend, thank you for your input. If it is of any use, I have since moved to different hosts and have made many changes to the environment. I have not seen the issue crop up since. I agree with your observation regarding my experience. |
Hi |
Same issue on Magento2.3.6 CE... |
still happening on Magento 2.4.1p |
…ment [Bengals Team] Test Fixes and Automation Tasks
Preconditions
Magento version: 2.1.4 community edition
PHP version 7.0.15
Steps to reproduce
Try to assign some products to categories programmatically using a CategoryLinkManagement object. The code looks something like this:
where the
categoryLinkManagement
property is injected via DI into the current class.Expected result
The product gets assigned to the category.
Actual result
I get an error telling me that "Could not save product "2048" with position 0 to category 42"
What I think
After digging around in the code, it seems that the issue stems from this piece of code in the
Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator
class, theisCategoryProperForGenerating
method:more specific,
From what I can tell, the code simply tries to get the first element from the array of category parent ids and assign it to
$rootCategoryId
, but it does that by relying on php 5 or less behavior. Here is what the php manual says aboutlist
:They are even warning that
list
is unpredictable:So this code fails to get the root category in php 7 and it even generates a notice if the parent ids array has less than 2 elements, since there is no element with an index of 1.
Exception: Notice: Undefined offset: 1 in vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php on line 195
(here is a related issue detailing this: #7916)
The text was updated successfully, but these errors were encountered: