If the event happens in PHP (a payment handler, a plugin, a processor), queue the emails through the service:
$data = [
'email' => $order->get('email'), // recipient for the “Event user” strategy
'order_id' => $order->get('id'), // → [[+order_id]] in the template
'fullname' => $order->get('name'), // → [[+fullname]]
'total' => $order->get('total'), // → [[+total]]
];
$count = $modx->services->get('Vestnik')->trigger('shop.order.new', $data, 'component');
| Parameter | Description |
|---|---|
$eventKey | Event key, required. Must match the “Event key” of an active rule. |
$data | Template data array; the email key is the address for the “Event user” strategy, attachments — attachments. |
$source | manual (default) or component; the plugin passes modx. Rules are not filtered by it and it is not logged — it is passed to OnVestnikBeforeQueue and the debug log. |
Returns the number of queued emails. Sending happens by cron.