Please someone tell me how to stop process(flow) of any event observer.
i.e an event observer if – "before_create_account"
i know this i can use this event and do something before a new account create. But what i have to do if i want to stop actual process of this event. i want to stop flow. If some condition is false then user will not able to create account. i want to check some condition before account create and if that condition is false new account registration should be rejected. what code i have to write for this.
- before_create_account is just an example i know its not true event
Best Answer
The event observer system of Magento does not have its own mechanism to stop processing whatever happens after the event. So most of the time the only solution is to throw an exception and hope that it will be catched appropiately.
Depending on the code where the event is dispatched, this can yield different outcomes:
See also: How prevent a model data save using _save_before event