📄 order.php
字号:
'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'],
'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'],
'products_options_id' => (int)$this->products[$i]['attributes'][$j]['option_id'],
'products_options_values_id' => (int)$this->products[$i]['attributes'][$j]['value_id'],
'products_prid' => $this->products[$i]['id']
);
zen_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
$zco_notifier->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM', $sql_data_array);
if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values->fields['products_attributes_filename']) && zen_not_null($attributes_values->fields['products_attributes_filename'])) {
$sql_data_array = array('orders_id' => $zf_insert_id,
'orders_products_id' => $order_products_id,
'orders_products_filename' => $attributes_values->fields['products_attributes_filename'],
'download_maxdays' => $attributes_values->fields['products_attributes_maxdays'],
'download_count' => $attributes_values->fields['products_attributes_maxcount'],
'products_prid' => $this->products[$i]['id']
);
zen_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
$zco_notifier->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_DOWNLOAD_LINE_ITEM', $sql_data_array);
}
//clr 030714 changing to use values from $orders->products and adding call to zen_decode_specialchars()
// $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . $attributes_values->fields['products_options_values_name'];
$this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);
}
}
//------eof: insert customer-chosen options ----
$zco_notifier->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $custom_insertable_text);
/* START: ADD MY CUSTOM DETAILS
* 1. calculate/prepare custom information to be added to this product entry in order-confirmation.
* 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format:
* $this->products_ordered_attributes .= {INSERT CUSTOM INFORMATION HERE};
*/
$this->products_ordered_attributes .= ''; // $custom_insertable_text;
/* END: ADD MY CUSTOM DETAILS */
// update totals counters
$this->total_weight += ($this->products[$i]['qty'] * $this->products[$i]['weight']);
$this->total_tax += zen_calculate_tax($total_products_price, $products_tax) * $this->products[$i]['qty'];
$this->total_cost += $total_products_price;
$zco_notifier->notify('NOTIFY_ORDER_PROCESSING_ONE_TIME_CHARGES_BEGIN');
// build output for email notification
$this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
$this->products_ordered_attributes . "\n";
$this->products_ordered_html .=
'<tr>' . "\n" .
'<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . ' x</td>' . "\n" .
'<td class="product-details" valign="top">' . nl2br($this->products[$i]['name']) . ($this->products[$i]['model'] != '' ? ' (' . nl2br($this->products[$i]['model']) . ') ' : '') . "\n" .
'<nobr><small><em> '. nl2br($this->products_ordered_attributes) .'</em></small></nobr></td>' . "\n" .
'<td class="product-details-num" valign="top" align="right">' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ?
'</td></tr>' . "\n" . '<tr><td class="product-details">' . nl2br(TEXT_ONETIME_CHARGES_EMAIL) . '</td>' . "\n" .
'<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
'</td></tr>' . "\n";
}
$order_total_modules->apply_credit();//ICW ADDED FOR CREDIT CLASS SYSTEM
$zco_notifier->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS');
}
function send_order_email($zf_insert_id, $zf_mode) {
global $currencies, $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();
//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);
//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%">' . ' ' . '</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, ' ')) $email_order = str_replace(' ', ' ', $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, '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'];
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, 'checkout_extra', $this->attachArray);
}
$zco_notifier->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -