public function sendEmailOrderComplete($orderId) { //Instead of passing the order as a parameter, we have to pass the order ID and fetch the order again from the database //Becase the order creation time will be null otherwise $order = new Order($orderId); $this->smarty->assign('order', $order); $orderItems = OrderDetail::getAll($order->getId()); $this->smarty->assign('orderItems', $orderItems); $body = $this->smarty->fetch("EmailOrderComplete.tpl"); $subject = "Order confirmation"; $adminEmail = SiteConfig::get("EComm::AdminEmail"); $userEmail = $order->getUserEmail(); $headers = "From: {$adminEmail}"; $mailResult1 = mail($adminEmail, $subject, $body, $headers); $mailResult2 = mail($userEmail, $subject, $body, $headers); return $mailResult1 && $mailResult2; }