You can just call those functions from the Model without any problem. They are saved in the session, so the next time a messages-block is showed they will be displayed to the user (so basically on the next page that is shown).
Magento extension display error and redirect from within model not controller
質問
If an error occurs within the model of my extension I want to display a helpful error message to the site user but allow them to continue using the store.
I've written a custom component that uses a third party remote API. Sometimes errors occur within the API and I want to be able to handle them gracefully. I've read the following article about generating errors warnings and notices here http://www.deepcodeonline.com/blog/magento/how-to-display-error-success-and-notice-messages-in-magento.
I can get it to work when the addError or addNotice methods are called from the controller code, but I want to call them from the model, because its only in the model that I know an error's occurred.
解決
所属していません StackOverflow