I want to list all the shopping cart rules that are set with auto-generate coupon code options in admin,

what model i should use? and what are the conditions?

  • You should use salesrule/rule_collection Resource Model – Anil Suthar Jun 30 '16 at 8:10
protected function getAutoGenerateCouponRules()
    $rules = Mage::getResourceModel('salesrule/rule_collection');
    $autoGenerateCouponRules = array();
    foreach ($rules as $rule) {
        if ($rule->getIsActive()) {
            if($rule->getUseAutoGeneration() == 1){
                $autoGenerateCouponRules[] = array('id' => $rule->getRuleId(), 'name' => $rule->getName());
    return $autoGenerateCouponRules;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.