Shoppingcart email confirmation

Hi,

Does anyone have experience with the shopping cart plugin? I can see that at some point it should fire the event “onShoppingCartAfterSaveOrder” that should trigger the email notification. But can’t find it anywhere.

Any ideas? So far im trying to add my own onShoppingCartAfterSaveOrder event and that gets fired but fails when i use it to send and email.

Hi,

In the shoppingcart.php , you will find the onshoppingcartaftersaveorder function.

I have just added few lines to test it and i have received correctly the email.

`
public function onShoppingCartSaveOrder($event)
{
$order = $event[‘order’];
$this->order_id = $this->saveOrderToFilesystem($order);
$this->grav->fireEvent(‘onShoppingCartAfterSaveOrder’, new Event([
‘order’ => $order,
‘order_id’ => $this->order_id
]));
$to = ‘myemail@mapajo.fr’;
$from = ‘email@test.com’;

    $subject = 'Test';
    $content = 'Test';

    $message = $this->grav['Email']->message($subject, $content, 'text/html')
        ->setFrom($from)
        ->setTo($to);
    $sent = $this->grav['Email']->send($message);
}

`
I am not sure that is the best way but it works!

Thank you for your response unmick. I should have reported back but thats exactly what i ended up doing to fix the situation. But then i thought it over and did some digging and found a customcheckout plugin from the cart developer that does not seem to be maintained anymore so decided to move over to snipcart. Seems like a more solid solution for me.