/** * Determines qty of the discounted items * * @param Mage_Sales_Model_Rule $rule * @return int qty */ private function _getQty($rule, $cartQty) { $discountQty = 1; $discountStep = (int) $rule->getDiscountStep(); if ($discountStep) { $discountQty = floor($cartQty / $discountStep); $maxDiscountQty = (int) $rule->getDiscountQty(); if (!$maxDiscountQty) { $maxDiscountQty = $cartQty; } $discountQty = min($discountQty, $maxDiscountQty); } return $discountQty; }
/** * Determines qty of the discounted items * * @param Mage_Sales_Model_Rule $rule * @return int qty */ protected function _getQty($rule, $cartQty) { $discountQty = 1; $discountStep = (int) $rule->getDiscountStep(); if ($rule->getSimpleAction() == Amasty_Rules_Helper_Data::TYPE_AMOUNT) { return $cartQty; // apply for all } if ($discountStep) { $discountQty = floor($cartQty / $discountStep); $maxDiscountQty = (int) $rule->getDiscountQty(); if (!$maxDiscountQty) { $maxDiscountQty = $cartQty; } $discountQty = min($discountQty, $maxDiscountQty); } return $discountQty; }