예제 #1
0
 static function send_order_update($order, $subject, $body_text)
 {
     // order update mail to customer
     $to = $order->email;
     $from = basket_plus::getBasketVar(EMAIL_FROM);
     $email_template_name = "order_update";
     // get order Email template
     $email_template = ORM::factory("bp_email_template")->where("name", "=", $email_template_name)->find();
     $body = $email_template->email_html;
     $subject = basket_plus::replaceStringsAll(basket_plus::getBasketVar($subject), $order);
     //first replace variables
     $body = basket_plus::replaceStrings($body, array(META_TAG => basket_plus::getBasketVar(META_TAG), EMAIL_TEMPLATE_STYLE => basket_plus::getBasketVar(EMAIL_TEMPLATE_STYLE), "order_email_title" => t("Order Update"), "order_email_header" => t("Order Update"), ORDER_EMAIL_LOGO => basket_plus::getBasketVar(ORDER_EMAIL_LOGO), ORDER_EMAIL_FOOTER => basket_plus::getBasketVar(ORDER_EMAIL_FOOTER), "body_text" => basket_plus::getBasketVar($body_text), WEBSHOP_DETAILS => basket_plus::getBasketVar(WEBSHOP_DETAILS)));
     //second replace variables
     $body = basket_plus::replaceStrings($body, array(ORDER_EMAIL_CLOSING => basket_plus::getBasketVar(ORDER_EMAIL_CLOSING), "GT" => "<", ORDER_BANK_ACCOUNT_OWNER => basket_plus::getBasketVar(ORDER_BANK_ACCOUNT_OWNER), ORDER_BANK_ACCOUNT => basket_plus::getBasketVar(ORDER_BANK_ACCOUNT), "delivery_method" => basket_plus::deliveredMethodText($order), WEBSITE => basket_plus::getBasketVar(WEBSITE), WEBSHOP_ADDRESS => basket_plus::getBasketVar(WEBSHOP_ADDRESS), WEBSHOP_POSTALCODE => basket_plus::getBasketVar(WEBSHOP_POSTALCODE), WEBSHOP_CITY => basket_plus::getBasketVar(WEBSHOP_CITY), WEBSHOP_PHONE => basket_plus::getBasketVar(WEBSHOP_PHONE), WEBSHOP_OWNER => basket_plus::getBasketVar(WEBSHOP_OWNER), EMAIL_CONTACT => basket_plus::getBasketVar(EMAIL_CONTACT), WEBSHOP => basket_plus::getBasketVar(WEBSHOP)));
     //third replace variables
     $body = basket_plus::replaceStringsAll($body, $order);
     $final_msg = basket_plus::preparehtmlmail($body, $from);
     //send mail
     mail($to, $subject, $final_msg['multipart'], $final_msg['headers']);
 }