protected function calculateDiscountAmount(Mage_Sales_Model_Quote_Item_Abstract $item, Varien_Object $result, array $data)
    {
        /** @var float */
        $itemRowTotal = $item->getBaseRowTotal();
        /** @var float */
        $currentDiscountAmount = $result->getBaseDiscountAmount();
        /** @var float */
        $previousAppliedDiscountAmount = 0.00;
        foreach ($data as $discount) {
            $previousAppliedDiscountAmount += $discount['amount'];
        }
        /** @var float */
        $itemRowTotalWithAppliedPreviousDiscount = $itemRowTotal - $previousAppliedDiscountAmount;
        if ($itemRowTotalWithAppliedPreviousDiscount < 0) {
            $itemRowTotalWithAppliedPreviousDiscount = 0;
        }
        return $itemRowTotalWithAppliedPreviousDiscount < $currentDiscountAmount
            ? $itemRowTotalWithAppliedPreviousDiscount
            : $currentDiscountAmount;
    }
protected function calculateDiscountAmount(Mage_Sales_Model_Quote_Item_Abstract $item, Varien_Object $result, array $data)
    {
        /** @var float */
        $itemRowTotal = $item->getBaseRowTotal();
        /** @var float */
        $currentDiscountAmount = $result->getBaseDiscountAmount();
        /** @var float */
        $previousAppliedDiscountAmount = 0.00;
        foreach ($data as $discount) {
            $previousAppliedDiscountAmount += $discount['amount'];
        }
        /** @var float */
        $itemRowTotalWithAppliedPreviousDiscount = $itemRowTotal - $previousAppliedDiscountAmount;
        if ($itemRowTotalWithAppliedPreviousDiscount < 0) {
            $itemRowTotalWithAppliedPreviousDiscount = 0;
        }
        return $itemRowTotalWithAppliedPreviousDiscount < $currentDiscountAmount
            ? $itemRowTotalWithAppliedPreviousDiscount
            : $currentDiscountAmount;
    }
protected function calculateDiscountAmount ( Mage_Sales_Model_Quote_Item_Abstract $ item , Varien_Object $ result , array $ data ) { /** @var float */ $ itemRowTotal = $ item -> getBaseRowTotal ( ) ; /** @var float */ $ currentDiscountAmount = $ result -> getBaseDiscountAmount ( ) ; /** @var float */ $ previousAppliedDiscountAmount = 0.00 ; foreach ( $ data as $ discount ) { $ previousAppliedDiscountAmount += $ discount [ 'amount' ] ; } /** @var float */ $ itemRowTotalWithAppliedPreviousDiscount = $ itemRowTotal - $ previousAppliedDiscountAmount ; if ( $ itemRowTotalWithAppliedPreviousDiscount < 0 ) { $ itemRowTotalWithAppliedPreviousDiscount = 0 ; } return $ itemRowTotalWithAppliedPreviousDiscount < $ currentDiscountAmount ? $ itemRowTotalWithAppliedPreviousDiscount : $ currentDiscountAmount ; }
When the previously applied discount amount on the item row total
is less than the current applied discount recalculate the current discount
to account for previously applied discount. Otherwise, don't recalculate
the current discount.

@param  Mage_Sales_Model_Quote_Item
@param  Varien_Object
@param  array
@return float
When the previously applied discount amount on the item row total is less than the current applied discount recalculate the current discount to account for previously applied discount . Otherwise don t recalculate the current discount .