Example #1
0
 function send_order_email($zf_insert_id, $zf_mode = FALSE)
 {
     global $currencies, $order_totals;
     $this->notify('NOTIFY_ORDER_SEND_EMAIL_INITIALIZE', array(), $zf_insert_id, $order_totals, $zf_mode);
     if (!defined('ORDER_EMAIL_DATE_FORMAT')) {
         define('ORDER_EMAIL_DATE_FORMAT', 'M-d-Y h:iA');
     }
     $this->send_low_stock_emails = TRUE;
     $this->notify('NOTIFY_ORDER_SEND_LOW_STOCK_EMAILS');
     if ($this->send_low_stock_emails && $this->email_low_stock != '' && SEND_LOWSTOCK_EMAIL == '1') {
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock');
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $html_msg = array();
     //intro area
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $html_msg['INTRO_STORE_NAME'] = STORE_NAME;
     $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id;
     $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     $html_msg['INTRO_URL_TEXT'] = EMAIL_TEXT_INVOICE_URL_CLICK;
     $html_msg['INTRO_URL_VALUE'] = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
     $html_msg['EMAIL_CUSTOMER_PHONE'] = $this->customer['telephone'];
     $html_msg['EMAIL_ORDER_DATE'] = date(ORDER_EMAIL_DATE_FORMAT);
     $invoiceInfo = EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     $htmlInvoiceURL = EMAIL_TEXT_INVOICE_URL_CLICK;
     $htmlInvoiceValue = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     //comments area
     if ($this->info['comments']) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
     } else {
         $html_msg['ORDER_COMMENTS'] = '';
     }
     $this->notify('NOTIFY_ORDER_EMAIL_BEFORE_PRODUCTS', array(), $email_order, $html_msg);
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n";
     $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     //order totals area
     $html_ot = '<tr><td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td> </tr>' . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td> </tr>' . "\n";
     }
     $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
     //addresses area: Delivery
     $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION;
     $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
     $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
     $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
     if (is_object($GLOBALS[$_SESSION['payment']])) {
         $cc_num_display = isset($this->info['cc_number']) && $this->info['cc_number'] != '' ? str_repeat('X', strlen($this->info['cc_number']) - 8) . substr($this->info['cc_number'], -4) . "\n\n" : '';
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         $email_order .= isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
         $email_order .= $GLOBALS[$payment_class]->email_footer ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
     } else {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $email_order .= PAYMENT_METHOD_GV . "\n\n";
     }
     $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
     $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV;
     $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '' ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');
     // include disclaimer
     if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '') {
         $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     }
     // include copyright
     if (defined('EMAIL_FOOTER_COPYRIGHT')) {
         $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     }
     $email_order = str_replace('&nbsp;', ' ', $email_order);
     $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EXTRA_INFO'] = '';
     $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg), $email_order, $html_msg);
     zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         // include authcode and transaction id in admin-copy of email
         if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
             $pmt_details = ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ? 'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id : '') . "\n\n";
             $email_order = $pmt_details . $email_order;
             $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
         }
         // Add extra heading stuff via observer class
         $this->extra_header_text = '';
         $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', $zf_insert_id, $email_order, $html_msg);
         $email_order = $this->extra_header_text . $email_order;
         $html_msg['EMAIL_TEXT_HEADER'] = nl2br($this->extra_header_text) . $html_msg['EMAIL_TEXT_HEADER'];
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray, $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address']);
     }
     $this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', $zf_insert_id, $email_order, $extra_info, $html_msg);
 }
 function send_order_email($zf_insert_id, $zf_mode)
 {
     global $currencies, $order_totals;
     //      print_r($this);
     //      die();
     if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         // send an email
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock');
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $html_msg = array();
     //intro area
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . EMAIL_GREET . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n" . ($html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER);
     $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $html_msg['INTRO_STORE_NAME'] = STORE_NAME;
     $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id;
     $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     //comments area
     if ($this->info['comments']) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $html_msg['ORDER_COMMENTS'] = zen_db_output($this->info['comments']);
     } else {
         $html_msg['ORDER_COMMENTS'] = '';
     }
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n";
     $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     //order totals area
     $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td></tr><tr>';
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td></tr><tr>';
     }
     $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . $html_ot . '</table>';
     $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION;
     $html_msg['ADDRESS_CUSTOMER_TITLE'] = EMAIL_TEXT_CUSTOMER_ADDRESS;
     $html_msg['ADDRESS_CUSTOMER_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, '', "<br />") . '<br />' . ENTRY_EMAIL_ADDRESS . $this->customer['email_address'];
     $email_order .= "\n" . EMAIL_TEXT_CUSTOMER_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], 0, '', "\n") . "\n" . ENTRY_EMAIL_ADDRESS . $this->customer['email_address'] . "\n";
     //addresses area: Delivery
     $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
     $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
     $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
     if (is_object($GLOBALS[$_SESSION['payment']])) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         if ($GLOBALS[$payment_class]->email_footer) {
             $email_order .= $GLOBALS[$payment_class]->email_footer . "\n\n";
         }
     } else {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $email_order .= PAYMENT_METHOD_GV . "\n\n";
     }
     $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
     $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV;
     $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->email_footer : '';
     $html_msg['EMAIL_VISITORS_DISCLAIMER'] = sprintf(EMAIL_VISITORS_DISCLAIMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
     // include disclaimer
     $email_order .= "\n-----\n" . sprintf(EMAIL_VISITORS_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     // include copyright
     $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     while (strstr($email_order, '&nbsp;')) {
         $email_order = str_replace('&nbsp;', ' ', $email_order);
     }
     $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     $html_msg['EMAIL_GREET'] = EMAIL_GREET;
     //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EXTRA_INFO'] = '';
     zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_visitors');
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_VISITORS_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_visitors_extra');
     }
 }
