2

Are there any event will be dispatched after the user adding/editing the rules in Promotions->Catalog price rules/Shopping cart price rules, i'm going to write a module to log these actions.

4

Hook onto the event: salesrule_rule_save_after and catalogrule_rule_save_after for shopping cart and catalog rules respectively. Also, to just be on the safe side you could check in the observer you are going to create that the admin session is active before you log what you need to from the admin session.

The model corresponding to the Shopping cart rules is salesrule/rule and it has a event prefix of salesrule_rule so whenever this model is saved the event : salesrule_rule_save_after will be dispatched.

  • how about adminhtml_controller_salesrule_prepare_save? – hkguile Aug 26 '14 at 6:28
  • This wouldn't work for catalog pricing rules. – Paras Sood Aug 26 '14 at 6:33
3

I think you can use catalogrule_rule_save_before and catalogrule_rule_save_after.
You can get the rule object in your observer like this:

public function doSomething($observer) {
    $rule = $observer->getEvent()->getRule();
    //do something with $rule
}
  • how about adminhtml_controller_salesrule_prepare_save? – hkguile Aug 26 '14 at 6:27
  • @hkinterview. That could work. But that won't get dispatched if I call $rule->save() from outside the admin controller. In the way I described it, it works independently from the place you call the save. – Marius Aug 26 '14 at 6:30

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.