Bonjour,
je déterre ce sujet car je rencontre le même problème. J'ai intercepté les deux évents ORDER_SEND_NOTIFICATION_EMAIL et ORDER_SEND_CONFIRMATION_EMAIL
et ni le webmaster ni le client ne reçoive leur e-mail avant paiement.
Une fois le paiement effectué, la commande passe bien sur le statut payée automatiquement sur le BO mais je n'arrive pas à envoyer à partir de là les mails de notifications webmaster et confirmation client.
Une piste serait la bienvenue !
Ma class :
public function checkSendConfirmationEmail(OrderEvent $event)
{
$payzen= new Payzen();
if($payzen->isPaymentModuleFor($event->getOrder()) && !$event->getOrder()->isPaid()) {
$event->stopPropagation();
}
}
/**
* Checks if we are the payment module for the order, and if the order is paid,
* then send a confirmation email to the customer.
*
* @params OrderEvent $order
*/
public function updateOrderStatus(OrderEvent $event)
{
$payzen = new Payzen();
if($payzen->isPaymentModuleFor($event->getOrder()) && $event->getOrder()->isPaid()) {
$this->dispatcher->dispatch(TheliaEvents::ORDER_SEND_NOTIFICATION_EMAIL, $event);
$this->dispatcher->dispatch(TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL, $event);
Tlog::getInstance()->debug("Notification email sent to webmaster " . $order->getCustomer()->getEmail());
Tlog::getInstance()->debug("Confirmation email sent to customer " . $order->getCustomer()->getEmail());
}
}
public static function getSubscribedEvents()
{
return array(
TheliaEvents::ORDER_UPDATE_STATUS => array("updateOrderStatus", 128),
TheliaEvents::ORDER_SEND_NOTIFICATION_EMAIL => array("checkSendConfirmationEmail", 256),
TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL => array("checkSendConfirmationEmail", 256),
);
}
Merci