public function sfSendOrderMail($order_id, $template_id, $subject = '', $header = '', $footer = '', $send = true) { $arrTplVar = new \stdClass(); $arrInfo = Application::alias('eccube.helper.db')->getBasisData(); $arrTplVar->arrInfo = $arrInfo; $objQuery = Application::alias('eccube.query'); if ($subject == '' && $header == '' && $footer == '') { // メールテンプレート情報の取得 /* @var $objMailtemplate MailtemplateHelper */ $objMailtemplate = Application::alias('eccube.helper.mailtemplate'); $mailtemplate = $objMailtemplate->get($template_id); $arrTplVar->tpl_header = $mailtemplate['header']; $arrTplVar->tpl_footer = $mailtemplate['footer']; $tmp_subject = $mailtemplate['subject']; } else { $arrTplVar->tpl_header = $header; $arrTplVar->tpl_footer = $footer; $tmp_subject = $subject; } // 受注情報の取得 $where = 'order_id = ? AND del_flg = 0'; $arrOrder = $objQuery->getRow('*', 'dtb_order', $where, array($order_id)); if (empty($arrOrder)) { trigger_error("該当する受注が存在しない。(注文番号: {$order_id})", E_USER_ERROR); } $where = 'order_id = ?'; $objQuery->setOrder('order_detail_id'); $arrTplVar->arrOrderDetail = $objQuery->select('*', 'dtb_order_detail', $where, array($order_id)); // 配送情報の取得 $arrTplVar->arrShipping = $this->sfGetShippingData($order_id); $arrTplVar->Message_tmp = $arrOrder['message']; // 会員情報の取得 $customer_id = $arrOrder['customer_id']; $objQuery->setOrder('customer_id'); $arrRet = $objQuery->select('point', 'dtb_customer', 'customer_id = ?', array($customer_id)); $arrCustomer = isset($arrRet[0]) ? $arrRet[0] : ''; $arrTplVar->arrCustomer = $arrCustomer; $arrTplVar->arrOrder = $arrOrder; //その他決済情報 if ($arrOrder['memo02'] != '') { $arrOther = unserialize($arrOrder['memo02']); foreach ($arrOther as $other_key => $other_val) { if (Utils::sfTrim($other_val['value']) == '') { $arrOther[$other_key]['value'] = ''; } } $arrTplVar->arrOther = $arrOther; } // 都道府県変換 $arrTplVar->arrPref = $this->arrPref; // 国変換 $arrTplVar->arrCountry = $this->arrCountry; /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); $arrTplVar->tpl_user_point = $objCustomer->getValue('point'); $objMailView = null; // 注文受付メール(携帯) if ($template_id == 2) { $objMailView = new SiteView(true, DEVICE_TYPE_MOBILE); } else { $objMailView = new SiteView(); } // メール本文の取得 $objMailView->setPage($this->getPage()); $objMailView->assignobj($arrTplVar); $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); // メール送信処理 /* @var $objSendMail Sendmail */ $objSendMail = Application::alias('eccube.sendmail'); $bcc = $arrInfo['email01']; $from = $arrInfo['email03']; $error = $arrInfo['email04']; $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); $objSendMail->setTo($arrOrder['order_email'], $arrOrder['order_name01'] . ' ' . $arrOrder['order_name02'] . ' 様'); // 送信フラグ:trueの場合は、送信する。 if ($send) { if ($objSendMail->sendMail()) { $this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body); } } return $objSendMail; }