예제 #1
0
파일: Mail.php 프로젝트: evilscripts/gy
 public static function Send($id_lang, $template, $subject, $templateVars, $to, $toName = NULL, $from = NULL, $fromName = NULL, $fileAttachment = NULL, $modeSMTP = NULL, $templatePath = _PS_MAIL_DIR_, $die = false, $id_shop = NULL, $bcc = null)
 {
     if (Module::isInstalled('agileprepaidcredit') and $template == 'payment_error') {
         if (AgilePrepaidCredit::isPaymentErrorCausedByTokens($templateVars) > 0) {
             return true;
         }
     }
     $order_info_templates = array('order_conf', 'bankwire', 'cheque', 'new_order');
     if (Module::isInstalled('agilesellershipping') and in_array($template, $order_info_templates)) {
         AgileSellerManager::adjust_shipping_cost_carriers($templateVars);
     }
     if (Module::isInstalled('agilepickupcenter') and $template == 'order_conf') {
         require_once _PS_ROOT_DIR_ . "/modules/agilepickupcenter/agilepickupcenter.php";
         $amodule = new AgilePickupCenter();
         $templateVars = $amodule->transform_mail_data($templateVars);
         if (isset($templateVars['{carrier_email}']) and Validate::isEmail($templateVars['{carrier_email}'])) {
             parent::Send($id_lang, $template, $subject, $templateVars, $templateVars['{carrier_email}'], $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
         }
     }
     if (in_array($template, $order_info_templates)) {
         $shop_email = Configuration::get('PS_SHOP_EMAIL');
         if (Module::isInstalled('agilemultipleseller')) {
             require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
             $templateVars = AgileSellerManager::appendMailTemplateVars($templateVars, $id_lang);
         }
         if (Module::isInstalled('agileprepaidcredit') and in_array($template, array('bankwire', 'cheque'))) {
             require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php";
             $templateVars = AgilePrepaidCredit::replace_amount2pay($templateVars);
         }
         parent::Send($id_lang, $template, $subject, $templateVars, $shop_email, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
     }
     if (Module::isInstalled('agilemultipleseller') and $template == 'order_customer_comment') {
         $id_order = intval($templateVars['{id_order}']);
         $id_seller = AgileSellerManager::getObjectOwnerID('order', $id_order);
         $seller = new Employee($id_seller);
         parent::Send($id_lang, $template, $subject, $templateVars, $seller->email, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
     }
     if (Module::isInstalled('agilemultipleseller') and $template == 'order_conf') {
         require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php";
         AgileMultipleSeller::sendNewOrderMail($id_lang, $templateVars, $from, $fromName, $fileAttachment, $modeSMTP, $die, $id_shop, $bcc);
     }
     return parent::Send($id_lang, $template, $subject, $templateVars, $to, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
 }
예제 #2
0
 public function getContent()
 {
     if (isset($this->order) and Validate::isLoadedObject($this->order) and Module::isInstalled('agilemultipleseller')) {
         $carrier = new Carrier($this->order->id_carrier);
         $this->smarty->assign(array('order_number_text' => sprintf('%06d', $this->order->id), 'carrier_name' => $carrier->name));
     }
     $content = parent::getContent();
     if (isset($this->order) and Validate::isLoadedObject($this->order) and Module::isInstalled('agilepickupcenter')) {
         $country = new Country((int) $this->order->id_address_invoice);
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
         $formatted_delivery_address = $formatted_invoice_address;
         if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
             $delivery_address = new Address((int) $this->order->id_address_delivery);
             $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
         }
         require_once _PS_ROOT_DIR_ . "/modules/agilepickupcenter/agilepickupcenter.php";
         $pickupcenter = new AgilePickupCenter();
         $delivery_address = $formatted_delivery_address . "<BR>" . $pickupcenter->displayInfoByCart($this->order->id_cart);
         $this->smarty->assign(array('delivery_address' => $delivery_address));
         $content = $this->smarty->fetch($this->getTemplateByCountry($country->iso_code));
     }
     return $content;
 }