Adding bundle items to cart creates recursive dependency error
-
04-10-2020 - |
Question
Item at http://wenderella.com/castaging/index.php/fruit-basket.html
It is a bundle product, a fruit basket, with dynamic pricing. Each fruit is a simple product with no stock management.
Option 1 (Required): Add a fruit - watermelon, pineapple or honeydew - Dropdown input, you can select qty of fruits you want
Option 2 (Not Required): Add another fruit - watermelon, pineapple or honeydew - Dropdown input, you can select qty of fruits you want
When I just add Option 1 or Option 2 to cart, there's no problem, it goes through.
But if I select something in both options (e.g. I choose a watermelon in option 1, then a pineapple in option 2), the following error occurs:
Fatal error: Nesting level too deep - recursive dependency? in /home/blacklea/public_html/wenderella.com/castaging/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php on line 134
I followed all steps to create a bundle product exactly (or so I think). What am I doing wrongly??
I have tried disabling all extensions and the error remains.
Version: CE 1.9.3
Solution
Modify app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
as stated below – only difference is , true
being added to in_array()
– and see if the exception disappears:
public function setParentItem($parentItem)
{
if ($parentItem) {
$this->_parentItem = $parentItem;
// Prevent duplication of children in those are already set
if (!in_array($this, $parentItem->getChildren(), true)) {
$parentItem->addChild($this);
}
}
return $this;
}
NB: Bear in mind that you're overriding a core file so for a more permanent solution you should either override the (child) class via a custom module or at least copy the vanilla file to app/code/local/Mage/Sales/Model/Quote/Item/Abstract.php
and modify that one.