G
G
Good Samaritan2021-02-12 10:48:29
1C-Bitrix
Good Samaritan, 2021-02-12 10:48:29

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

1 answer(s)
R
Roman Gritsuk, 2021-02-13
@djamali

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 question

Ask a Question

731 491 924 answers to any question