Exemple #1
0
 /**
  * Send an email using the isotope e-mail templates
  * @param integer
  * @param string
  * @param string
  * @param array
  * @param string
  * @param object
  */
 public function sendMail($intId, $strRecipient, $strLanguage, $arrData, $strReplyTo = '', $objCollection = null)
 {
     try {
         $objEmail = new IsotopeEmail($intId, $strLanguage, $objCollection);
         if ($strReplyTo != '') {
             $objEmail->replyTo($strReplyTo);
         }
         $objEmail->send($strRecipient, $arrData);
     } catch (Exception $e) {
         $this->log('Isotope email error: ' . $e->getMessage(), __METHOD__, TL_ERROR);
     }
 }
 /**
  * Save the order
  * @return void
  */
 protected function writeOrder()
 {
     $objOrder = new IsotopeOrder();
     if (!$objOrder->findBy('cart_id', $this->Isotope->Cart->id)) {
         $objOrder->uniqid = uniqid($this->Isotope->Config->orderPrefix, true);
         $objOrder->cart_id = $this->Isotope->Cart->id;
         $objOrder->findBy('id', $objOrder->save());
     }
     $objOrder->pid = FE_USER_LOGGED_IN === true ? $this->User->id : 0;
     $objOrder->date = time();
     $objOrder->config_id = (int) $this->Isotope->Config->id;
     $objOrder->shipping_id = $this->Isotope->Cart->hasShipping ? $this->Isotope->Cart->Shipping->id : 0;
     $objOrder->payment_id = $this->Isotope->Cart->hasPayment ? $this->Isotope->Cart->Payment->id : 0;
     $objOrder->subTotal = $this->Isotope->Cart->subTotal;
     $objOrder->taxTotal = $this->Isotope->Cart->taxTotal;
     $objOrder->shippingTotal = $this->Isotope->Cart->shippingTotal;
     $objOrder->grandTotal = $this->Isotope->Cart->grandTotal;
     $objOrder->surcharges = $this->Isotope->Cart->getSurcharges();
     $objOrder->checkout_info = $this->getCheckoutInfo();
     $objOrder->status = '';
     $objOrder->language = $GLOBALS['TL_LANGUAGE'];
     $objOrder->billing_address = $this->Isotope->Cart->billingAddress;
     $objOrder->shipping_address = $this->Isotope->Cart->shippingAddress;
     $objOrder->currency = $this->Isotope->Config->currency;
     $objOrder->iso_sales_email = $this->iso_sales_email ? $this->iso_sales_email : ($GLOBALS['TL_ADMIN_NAME'] != '' ? sprintf('%s <%s>', $GLOBALS['TL_ADMIN_NAME'], $GLOBALS['TL_ADMIN_EMAIL']) : $GLOBALS['TL_ADMIN_EMAIL']);
     $objOrder->iso_mail_admin = $this->iso_mail_admin;
     $objOrder->iso_mail_customer = $this->iso_mail_customer;
     $objOrder->iso_addToAddressbook = $this->iso_addToAddressbook;
     $objOrder->new_order_status = $this->Isotope->Cart->hasPayment ? $this->Isotope->Cart->Payment->new_order_status : 'pending';
     $strCustomerName = '';
     $strCustomerEmail = '';
     if ($this->Isotope->Cart->billingAddress['email'] != '') {
         $strCustomerName = $this->Isotope->Cart->billingAddress['firstname'] . ' ' . $this->Isotope->Cart->billingAddress['lastname'];
         $strCustomerEmail = $this->Isotope->Cart->billingAddress['email'];
     } elseif ($this->Isotope->Cart->shippingAddress['email'] != '') {
         $strCustomerName = $this->Isotope->Cart->shippingAddress['firstname'] . ' ' . $this->Isotope->Cart->shippingAddress['lastname'];
         $strCustomerEmail = $this->Isotope->Cart->shippingAddress['email'];
     } elseif (FE_USER_LOGGED_IN === true && $this->User->email != '') {
         $strCustomerName = $this->User->firstname . ' ' . $this->User->lastname;
         $strCustomerEmail = $this->User->email;
     }
     if (trim($strCustomerName) != '') {
         $strCustomerEmail = sprintf('"%s" <%s>', IsotopeEmail::romanizeFriendlyName($strCustomerName), $strCustomerEmail);
     }
     $objOrder->iso_customer_email = $strCustomerEmail;
     $arrData = array_merge($this->arrOrderData, array('uniqid' => $objOrder->uniqid, 'items' => $this->Isotope->Cart->items, 'products' => $this->Isotope->Cart->products, 'subTotal' => $this->Isotope->formatPriceWithCurrency($this->Isotope->Cart->subTotal, false), 'taxTotal' => $this->Isotope->formatPriceWithCurrency($this->Isotope->Cart->taxTotal, false), 'shippingPrice' => $this->Isotope->formatPriceWithCurrency($this->Isotope->Cart->Shipping->price, false), 'paymentPrice' => $this->Isotope->formatPriceWithCurrency($this->Isotope->Cart->Payment->price, false), 'grandTotal' => $this->Isotope->formatPriceWithCurrency($this->Isotope->Cart->grandTotal, false), 'cart_text' => strip_tags($this->replaceInsertTags($this->Isotope->Cart->getProducts('iso_products_text'))), 'cart_html' => $this->replaceInsertTags($this->Isotope->Cart->getProducts('iso_products_html'))));
     $objOrder->email_data = $arrData;
     $objOrder->save();
 }