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
Is Your Magento Store Secure?
Vulnerabilities like CosmicSting and SessionReaper are actively exploited. Scan your website in seconds to detect malware, exposed endpoints, and missing patches.
Run Free Security Scan on MageArgus →
Fact-Checked & Verified by W3ctrl
This content has been written and reviewed by Adobe-Certified Technical Experts with over 16 years of experience in Enterprise Architecture.
