Magento Cart Rule BUG - Wrongly applied when "less than" and configurable product
<p>I just found out that Magento seems to have a bug since 1.8 relating to cart rules.</p>

<p>let's say we have some configurable products and want to add a "discount" for a specific product if the qty is less then 50. In my case it a surcharge not a discount (you can easily add negative discount so it'll get surcharge by changing two files see <a href="http://php.quicoto.com/extra-fee-shopping-cart-price-rules-magento/" rel="nofollow">http://php.quicoto.com/extra-fee-shopping-cart-price-rules-magento/</a>).</p>

<p>so what does magento do?</p>

<p>1) checks if rule is valid for that product
2) if not it checks if it is a configurable product, then takes the first simple product, and check the rule against that.</p>

<p>in this case true cause qty is less then 50 ( cause this simple product is not even in cart.... )</p>

<p>extending the rule by a "less then 50 and more then 1" didn't worked.</p>

<pre><code>    $product = $object-&gt;getProduct();
    if (!($product instanceof Mage_Catalog_Model_Product)) {
        $product = Mage::getModel('catalog/product')-&gt;load($object-&gt;getProductId());
    } 
    // here, everythign correct. $valid is false cause item is less then x times in cart..
    $valid = parent::validate($object);  



// this part makes no sense, cause he's checking on a child which is not in cart.
     /** /
     if (!$valid &amp;&amp; $product-&gt;getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
        $children = $object-&gt;getChildren();
        $valid = $children &amp;&amp; $this-&gt;validate($children[0]);
    }/**/
</code></pre>

<p>this small snippet is related to it, and in my eyes it doesn't make any sense. why the rule should be checked against the first product of a configurable one? why randomly check the rule against some other product?</p>

<p>does anyone has an idea about that?</p>

<p>my solution for now, just comment this line out ... ;-) and the rule get applied as it should.</p>

<p>greets
felix</p>

<p><a href="http://i.stack.imgur.com/938ma.png" rel="nofollow">here's an image about the rule in magento backend</a></p>