4

I have this products subselection condition in a shoppng cart price rule:

If ALL of these conditions are TRUE : If total amount less than 16 for a subselection of items in cart matching ALL of these conditions: Attribute Set is Heft

This works well except for configurable products. Once we add a configurable product into the cart we get this error:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in [...]/lib/Varien/Object.php on line 629

And the configurable products don't even meet the conditions! (They are another attribute set.)

Why is this happening? Can any reproduce this problem? Any help is very much appreciated.

We use Magento CE 1.9.1 and memory limit is set to 512MB. I also tried 1024MB with the same outcome.

It worked in the previous version 1.6.

I also tried to debug Magento and ended up in Mage_Sales_Model_Quote_Address at the function collectTotal. Because once I comment $model->collect($this); adding to cart works. (Of course not as expected, but the cart gets the product. Which wasn't the case before.)

7
  • Have you tried deactivating the rule to check if the issue is still present? You run out of memory because something really intensive is being executed on the add to cart action Jan 28, 2015 at 21:23
  • What is your php memory limit set to? Jan 28, 2015 at 21:31
  • @R.S An obvious solution but unfortunately the problem lies deeper in the system. My memory limit is 512MB. But I also tried with 1024MB. Same error it will just take little longer to fill up memory. :-) I will mention this in my question as this obviously leads to misunderstanding regarding my question as I'm looking for the root problem.
    – jonazu
    Jan 28, 2015 at 22:06
  • Can you add the code that causing this issue Jan 28, 2015 at 22:16
  • @MayersDev Yes, deactivating the rule "deactivates" the error. I can also just change the condition and it works again. It's really just with this specific condition type.
    – jonazu
    Jan 28, 2015 at 22:17

2 Answers 2

6

It's a problem with method aliasing in subclasses.

tl;dr

For version CE 1.9.1.0 you can try to patch app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php at line #219 turning

$valid = $children && $this->validate($children[0]);

into

$valid = $children && self::validate($children[0]);

For other versions, find the above line inside the validate method.

Explanation

Mage_SalesRule_Model_Rule_Condition_Product_Subselect::validate() overrides the Mage_SalesRule_Model_Rule_Condition_Product_Combine::validate() and calls the parent implementation along the way. Too bad the latter eventually tries to call itself when met with rule validation on configurable products, but ends up calling the overriden implementation instead, so an infinite loop is started.

Warning

The quick fix proposed is consistent with the core SalesRule models but might break more complex class hyerarchies introduced by third party modules.

1
  • I used the latest app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php from Magento CE 1.9.3.4 which is fixing the problem as well Sep 13, 2017 at 13:58
4

Meanwhile I found out it's a bug introduced in 1.9.1. There are already two issues in Magento's bug tracking tool about this (you need a Magento Account to see them) http://www.magentocommerce.com/bug-tracking/issue/index/id/456 http://www.magentocommerce.com/bug-tracking/issue/index/id/567

While this does not solve my issue I know now it has nothing to do with my setup or any third party extensions. Therefore I rest my case and wait for the patch.

My current workaround is to convert any configurable product to a simple product. That is managable as we only have few. Otherwise I would have made a downgrade to 1.9.0. It is working there.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.