Question

The situation is simple – I want to offer 25% discount on one product in the cart. So if you order 5 of Product A and 3 of Product B, you should receive 25% off either one of Product A or one of Product B but not both (so not more than 1 total).

Here are the current settings:

  • Apply = Percent of product price discount
  • Discount Amount = 25
  • Maximum Qty Discount is Applied To = 1
  • Discount Qty Step (Buy X) = 0

This currently gives the user 25% off of one Product A and one Product B. That is, the "Maximum Qty Discount is Applied To" seems to refer to cart line items, rather than total quantity.

I have looked at using the action conditions, but nothing seems to address this issue. Am I missing something? Or is an extension required for this functionality? Thanks in advance.

Was it helpful?

Solution

Yes, there is no corresponding condition in the default magento shopping cart rules. And yes, there are some extensions at the magento connect. Search for "special promotions" or "advanced promotions" for example.

Basically, if you want to create a new module you can define a new action, similar to "fixed discount to whole cart" then observe event salesrule_validator_process and calculate total discount based on the first (say cheapest) product price. Take into account free shipping promo also.

The event is dispatched from app\code\core\Mage\SalesRule\Model\Validator.php as

    Mage::dispatchEvent('salesrule_validator_process', array(
        'rule'    => $rule,
        'item'    => $item,
        'address' => $address,
        'quote'   => $quote,
        'qty'     => $qty,
        'result'  => $result,
    ));
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top