Magento – Shopping Cart Rule Causing Internal Sever Error 500

addtocartce-1.9.1.0errorshopping-cart-price-rules

I am trying to configure a shopping cart price rule where if you add 2 or more bundled products from one category you get the discount off the subtotal of the cart. This is the only cart rule on the website. I have it as follows.

If ALL of these conditions are TRUE :

If total quantity  equals or greater than  2  for a subselection of items in cart matching ALL  of these conditions:
    Category  is  18  

Actions: Fixed Amount discount for whole cart.
Discount Amount: $29.00

This seems like a straight forward discount, and it DOES apply to the correct products in the cart.

The problem arrises when you try and add a configured product to the cart, I am getting a "Internal Server Error 500". After checking with the hosting company they reported that it is attempting to use a truly massive amount of memory, and even when we allowed it to use ten times a normally allowable amount it still failed. Here is a slow log of the php process erroring out:

[0x000000000df1e2f8] __call() /chroot/home/shopadip/shopadiplayer.com/html/lib/Varien/Object.php:631

[0x00007fffa1344f80] __call() unknown:0

[0x000000000df1e0c8] getOperator()
/chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/Rule/Model/Condition/Abstract.php:297

[0x000000000df1d358] isArrayOperatorType() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/Rule/Model/Condition/Abstract.php:557

[0x000000000df1c0c0] validateAttribute() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php:523

[0x000000000df1bbe8] validate() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product.php:70

[0x000000000df1b730] validate() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/Rule/Model/Condition/Combine.php:307

[0x000000000df1b1e8] validate() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php:216

[0x000000000df1adb8] validate()
/chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php:216

[0x000000000df1adb8] validate() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php:117

[0x000000000df1a870] validate() /chroot/home/shopadip/shopadiplayer.com/html/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php:219

When I turn the shopping cart rule to inactive, all products are added to the cart without error. I cannot find any threads about server errors when using cart rules. Please help.

Magento CE 1.9.1

Thanks,

Best Answer

Based on comments on @kalpesh link this also solved the problem for me. (adding the fix here for future reference)

There is a patch for this https://gist.github.com/piotrekkaminski/54529dadb0bc01a62a2d

It is marked for EE but the fix worked for us.

app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php

- if (parent::validate($item)) {
+ if (Mage_Rule_Model_Condition_Combine::validate($item)) { 
Related Topic