Frage

How to set dynamic discount amount if an coupon is applied.

For this i have created a shopping cart price rule and send this promo coupon to some customers and when they purchase products from my site and applied this coupon every customers get different discount amount based on the products in their shopping cart so how i can set this dynamic discount amount ?

I have already make some research on salesrule/rule module but getting confused so please help me...

War es hilfreich?

Lösung

Just for some your knowledge or someone needy finally i have found solution for my question for dynamic discount amount.

to achieve this you need to change in two methods first one is process(Mage_Sales_Model_Quote_Item_Abstract $item) under Mage_SalesRule_Model_Validator class in which you need to change the rule discount amount and set it to any dynamic calculated value like $rule->setDiscountAmount($dynamicDiscountAmount); and in the collect method just update the discount amount for display purpose in totals block

$address->setDiscountAmount(-$discountAmount);
$address->setBaseDiscountAmount(-$discountAmount);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top