$address[] = rawurlencode($customer['address']); $address[] = rawurlencode($customer['zip']); $address[] = rawurlencode($customer['city']); $address[] = rawurlencode($customer['country']); $actionLink = 'http://maps.google.com/maps?daddr=' . implode('+', $address); $actionButtons['travel_guide'] = '<a href="' . $actionLink . '" rel="nofollow" target="_blank" class="btn btn-xs btn-default"><i class="fa fa-map-marker"></i> ' . $this->pi_getLL('travel_guide') . '</a>'; $jsonData['html'] = ''; if ($customer['company']) { $jsonData['html'] .= '<h1>' . $customer['company'] . '</h1>'; } if ($customer['name']) { $jsonData['html'] .= '<h1>' . $customer['name'] . '</h1>'; } $jsonData['html'] .= $customer['address'] . '<br /> ' . $customer['zip'] . ' ' . $customer['city'] . ' <br /> ' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $customer['country']) . '<br /><br /> '; if ($customer['email']) { $jsonData['html'] .= $this->pi_getLL('email') . ': <a href="mailto:' . $customer['email'] . '">' . $customer['email'] . '</a><br />'; } if ($customer['telephone']) { $jsonData['html'] .= $this->pi_getLL('telephone') . ': ' . $customer['telephone'] . '<br />'; } if ($customer['mobile']) { $jsonData['html'] .= $this->pi_getLL('mobile') . ': ' . $customer['mobile'] . '<br />'; } if ($customer['fax']) { $jsonData['html'] .= $this->pi_getLL('fax') . ': ' . $customer['fax'] . '<br />'; } // custom page hook that can be controlled by third-party plugin if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/get_admin_customers_listing_details.php']['actionButtonsAdminCustomersTooltipPreProc'])) {
<div class="clearfix"> <div class="pull-right"> <button name="Submit" type="submit" value="" onclick="history.back();return false;" class="btn btn-danger btn-sm"><i class="fa fa-remove"></i> ' . $this->pi_getLL('cancel') . '</button> <button name="Submit" type="submit" value="" class="btn btn-success btn-sm"><i class="fa fa-save"></i> ' . $this->pi_getLL('save') . '</button> </div> </div> </form> '; } else { $content .= 'Currently all active countries are in use. <input name="Submit" type="submit" value="' . $this->pi_getLL('cancel') . '" onclick="history.back();return false;" class="btn btn-success" />'; } } else { if ($rows > 0) { $content .= '<ul class="zone_items fa-ul">'; while (($country = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { $content .= '<li class="zone_item_country"><i class=" fa-li fa fa-square"></i>' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en']) . '</li>'; } $content .= '</ul>'; } else { $content .= $this->pi_getLL('admin_label_current_no_countries_mapped_to_this_zone'); } } if ($this->get['zone_id'] != $zone['id']) { $content .= '<hr> <div class="clearfix"> <div class="pull-right"> <a href="' . mslib_fe::typolink($this->shop_pid . ',2003', '&tx_multishop_pi1[page_section]=' . $this->ms['page'] . '&edit=1&zone_id=' . $zone['id']) . '" class="btn btn-primary btn-sm"><i class="fa fa-pencil"></i> ' . $this->pi_getLL('add_countries') . '</a> <a href="' . mslib_fe::typolink($this->shop_pid . ',2003', '&tx_multishop_pi1[page_section]=' . $this->ms['page'] . '&delete=1&zone_id=' . $zone['id']) . '" class="btn btn-danger btn-sm"><i class="fa fa-save"></i> ' . $this->pi_getLL('delete_zone') . '</a> </div> </div>'; }
// hook if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/includes/admin_stats_orders/turn_over_per_month.php']['monthlyStatsOrdersPagePreProc'])) { $params = array(); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/includes/admin_stats_orders/turn_over_per_month.php']['monthlyStatsOrdersPagePreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // billing countries $additional_where = array(); if (!$this->masterShop) { $additional_where[] = 'page_uid=\'' . $this->shop_pid . '\''; } $order_countries = mslib_befe::getRecords('', 'tx_multishop_orders', '', $additional_where, 'billing_country', 'billing_country asc'); $order_billing_country = array(); foreach ($order_countries as $order_country) { $cn_localized_name = htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order_country['billing_country'])); if (!empty($cn_localized_name)) { $order_billing_country[] = '<option value="' . mslib_befe::strtolower($order_country['billing_country']) . '" ' . (mslib_befe::strtolower($this->get['country']) == strtolower($order_country['billing_country']) ? 'selected' : '') . '>' . $cn_localized_name . '</option>'; } } ksort($order_billing_country); $billing_countries_sb = '<select class="invoice_select2" name="country" id="country""><option value="">' . $this->pi_getLL('all_countries') . '</option>' . implode("\n", $order_billing_country) . '</select>'; $all_orders_status = mslib_fe::getAllOrderStatus($GLOBALS['TSFE']->sys_language_uid); if ($this->post['Search'] and $this->get['payment_status'] != $this->cookie['payment_status']) { $this->cookie['payment_status'] = $this->get['payment_status']; $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_multishop_cookie', $this->cookie); $GLOBALS['TSFE']->storeSessionData(); } if ($this->get['stats_year_sb'] > 0) { if ($this->get['stats_year_sb'] != $this->cookie['stats_year_sb']) { $this->cookie['stats_year_sb'] = $this->get['stats_year_sb'];
} $str = "SELECT * from static_countries sc order by sc.cn_short_en"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $countries = array(); while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { $str2 = "select * from tx_multishop_shipping_countries where cn_iso_nr='" . $row['cn_iso_nr'] . "' and page_uid='" . $this->showCatalogFromPage . "' "; $qry2 = $GLOBALS['TYPO3_DB']->sql_query($str2); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry2) > 0) { $row['enabled'] = 1; } $countries[] = $row; } $content .= ' <div class="panel panel-default"> <div class="panel-heading"><h3>' . $this->pi_getLL('admin_label_enabled_countries') . '</h3></div> <div class="panel-body"> <form action="' . mslib_fe::typolink($this->shop_pid . ',2003', '&tx_multishop_pi1[page_section]=' . $this->ms['page']) . '" method="post"> <ul id="tx_multishop_countries_checkboxes" class="list-inline">'; foreach ($countries as $country) { $content .= '<li><div class="checkbox checkbox-success"><input id="countries[' . $country['cn_iso_nr'] . ']" name="countries[' . $country['cn_iso_nr'] . ']" type="checkbox" value="1" ' . ($country['enabled'] ? 'checked' : '') . ' /><label for="countries[' . $country['cn_iso_nr'] . ']">' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en']) . '</label></div></li>'; } $content .= '</ul> <div class="clearfix"> <div class="pull-right"> <button name="Submit" type="submit" value="" class="btn btn-success"><i class="fa fa-save"></i> Save</button> </div> </div> </form> '; $content .= '<hr><div class="clearfix"><a class="btn btn-success msAdminBackToCatalog" href="' . mslib_fe::typolink() . '"><span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-arrow-left fa-stack-1x"></i></span> ' . $this->pi_getLL('admin_close_and_go_back_to_catalog') . '</a></div></div></div>'; $content = '' . mslib_fe::shadowBox($content) . '';
$country_block = ''; $delivery_country_block = ''; if (count($enabled_countries) == 1) { $country_block .= '<input name="country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; $delivery_country_block .= '<input name="delivery_country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; } else { $default_country = mslib_fe::getCountryByIso($this->ms['MODULES']['COUNTRY_ISO_NR']); if (!$user['country']) { $user['country'] = $default_country['cn_short_en']; } if (!$user['delivery_country']) { $user['delivery_country'] = $default_country['cn_short_en']; } foreach ($enabled_countries as $country) { $tmpcontent_con .= '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($user['country']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en'])) . '</option>'; $tmpcontent_con_delivery .= '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($user['delivery_country']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en'])) . '</option>'; } if ($tmpcontent_con) { $country_block .= ' <div class="account-field col-sm-' . ($this->conf['multistep_checkout_address_tmpl_path'] ? '12' : '8') . '" id="input-country"> <label for="country" id="account-country">' . ucfirst($this->pi_getLL('country')) . '*</label> <select name="country" id="country" class="country" required="required" data-h5-errorid="invalid-country" title="' . $this->pi_getLL('country_is_required') . '"> <option value="">' . ucfirst($this->pi_getLL('choose_country')) . '</option> ' . $tmpcontent_con . ' </select> <div id="invalid-country" class="error-space" style="display:none"></div> </div> '; } } // country eof
</div> <a href="#" id="close_edit_delivery_info" class="float_right btn btn-success">' . $this->pi_getLL('save') . '</a> </div>'; } if ($hide_delivery_vcard) { $tmpcontent .= '<div class="address_details_container" id="delivery_details_container" style="display:none">'; } else { $tmpcontent .= '<div class="address_details_container" id="delivery_details_container">'; } if ($orders['delivery_company']) { $tmpcontent .= '<strong>' . $orders['delivery_company'] . '</strong><br />'; } $tmpcontent .= $orders['delivery_name'] . '<br /> ' . $orders['delivery_address'] . '<br /> ' . $orders['delivery_zip'] . ' ' . $orders['delivery_city'] . ' <br /> ' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $orders['delivery_country']) . '<br /><br />'; if ($orders['delivery_email']) { $tmpcontent .= $this->pi_getLL('email') . ': <a href="mailto:' . $orders['delivery_email'] . '">' . $orders['delivery_email'] . '</a><br />'; } if ($orders['delivery_telephone']) { $tmpcontent .= $this->pi_getLL('telephone') . ': ' . $orders['delivery_telephone'] . '<br />'; } if ($orders['delivery_mobile']) { $tmpcontent .= $this->pi_getLL('mobile') . ': ' . $orders['delivery_mobile'] . '<br />'; } if ($orders['delivery_fax']) { $tmpcontent .= $this->pi_getLL('fax') . ': ' . $orders['delivery_fax'] . '<br />'; } if ($this->ms['MODULES']['ORDER_EDIT'] and !$orders['is_locked']) { $tmpcontent .= '<span><a href="#" id="edit_delivery_info" class="btn btn-success">' . $this->pi_getLL('edit') . '</a></span>'; }
$markerArray['###DELIVERY_BUILDING###'] = '<strong>' . $order['delivery_building'] . '</strong><br/>'; } else { $markerArray['###DELIVERY_BUILDING###'] = ''; } $markerArray['###DELIVERY_NAME###'] = $order['delivery_name']; $markerArray['###DELIVERY_BUILDING###'] = $order['delivery_building']; if (strpos($template, '###DELIVERY_BUILDING###') === false && $order['delivery_building'] != '') { $order['delivery_address'] = $order['delivery_building'] . '<br/>' . $order['delivery_address']; } $markerArray['###DELIVERY_ADDRESS###'] = $order['delivery_address']; $markerArray['###DELIVERY_ZIP###'] = $order['delivery_zip']; $markerArray['###DELIVERY_CITY###'] = mslib_befe::strtoupper($order['delivery_city']); $markerArray['###DELIVERY_COUNTRY###'] = ''; if (mslib_befe::strtolower($order['billing_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) { // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP $markerArray['###DELIVERY_COUNTRY###'] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']); } $markerArray['###LABEL_CUSTOMER_ID###'] = $this->pi_getLL('admin_customer_id'); $markerArray['###CUSTOMER_ID###'] = $order['customer_id']; $markerArray['###LABEL_ORDER_ID###'] = $this->pi_getLL('orders_id'); $markerArray['###ORDER_ID###'] = $order['orders_id']; $markerArray['###LABEL_ORDER_DATE###'] = $this->pi_getLL('admin_order_date'); $markerArray['###ORDER_DATE###'] = strftime("%x", $order['crdate']); $markerArray['###LABEL_PACKINGSLIP_PAYMENT_METHOD###'] = ''; $markerArray['###PACKINGSLIP_PAYMENT_METHOD###'] = ''; if ($order['payment_method_label']) { $markerArray['###LABEL_PACKINGSLIP_PAYMENT_METHOD###'] = $this->pi_getLL('payment_method'); $markerArray['###PACKINGSLIP_PAYMENT_METHOD###'] = $order['payment_method_label']; } $markerArray['###LABEL_PACKINGSLIP_SHIPPING_METHOD###'] = ''; $markerArray['###PACKINGSLIP_SHIPPING_METHOD###'] = '';
<label class="account-city" for="city">' . ucfirst($this->pi_getLL('city')) . '</label> <input type="text" name="city" id="city" class="form-control city" value="' . htmlspecialchars($user['city']) . '"> </div> </div> </div> <div class="form-group">'; // load countries if (count($enabled_countries) == 1) { $row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2); $content .= '<input name="country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; $content .= '<input name="delivery_country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; } else { $billing_countries_option = array(); $delivery_countries_option = array(); foreach ($enabled_countries as $country) { $cn_localized_name = htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en'])); $billing_countries_option[$cn_localized_name] = '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . ($user['country'] == mslib_befe::strtolower($country['cn_short_en']) || mslib_befe::strtolower($country['cn_short_en']) == 'netherlands' ? 'selected' : '') . '>' . $cn_localized_name . '</option>'; $delivery_countries_option[$cn_localized_name] = '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . ($user['delivery_country'] == mslib_befe::strtolower($country['cn_short_en']) || mslib_befe::strtolower($country['cn_short_en']) == 'netherlands' ? 'selected' : '') . '>' . $cn_localized_name . '</option>'; } ksort($billing_countries_option); ksort($delivery_countries_option); $tmpcontent_con = implode("\n", $billing_countries_option); $tmpcontent_con_delivery = implode("\n", $delivery_countries_option); if ($tmpcontent_con) { $content .= '<label for="country" id="account-country">' . ucfirst($this->pi_getLL('country')) . '<span class="text-danger">*</span></label> <select name="country" id="country" class="form-control country" required="required" data-h5-errorid="invalid-country" title="' . $this->pi_getLL('country_is_required') . '"> <option value="">' . ucfirst($this->pi_getLL('choose_country')) . '</option> ' . $tmpcontent_con . ' </select> <div id="invalid-country" class="error-space" style="display:none"></div>'; }
$res_st = $GLOBALS['TYPO3_DB']->sql_query($query_st); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res_st)) { $tab_content .= '<ul class="category_listing_ul_territories_' . $counter . '" id="msAdmin_category_listing_ul_territories">'; while ($row_st = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_st)) { $query = "SELECT * from static_countries c, tx_multishop_countries_to_zones c2z where c2z.zone_id='" . $zone['id'] . "' and c.cn_parent_tr_iso_nr='" . $row_st['tr_iso_nr'] . "' and c2z.cn_iso_nr=c.cn_iso_nr order by c.cn_short_en"; $res = $GLOBALS['TYPO3_DB']->sql_query($query); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { $tab_content .= '<li class="item_territories_' . $counter . '">'; $tab_content .= '<label class="tree_item_label">'; $tab_content .= $row_st['tr_name_en']; $tab_content .= '</label>'; $tab_content .= ' <ul class="category_listing_ul_' . $counter . '" id="msAdmin_category_listing_ul">'; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $tab_content .= '<li class="item_' . $counter . ' form-inline">'; $tab_content .= '<label class="tree_item_label">'; $tab_content .= htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $row['cn_short_en'])); $tab_content .= '</label> '; $tab_content .= '<select name="tax_id[' . $row['cn_iso_nr'] . '][0]" class="form-control form-control-country"><option value="">' . $this->pi_getLL('admin_no_tax') . '</option>'; $query3 = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_multishop_tax_rules', "cn_iso_nr='" . $row['cn_iso_nr'] . "' and zn_country_iso_nr='0' and rules_group_id\t = " . $this->get['rules_group_id'], '', '', ''); $res3 = $GLOBALS['TYPO3_DB']->sql_query($query3); $row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res3); foreach ($taxes as $tax) { $tab_content .= '<option value="' . $tax['tax_id'] . '"' . ($tax['tax_id'] == $row3['tax_id'] ? ' selected' : '') . '>' . $tax['name'] . '</option>' . "\n"; } $tab_content .= '</select> '; // now load the stated $query2 = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'static_country_zones', 'zn_country_iso_nr=' . $row['cn_iso_nr'], '', '', ''); $res2 = $GLOBALS['TYPO3_DB']->sql_query($query2); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res2) > 0) { $tab_content .= '<div class="state_tax_sb_wrapper"><ul class="state_tax_sb">'; while ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) {
public function mailUser($user, $subject, $body, $from_email = '*****@*****.**', $from_name = 'TYPO3 Multishop', $attachments = array(), $options = array()) { if ($user['email']) { $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->Encoding = 'base64'; $mail->XMailer = ' '; if ($GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] == 'smtp') { $mail->IsSMTP(); if (strstr($GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server'], ':')) { // Hostname also has port number $array = explode(':', $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server']); $mail->Host = $array[0]; $mail->Port = $array[1]; } else { $mail->Host = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server']; } if (isset($GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_username'])) { $mail->SMTPAuth = true; if (!empty($GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_encrypt'])) { $mail->SMTPSecure = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_encrypt']; } $mail->Username = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_username']; $mail->Password = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_password']; } } if (is_array($options['add_custom_header'])) { foreach ($options['add_custom_header'] as $custom_header) { $mail->AddCustomHeader($custom_header); } } // $mail->IsSendmail(); // telling the class to use SendMail transport if (isset($options['email_tmpl_path']) && $options['email_tmpl_path']) { $template = $this->cObj->fileResource($options['email_tmpl_path']); } else { if ($this->conf['email_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['email_tmpl_path']); } else { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/email_template.tmpl'); } } $markerArray = array(); $markerArray['###SUBJECT###'] = $subject; $markerArray['###BODY###'] = $body; // ADDITIONAL OPTIONAL MARKERS $markerArray['###STORE_NAME###'] = $this->ms['MODULES']['STORE_NAME']; $markerArray['###STORE_EMAIL###'] = $this->ms['MODULES']['STORE_EMAIL']; $markerArray['###STORE_DOMAIN###'] = $this->server['HTTP_HOST']; $markerArray['###STORE_URL###'] = $this->FULL_HTTP_URL; $markerArray['###STORE_ADDRESS###'] = ''; $markerArray['###STORE_ZIP###'] = ''; $markerArray['###STORE_CITY###'] = ''; $markerArray['###STORE_COUNTRY###'] = ''; if (!empty($this->conf['tt_address_record_id_store']) && $this->conf['tt_address_record_id_store'] > 0) { $address = mslib_befe::getRecord($this->conf['tt_address_record_id_store'], 'tt_address', 'uid'); if (is_array($address) && $address['uid']) { $markerArray['###STORE_ADDRESS###'] = $address['address']; $markerArray['###STORE_ZIP###'] = $address['zip']; $markerArray['###STORE_CITY###'] = $address['city']; $markerArray['###STORE_COUNTRY###'] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $address['country']); } } if (is_array($options['markerArray']) && count($options['markerArray'])) { foreach ($options['markerArray'] as $key => $val) { $markerArray[$key] = $val; } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailUserBodyTemplatePreProc'])) { $params = array('markerArray' => &$markerArray, 'user' => &$user, 'subject' => &$subject, 'body' => &$body, 'from_email' => &$from_email, 'from_name' => &$from_name, 'attachments' => &$attachments, 'options' => &$options); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailUserBodyTemplatePreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $body = $this->cObj->substituteMarkerArray($template, $markerArray); // try to change URL images to embedded $mail->SetFrom($from_email, $from_name); if (!empty($this->ms['MODULES']['STORE_REPLY_TO_EMAIL'])) { $mail->AddReplyTo($this->ms['MODULES']['STORE_REPLY_TO_EMAIL']); } if (count($attachments)) { foreach ($attachments as $path) { if ($path and is_file($path)) { $mail->AddAttachment($path); } } } $mail->Subject = $subject; //$mail->AltBody=$this->pi_getLL('admin_label_email_html_warning'); // optional, comment out and test if (!$options['withoutImageEmbedding']) { self::MsgHTMLwithEmbedImages($mail, $body); } else { $mail->MsgHTML($body, $this->DOCUMENT_ROOT); } if (!isset($options['skipSending'])) { $options['skipSending'] = 0; } //hook to let other plugins further manipulate the query if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailUserSendPreProc'])) { $params = array('user' => &$user, 'subject' => &$subject, 'body' => &$body, 'from_email' => &$from_email, 'from_name' => &$from_name, 'attachments' => &$attachments, 'options' => &$options, 'mailObj' => &$mail); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailUserSendPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $mail->AddAddress($user['email'], $user['username']); if (!$options['skipSending']) { //hook to let other plugins further manipulate the query $return_status = $mail->Send(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailUserSendPostProc'])) { $params = array('user' => &$user, 'subject' => &$subject, 'body' => &$body, 'from_email' => &$from_email, 'from_name' => &$from_name, 'attachments' => &$attachments, 'options' => &$options, 'return_status' => &$return_status, 'mailObj' => &$mail); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailUserSendPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($return_status) { return 1; } else { return 0; } } else { // Skip sending but return true return 1; } } else { return 0; } }
function mailOrder($orders_id, $copy_to_merchant = 1, $custom_email_address = '', $mail_template = '') { $order = mslib_fe::getOrder($orders_id); if ($order['orders_id']) { $order['mail_template'] = $mail_template; if (isset($order['language_id'])) { // Switch to language that is stored in the order mslib_befe::setSystemLanguage($order['language_id']); } if (!$custom_email_address) { $custom_email_address = $order['billing_email']; } $billing_address = ''; $delivery_address = ''; $full_customer_name = $order['billing_first_name']; if ($order['billing_middle_name']) { $full_customer_name .= ' ' . $order['billing_middle_name']; } if ($order['billing_last_name']) { $full_customer_name .= ' ' . $order['billing_last_name']; } $delivery_full_customer_name = $order['delivery_first_name']; if ($order['delivery_middle_name']) { $delivery_full_customer_name .= ' ' . $order['delivery_middle_name']; } if ($order['delivery_last_name']) { $delivery_full_customer_name .= ' ' . $order['delivery_last_name']; } $full_customer_name = preg_replace('/\\s+/', ' ', $full_customer_name); $delivery_full_customer_name = preg_replace('/\\s+/', ' ', $delivery_full_customer_name); if (!$order['delivery_address'] or !$order['delivery_city']) { $order['delivery_company'] = $order['billing_company']; $order['delivery_street_name'] = $order['billing_street_name']; $order['delivery_building'] = $order['billing_building']; $order['delivery_address'] = $order['billing_address']; $order['delivery_address_number'] = $order['billing_address_number']; $order['delivery_address_ext'] = $order['billing_address_ext']; $order['delivery_zip'] = $order['billing_zip']; $order['delivery_city'] = $order['billing_city']; $order['delivery_telephone'] = $order['billing_telephone']; $order['delivery_mobile'] = $order['billing_mobile']; } if ($order['delivery_company']) { $delivery_address = $order['delivery_company'] . "<br />"; } if ($delivery_full_customer_name) { $delivery_address .= $delivery_full_customer_name . "<br />"; } if ($order['delivery_building']) { $delivery_address .= $order['delivery_building'] . "<br />"; } if ($order['delivery_address']) { $delivery_address .= $order['delivery_address'] . "<br />"; } if ($order['delivery_zip'] and $order['delivery_city']) { $delivery_address .= $order['delivery_zip'] . " " . $order['delivery_city']; } if ($order['delivery_country'] && mslib_befe::strtolower($order['delivery_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) { // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP $delivery_address .= '<br />' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']); } // if ($order['delivery_telephone']) $delivery_address.=ucfirst($this->pi_getLL('telephone')).': '.$order['delivery_telephone']."<br />"; // if ($order['delivery_mobile']) $delivery_address.=ucfirst($this->pi_getLL('mobile')).': '.$order['delivery_mobile']."<br />"; if ($order['billing_company']) { $billing_address = $order['billing_company'] . "<br />"; } if ($full_customer_name) { $billing_address .= $full_customer_name . "<br />"; } if ($order['billing_building']) { $billing_address .= $order['billing_building'] . "<br />"; } if ($order['billing_address']) { $billing_address .= $order['billing_address'] . "<br />"; } if ($order['billing_zip'] and $order['billing_city']) { $billing_address .= $order['billing_zip'] . " " . $order['billing_city']; } if ($order['billing_country'] && mslib_befe::strtolower($order['billing_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) { // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP $billing_address .= '<br />' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['billing_country']); } $loadFromPids = array(); if ($this->conf['masterShop']) { $loadFromPids[] = $order['page_uid']; $loadFromPids[] = $this->shop_pid; if ($this->showCatalogFromPage and $this->showCatalogFromPage != $this->shop_pid) { $loadFromPids[] = $this->showCatalogFromPage; } } // psp email template $psp_mail_template = array(); if ($order['payment_method']) { $psp_data = mslib_fe::loadPaymentMethod($order['payment_method']); $psp_vars = unserialize($psp_data['vars']); if (isset($psp_vars['order_confirmation'])) { $psp_mail_template['order_confirmation'] = ''; if ($psp_vars['order_confirmation'] > 0) { $psp_mail_template['order_confirmation'] = mslib_fe::getCMSType($psp_vars['order_confirmation']); } } if (isset($psp_vars['order_paid'])) { $psp_mail_template['order_paid'] = ''; if ($psp_vars['order_paid'] > 0) { $psp_mail_template['order_paid'] = mslib_fe::getCMSType($psp_vars['order_paid']); } } } // loading the email template $page = array(); //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPreCMSContent'])) { $params = array('page' => &$page, 'order' => &$order, 'mail_template' => $mail_template, 'psp_mail_template' => $psp_mail_template, 'loadFromPids' => $loadFromPids); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPreCMSContent'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($mail_template) { switch ($mail_template) { case 'email_order_paid_letter': if (isset($psp_mail_template['order_paid'])) { $page = array(); if (!empty($psp_mail_template['order_paid'])) { $page = mslib_fe::getCMScontent($psp_mail_template['order_paid'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } } else { if ($order['payment_method']) { $page = mslib_fe::getCMScontent('email_order_paid_letter_' . $order['payment_method'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } if (!count($page[0])) { $page = mslib_fe::getCMScontent('email_order_paid_letter', $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } } break; default: $page = mslib_fe::getCMScontent($mail_template, $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); break; } } else { if ($order['is_proposal']) { // proposal template $mail_template = 'email_order_proposal'; $page = mslib_fe::getCMScontent($mail_template, $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } else { // normal order template if (isset($psp_mail_template['order_confirmation'])) { $page = array(); if (!empty($psp_mail_template['order_confirmation'])) { $page = mslib_fe::getCMScontent($psp_mail_template['order_confirmation'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } } else { if ($order['payment_method']) { $page = mslib_fe::getCMScontent('email_order_confirmation_' . $order['payment_method'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } if (!count($page[0])) { $page = mslib_fe::getCMScontent('email_order_confirmation', $GLOBALS['TSFE']->sys_language_uid, $loadFromPids); } } } } //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPostCMSContent'])) { $params = array('page' => &$page, 'order' => &$order, 'mail_template' => $mail_template, 'psp_mail_template' => $psp_mail_template, 'loadFromPids' => $loadFromPids); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPostCMSContent'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($page[0]['content']) { // loading the email confirmation letter eof // replacing the variables with dynamic values $array1 = array(); $array2 = array(); $array1[] = '###GENDER_SALUTATION###'; $array2[] = mslib_fe::genderSalutation($order['billing_gender']); // full billing name $array1[] = '###BILLING_FULL_NAME###'; $array2[] = $full_customer_name; $array1[] = '###FULL_NAME###'; $array2[] = $full_customer_name; $array1[] = '###BILLING_NAME###'; $array2[] = $order['billing_name']; $array1[] = '###BILLING_COMPANY###'; $array2[] = $order['billing_company']; $array1[] = '###BILLING_FIRST_NAME###'; $array2[] = $order['billing_first_name']; $array1[] = '###BILLING_LAST_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $order['billing_middle_name'] . ' ' . $order['billing_last_name']); $array1[] = '###BILLING_EMAIL###'; $array2[] = $order['billing_email']; $array1[] = '###BILLING_TELEPHONE###'; $array2[] = $order['billing_telephone']; $array1[] = '###BILLING_MOBILE###'; $array2[] = $order['billing_mobile']; // full delivery name $array1[] = '###DELIVERY_NAME###'; $array2[] = $order['delivery_name']; $array1[] = '###DELIVERY_FULL_NAME###'; $array2[] = $delivery_full_customer_name; $array1[] = '###DELIVERY_COMPANY###'; $array2[] = $order['delivery_company']; $array1[] = '###DELIVERY_FIRST_NAME###'; $array2[] = $order['delivery_first_name']; $array1[] = '###DELIVERY_LAST_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $order['delivery_middle_name'] . ' ' . $order['delivery_last_name']); $array1[] = '###DELIVERY_EMAIL###'; $array2[] = $order['delivery_email']; $array1[] = '###DELIVERY_TELEPHONE###'; $array2[] = $order['delivery_telephone']; $array1[] = '###DELIVERY_MOBILE###'; $array2[] = $order['delivery_mobile']; $array1[] = '###CUSTOMER_EMAIL###'; $array2[] = $order['billing_email']; if ($order['cruser_id'] && is_numeric($order['cruser_id'])) { $crUser = mslib_fe::getUser($order['cruser_id']); $array1[] = '###CREATED_BY_FIRST_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $crUser['first_name']); $array1[] = '###CREATED_BY_LAST_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $crUser['middle_name'] . ' ' . $crUser['last_name']); $array1[] = '###CREATED_BY_FULL_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $crUser['first_name'] . ' ' . $crUser['middle_name'] . ' ' . $crUser['last_name']); } else { $array1[] = '###CREATED_BY_FIRST_NAME###'; $array2[] = ''; $array1[] = '###CREATED_BY_LAST_NAME###'; $array2[] = ''; $array1[] = '###CREATED_BY_FULL_NAME###'; $array2[] = ''; } $time = $order['crdate']; $long_date = strftime($this->pi_getLL('full_date_format'), $time); $array1[] = '###ORDER_DATE_LONG###'; // ie woensdag 23 juni, 2010 $array2[] = $long_date; $array1[] = '###ORDER_DATE###'; // 21-12-2010 in localized format $array2[] = strftime("%x", $time); // backwards compatibility $array1[] = '###LONG_DATE###'; // ie woensdag 23 juni, 2010 $array2[] = $long_date; $time = time(); $long_date = strftime($this->pi_getLL('full_date_format'), $time); $array1[] = '###CURRENT_DATE_LONG###'; // ie woensdag 23 juni, 2010 $array2[] = $long_date; $array1[] = '###STORE_NAME###'; $array2[] = $this->ms['MODULES']['STORE_NAME']; $array1[] = '###TOTAL_AMOUNT###'; $array2[] = mslib_fe::amount2Cents($order['total_amount']); $array1[] = '###PROPOSAL_NUMBER###'; $array2[] = $order['orders_id']; $array1[] = '###ORDER_NUMBER###'; $array2[] = $order['orders_id']; $array1[] = '###ORDER_LINK###'; $array2[] = ''; $array1[] = '###ORDER_STATUS###'; $array2[] = $order['orders_status']; $array1[] = '###TRACK_AND_TRACE_CODE###'; $array2[] = $order['track_and_trace_code']; $array1[] = '###BILLING_ADDRESS###'; $array2[] = $billing_address; $array1[] = '###DELIVERY_ADDRESS###'; $array2[] = $delivery_address; $array1[] = '###BILLING_STREET_NAME###'; $array2[] = $order['billing_street_name']; $array1[] = '###BILLING_ADDRESS_NUMBER###'; $array2[] = $order['billing_address_number']; $array1[] = '###BILLING_ADDRESS_EXT###'; $array2[] = $order['billing_address_ext']; $array1[] = '###BILLING_ZIP###'; $array2[] = $order['billing_zip']; $array1[] = '###BILLING_CITY###'; $array2[] = $order['billing_city']; $array1[] = '###BILLING_COUNTRY###'; $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['billing_country']); $array1[] = '###DELIVERY_STREET_NAME###'; $array2[] = $order['delivery_street_name']; $array1[] = '###DELIVERY_ADDRESS_NUMBER###'; $array2[] = $order['delivery_address_number']; $array1[] = '###DELIVERY_ADDRESS_EXT###'; $array2[] = $order['delivery_address_ext']; $array1[] = '###DELIVERY_ZIP###'; $array2[] = $order['delivery_zip']; $array1[] = '###DELIVERY_CITY###'; $array2[] = $order['delivery_city']; $array1[] = '###DELIVERY_COUNTRY###'; $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']); $array1[] = '###CUSTOMER_ID###'; $array2[] = $order['customer_id']; $ORDER_DETAILS = self::printOrderDetailsTable($order, 'email'); if ($this->ms['MODULES']['CREATE_INVOICE_DIRECTLY_AFTER_CREATING_ORDER']) { // FORCE CREATE INVOICE IF NOT ALREADY EXISTING $invoice = mslib_fe::getOrderInvoice($order['orders_id'], 1); } else { $invoice = mslib_fe::getOrderInvoice($order['orders_id'], 0); } $invoice_id = ''; $invoice_link = ''; if (is_array($invoice)) { $invoice_id = $invoice['invoice_id']; $invoice_link = '<a href="' . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', '&tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash']) . '">' . $invoice['invoice_id'] . '</a>'; } $array1[] = '###INVOICE_NUMBER###'; $array2[] = $invoice_id; $array1[] = '###INVOICE_LINK###'; $array2[] = $invoice_link; $array1[] = '###ORDER_DETAILS###'; $array2[] = $ORDER_DETAILS; $array1[] = '###SHIPPING_METHOD###'; $array2[] = $order['shipping_method_label']; $array1[] = '###PAYMENT_METHOD###'; $array2[] = $order['payment_method_label']; $array1[] = '###EXPECTED_DELIVERY_DATE###'; if ($order['expected_delivery_date'] > 0) { $array2[] = strftime("%x", $order['expected_delivery_date']); } else { $array2[] = ''; } $array1[] = '###EXPECTED_DELIVERY_DATE_LONG###'; if ($order['expected_delivery_date'] > 0) { $array2[] = strftime($this->pi_getLL('full_date_format'), $order['expected_delivery_date']); } else { $array2[] = ''; } $array1[] = '###CUSTOMER_COMMENTS###'; $array2[] = $order['customer_comments']; if ($order['customer_id'] > 0) { $user = mslib_fe::getUser($order['customer_id']); $array1[] = '###USERNAME###'; $array2[] = $user['username']; if (isset($this->post['password']) && !empty($this->post['password']) && $order['customer_id'] > 0) { $array1[] = '###PASSWORD###'; $array2[] = $this->post['password']; } } //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderReplacersPostProc'])) { $params = array('array1' => &$array1, 'array2' => &$array2, 'order' => &$order, 'mail_template' => $mail_template, 'loadFromPids' => $loadFromPids); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderReplacersPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // Copy $pageCopyToMerchant = $page; if ($page[0]['content']) { $page[0]['content'] = str_replace($array1, $array2, $page[0]['content']); } if ($page[0]['name']) { $page[0]['name'] = str_replace($array1, $array2, $page[0]['name']); } // replacing the variables with dynamic values eof $user = array(); $user['name'] = $full_customer_name; $user['email'] = $custom_email_address; //hook $send_mail = 1; $mail_attachment = array(); $add_invoice_attachment_on_templates = array(); $add_invoice_attachment_on_templates[] = 'email_order_paid_letter'; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrder'])) { $params = array('this' => &$this, 'page' => &$page, 'content' => &$content, 'send_mail' => &$send_mail, 'user' => $user, 'order' => $order, 'order_details' => $ORDER_DETAILS, 'copy_to_merchant' => $copy_to_merchant, 'mail_attachment' => &$mail_attachment, 'loadFromPids' => $loadFromPids, 'add_invoice_attachment_on_templates' => &$add_invoice_attachment_on_templates); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrder'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($send_mail) { if ($user['email']) { if (in_array($mail_template, $add_invoice_attachment_on_templates) && $this->ms['MODULES']['ATTACH_INVOICE_PDF_IN_PAID_LETTER_EMAIL'] > 0) { $filterInvoice = array(); $filterInvoice[] = 'orders_id=' . $order['orders_id']; $invoices = mslib_befe::getRecords('', 'tx_multishop_invoices', '', $filterInvoice, '', 'id desc'); $invoice = $invoices[0]; $pdfFileName = $invoice['invoice_id'] . '_' . $invoice['orders_id'] . '.pdf'; $pdfFilePath = $this->DOCUMENT_ROOT . 'uploads/tx_multishop/tmp/' . $pdfFileName; // generate the invoice PDF // Get Language code (ie nl, en, de) $language_code = mslib_befe::getLanguageIso2ByLanguageUid($order['language_id']); $language_code = strtolower($language_code); // Download invoice in the language of the order $invoice_data = mslib_fe::file_get_contents($this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', 'tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash'] . '&tx_multishop_pi1[forceRecreate]=1&language=' . $language_code)); file_put_contents($pdfFilePath, $invoice_data); $mail_attachment[] = $pdfFilePath; } mslib_fe::mailUser($user, $page[0]['name'], $page[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME'], $mail_attachment); // moved to cleaning up section //if (strpos($mail_template, 'email_order_paid_letter')!==false && $this->ms['MODULES']['ATTACH_INVOICE_PDF_IN_PAID_LETTER_EMAIL']>0 && file_exists($pdfFilePath)) { // unlink($pdfFilePath); //} } if ($copy_to_merchant) { $mailSubject = ''; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderToMerchant'])) { $conf = array('this' => &$this, 'page' => &$page, 'content' => &$content, 'send_mail' => &$send_mail, 'user' => $user, 'order' => $order, 'order_details' => $ORDER_DETAILS, 'mail_attachment' => &$mail_attachment, 'mail_template' => $mail_template, 'psp_mail_template' => $psp_mail_template, 'loadFromPids' => $loadFromPids, 'mailSubject' => &$mailSubject, 'pageCopyToMerchant' => &$pageCopyToMerchant, 'array1' => &$array1, 'array2' => &$array2); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderToMerchant'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $conf, $this); } } if ($pageCopyToMerchant[0]['content']) { $pageCopyToMerchant[0]['content'] = str_replace($array1, $array2, $pageCopyToMerchant[0]['content']); } if ($pageCopyToMerchant[0]['name']) { $pageCopyToMerchant[0]['name'] = str_replace($array1, $array2, $pageCopyToMerchant[0]['name']); } if ($mailSubject == '') { $mailSubject = $this->pi_getLL('copy_for_merchant') . ': ' . $pageCopyToMerchant[0]['name']; } // now mail a copy to the merchant $merchant = array(); $merchant['name'] = $this->ms['MODULES']['STORE_NAME']; $merchant['email'] = $this->ms['MODULES']['STORE_EMAIL']; mslib_fe::mailUser($merchant, $mailSubject, $pageCopyToMerchant[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME'], $mail_attachment); if ($this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO']) { $email = array(); if (!strstr($this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO'], ",")) { $email[] = $this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO']; } else { $email = explode(',', $this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO']); } if (count($email)) { foreach ($email as $item) { $merchant = array(); $merchant['name'] = $this->ms['MODULES']['STORE_NAME']; $merchant['email'] = $item; mslib_fe::mailUser($merchant, $mailSubject, $pageCopyToMerchant[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME'], $mail_attachment); } } } } // cleaning up the temporary attachment files if (is_array($mail_attachment) && count($mail_attachment)) { foreach ($mail_attachment as $filepath) { if (strpos($filepath, 'tx_multishop/tmp') !== false) { if (file_exists($filepath)) { @unlink($filepath); } } } } } } if (isset($order['language_id'])) { // Switch back to default language mslib_befe::resetSystemLanguage(); } return 1; } }
} if ($full_customer_name) { $billing_address .= $full_customer_name . "<br />"; } if ($order['billing_building']) { $billing_address .= $order['billing_building'] . "<br />"; } if ($order['billing_address']) { $billing_address .= $order['billing_address'] . "<br />"; } if ($order['billing_zip'] and $order['billing_city']) { $billing_address .= $order['billing_zip'] . " " . $order['billing_city']; } if ($order['billing_country'] && mslib_befe::strtolower($order['billing_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) { // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP $billing_address .= '<br />' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['billing_country']); } $array1 = array(); $array2 = array(); $array1[] = '###GENDER_SALUTATION###'; $array2[] = mslib_fe::genderSalutation($order['billing_gender']); $array1[] = '###DELIVERY_FIRST_NAME###'; $array2[] = $order['delivery_first_name']; $array1[] = '###DELIVERY_LAST_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $order['delivery_middle_name'] . ' ' . $order['delivery_last_name']); $array1[] = '###BILLING_FIRST_NAME###'; $array2[] = $order['billing_first_name']; $array1[] = '###BILLING_LAST_NAME###'; $array2[] = preg_replace('/\\s+/', ' ', $order['billing_middle_name'] . ' ' . $order['billing_last_name']); $array1[] = '###BILLING_TELEPHONE###'; $array2[] = $order['billing_telephone'];
$array1[] = '###STORE_URL###'; $array2[] = $this->FULL_HTTP_URL; $setEmptyStoreMarkers = 1; if (!empty($this->conf['tt_address_record_id_store']) && $this->conf['tt_address_record_id_store'] > 0) { $address = mslib_befe::getRecord($this->conf['tt_address_record_id_store'], 'tt_address', 'uid'); if (is_array($address) && $address['uid']) { $array1[] = '###STORE_ADDRESS###'; $array2[] = $address['address']; $array1[] = '###STORE_ZIP###'; $array2[] = $address['zip']; $array1[] = '###STORE_CITY###'; $array2[] = $address['city']; $array1[] = '###STORE_TELEPHONE###'; $array2[] = $address['telephone']; $array1[] = '###STORE_COUNTRY###'; $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $address['country']); $setEmptyStoreMarkers = 0; } } if ($setEmptyStoreMarkers) { $array1[] = '###STORE_ADDRESS###'; $array2[] = ''; $array1[] = '###STORE_ZIP###'; $array2[] = ''; $array1[] = '###STORE_CITY###'; $array2[] = ''; $array1[] = '###STORE_TELEPHONE###'; $array2[] = ''; $array1[] = '###STORE_COUNTRY###'; $array2[] = ''; }
$subpartArray['###CHECKOUT_LINK###'] = $output['checkout_link']; $subpartArray['###LABEL_CHECKOUT###'] = $output['label_checkout']; $subpartArray['###ITEM###'] = $contentItem; $subpartArray['###CART_FOOTER###'] = $footerItem; // shipping cost $subpartArray['###SHIPPING_COST_COUNTRY_SELECTION###'] = ''; if ($this->ms['MODULES']['DISPLAY_SHIPPING_COSTS_ON_SHOPPING_CART_PAGE']) { // load countries $deliver_to_sb = ''; // load enabled countries to array $str2 = "SELECT * from static_countries sc, tx_multishop_countries_to_zones c2z, tx_multishop_shipping_countries c where c.page_uid='" . $this->showCatalogFromPage . "' and sc.cn_iso_nr=c.cn_iso_nr and c2z.cn_iso_nr=sc.cn_iso_nr group by c.cn_iso_nr order by sc.cn_short_en"; //$str2="SELECT * from static_countries c, tx_multishop_countries_to_zones c2z where c2z.cn_iso_nr=c.cn_iso_nr order by c.cn_short_en"; $qry2 = $GLOBALS['TYPO3_DB']->sql_query($str2); $enabled_countries = array(); while (($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2)) != false) { $countries_name = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $row2['cn_short_en']); $row2['locale_countries_name'] = $countries_name; $enabled_countries[$countries_name] = $row2; } ksort($enabled_countries); // load enabled countries to array eof if (count($enabled_countries) == 1) { $deliver_to_sb .= '<input name="deliver_to_country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; } else { $default_country = mslib_fe::getCountryByIso($this->tta_shop_info['cn_iso_nr']); foreach ($enabled_countries as $country) { $tmpcontent_con .= '<option value="' . mslib_befe::strtolower($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($default_country['cn_short_en']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars($country['locale_countries_name']) . '</option>'; } if ($tmpcontent_con) { $deliver_to_sb .= ' <select name="deliver_to_country" id="deliver_to_country" class="country" title="' . $this->pi_getLL('country_is_required') . '">
$str2 = "SELECT * from static_countries sc, tx_multishop_countries_to_zones c2z, tx_multishop_shipping_countries c where c.page_uid='" . $this->showCatalogFromPage . "' and sc.cn_iso_nr=c.cn_iso_nr and c2z.cn_iso_nr=sc.cn_iso_nr group by c.cn_iso_nr order by c2z.zone_id asc, sc.cn_short_" . $this->lang . " asc"; //$str2="SELECT * from static_countries c, tx_multishop_countries_to_zones c2z where c2z.cn_iso_nr=c.cn_iso_nr order by c.cn_short_en"; $qry2 = $GLOBALS['TYPO3_DB']->sql_query($str2); $enabled_countries = array(); while (($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2)) != false) { $shipping_cost_data = array(); $shipping_cost_data = mslib_fe::getProductShippingCostsOverview($row2['cn_iso_nr'], $this->post['tx_multishop_pi1']['pid'], $this->post['tx_multishop_pi1']['qty']); foreach ($shipping_cost_data as $shipping_code => $shipping_cost) { if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $return_data['shipping_cost'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = $shipping_cost['shipping_costs_including_vat']; $return_data['shipping_costs_display'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = mslib_fe::amount2Cents($shipping_cost['shipping_costs_including_vat']); } else { $return_data['shipping_cost'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = $shipping_cost['shipping_costs']; $return_data['shipping_costs_display'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = mslib_fe::amount2Cents($shipping_cost['shipping_costs']); } $return_data['deliver_to'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $row2['cn_short_en'])); $return_data['deliver_by'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = $shipping_cost['deliver_by']; $return_data['shipping_method'][$row2['zone_id']][$shipping_code][$row2['cn_iso_nr']] = $shipping_cost; $return_data['products_name'] = $shipping_cost['product_name']; } } echo json_encode($return_data); } exit; break; case 'get_images_for_crop': switch ($this->get['tx_multishop_pi1']['crop_section']) { case 'manufacturers': $image_type = 'manufacturers'; $image_size = 'enlarged'; $image_size_format = 'normal';
public function customerAddressFormat($address_data, $address_type = 'billing', $address_format = 'default') { $address_format_setting = $this->ms['MODULES']['ADDRESS_FORMAT']; //hook to let other plugins further manipulate the settings if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['customerAddressFormatSetting'])) { $params = array('address_format_setting' => &$address_format_setting, 'address_data' => &$address_data, 'address_type' => &$address_type, 'address_format' => &$address_format); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['customerAddressFormatSetting'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $array1 = array(); $array2 = array(); $array1[] = '###STREET_NAME###'; $array2[] = $address_data['street_name']; if (!empty($address_data['building'])) { $array1[] = '###BUILDING###'; $array2[] = $address_data['building']; } else { if (strpos($address_format_setting, '###BUILDING###<br/>') !== false) { $array1[] = '###BUILDING###<br/>'; $array2[] = ''; } else { $array1[] = '###BUILDING###'; $array2[] = ''; } } if (strpos($address_format_setting, '###BUILDING###') === false && $address_data['building']) { $array1[] = '###ADDRESS###'; $array2[] = $address_data['building'] . '<br/>' . $address_data['address']; } else { $array1[] = '###ADDRESS###'; $array2[] = $address_data['address']; } $array1[] = '###ZIP###'; $array2[] = $address_data['zip']; $array1[] = '###CITY###'; $array2[] = $address_data['city']; $array1[] = '###COUNTRY###'; $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $address_data['country']); $array1[] = '###STATE###'; $array2[] = $address_data['state']; $array1[] = '###FULL_NAME###'; $array2[] = $address_data['name']; $array1[] = '###FIRST_NAME###'; $array2[] = $address_data['first_name']; $array1[] = '###LAST_NAME###'; $array2[] = $address_data['last_name']; $array1[] = '###EMAIL###'; $array2[] = $address_data['email']; $array1[] = '###TELEPHONE###'; $array2[] = $address_data['telephone']; $array1[] = '###FAX###'; $array2[] = $address_data['fax']; $array1[] = '###VAT_ID###'; $array2[] = $address_data['vat_id']; $array1[] = '###COC_ID###'; $array2[] = $address_data['coc_id']; $address_format_value = ''; if ($address_format_setting) { $address_format_value = str_replace($array1, $array2, $address_format_setting); } return $address_format_value; }
if ($user['lastlogin']) { $user['lastlogin'] = strftime("%a. %x %X", $user['lastlogin']); } else { $user['lastlogin'] = '******'; } $markerArray['LAST_LOGIN'] = $this->pi_getLL('latest_login') . ': ' . $user['lastlogin'] . '<br/>'; $markerArray['BILLING_BUILDING'] = ''; if ($customer_billing_address['building']) { $markerArray['BILLING_BUILDING'] = $customer_billing_address['building'] . '<br/>'; } $markerArray['BILLING_ADDRESS'] = $billing_street_address . '<br/>' . $billing_postcode . '<br/>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $billing_country)); $markerArray['DELIVERY_BUILDING'] = ''; if ($customer_delivery_address['building']) { $markerArray['DELIVERY_BUILDING'] = $customer_delivery_address['building'] . '<br/>'; } $markerArray['DELIVERY_ADDRESS'] = $delivery_street_address . '<br/>' . $delivery_postcode . '<br/>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $delivery_country)); $markerArray['GOOGLE_MAPS_URL_QUERY'] = '//maps.google.com/maps?f=q&source=s_q&&geocode=&q=' . rawurlencode($billing_street_address) . ',' . rawurlencode($billing_postcode) . ',' . rawurlencode($billing_country) . '&z=14&iwloc=A&output=embed&iwloc='; $markerArray['ADMIN_LABEL_CONTACT_INFO'] = $this->pi_getLL('admin_label_contact_info'); $markerArray['ADMIN_LABEL_BILLING_ADDRESS'] = $this->pi_getLL('admin_label_billing_address'); $markerArray['ADMIN_LABEL_DELIVERY_ADDRESS'] = $this->pi_getLL('admin_label_delivery_address'); // customers related orders listings $filter = array(); $from = array(); $having = array(); $match = array(); $orderby = array(); $where = array(); $select = array(); $select[] = 'o.*'; $filter[] = 'o.customer_id=' . $user['uid']; if (!$this->masterShop) {