2

i'm create Catalog Price Rules Programmatically it's work fine.

The issue is, I need to login with admin and click button "Apply Rules" other wise discount is not apply in magento store. So I need "Apply Rules" programmatically and I try bellow code but its not work.

try{
  $catalogPriceRule = Mage::getModel('catalogrule/rule');
  $catalogPriceRule->applyAll();
} catch (Exception $e) {
  echo $e;
}

enter image description here

Any help or suggestion will be appreciated.

1 Answer 1

0

Use this for particular rule

$rule = Mage::getModel('catalogrule/rule')->load(1);

    $rule->save(); //save the rule

    $rule->applyAll(); //apply all the rules 

And for all rules

$rule = Mage::getModel('catalogrule/rule');

    $rule->save(); //save the rule

    $rule->applyAll(); //apply all the rules  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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