Example #3
0
    ?>
</strong></td>
            <td class="smallText" align="center"><strong><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</strong></td>
          </tr>
<?php 
    $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments\n                                    from " . TABLE_ORDERS_STATUS_HISTORY . "\n                                    where orders_id = '" . zen_db_input($oID) . "' and customer_notified >= 0\n                                    order by date_added");
    if ($orders_history->RecordCount() > 0) {
        $count_comments = 0;
        while (!$orders_history->EOF) {
            $count_comments++;
            echo '          <tr>' . "\n" . '            <td class="smallText" align="center" valign="top">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n";
            echo '            <td class="smallText" valign="top">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
            echo '            <td class="smallText" valign="top">' . ($orders_history->fields['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($orders_history->fields['comments']))) . '&nbsp;</td>' . "\n" . '          </tr>' . "\n";
            $orders_history->MoveNext();
            if (ORDER_COMMENTS_INVOICE == 1 && $count_comments >= 1) {
                break;
            }
        }
    } else {
        echo '          <tr>' . "\n" . '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '          </tr>' . "\n";
    }
    ?>
        </table></td>
      </tr>
<?php 
}
// order comments
?>
<?php 
    $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments\n                                    from " . TABLE_ORDERS_STATUS_HISTORY . "\n                                    where orders_id = '" . zen_db_input($oID) . "'\n                                    order by date_added");
    if ($orders_history->RecordCount() > 0) {
        while (!$orders_history->EOF) {
            echo '          <tr>' . "\n" . '            <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" . '            <td class="smallText" align="center">';
            if ($orders_history->fields['customer_notified'] == '1') {
                echo zen_image(DIR_WS_ICONS . 'tick.gif', TEXT_YES) . "</td>\n";
            } else {
                if ($orders_history->fields['customer_notified'] == '-1') {
                    echo zen_image(DIR_WS_ICONS . 'locked.gif', TEXT_HIDDEN) . "</td>\n";
                } else {
                    echo zen_image(DIR_WS_ICONS . 'unlocked.gif', TEXT_VISIBLE) . "</td>\n";
                }
            }
            echo '            <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
            echo '            <td class="smallText">' . nl2br(zen_db_output($orders_history->fields['comments'])) . '&nbsp;</td>' . "\n" . '          </tr>' . "\n";
            $orders_history->MoveNext();
        }
    } else {
        echo '          <tr>' . "\n" . '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . '          </tr>' . "\n";
    }
    ?>
        </table></td>
      </tr>
      <tr>
        <td class="main noprint"><br /><strong><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</strong></td>
      </tr>
      <tr>
Example #5
0
</td>
            <td class="main" align="right" valign="top"><?php 
    echo zen_image(DIR_WS_CATALOG_IMAGES . $rInfo->products_image, $rInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
    ?>
</td>
          </tr>
        </table>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top" class="main"><b><?php 
    echo ENTRY_REVIEW;
    ?>
</b><br><br><?php 
    echo nl2br(zen_db_output(zen_break_string($rInfo->reviews_text, 15)));
    ?>
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
    echo zen_draw_separator('pixel_trans.gif', '1', '10');
    ?>
</td>
      </tr>
      <tr>
        <td class="main"><b><?php 
    echo ENTRY_RATING;
    ?>
 function build_li_orders($oID, $field, $value)
 {
     $id = $this->timeframe_id;
     // first check to see if we even need to do anything
     if ($this->detail_level == 'order' || $this->detail_level == 'matrix') {
         // create the array if it doesn't already exist
         if (!is_array($this->timeframe[$id]['orders'][$oID])) {
             $this->timeframe[$id]['orders'][$oID] = array('oID' => $oID, 'goods' => 0, 'num_products' => 0, 'diff_products' => array(), 'shipping' => 0, 'tax' => 0, 'discount' => 0, 'discount_qty' => 0, 'gc_sold' => 0, 'gc_sold_qty' => 0, 'gc_used' => 0, 'gc_used_qty' => 0, 'grand' => 0);
             // get the customer data
             global $db;
             $c_data = $db->Execute("select c.* from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o\n                                  where o.customers_id = c.customers_id\n                                  and o.orders_id = '" . $oID . "' limit 1");
             $customers_id = $c_data->fields['customers_id'];
             $first_name = zen_db_output($c_data->fields['customers_firstname']);
             $last_name = zen_db_output($c_data->fields['customers_lastname']);
             $this->timeframe[$id]['orders'][$oID]['customers_id'] = $customers_id;
             $this->timeframe[$id]['orders'][$oID]['first_name'] = $first_name;
             $this->timeframe[$id]['orders'][$oID]['last_name'] = $last_name;
         }
         // add the passed $value to the passed $field in the ['orders'] array
         $this->timeframe[$id]['orders'][$oID][$field] += $value;
     }
 }
Example #7
0
 function send_order_email($zf_insert_id, $zf_mode)
 {
     global $currencies, $db, $order_totals, $zco_notifier;
     //      print_r($this);
     //      die();
     if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         // send an email
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock');
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $html_msg = array();
     // COWOA Conditional
     if ($_SESSION['COWOA']) {
         $invoiceInfo = "";
         $htmlInvoiceURL = "";
         $htmlInvoiceValue = "";
     } else {
         $invoiceInfo = EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
         $htmlInvoiceURL = EMAIL_TEXT_INVOICE_URL_CLICK;
         $htmlInvoiceValue = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
     }
     //intro area
     //added by john 2010-05-04 afterbuy
     $afterbuy_id = '';
     $afterbuy_id_chk = false;
     $email_module_template = 'checkout';
     $afterbuy_id_db = $db->Execute('select afterbuy_id,afterbuy_success,payment_module_code  from ' . TABLE_ORDERS . ' where orders_id=' . (int) $zf_insert_id);
     if ($afterbuy_id_db->RecordCount() == 1) {
         if ($afterbuy_id_db->fields['afterbuy_success'] == 1) {
             $afterbuy_id_chk = true;
             $afterbuy_id = $afterbuy_id_db->fields['afterbuy_id'];
             $html_msg['AFTERBUY_ID'] = $afterbuy_id;
             $html_msg['EMAIL_TEXT_AFTERBUY_ID_TIP1'] = EMAIL_TEXT_AFTERBUY_ID_TIP1;
         } else {
             $html_msg['AFTERBUY_ID'] = '';
             $html_msg['EMAIL_TEXT_AFTERBUY_ID_TIP1'] = '';
         }
     }
     //end
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . ($afterbuy_id_chk == true ? EMAIL_TEXT_AFTERBUY_ID_TIP1 . $afterbuy_id . "\n" : '') . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $html_msg['INTRO_STORE_NAME'] = STORE_NAME;
     $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id;
     $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     $html_msg['INTRO_URL_TEXT'] = $htmlInvoiceURL;
     $html_msg['INTRO_URL_VALUE'] = $htmlInvoiceValue;
     //comments area
     if ($this->info['comments']) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
     } else {
         $html_msg['ORDER_COMMENTS'] = '';
     }
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n";
     $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     //order totals area
     $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td> </tr>' . "\n" . '<tr>';
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td> </tr>' . "\n" . '<tr>';
     }
     $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
     //addresses area: Delivery
     $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION;
     $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
     $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
     $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
     if (is_object($GLOBALS[$_SESSION['payment']])) {
         $cc_num_display = isset($this->info['cc_number']) && $this->info['cc_number'] != '' ? substr($this->info['cc_number'], 0, 4) . str_repeat('X', strlen($this->info['cc_number']) - 8) . substr($this->info['cc_number'], -4) . "\n\n" : '';
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         $email_order .= isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
         $email_order .= $GLOBALS[$payment_class]->email_footer ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
     } else {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $email_order .= PAYMENT_METHOD_GV . "\n\n";
     }
     $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
     $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV;
     $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '' ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');
     // include disclaimer
     $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     // include copyright
     $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     while (strstr($email_order, '&nbsp;')) {
         $email_order = str_replace('&nbsp;', ' ', $email_order);
     }
     $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EXTRA_INFO'] = '';
     $zco_notifier->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
     zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, $email_module_template, $this->attachArray);
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
             $pmt_details = 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id . "\n\n";
             $email_order = $pmt_details . $email_order;
             $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
         }
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, $email_module_template, $this->attachArray);
     }
     $zco_notifier->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');
 }
