Question

$coupon = Mage::getModel('salesrule/coupon');
$couponCollection = $coupon->getCollection();
foreach($couponCollection as $c){
echo 'Code:'.$c->getCode().'--->Discount Amount:'.$c->getDiscountAmount().'<br />';
}

Found this piece somewhere here on stackoverflow. The discount amount is not showing.. Can somebody help me get this value ?

Was it helpful?

Solution

Change:

$coupon = Mage::getModel('salesrule/coupon');

to:

$coupon = Mage::getModel('salesrule/rule');

getDiscountAmount doesn't exist in /app/code/core/Mage/SalesRule/Model/Coupon.php but does show up in /app/code/core/Mage/SalesRule/Model/Rule.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top