added confirmation email for eshop

This commit is contained in:
2024-09-10 12:47:03 +02:00
parent aefa952410
commit 39c1604db4

View File

@@ -127,6 +127,33 @@ class WarehouseEShopOrderController extends TTCrud {
}
}
// send confirmation email
$subjectId = str_pad($id, 3, '0', STR_PAD_LEFT);
// create email body with all items (use $shoppingCart)
$body = "Bestellung #$subjectId\n\n";
$body .= "Lieferadresse:\n";
$body .= $json['deliveryAddressName'] . "\n";
$body .= $json['deliveryAddressLine'] . "\n";
$body .= $json['deliveryAddressPLZ'] . ' ' . $json['deliveryAddressCity'] . "\n\n";
$body .= "Bestellte Artikel:\n";
foreach ($shoppingCart as $item) {
$body .= $item['amount'] . ' x ' . $item['title'] . "\n";
}
$body .= "\n\n";
$body .= "Bestellung wurde nun zur weitere Bearbeitung angenommen.\n";
$body .= "XINON GmbH";
$user = UserModel::getOne($json['createBy']);
$email = new Emailnotification();
$email->setSubject("Bestellbestätigung Bestellung #$subjectId");
$email->setBody($body);
$email->setFrom(TT_OUTGOING_EMAIL_2FA, TT_OUTGOING_EMAIL_2FA);
$email->setTo($user->email);
$email->send();
self::returnJson(['success' => true,
'message' => $this->infoMessages['create'],
'id' => $id]);