Example #8
0
                  <td class="dataTableHeadingContent smallText" align="center" width="5%"><strong><?php 
            echo TABLE_HEADING_DELETE_COMMENTS;
            ?>
</strong></td>
                </tr>
<?php 
            $orders_history = $db->Execute("select * from " . TABLE_ORDERS_STATUS_HISTORY . "\n                                    where orders_id = '" . $oID . "'\n                                    order by orders_status_history_id asc");
            if ($orders_history->RecordCount() > 0) {
                while (!$orders_history->EOF) {
                    if ($orders_history->fields['customer_notified'] == -1) {
                        echo '        <tr>' . NL . '          <td class="smallText" valign="top">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . NL;
                        $status_id = 'status_' . $orders_history->fields['orders_status_history_id'];
                        $status_default = $orders_history->fields['orders_status_id'];
                        $orders_status = $orders_history->fields['orders_status_name'];
                        $comments_id = 'comments_' . $orders_history->fields['orders_status_history_id'];
                        $comments_default = zen_db_output($orders_history->fields['comments']);
                        $delete_id = 'delete_' . $orders_history->fields['orders_status_history_id'];
                        echo '          <td>' . zen_draw_textarea_field($comments_id, 'soft', '60', '8', $comments_default) . '</td>' . NL;
                        echo '          <td align="center" valign="top">' . zen_draw_checkbox_field($delete_id, 1) . '</td>' . NL;
                        echo '        </tr>' . NL;
                    }
                    $orders_history->MoveNext();
                }
            } else {
                echo '          <tr>' . NL . '            <td class="smallText" colspan="4">' . TEXT_NO_ORDER_HISTORY . '</td>' . NL . '          </tr>' . NL;
            }
            ?>
              
            </table>
            </td>
          </tr>
