/** * Event handler * * @param Event $event calling event * * @return boolean */ function handleEvent(\Cx\Modules\Crm\Model\Entity\CrmEvent $event) { $info = $event->getInfo(); $substitutions = isset($info['substitution']) ? $info['substitution'] : array(); $lang_id = isset($info['lang_id']) ? $info['lang_id'] : FRONTEND_LANG_ID; $arrMailTemplate = array_merge($this->default_info, array('key' => $event->getName(), 'lang_id' => $lang_id, 'substitution' => $substitutions)); if (false === \Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate)) { $event->cancel(); return false; } return true; }
/** * Use this to parse your backend page * * You will get the template located in /View/Template/{CMD}.html * You can access Cx class using $this->cx * To show messages, use \Message class * @param \Cx\Core\Html\Sigma $template Template for current CMD * @param array $cmd CMD separated by slashes */ public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd) { global $_ARRAYLANG; // Parse entity view generation pages $entityClassName = $this->getNamespace() . '\\Model\\Entity\\' . current($cmd); if (in_array($entityClassName, $this->getEntityClasses())) { $this->parseEntityClassPage($template, $entityClassName, current($cmd)); return; } // Not an entity, parse overview or settings switch (current($cmd)) { case 'Settings': if (!isset($cmd[1])) { $cmd[1] = ''; } switch ($cmd[1]) { case '': default: if (!$template->blockExists('mailing')) { return; } $template->setVariable('MAILING', \Cx\Core\MailTemplate\Controller\MailTemplate::adminView($this->getName(), 'nonempty', $config['corePagingLimit'], 'settings/email')->get()); break; } break; case '': default: if ($template->blockExists('overview')) { $template->touchBlock('overview'); } break; } }
/** * Inform the admin about a reject * * If an email could not be sent, inform the administrator * about that (only if the option to do so was set) * * @param integer $newsletterID Nesletter id * @param integer $userID User Id * @param string $email E-mail id of the user * @param string $type User type * @param array $newsletterUserData Info about the newsletter user */ protected function informAdminAboutRejectedMail($newsletterID, $userID, $email, $type, $newsletterUserData) { global $_CONFIG; // Get the current user's email address $loggedUserMail = \FWUser::getFWUserObject()->objUser->getEmail(); $newsletterValues = $this->getNewsletterValues($newsletterID); $arrMailTemplate = array('key' => 'notify_undelivered_email', 'section' => 'Newsletter', 'lang_id' => BACKEND_LANG_ID, 'to' => $loggedUserMail, 'from' => $newsletterValues['sender_email'], 'sender' => $newsletterValues['sender_name'], 'reply' => $newsletterValues['return_path'], 'substitution' => array('NEWSLETTER_USER_SEX' => $newsletterUserData['sex'], 'NEWSLETTER_USER_TITLE' => $newsletterUserData['title'], 'NEWSLETTER_USER_FIRSTNAME' => $newsletterUserData['firstname'], 'NEWSLETTER_USER_LASTNAME' => $newsletterUserData['lastname'], 'NEWSLETTER_USER_EMAIL' => $newsletterUserData['email'], 'NEWSLETTER_DOMAIN_URL' => $_CONFIG['domainUrl'], 'NEWSLETTER_CURRENT_DATE' => date(ASCMS_DATE_FORMAT), 'NEWSLETTER_SUBJECT' => $newsletterValues['subject'], 'NEWSLETTER_USER_EDIT_LINK' => $this->getUserEditLink($userID, $type))); \Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate); }
/** * Generate PDF Document * * @param integer $pdfTemplateId id of the PDF Template * @param array $substitution array of substitution values * @param string $mailTplKey MailTemplate key * @param boolean $convertToHtmlEntities convert input to HTML entities * * @return mixed array|null */ public function generatePDF($pdfTemplateId, $substitution, $mailTplKey, $convertToHtmlEntities = false) { if (empty($mailTplKey)) { return; } $repo = $this->cx->getDb()->getEntityManager()->getRepository('\\Cx\\Core_Modules\\Pdf\\Model\\Entity\\PdfTemplate'); $pdfTemplates = $repo->findOneBy(array('id' => $pdfTemplateId)); if (!$pdfTemplates || !$pdfTemplates->getHtmlContent()) { return; } $tplContent = $pdfTemplates->getHtmlContent(); \Cx\Core\MailTemplate\Controller\MailTemplate::substitute($tplContent, $substitution, $convertToHtmlEntities); $session = $this->getComponent('Session')->getSession(); $datetime = $this->getComponent('DateTime')->createDateTimeForUser('now')->format('d_m_Y_h_s_i'); $title = $mailTplKey . '.pdf'; $fileName = $mailTplKey . '_' . $datetime . '.pdf'; $pdf = new \Cx\Core_Modules\Pdf\Model\Entity\PdfDocument(); $pdf->SetTitle($title); $pdf->setContent($tplContent); $pdf->setDestination('F'); $pdf->setFilePath($session->getTempPath() . '/' . $fileName); $pdf->Create(); return array('filePath' => $session->getWebTempPath() . '/' . $fileName, 'fileName' => $title); }
/** * Sends the Customer login data * * Note that this only works as expected *after* the Customer has logged * in, but *before* the Customer is redirected to an online payment service * provider, as the session usually gets lost in the process. * So, it's best to call this right after storing the Order, before the * payment transaction is started. * @param string $email The e-mail address * @param string $password The password * @return boolean True on success, false otherwise */ static function sendLogin($email, $password) { global $_ARRAYLANG; $objCustomer = new Customer(); $objCustomer = $objCustomer->getUsers(array('email' => $email)); if (!$objCustomer || $objCustomer->EOF) { return \Message::error($_ARRAYLANG['TXT_SHOP_NO_ACCOUNT_WITH_EMAIL']); } $arrSubstitution = $objCustomer->getSubstitutionArray() + self::getSubstitutionArray(); if (!$arrSubstitution) { return false; } $arrSubstitution['CUSTOMER_LOGIN'][0]['CUSTOMER_PASSWORD'] = $password; // Defaults to FRONTEND_LANG_ID $arrMailTemplate = array('section' => 'Shop', 'key' => 'customer_login', 'substitution' => &$arrSubstitution, 'to' => $objCustomer->email()); return \Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate); }
/** * Send a confirmation e-mail with the order data * * Calls {@see Orders::getSubstitutionArray()}, which en route * creates User accounts for individual electronic Products by default. * Set $create_accounts to false when sending a copy. * @static * @param integer $order_id The order ID * @param boolean $create_accounts Create User accounts for electronic * Products it true * @return boolean The Customers' e-mail address * on success, false otherwise * @access private */ static function sendConfirmationMail($order_id, $create_accounts = true) { $arrSubstitution = Orders::getSubstitutionArray($order_id, $create_accounts); $customer_id = $arrSubstitution['CUSTOMER_ID']; $objCustomer = Customer::getById($customer_id); if (!$objCustomer) { //die("Failed to get Customer for ID $customer_id"); return false; } $arrSubstitution += $objCustomer->getSubstitutionArray() + self::getSubstitutionArray() + array('TIMESTAMP' => date(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME, date_timestamp_get(date_create())), 'ROOT_URL' => \Cx\Core\Routing\Url::fromDocumentRoot()->toString()); //DBG::log("sendConfirmationMail($order_id, $create_accounts): Subs: ".var_dump($arrSubstitution, true)); if (empty($arrSubstitution)) { return false; } // Prepared template for order confirmation $arrMailTemplate = array('section' => 'Shop', 'key' => 'order_confirmation', 'lang_id' => $arrSubstitution['LANG_ID'], 'to' => $arrSubstitution['CUSTOMER_EMAIL'] . ',' . \Cx\Core\Setting\Controller\Setting::getValue('email_confirmation', 'Shop'), 'substitution' => &$arrSubstitution); //DBG::log("sendConfirmationMail($order_id, $create_accounts): Template: ".var_export($arrMailTemplate, true)); //DBG::log("sendConfirmationMail($order_id, $create_accounts): Substitution: ".var_export($arrSubstitution, true)); // NOTE: Creates some XML order file (for customizing) // $template = file_get_contents( // ASCMS_MODULE_PATH.'/Shop/View/Template/Backend/module_shop_export_orders.xml'); // \Cx\Core\MailTemplate\Controller\MailTemplate::substitute($template, $arrSubstitution, true); // // Strip leftover comments from blocks: "<!---->" or "<!-- -->" // $template = preg_replace('/<!--\s*-->/', '', $template); // $file = new Cx\Lib\FileSystem\File( // ASCMS_DOCUMENT_ROOT.'/orders/'.$order_id.'.xml'); // //$file->makeWritable(); // Fails on win32 // $file->write($template); /// if (!\Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate)) { return false; } return $arrSubstitution['CUSTOMER_EMAIL']; }
/** * settings for mail tempalte design * * @global <type> $objDatabase * @global <type> $_ARRAYLANG * @return true */ function mailTemplates() { global $_CORELANG, $_ARRAYLANG; $_REQUEST['active_tab'] = 1; if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'mailtemplate_edit') { $_REQUEST['active_tab'] = 2; } \Cx\Core\MailTemplate\Controller\MailTemplate::deleteTemplate('Crm'); // If there is anything to be stored, and if that fails, return to // the edit view in order to save the posted form content $result_store = \Cx\Core\MailTemplate\Controller\MailTemplate::storeFromPost('Crm'); if ($result_store === false) { $_REQUEST['active_tab'] = 2; } $objTemplate = null; $result &= \Cx\Core\Setting\Controller\Setting::show_external($objTemplate, $_CORELANG['TXT_CORE_MAILTEMPLATES'], \Cx\Core\MailTemplate\Controller\MailTemplate::overview('Crm', 'config', \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', 'Crm'))->get()); $result &= \Cx\Core\Setting\Controller\Setting::show_external($objTemplate, empty($_REQUEST['key']) ? $_CORELANG['TXT_CORE_MAILTEMPLATE_ADD'] : $_CORELANG['TXT_CORE_MAILTEMPLATE_EDIT'], \Cx\Core\MailTemplate\Controller\MailTemplate::edit('Crm')->get()); $result &= \Cx\Core\Setting\Controller\Setting::show_external($objTemplate, $_ARRAYLANG['TXT_CRM_PLACEHOLDERS'], $this->getCrmModulePlaceHolders()); $this->_objTpl->addBlock('CRM_MAIL_SETTINGS_FILE', 'settings_block', $objTemplate->get()); $this->_objTpl->touchBlock('settings_block'); }
/** * Migrates existing old Shop mailtemplates to the new MailTemplate class * @return boolean False. Always. * @throws Cx\Lib\Update_DatabaseException */ static function errorHandler() { if (!(include_once \Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseFrameworkPath() . '/UpdateUtil')) { return false; } if (\Cx\Lib\UpdateUtil::table_empty(DBPREFIX . 'core_mail_template')) { // Make sure there are no bodies lying around \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_NAME); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_FROM); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SENDER); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_REPLY); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_TO); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_CC); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_BCC); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SUBJECT); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE_HTML); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_ATTACHMENTS); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_INLINE); } // Migrate existing templates from the shop to the MailTemplate. // These are the keys replacing the IDs. // TODO: Migrate the old template using the original IDs, make them unprotected // TODO: Add the new default templates with the new keys // and have the user migrate changes herself! $arrKey = array(1 => 'order_confirmation', 2 => 'order_complete', 3 => 'customer_login', 4 => 'order_confirmation_login'); $arrLanguageId = \FWLanguage::getIdArray(); if (empty($arrLanguageId)) { throw new \Cx\Lib\Update_DatabaseException("Failed to get frontend language IDs"); } foreach ($arrLanguageId as $lang_id) { // Mind that the template name is single language yet! $arrTemplates = self::getTemplateArray($lang_id); if (empty($arrTemplates)) { continue; } foreach ($arrTemplates as $id => $arrTemplate) { // TODO: utf8_encode() may not be necessary in all cases. // It worked without it for me earlier, but was necessary for verkehrstheorie.ch $arrTemplate = array_map("utf8_encode", $arrTemplate); if (isset($arrKey[$id])) { // System templates get their default key $arrTemplate['key'] = $arrKey[$id]; if ($id == 4) { // Clear the protected flag, so the obsolete template // #4 may be removed at will $arrTemplate['protected'] = false; } } else { // Custom templates: // Make the name lowercase and replace any non-letter $new_key = preg_replace('/[^a-z]/', '_', strtolower($arrTemplate['name'])); // Keep it unique! Use the ID if the key is taken if (in_array($new_key, $arrKey)) { $new_key = $id; } // Remember used keys, and replace the former ID $arrKey[$id] = $new_key; $arrTemplate['key'] = $new_key; } foreach ($arrTemplate as &$string) { // Replace old <PLACEHOLDERS> with new [PLACEHOLDERS]. $string = preg_replace('/\\<([A-Z_]+)\\>/', '[$1]', $string); // TODO: This is completely unreliable. // Use the process as described above, not replacing the old templates, // but adding the new ones instead. // $string = str_replace('[ORDER_DATA]', $order_data, $string); // $string = preg_replace('/[\\w\\s\\:]+\\[USERNAME\\](?:\\n|<br\\s?\\/? // >)*[\\w\\s\\:]+\\[PASSWORD\\]/', // $login_data, $string); } // $arrTemplate['message_html'] = preg_replace( // '/(?:\r|\n|\r\n)/', "<br />\n", $arrTemplate['message']); $arrTemplate['lang_id'] = $lang_id; if (!\Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', $arrTemplate)) { throw new \Cx\Lib\Update_DatabaseException("Failed to store Mailtemplate"); } } } // Drop old Mail tables after successful migration \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail_content'); \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail'); // Always! return false; }
/** * Migrates existing old Shop mailtemplates to the new MailTemplate class * @return boolean False. Always. * @throws Cx\Lib\Update_DatabaseException */ static function errorHandler() { // Mail \Cx\Core\MailTemplate\Controller\MailTemplate::errorHandler(); if (\Cx\Lib\UpdateUtil::table_empty(DBPREFIX . 'core_mail_template')) { // Make sure there are no bodies lying around \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_NAME); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_FROM); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SENDER); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_REPLY); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_TO); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_CC); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_BCC); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SUBJECT); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE_HTML); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_ATTACHMENTS); \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_INLINE); } $arrFrom = $arrSender = $arrSubject = array(); $arrLanguageId = \FWLanguage::getIdArray(); if (empty($arrLanguageId)) { throw new \Cx\Lib\Update_DatabaseException("Failed to get frontend language IDs"); } if (\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'module_shop_mail')) { // Migrate existing templates from the shop to the MailTemplate, // appending "_backup_by_update" to the respective keys. // Make them unprotected. // These are the keys replacing the IDs: $arrKey = array(1 => 'order_confirmation', 2 => 'order_complete', 3 => 'customer_login', 4 => 'order_confirmation_login'); foreach ($arrLanguageId as $lang_id) { // Mind that the template name is single language yet! $arrTemplates = self::getTemplateArray($lang_id); if (empty($arrTemplates)) { continue; } foreach ($arrTemplates as $id => $arrTemplate) { // NOTE: utf8_encode() may be necessary in some cases. // It usually works without it, but was necessary on a few installations. // $arrTemplate = array_map("utf8_encode", $arrTemplate); if (!empty($arrTemplate['from']) && empty($arrFrom[$id])) { $arrFrom[$id] = $arrTemplate['from']; } if (!empty($arrTemplate['sender']) && empty($arrSender[$id])) { $arrSender[$id] = $arrTemplate['sender']; } if (!empty($arrTemplate['subject']) && empty($arrSubject[$id])) { $arrSubject[$id] = str_replace('<DATE>', '[ORDER_DATE]', $arrTemplate['subject']); } if (isset($arrKey[$id])) { // System templates get their default key $arrTemplate['key'] = $arrKey[$id] . '_backup_by_update'; // Clear the protected flag, so the old templates // may be removed at will $arrTemplate['protected'] = false; } else { // Custom templates: // Make the name lowercase and replace any non-letter $new_key = preg_replace('/[^a-z]/', '_', strtolower($arrTemplate['name'])); // Keep it unique! Use the ID if the key is taken if (in_array($new_key, $arrKey)) { $new_key = $id; } // Remember used keys, and replace the former ID $arrKey[$id] = $new_key; $arrTemplate['key'] = $new_key; } // Some installations may contain corrupt templates // causing empty (0 or "") keys. Those would make // MailTemplate::store() fail! if (empty($arrTemplate['key'])) { $arrTemplate['key'] = uniqid() . '_backup_by_update)'; } foreach ($arrTemplate as &$string) { // Replace old <PLACEHOLDERS> with new [PLACEHOLDERS]. $string = preg_replace('/\\<([A-Z_]+)\\>/', '[$1]', $string); // This is completely unreliable. // Use the process as described above, not replacing the old templates, // but adding the new ones instead. // $string = str_replace('[ORDER_DATA]', $order_data, $string); // $string = preg_replace('/[\\w\\s\\:]+\\[USERNAME\\](?:\\n|<br\\s?\\/? // >)*[\\w\\s\\:]+\\[PASSWORD\\]/', // $login_data, $string); } // $arrTemplate['message_html'] = preg_replace( // '/(?:\r|\n|\r\n)/', "<br />\n", $arrTemplate['message']); $arrTemplate['lang_id'] = $lang_id; if (!\Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', $arrTemplate)) { throw new \Cx\Lib\Update_DatabaseException("Failed to store Mailtemplate"); } } } // Drop old Mail tables after successful migration \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail_content'); \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail'); } // Add the new default templates with the new keys // and have the user migrate changes herself! foreach ($arrLanguageId as $lang_id) { if (!\Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'order_confirmation', $lang_id)) { \Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', array('lang_id' => $lang_id, 'key' => 'order_confirmation', 'name' => 'Bestellungsbestätigung', 'from' => isset($arrFrom[1]) ? $arrFrom[1] : '', 'sender' => isset($arrSender[1]) ? $arrSender[1] : '', 'to' => '[CUSTOMER_EMAIL]', 'subject' => isset($arrSubject[1]) ? $arrSubject[1] : '', 'message' => <<<EOF [CUSTOMER_SALUTATION], Herzlichen Dank für Ihre Bestellung im [SHOP_COMPANY] Online Shop. Ihre Auftrags-Nr. lautet: [ORDER_ID] Ihre Kunden-Nr. lautet: [CUSTOMER_ID] Bestellungszeit: [ORDER_DATE] [ORDER_TIME] ------------------------------------------------------------------------ Bestellinformationen ------------------------------------------------------------------------[[ORDER_ITEM] ID: [PRODUCT_ID] Artikel Nr.: [PRODUCT_CODE] Menge: [PRODUCT_QUANTITY] Beschreibung: [PRODUCT_TITLE][[PRODUCT_OPTIONS] [PRODUCT_OPTIONS][PRODUCT_OPTIONS]] Stückpreis: [PRODUCT_ITEM_PRICE] [CURRENCY] Total [PRODUCT_TOTAL_PRICE] [CURRENCY][[USER_DATA] Benutzername: [USER_NAME] Passwort: [USER_PASS][USER_DATA]][[COUPON_DATA] Gutschein Code: [COUPON_CODE][COUPON_DATA]][ORDER_ITEM]] ------------------------------------------------------------------------ Zwischensumme: [ORDER_ITEM_COUNT] Artikel [ORDER_ITEM_SUM] [CURRENCY][[DISCOUNT_COUPON] Gutschein Code: [DISCOUNT_COUPON_CODE] [DISCOUNT_COUPON_AMOUNT] [CURRENCY][DISCOUNT_COUPON]] ------------------------------------------------------------------------[[SHIPMENT] Versandart: [SHIPMENT_NAME] [SHIPMENT_PRICE] [CURRENCY][SHIPMENT]][[PAYMENT] Bezahlung: [PAYMENT_NAME] [PAYMENT_PRICE] [CURRENCY][PAYMENT]][[VAT] [VAT_TEXT] [VAT_PRICE] [CURRENCY][VAT]] ------------------------------------------------------------------------ Gesamtsumme [ORDER_SUM] [CURRENCY] ------------------------------------------------------------------------ Bemerkungen: [REMARKS] Ihre Kundenadresse: [CUSTOMER_COMPANY] [CUSTOMER_FIRSTNAME] [CUSTOMER_LASTNAME] [CUSTOMER_ADDRESS] [CUSTOMER_ZIP] [CUSTOMER_CITY] [CUSTOMER_COUNTRY][[SHIPPING_ADDRESS] Lieferadresse: [SHIPPING_COMPANY] [SHIPPING_FIRSTNAME] [SHIPPING_LASTNAME] [SHIPPING_ADDRESS] [SHIPPING_ZIP] [SHIPPING_CITY] [SHIPPING_COUNTRY][SHIPPING_ADDRESS]] Ihr Link zum Online Store: [SHOP_HOMEPAGE][[CUSTOMER_LOGIN] Ihre Zugangsdaten zum Shop: Benutzername: [CUSTOMER_USERNAME] Passwort: [CUSTOMER_PASSWORD][CUSTOMER_LOGIN]] Wir freuen uns auf Ihren nächsten Besuch im [SHOP_COMPANY] Online Store und wünschen Ihnen noch einen schönen Tag. P.S. Diese Auftragsbestätigung wurde gesendet an: [CUSTOMER_EMAIL] Mit freundlichen Grüssen Ihr [SHOP_COMPANY] Online Shop Team [SHOP_HOMEPAGE] EOF , 'message_html' => <<<EOF [CUSTOMER_SALUTATION],<br /> <br /> Herzlichen Dank für Ihre Bestellung im [SHOP_COMPANY] Online Shop.<br /> <br /> Ihre Auftrags-Nr. lautet: [ORDER_ID]<br /> Ihre Kunden-Nr. lautet: [CUSTOMER_ID]<br /> Bestellungszeit: [ORDER_DATE] [ORDER_TIME]<br /> <br /> <br /> <table cellspacing="1" cellpadding="1" style="border: 0;"> <tbody> <tr> <td colspan="6">Bestellinformationen</td> </tr> <tr> <td><div style="text-align: right;">ID</div></td> <td><div style="text-align: right;">Artikel Nr.</div></td> <td><div style="text-align: right;">Menge</div></td> <td>Beschreibung</td> <td><div style="text-align: right;">Stückpreis</div></td> <td><div style="text-align: right;">Total</div></td> </tr><!--[[ORDER_ITEM]--> <tr> <td><div style="text-align: right;">[PRODUCT_ID]</div></td> <td><div style="text-align: right;">[PRODUCT_CODE]</div></td> <td><div style="text-align: right;">[PRODUCT_QUANTITY]</div></td> <td>[PRODUCT_TITLE]<!--[[PRODUCT_OPTIONS]--><br /> [PRODUCT_OPTIONS]<!--[PRODUCT_OPTIONS]]--></td> <td><div style="text-align: right;">[PRODUCT_ITEM_PRICE] [CURRENCY]</div></td> <td><div style="text-align: right;">[PRODUCT_TOTAL_PRICE] [CURRENCY]</div></td> </tr><!--[[USER_DATA]--> <tr> <td colspan="3"> </td> <td>Benutzername: [USER_NAME]<br />Passwort: [USER_PASS]</td> <td colspan="2"> </td> </tr><!--[USER_DATA]]--><!--[[COUPON_DATA]--> <tr> <td colspan="3"> </td> <td>Gutschein Code: [COUPON_CODE]</td> <td colspan="2"> </td> </tr><!--[COUPON_DATA]]--><!--[ORDER_ITEM]]--> <tr style="border-top: 4px none;"> <td colspan="2">Zwischensumme</td> <td><div style="text-align: right;">[ORDER_ITEM_COUNT]</div></td> <td colspan="2">Artikel</td> <td><div style="text-align: right;">[ORDER_ITEM_SUM] [CURRENCY]</div></td> </tr><!--[[DISCOUNT_COUPON]--> <tr style="border-top: 4px none;"> <td colspan="3">Gutscheincode</td> <td colspan="2">[DISCOUNT_COUPON_CODE]</td> <td><div style="text-align: right;">[DISCOUNT_COUPON_AMOUNT] [CURRENCY]</div></td> </tr><!--[DISCOUNT_COUPON]][[SHIPMENT]--> <tr style="border-top: 2px none;"> <td colspan="3">Versandart</td> <td colspan="2">[SHIPMENT_NAME]</td> <td><div style="text-align: right;">[SHIPMENT_PRICE] [CURRENCY]</div></td> </tr><!--[SHIPMENT]][[PAYMENT]--> <tr style="border-top: 2px none;"> <td colspan="3">Bezahlung</td> <td colspan="2">[PAYMENT_NAME]</td> <td><div style="text-align: right;">[PAYMENT_PRICE] [CURRENCY]</div></td> </tr><!--[PAYMENT]][[VAT]--> <tr style="border-top: 2px none;"> <td colspan="5">[VAT_TEXT]</td> <td><div style="text-align: right;">[VAT_PRICE] [CURRENCY]</div></td> </tr><!--[VAT]]--> <tr style="border-top: 4px none;"> <td colspan="5">Gesamtsumme</td> <td><div style="text-align: right;">[ORDER_SUM] [CURRENCY]</div></td> </tr> </tbody> </table> <br /> Bemerkungen:<br /> [REMARKS]<br /> <br /> <br /> Ihre Kundenadresse:<br /> [CUSTOMER_COMPANY]<br /> [CUSTOMER_FIRSTNAME] [CUSTOMER_LASTNAME]<br /> [CUSTOMER_ADDRESS]<br /> [CUSTOMER_ZIP] [CUSTOMER_CITY]<br /> [CUSTOMER_COUNTRY]<br /><!--[[SHIPPING_ADDRESS]--> <br /> <br /> Lieferadresse:<br /> [SHIPPING_COMPANY]<br /> [SHIPPING_FIRSTNAME] [SHIPPING_LASTNAME]<br /> [SHIPPING_ADDRESS]<br /> [SHIPPING_ZIP] [SHIPPING_CITY]<br /> [SHIPPING_COUNTRY]<br /><!--[SHIPPING_ADDRESS]]--> <br /> <br /> Ihr Link zum Online Store: [SHOP_HOMEPAGE]<br /><!--[[CUSTOMER_LOGIN]--> <br /> Ihre Zugangsdaten zum Shop:<br /> Benutzername: [CUSTOMER_USERNAME]<br /> Passwort: [CUSTOMER_PASSWORD]<br /><!--[CUSTOMER_LOGIN]]--> <br /> Wir freuen uns auf Ihren nächsten Besuch im [SHOP_COMPANY] Online Store und wünschen Ihnen noch einen schönen Tag.<br /> <br /> P.S. Diese Auftragsbestätigung wurde gesendet an: [CUSTOMER_EMAIL]<br /> <br /> Mit freundlichen Grüssen<br /> Ihr [SHOP_COMPANY] Online Shop Team<br /> <br /> [SHOP_HOMEPAGE]<br /> <br /> EOF , 'protected' => true, 'html' => true)); } if (!\Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'order_complete', $lang_id)) { \Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', array('lang_id' => $lang_id, 'key' => 'order_complete', 'name' => 'Auftrag abgeschlossen', 'from' => isset($arrFrom[2]) ? $arrFrom[2] : '', 'sender' => isset($arrSender[2]) ? $arrSender[2] : '', 'to' => '[CUSTOMER_EMAIL]', 'subject' => isset($arrSubject[2]) ? $arrSubject[2] : '', 'message' => <<<EOF [CUSTOMER_SALUTATION] Ihre Bestellung wurde ausgeführt. Sie werden in den nächsten Tagen ihre Lieferung erhalten. Herzlichen Dank für das Vertrauen. Wir würden uns freuen, wenn Sie uns weiterempfehlen und wünschen Ihnen noch einen schönen Tag. Mit freundlichen Grüssen Ihr [SHOP_COMPANY] Online Shop Team [SHOP_HOMEPAGE] EOF , 'message_html' => <<<EOF [CUSTOMER_SALUTATION]<br /> <br /> Ihre Bestellung wurde ausgeführt. Sie werden in den nächsten Tagen ihre Lieferung erhalten.<br /> <br /> Herzlichen Dank für das Vertrauen.<br /> Wir würden uns freuen, wenn Sie uns weiterempfehlen und wünschen Ihnen noch einen schönen Tag.<br /> <br /> Mit freundlichen Grüssen<br /> Ihr [SHOP_COMPANY] Online Shop Team<br /> <br /> [SHOP_HOMEPAGE]<br /> EOF , 'protected' => true, 'html' => true)); } if (!\Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'customer_login', $lang_id)) { \Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', array('lang_id' => $lang_id, 'key' => 'customer_login', 'name' => 'Logindaten', 'from' => isset($arrFrom[3]) ? $arrFrom[3] : '', 'sender' => isset($arrSender[3]) ? $arrSender[3] : '', 'to' => '[CUSTOMER_EMAIL]', 'subject' => isset($arrSubject[3]) ? $arrSubject[3] : '', 'message' => <<<EOF [CUSTOMER_SALUTATION] Hier Ihre Zugangsdaten zum Shop:[[CUSTOMER_LOGIN] Benutzername: [CUSTOMER_USERNAME] Passwort: [CUSTOMER_PASSWORD][CUSTOMER_LOGIN]] Mit freundlichen Grüssen Ihr [SHOP_COMPANY] Online Shop Team [SHOP_HOMEPAGE] EOF , 'message_html' => <<<EOF [CUSTOMER_SALUTATION]<br /> <br /> Hier Ihre Zugangsdaten zum Shop:<br /><!--[[CUSTOMER_LOGIN]--> Benutzername: [CUSTOMER_USERNAME]<br /> Passwort: [CUSTOMER_PASSWORD]<br /><!--[CUSTOMER_LOGIN]]--> <br /> Mit freundlichen Grüssen<br /> Ihr [SHOP_COMPANY] Online Shop Team<br /> <br /> [SHOP_HOMEPAGE]<br /> EOF , 'protected' => true, 'html' => true)); } } // Always! return false; }
/** * Send an e-mail to the Customer with the confirmation that the Order * with the given Order ID has been processed * @param integer $order_id The order ID * @return boolean True on success, false otherwise */ static function sendProcessedMail($order_id) { $arrSubstitution = Orders::getSubstitutionArray($order_id) + self::getSubstitutionArray(); $lang_id = $arrSubstitution['LANG_ID']; // Select template for: "Your order has been processed" $arrMailTemplate = array('section' => 'Shop', 'key' => 'order_complete', 'lang_id' => $lang_id, 'to' => $arrSubstitution['CUSTOMER_EMAIL'], 'substitution' => &$arrSubstitution); if (!\Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate)) { return false; } return $arrSubstitution['CUSTOMER_EMAIL']; }
/** * Send notification mail * * @param integer $action 1 = subscribe | 2 = unsubscribe * @param integer $recipientId Id of the recipient * * @return boolean True when notification mail send successfully, false otherwise */ function _sendNotificationEmail($action, $recipientId) { global $_CONFIG, $_ARRAYLANG, $objDatabase; //action: 1 = subscribe | 2 = unsubscribe $objSettings = $objDatabase->Execute("SELECT `setname`, `setvalue` FROM `" . DBPREFIX . "module_newsletter_settings` WHERE `setname` = 'notificationSubscribe' OR `setname` = 'notificationUnsubscribe' "); if ($objSettings !== false) { while (!$objSettings->EOF) { $arrSettings[$objSettings->fields['setname']] = $objSettings->fields['setvalue']; $objSettings->MoveNext(); } } if ($arrSettings['notificationSubscribe'] == 1 && $action == 1 || $arrSettings['notificationUnsubscribe'] == 1 && $action == 2) { $objRecipient = $objDatabase->SelectLimit("SELECT sex, salutation, lastname, firstname, email FROM " . DBPREFIX . "module_newsletter_user WHERE id=" . $recipientId, 1); if ($objRecipient !== false) { $arrRecipient['sex'] = $objRecipient->fields['sex']; $arrRecipient['salutation'] = $objRecipient->fields['salutation']; $arrRecipient['lastname'] = $objRecipient->fields['lastname']; $arrRecipient['firstname'] = $objRecipient->fields['firstname']; $arrRecipient['email'] = $objRecipient->fields['email']; } $objRecipientTitle = $objDatabase->SelectLimit("SELECT title FROM " . DBPREFIX . "module_newsletter_user_title WHERE id=" . $arrRecipient['salutation'], 1); if ($objRecipientTitle !== false) { $arrRecipientTitle = $objRecipientTitle->fields['title']; } $notifyMails = array(); if ($action == 1) { $txtAction = $_ARRAYLANG['TXT_NEWSLETTER_NOTIFICATION_SUBSCRIBE']; } else { $txtAction = $_ARRAYLANG['TXT_NEWSLETTER_NOTIFICATION_UNSUBSCRIBE']; $objNotificationAdressesFromLists = $objDatabase->Execute('SELECT notification_email FROM ' . DBPREFIX . 'module_newsletter_category AS c INNER JOIN ' . DBPREFIX . 'module_newsletter_rel_user_cat AS r ON r.category = c.id WHERE r.user = '******',', $objNotificationAdressesFromLists->fields['notification_email']) as $mail) { if (!in_array($mail, $notifyMails)) { array_push($notifyMails, trim($mail)); } } $objNotificationAdressesFromLists->MoveNext(); } } } $arrSettings = $this->_getSettings(); $arrMailTemplate = array('key' => 'notification_email', 'section' => 'Newsletter', 'lang_id' => FRONTEND_LANG_ID, 'to' => implode(',', $notifyMails), 'from' => $arrSettings['sender_mail']['setvalue'], 'sender' => $arrSettings['sender_name']['setvalue'], 'reply' => $arrSettings['reply_mail']['setvalue'], 'substitution' => array('NEWSLETTER_NOTIFICATION_ACTION' => $txtAction, 'NEWSLETTER_USER_SEX' => $arrRecipient['sex'], 'NEWSLETTER_USER_TITLE' => $arrRecipientTitle, 'NEWSLETTER_USER_FIRSTNAME' => $arrRecipient['firstname'], 'NEWSLETTER_USER_LASTNAME' => $arrRecipient['lastname'], 'NEWSLETTER_USER_EMAIL' => $arrRecipient['email'], 'NEWSLETTER_DOMAIN_URL' => $_CONFIG['domainUrl'], 'NEWSLETTER_CURRENT_DATE' => date(ASCMS_DATE_FORMAT))); if (!\Cx\Core\MailTemplate\Controller\MailTemplate::send($arrMailTemplate)) { return false; } return true; } // TODO: This used to return *nothing* when notifications were turned off. // Probably true should be returned in this case instead. // -- See the condition way above. return false; }