Answer the question
In order to leave comments, you need to log in
How to prevent sending an email when adding an order?
I had the following task. Create a quick order form so that when adding, a letter is sent to the admin, but now two letters are sent, what I send manually when adding an order and what is sent automatically when adding a new order. In my case, how can I cancel sending a letter automatically when creating an order ( $order->save(); ) .
Answer the question
In order to leave comments, you need to log in
EVENT_1 - default mail event
EVENT_2 - Your event, in custom functionality.
If it is necessary that EVENT_1 is not sent only in your component, but works in the standard design, then you can do this.
- Before saving the order, declare a global variable.
- In the event handler of the main OnBeforeEventAdd module, check the presence of this variable and that this event == EVENT_1. If it is, then return false in the event handler. Thus, sending the standard mail event EVENT_1 will be cancelled.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question