Example #9
0
                      <td><table width="75%" border="1" cellpadding="2" cellspacing="0">
                          <tr class="dataTableHeadingRow"> 
                            <td class="dataTableHeadingContent" align="center"><b><?php 
    echo TABLE_HEADING_DATE_ADDED;
    ?>
</b></td>
                            <td class="dataTableHeadingContent" align="center"><b><?php 
    echo TABLE_HEADING_COMMENTS;
    ?>
</b></td>
                          </tr>
                          <?php 
    $admin_history = $db->Execute("select orders_id, date_added, comments from " . TABLE_ADMIN_COMMENTS . " where orders_id = '" . zen_db_input($oID) . "' order by date_added");
    if ($admin_history->RecordCount() > 0) {
        while (!$admin_history->EOF) {
            echo '          <tr>' . "\n" . '            <td class="smallText" align="center">' . zen_datetime_short($admin_history->fields['date_added']) . '</td>' . "\n" . '            <td class="smallText">' . nl2br(zen_db_output($admin_history->fields['comments'])) . '&nbsp;</td>' . "\n" . '          </tr>' . "\n";
            $admin_history->MoveNext();
        }
    } else {
        echo '          <tr>' . "\n" . '            <td class="smallText" colspan="2">No Admin Comments.</td>' . "\n" . '          </tr>' . "\n";
    }
    ?>
                        </table></td>
                    </tr>
                    <tr> 
                      <td><?php 
    echo zen_draw_form('status', FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=update_admin_comments');
    ?>
 
                        <table width="75%" border="0" cellpadding="0" cellspacing="0" class="main">
                          <tr> 
 function zen_html_quotes($string)
 {
     if (function_exists('zen_db_output')) {
         return zen_db_output($string);
     }
     return htmlspecialchars($string, ENT_COMPAT, CHARSET, TRUE);
 }
Example #11
0
     }
     $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' ' . $oInfo->payment_method);
     $contents[] = array('text' => '<br />' . ENTRY_SHIPPING . ' ' . $oInfo->shipping_method);
     // check if order has open gv
     $gv_check = $db->Execute("select order_id, unique_id\r\n                                  from " . TABLE_COUPON_GV_QUEUE . "\r\n                                  where order_id = '" . $oInfo->orders_id . "' and release_flag='N' limit 1");
     if ($gv_check->RecordCount() > 0) {
         $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'order=' . $oInfo->orders_id) . '">' . zen_image_button('button_gift_queue.gif', IMAGE_GIFT_QUEUE) . '</a>';
         $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', '3'));
         $contents[] = array('align' => 'center', 'text' => $goto_gv);
     }
 }
 // indicate if comments exist
 $orders_history_query = $db->Execute("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . $oInfo->orders_id . "' and comments !='" . "' order by date_added desc");
 if ($orders_history_query->RecordCount() > 0) {
     $contents[] = array('align' => 'left', 'text' => '<br />' . TABLE_HEADING_COMMENTS);
     $contents[] = array('align' => 'left', 'text' => '<br />' . nl2br(zen_db_output($orders_history_query->fields['comments'])));
 }
 $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', '3'));
 $order = new order($oInfo->orders_id);
 $contents[] = array('text' => TEXT_PRODUCTS_ORDERED . sizeof($order->products));
 for ($i = 0; $i < sizeof($order->products); $i++) {
     $contents[] = array('text' => $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name']);
     if (sizeof($order->products[$i]['attributes']) > 0) {
         for ($j = 0; $j < sizeof($order->products[$i]['attributes']); $j++) {
             $contents[] = array('text' => '&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</i></nobr>');
         }
     }
     if ($i + 1 >= MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) {
         $contents[] = array('align' => 'left', 'text' => TEXT_MORE);
         break;
     }
Example #12
0
 function send_order_email($pOrdersId, $pEmailRecipient = NULL, $pFormat = NULL)
 {
     global $currencies, $order_totals, $gBitCustomer;
     $language_page_directory = DIR_WS_LANGUAGES . $gBitCustomer->getLanguage() . '/';
     require_once BITCOMMERCE_PKG_PATH . $language_page_directory . 'checkout_process.php';
     require_once BITCOMMERCE_PKG_PATH . './includes/functions/functions_customers.php';
     if (empty($pEmailRecipient)) {
         $pEmailRecipient = $this->customer['email_address'];
     }
     if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         // send an email
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock', '', $pFormat);
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $emailVars = array();
     $emailVars['order'] = $this;
     //intro area
     if (!empty($this->customer['firstname'])) {
         $customerName = $this->customer['firstname'] . ' ' . $this->customer['lastname'];
     } else {
         $customerName = BitUser::getDisplayNameFromHash(FALSE, $this->customer);
     }
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $customerName . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $pOrdersId . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $pOrdersId, 'SSL', false) . "\n\n";
     $emailVars['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $emailVars['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $emailVars['INTRO_STORE_NAME'] = STORE_NAME;
     $emailVars['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $emailVars['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $emailVars['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $emailVars['INTRO_ORDER_NUMBER'] = $pOrdersId;
     $emailVars['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $emailVars['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     $emailVars['INTRO_URL_TEXT'] = EMAIL_TEXT_INVOICE_URL_CLICK;
     $emailVars['INTRO_URL_VALUE'] = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $pOrdersId, 'SSL', false);
     //comments area
     if (!empty($this->info['comments'])) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $emailVars['ORDER_COMMENTS'] = zen_db_output($this->info['comments']);
     } else {
         $emailVars['ORDER_COMMENTS'] = '';
     }
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n";
     foreach (array_keys($this->contents) as $productsKey) {
         $email_order .= $this->contents[$productsKey]['products_quantity'] . ' x ' . $this->contents[$productsKey]['name'] . ($this->contents[$productsKey]['model'] != '' ? ' (' . $this->contents[$productsKey]['model'] . ') ' : '') . ' = ' . $currencies->display_price($this->contents[$productsKey]['final_price'], $this->contents[$productsKey]['tax'], $this->contents[$productsKey]['products_quantity'], $this->getField('currency'), $this->getField('currency_value')) . ($this->contents[$productsKey]['onetime_charges'] != 0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->contents[$productsKey]['onetime_charges'], $this->contents[$productsKey]['tax'], 1) : '');
         foreach (array_keys($this->contents[$productsKey]['attributes']) as $j) {
             $optionValues = zen_get_option_value((int) $this->contents[$productsKey]['attributes'][$j]['options_id'], (int) $this->contents[$productsKey]['attributes'][$j]['options_values_id']);
             $email_order .= "\n    + " . $optionValues['products_options_name'] . ' ' . zen_decode_specialchars($this->contents[$productsKey]['attributes'][$j]['value']);
         }
         $email_order .= "\n\n";
     }
     $email_order .= EMAIL_SEPARATOR . "\n";
     $emailVars['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     if (!empty($this->products_ordered_html)) {
         $emailVars['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     }
     //order totals area
     $html_ot = '<td class="order-totals-text alignright" width="100%">' . '&nbsp;' . '</td><td class="order-totals-num alignright" nowrap="nowrap">' . '---------' . '</td></tr><tr>';
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td></tr><tr>';
     }
     $emailVars['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . $html_ot . '</table>';
     //addresses area: Delivery
     $emailVars['HEADING_ADDRESS_INFORMATION'] = tra('Address Information');
     $emailVars['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $emailVars['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($this->customer['user_id'], $this->delivery, true, '', "<br />") : 'n/a';
     $emailVars['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $emailVars['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_format($this->delivery['format_id'], $this->delivery, FALSE, '', "\n") . "\n\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_format($this->billing['format_id'], $this->billing, FALSE, '', "\n") . "\n\n";
     $emailVars['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $emailVars['ADDRESS_BILLING_DETAIL'] = zen_address_label($this->customer['user_id'], $this->billing, true, '', "<br />");
     $emailVars['PAYMENT_METHOD_TITLE'] = $emailVars['PAYMENT_METHOD_DETAIL'] = $emailVars['PAYMENT_METHOD_FOOTER'] = '';
     if (!empty($_SESSION['payment']) && is_object($GLOBALS[$_SESSION['payment']])) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         if (!empty($GLOBALS[$payment_class]->email_footer)) {
             $email_order .= $GLOBALS[$payment_class]->email_footer . "\n\n";
         }
         $emailVars['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
         $emailVars['PAYMENT_METHOD_DETAIL'] = $GLOBALS[$payment_class]->title;
         $emailVars['PAYMENT_METHOD_FOOTER'] = !empty($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer : '';
     }
     // include disclaimer
     $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     // include copyright
     $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     while (strstr($email_order, '&nbsp;')) {
         $email_order = str_replace('&nbsp;', ' ', $email_order);
     }
     $emailVars['EMAIL_FIRST_NAME'] = $this->getFirstName();
     //		$emailVars['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     //	$emailVars['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $emailVars['EXTRA_INFO'] = '';
     zen_mail($customerName, $pEmailRecipient, EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $pOrdersId, $email_order, STORE_NAME, EMAIL_FROM, $emailVars, 'checkout', '', $pFormat);
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $customerName, $this->customer['email_address'], $this->customer['telephone']);
         $emailVars['EXTRA_INFO'] = $extra_info['HTML'];
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, tra('[NEW ORDER]') . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $pOrdersId, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $emailVars, 'checkout_extra', '', $pFormat);
     }
 }