Get All Discount Coupons code and rules in magento

/
/
/
100 Views

If you want to get all discount coupons codes of magento.Please use the folllowing code

$sales_rules_collection = Mage::getModel(‘salesrule/rule’)->getCollection();
foreach($sales_rules_collection as $rule) {

if($rule->getData(‘is_active’) ==1) {

$rule->getData(‘name’);
$rule->getData(‘code’);
$rule->getData(‘simple_action’);
$rule->getData(‘discount_amount’);

}
}

If you want to get more information of each rule you can pass the other artibutes name to get the value.

Try to print the each rules as array and you will find the all artibutes

See the following code

$sales_rules_collection = Mage::getModel(‘salesrule/rule’)->getCollection();
foreach($sales_rules_collection as $rule) {

echo ‘<pre>’;
print_r($rule);

}

 

If you need any help please comments here and please share with your developer friends 🙂

Thank you

Sign up for our newsletter to get Daily Updates

It is main inner container footer text