F
F
Franked2019-03-05 16:40:07
1C-Bitrix
Franked, 2019-03-05 16:40:07

How to override the Notify class in the local folder (or customize your own notifications) in Bitrix: Site Management?

Hello!
I have a task to send additional ( my own data ) according to the mail template to the client who made the order. How to make it so that I can substitute my data in the letter (for example: the location of the warehouse selected by the user), in addition to all the other standard ones?
** My guess: ** As I understand it, when placing an order, the Notify
class is called (located at: /bitrix/modules/sale/lib/notify.php) , which, depending on the triggered mail event, collects the necessary data and sends Send to mail method (checked, tried to change some data - it works). And as I understand it, to solve this problem, I need to redefine the class Notify in the local folder and customize the templates that I need (so as not to touch the native notify.php). But the problem is that for some reason it is not redefined for me and it looks like the one that is in the bitrix folder and not in my local .. is used, although I placed the file like right .. (at: / local / modules / sale / lib/notify.php) and changed namespace Bitrix\Sale; to: namespace Local\Sale; , but for some reason it still does not react ...
Please tell me what can be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2019-03-06
@Franked

Please tell me what can be done?

For starters: classes cannot be redefined - only modules, but this is not an option from the word "absolutely".
To solve your problem, there are legal ways:
- Modify the sent mail template and add php code to it to get the necessary information
- On the onBeforeEventAdd / onBeforeEventSend event, add the necessary data to the mail template
- Disable standard notifications and send notifications on events yourself.
Choose the method you want to use yourself :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question