cancel
Showing results for 
Search instead for 
Did you mean: 

A cart rule bug in CE 1.9.2.0

A cart rule bug in CE 1.9.2.0

I got a bug when I upgrade to CE 1.9.2.0. It will happen in the cart page (/checkout/cart/). I do some dump then found there should be a bug in app\code\core\Mage\SalesRule\Model\Validator.php processFreeShipping(Mage_Sales_Model_Quote_Item_Abstract $item) function. If your magento have cart rule with "product subselection" conditions. It will stuck until out of memory.

 

To make sure it is a core bug. I install a new Magento 1.9.2.0 to prove it. Here is the step below:

1. Create 2 new configurable products with some simples.

2. Add 2 items in your cart.

3. Go to the backend and add a cart rule with "product subselection" like this.

If total quantity  is  2  for a subselection of items in cart matching ALL  of these conditions:

4. Reflash your cart page. You will see error like "Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 130968 bytes) in /var/www/m1920/lib/Varien/Profiler.php on line 107"

 

Does any one got the same problem?

 

6 REPLIES 6

Re: A cart rule bug in CE 1.9.2.0

Depending on the amount of product and customers you have in Magento, 256M which is your current memory_limit may not be enough. Try setting memory_limit to 512M

 

Magento can get pretty memory intensive when processing cart rules.

 

Search here => http://www.magentocommerce.com/bug-tracking to see if anyone else has the issue and set up a new ticket if you're the first to notice the problem.

Re: A cart rule bug in CE 1.9.2.0

Hi Chiefair

This is from my dev VM enviroment. I also tried it on our testing server. The result is the same. The only different is it took longer to run out of your memory.

 

testing server:

Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 65484 bytes) in /var/www/magento/lib/Varien/Object.php on line 775

Re: A cart rule bug in CE 1.9.2.0

Sounds like there's an issue with a memory leak, time to inform Magento through the provided link that they have an issue to address.

Re: A cart rule bug in CE 1.9.2.0

It's maybe the same issue #7814. Thanks Chiefair.

Re: A cart rule bug in CE 1.9.2.0

This is a bug and we also fell over it:

 

If you have one or more configurable products (which have invisible quote items) in your cart and a cart rule with sub-selection conditions is active, the sales rule will run into an infinite recursion - ending either in a memory limit error, a timeout error or a segfault.

 

We have implemented a Hotfix, which can be downloaded here (for Magento 1.9.1.x-1.9.2.2):

https://gist.github.com/tux-rampage/4d318ef516c8f4b2cf7e#file-luka-mce20151203-salesrule-hotfix-patc...

 

To apply:

  • Right-Click the "Raw" Button and choose "Save target as..." to download the patch file
  • Upload the patch file to your magento server
  • Make a backup of your store
  • Apply the patch:
    patch -p2 </path/to/LUKA-MCE20151203-salesrule-hotfix.patch

Re: A cart rule bug in CE 1.9.2.0

Thanks for posting that hotfix.  It works great on the front-end when customers are ordering, however an admin cannot create an order with an affected configurable product.  To reproduce, simply create an order as an admin using the same configurable product and you will see that product cannot be added to the order.