ppokrovsky Posted August 20, 2014 Share Posted August 20, 2014 Dear Prestashop Pros, could you give me a clue if it is possible to unhook a certain module using prestashop apis? For example, I'm developing payment module, and during development process I do not want it my module to send any emails from $this->validateOrder call execution. Can I temporary disable sending email? Another example - i use emailalerts module which sends an email to shop admin when order is processed. I would like to disable this functionality as well, but not through disabling the whole module, but rather unhooking it from actionValidateOrder hook. Thanks in advance! Link to comment Share on other sites More sharing options...
PascalVG Posted August 22, 2014 Share Posted August 22, 2014 Maybe just run the code conditionally? http://stackoverflow.com/questions/20881143/how-to-disable-code-conditionally My 2 cents, pascal. Link to comment Share on other sites More sharing options...
bellini13 Posted August 22, 2014 Share Posted August 22, 2014 In the Advanced Preferences > Email menu, you can disable sending emails. So you can either just disable the option during your testing, and then re-enable it. Or you can programmatically disable this option from your module, and then re-enable it. You can also override the Mail class, so that the send function just returns true. Link to comment Share on other sites More sharing options...
ppokrovsky Posted August 22, 2014 Author Share Posted August 22, 2014 bellini, pascalVG, thank you for your tips. I was hoping somehow it is possible without overriding core classes, which is a bit overkill to my opinion. But if this is the only way - I will either stick with enabling/disabling emails via bo, or overriding. Thanks again for your help. Link to comment Share on other sites More sharing options...
bellini13 Posted August 22, 2014 Share Posted August 22, 2014 You can programmatically do it. You just need to review the admin email controller to determine what the correct value is to disable emails. Then in your module, before you execute validateOrder, you would disable the option, then re-enable it after validateOrder is complete. This may not stop emails that are sent from MailAlerts module however, you would have to test that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now