VD : debug require_once('../logger/include.php'); // <- VD require('includes/application_top.php'); // output a response header header('Content-type: text/html; charset=' . CHARSET . ''); // include the appropriate functions & classes include('order_editor/functions.php'); include('order_editor/cart.php'); include('order_editor/order.php'); include('order_editor/shipping.php'); include('order_editor/http_client.php'); include(DIR_WS_LANGUAGES . $language. '/' . FILENAME_ORDERS_EDIT); // Include currencies class require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); // -> QPBPP135 require(DIR_WS_CLASSES . 'PriceFormatter.php'); $pf = new PriceFormatter; // <- QPBPP135 //$action //all variables are sent by $_GET only or by $_POST only, never together if (sizeof($_GET) > 0) { $action = $_GET['action']; } elseif (sizeof($_POST) > 0) { $action = $_POST['action']; } //1. Update most the orders table if ($action == 'update_order_field') { tep_db_query("UPDATE " . TABLE_ORDERS . " SET " . $_GET['field'] . " = '" . oe_iconv($_GET['new_value']) . "' WHERE orders_id = '" . $_GET['oID'] . "'"); //generate responseText echo $_GET['field']; } //2. Update the orders_products table for qty, tax, name, or model if ($action == 'update_product_field') { if ($_GET['field'] == 'products_quantity') { // Update Inventory Quantity $order_query = tep_db_query(" SELECT products_id, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); $orders_product_info = tep_db_fetch_array($order_query); // stock check // -> VDOFS : gestion des articles épuisés if ($_GET['new_value'] != $orders_product_info['products_quantity']){ $quantity_difference = ($_GET['new_value'] - $orders_product_info['products_quantity']); if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } else { tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } //end if (STOCK_LIMITED == 'true') } //end if ($_GET['new_value'] != $orders_product_info['products_quantity']) // <- VDOFS // -> QPBPP135 /* $product_query = tep_db_query("select p.products_price, p.products_tax_class_id, p.products_qty_blocks from " . TABLE_PRODUCTS . " where p.products_id = '" . (int)$orders_product_info['products_id']); $product = tep_db_fetch_array($product_query); $order_query = tep_db_query("select delivery_country, delivery_state from " . TABLE_ORDERS . " where order_id = '" . $_GET['oID'] . "'"); $order = tep_db_fetch_array($order_query); $country_id = oe_get_country_id($order['delivery_country']); $zone_id = oe_get_zone_id($country_id, $order['delivery_state']); $products_tax = tep_get_tax_rate($product['products_tax_class_id'], $country_id, $zone_id); $pf->loadProduct((int)$orders_product_info['products_id'], $product['products_price'], $products_tax, (int)$product['products_qty_blocks']); PUT SOMETHING HERE : need to update unit price from qt change !!!! $product['products_price'] = $pf->computePrice($_GET['new_value'], 0, false); */ // <- QPBPP135 }//end if ($_GET['field'] = 'products_quantity' tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET " . $_GET['field'] . " = '" . oe_iconv($_GET['new_value']) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); //generate responseText echo $_GET['field']; } //3. Update the orders_products table for price and final_price (interdependent values) if ($action == 'update_product_value_field') { tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET products_price = '" . tep_db_input(tep_db_prepare_input($_GET['price'])) . "', final_price = '" . tep_db_input(tep_db_prepare_input($_GET['final_price'])) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); //generate responseText echo TABLE_ORDERS_PRODUCTS; } //4. Update the orders_products_attributes table if ($action == 'update_attributes_field') { tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " SET " . $_GET['field'] . " = '" . oe_iconv($_GET['new_value']) . "' WHERE orders_products_attributes_id = '" . $_GET['aid'] . "' AND orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); if (isset($_GET['final_price'])) { tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET final_price = '" . tep_db_input(tep_db_prepare_input($_GET['final_price'])) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); } //generate responseText echo $_GET['field']; } //5. Update the orders_products_download table if ($action == 'update_downloads') { tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET " . $_GET['field'] . " = '" . tep_db_input(tep_db_prepare_input($_GET['new_value'])) . "' WHERE orders_products_download_id = '" . $_GET['did'] . "' AND orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); //generate responseText echo $_GET['field']; } //6. Update the currency of the order if ($action == 'update_currency') { tep_db_query("UPDATE " . TABLE_ORDERS . " SET currency = '" . tep_db_input(tep_db_prepare_input($_GET['currency'])) . "', currency_value = '" . tep_db_input(tep_db_prepare_input($_GET['currency_value'])) . "' WHERE orders_id = '" . $_GET['oID'] . "'"); //generate responseText echo $_GET['currency']; }//end if ($action == 'update_currency') { //7. Update most any field in the orders_products table if ($action == 'delete_product_field') { // Update Inventory Quantity $order_query = tep_db_query(" SELECT products_id, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); $order = tep_db_fetch_array($order_query); //update quantities first if (STOCK_LIMITED == 'true'){ // -> VDOFS : gestion des articles épuisés tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " WHERE products_id = '" . (int)$order['products_id'] . "'"); } else { tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered - " . $order['products_quantity'] . " WHERE products_id = '" . (int)$order['products_id'] . "'"); } // -> VDOFS : gestion des articles épuisés tep_db_query("DELETE FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); tep_db_query("DELETE FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); tep_db_query("DELETE FROM " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); //generate responseText echo TABLE_ORDERS_PRODUCTS; } //8. Update the orders_status_history table if ($action == 'delete_comment') { tep_db_query("DELETE FROM " . TABLE_ORDERS_STATUS_HISTORY . " WHERE orders_status_history_id = '" . $_GET['cID'] . "' AND orders_id = '" . $_GET['oID'] . "'"); //generate responseText echo TABLE_ORDERS_STATUS_HISTORY; } //9. Update the orders_status_history table if ($action == 'update_comment') { echo $_GET['comment']; // -> 0000005: sqlerror quand on insère/modifie des commentaires tep_db_query("UPDATE " . TABLE_ORDERS_STATUS_HISTORY . " SET comments = '" . tep_db_input(html_entity_decode(stripslashes(oe_iconv($_GET['comment'])))) . "' WHERE orders_status_history_id = '" . $_GET['cID'] . "' AND orders_id = '" . $_GET['oID'] . "'"); // <- 0000005 //generate responseText echo TABLE_ORDERS_STATUS_HISTORY; } //10. Reload the shipping and order totals block if ($action == 'reload_totals') { $oID = $_POST['oID']; $shipping = array(); if (is_array($_POST['update_totals'])) { foreach($_POST['update_totals'] as $total_index => $total_details) { extract($total_details, EXTR_PREFIX_ALL, "ot"); if ($ot_class == "ot_shipping") { $shipping['cost'] = $ot_value; $shipping['title'] = $ot_title; $shipping['id'] = $ot_id; } // end if ($ot_class == "ot_shipping") } //end foreach } //end if is_array if (tep_not_null($shipping['id'])) { tep_db_query("UPDATE " . TABLE_ORDERS . " SET shipping_module = '" . $shipping['id'] . "' WHERE orders_id = '" . $_POST['oID'] . "'"); } $order = new manualOrder($oID); $order->adjust_zones(); $cart = new manualCart(); $cart->restore_contents($oID); $total_count = $cart->count_contents(); $total_weight = $cart->show_weight(); // Get the shipping quotes $shipping_modules = new shipping; $shipping_quotes = $shipping_modules->quote(); if (DISPLAY_PRICE_WITH_TAX == 'true') {//extract the base shipping cost or the ot_shipping module will add tax to it again $module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_')); $tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $order->info['total'] -= ( $order->info['shipping_cost'] - ($order->info['shipping_cost'] / (1 + ($tax /100))) ); $order->info['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100))); } //this is where we call the order total modules require( 'order_editor/order_total.php'); $order_total_modules = new order_total(); $order_totals = $order_total_modules->process(); $current_ot_totals_array = array(); $current_ot_titles_array = array(); $written_ot_totals_array = array(); $written_ot_titles_array = array(); //how many weird arrays can I make today? $current_ot_totals_query = tep_db_query("select class, title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$oID . "' order by sort_order"); while ($current_ot_totals = tep_db_fetch_array($current_ot_totals_query)) { $current_ot_totals_array[] = $current_ot_totals['class']; $current_ot_titles_array[] = $current_ot_totals['title']; } tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$oID . "'"); $j=1; //giving something a sort order of 0 ain't my bag baby $new_order_totals = array(); if (is_array($_POST['update_totals'])) { //1 foreach($_POST['update_totals'] as $total_index => $total_details) { //2 extract($total_details, EXTR_PREFIX_ALL, "ot"); if (!strstr($ot_class, 'ot_custom')) { //3 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { //4 $firephp->table('edit_orders_ajax : order_totals', $order_totals); if ($order_totals[$i]['code'] == 'ot_tax') { //5 $new_ot_total = ((in_array($order_totals[$i]['title'], $current_ot_titles_array)) ? false : true); } else { //within 5 $new_ot_total = ((in_array($order_totals[$i]['code'], $current_ot_totals_array)) ? false : true); } //end 5 if ($order_totals[$i]['code'] == 'ot_tax') if ( ( ($order_totals[$i]['code'] == 'ot_tax') && ($order_totals[$i]['code'] == $ot_class) && ($order_totals[$i]['title'] == $ot_title) ) || ( ($order_totals[$i]['code'] != 'ot_tax') && ($order_totals[$i]['code'] == $ot_class) ) ) { //6 //only good for components that show up in the $order_totals array if ($ot_title != '') { //7 $new_order_totals[] = array('title' => $ot_title, 'text' => (($ot_class != 'ot_total') ? $order_totals[$i]['text'] : '' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . ''), 'value' => (($order_totals[$i]['code'] != 'ot_total') ? $order_totals[$i]['value'] : $order->info['total']), 'code' => $order_totals[$i]['code'], 'sort_order' => $j); $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } else { //within 7 $order->info['total'] += ($ot_value*(-1)); $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; } //end 7 } elseif ( ($new_ot_total) && (!in_array($order_totals[$i]['title'], $current_ot_titles_array)) ) { //within 6 $new_order_totals[] = array('title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'code' => $order_totals[$i]['code'], 'sort_order' => $j); $current_ot_totals_array[] = $order_totals[$i]['code']; $current_ot_titles_array[] = $order_totals[$i]['title']; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; //echo $order_totals[$i]['code'] . "
"; for debugging- use of this results in errors } elseif ($new_ot_total) { //also within 6 $order->info['total'] += ($order_totals[$i]['value']*(-1)); $current_ot_totals_array[] = $order_totals[$i]['code']; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; }//end 6 // $firephp->table('edit_orders_ajax : new_order_totals', $new_order_totals); }//end 4 } elseif ( (tep_not_null($ot_value)) && (tep_not_null($ot_title)) ) { // this modifies if (!strstr($ot_class, 'ot_custom')) { //3 $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, 'code' => 'ot_custom_' . $j, 'sort_order' => $j); $order->info['total'] += $ot_value; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } //end 3 //save ot_skippy from certain annihilation if ( (!in_array($ot_class, $written_ot_totals_array)) && (!in_array($ot_title, $written_ot_titles_array)) && (tep_not_null($ot_value)) && (tep_not_null($ot_title)) && ($ot_class != 'ot_tax') && ($ot_class != 'ot_loworderfee') ) { //7 //this is supposed to catch the oddball components that don't show up in $order_totals $new_order_totals[] = array( 'title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, 'code' => $ot_class, 'sort_order' => $j); //$current_ot_totals_array[] = $order_totals[$i]['code']; //$current_ot_titles_array[] = $order_totals[$i]['title']; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } //end 7 } //end 2 } else {//within 1 // $_POST['update_totals'] is not an array => write in all order total components that have been generated by the sundry modules for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { //8 $new_order_totals[] = array('title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'code' => $order_totals[$i]['code'], 'sort_order' => $j); $j++; } //end 8 } //end if (is_array($_POST['update_totals'])) { //1 for ($i=0, $n=sizeof($new_order_totals); $i<$n; $i++) { $sql_data_array = array('orders_id' => $oID, // -> VD : suppression des '/' dans les titres des totaux 'title' => stripslashes(oe_iconv($new_order_totals[$i]['title'])), 'text' => stripslashes($new_order_totals[$i]['text']), // <- VD 'value' => $new_order_totals[$i]['value'], 'class' => $new_order_totals[$i]['code'], 'sort_order' => $new_order_totals[$i]['sort_order']); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } $order = new manualOrder($oID); $shippingKey = $order->adjust_totals($oID); $order->adjust_zones(); $cart = new manualCart(); $cart->restore_contents($oID); $total_count = $cart->count_contents(); $total_weight = $cart->show_weight(); ?>


totals); $i++) { $id = $order->totals[$i]['class']; if ($order->totals[$i]['class'] == 'ot_shipping') { if (tep_not_null($order->info['shipping_id'])) { $shipping_module_id = $order->info['shipping_id']; } else { //here we could create logic to attempt to determine the shipping module used if it's not in the database $shipping_module_id = ''; } } else { $shipping_module_id = ''; } //end if ($order->totals[$i]['class'] == 'ot_shipping') { // $firephp->dump('edit_orders_ajax : shipping_module_id', $shipping_module_id); $rowStyle = (($i % 2) ? 'dataTableRowOver' : 'dataTableRow'); // -> VD : autorise la modification des frais d'expédition et du sous-total TTC dans l'édition des commandes) if ((!strstr($order->totals[$i]['class'], 'ot_custom')) && ($order->totals[$i]['class'] != 'ot_shipping') && ($order->totals[$i]['class'] != 'ot_subtotal')) { // if ((!strstr($order->totals[$i]['class'], 'ot_custom')) ) { // <- VD : echo ' ' . "\n"; if ($order->totals[$i]['class'] != 'ot_total') { echo ' ' . "\n"; } else { echo ' ' . "\n"; } echo ' ' . "\n"; if ($order->info['currency'] != DEFAULT_CURRENCY) echo ' ' . "\n"; echo ' ' . "\n" . ' ' . "\n"; } else { if ($i % 2) { echo ' ' . "\n" . ' ' . "\n"; } else { echo ' ' . "\n" . ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n"; if ($order->info['currency'] != DEFAULT_CURRENCY) echo ' ' . "\n"; echo ' ' . "\n"; } } ?>
' . tep_image('order_editor/images/plus.gif', IMAGE_ADD_NEW_OT) . '  ' . $order->totals[$i]['text'] . '
' . tep_image('order_editor/images/plus.gif', IMAGE_ADD_NEW_OT) . '' . $order->totals[$i]['text'] . '
0) { ?> VD : affichage des frais de transport HT // $shipping_cost_value = tep_add_tax($shipping_quotes[$i]['methods'][$j]['cost'], $shipping_quotes[$i]['tax']); // TTC $shipping_cost_value = $shipping_quotes[$i]['methods'][$j]['cost']; // <- VD echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' '; } } ?>
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $shipping_quotes[$i]['module'] . ' (' . $shipping_quotes[$i]['methods'][$j]['title'] . '):' . $currencies->format($shipping_cost_value, true, $order->info['currency'], $order->info['currency_value']) . '
$orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']); $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name']; } // UPDATE STATUS HISTORY & SEND EMAIL TO CUSTOMER IF NECESSARY ##### $check_status_query = tep_db_query(" SELECT customers_name, customers_email_address, orders_status, date_purchased FROM " . TABLE_ORDERS . " WHERE orders_id = '" . $_GET['oID'] . "'"); $check_status = tep_db_fetch_array($check_status_query); if (($check_status['orders_status'] != $_GET['status']) || (tep_not_null($_GET['comments']))) { tep_db_query("UPDATE " . TABLE_ORDERS . " SET orders_status = '" . tep_db_input($_GET['status']) . "', last_modified = now() WHERE orders_id = '" . $_GET['oID'] . "'"); // Notify Customer ? $customer_notified = '0'; if (isset($_GET['notify']) && ($_GET['notify'] == 'true')) { $notify_comments = ''; if (isset($_GET['notify_comments']) && ($_GET['notify_comments'] == 'true')) { $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, stripslashes(oe_iconv($_GET['comments']))) . "\n\n"; } $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $_GET['oID'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $_GET['oID'], 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$_GET['status']]) . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE2); tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $customer_notified = '1'; } tep_db_query("INSERT into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . tep_db_input($_GET['oID']) . "', '" . tep_db_input($_GET['status']) . "', now(), " . tep_db_input($customer_notified) . // -> 0000005: sqlerror quand on insère/modifie des commentaires ", '" . tep_db_input(html_entity_decode(stripslashes(oe_iconv($_GET['comments'])))) . "')"); // <- 0000005 } ?> ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' \n"; } else { echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "\n"; } echo ' ' . "\n" . ' ' . "\n"; echo ' ' . "\n" . ' ' . "\n"; echo ' ' . "\n"; } } else { echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } ?>
       
 ' . tep_datetime_short($orders_history['date_added']) . ' '; if ($orders_history['customer_notified'] == '1') { echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . " ' . $orders_status_array[$orders_history['orders_status_id']] . ' ' . tep_draw_textarea_field("update_comments[" . $orders_history['orders_status_history_id'] . "][comments]", "soft", "40", "5", "" . $orders_history['comments'] . "", "onChange=\"updateCommentsField('update', '" . $orders_history['orders_status_history_id'] . "', 'false', encodeURIComponent(this.value))\"") . '' . "\n" . '
' . TEXT_NO_ORDER_HISTORY . '
format($_GET['value'], true, $order->info['currency'], $order->info['currency_value']) ."', value = '" . $_GET['value'] . "', class = 'ot_shipping', sort_order = '" . $_GET['sort_order'] . "'"; tep_db_query($Query); tep_db_query("UPDATE " . TABLE_ORDERS . " SET shipping_module = '" . $_GET['id'] . "' WHERE orders_id = '" . $_GET['oID'] . "'"); $order = new manualOrder($_GET['oID']); $shippingKey = $order->adjust_totals($_GET['oID']); $order->adjust_zones(); $cart = new manualCart(); $cart->restore_contents($_GET['oID']); $total_count = $cart->count_contents(); $total_weight = $cart->show_weight(); // Get the shipping quotes $shipping_modules = new shipping; $shipping_quotes = $shipping_modules->quote(); ?>


totals); $i++) { $id = $order->totals[$i]['class']; if ($order->totals[$i]['class'] == 'ot_shipping') { $shipping_module_id = $order->info['shipping_id']; } else { $shipping_module_id = ''; } //end if ($order->totals[$i]['class'] == 'ot_shipping') { $rowStyle = (($i % 2) ? 'dataTableRowOver' : 'dataTableRow'); // -> VD : autorise la modification des frais d'expédition et du sous-total TTC dans l'édition des commandes) if ((!strstr($order->totals[$i]['class'], 'ot_custom')) && ($order->totals[$i]['class'] != 'ot_shipping') && ($order->totals[$i]['class'] != 'ot_subtotal')) { // if ( ($order->totals[$i]['class'] == 'ot_total') || ($order->totals[$i]['class'] == 'ot_shipping') || ($order->totals[$i]['class'] == 'ot_total_wotax') || ($order->totals[$i]['class'] == 'ot_subtotal_wotax') || ($order->totals[$i]['class'] == 'ot_subtotal') || ($order->totals[$i]['class'] == 'ot_tax') || ($order->totals[$i]['class'] == 'ot_loworderfee') ) { // <- VD echo ' ' . "\n"; if ($order->totals[$i]['class'] != 'ot_total') { echo ' ' . "\n"; } else { echo ' ' . "\n"; } echo ' ' . "\n"; if ($order->info['currency'] != DEFAULT_CURRENCY) echo ' ' . "\n"; echo ' ' . "\n" . ' ' . "\n"; } else { if ($i % 2) { echo ' ' . "\n" . ' ' . "\n"; } else { echo ' ' . "\n" . ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n"; if ($order->info['currency'] != DEFAULT_CURRENCY) echo ' ' . "\n"; echo ' ' . "\n"; } } ?>
' . tep_image('order_editor/images/plus.gif', IMAGE_ADD_NEW_OT) . '  ' . $order->totals[$i]['text'] . '
' . tep_image('order_editor/images/plus.gif', IMAGE_ADD_NEW_OT) . '' . $order->totals[$i]['text'] . '
0) { ?> ' . "\n" . ' ' . "\n" . '' . "\n" . ' '; } } ?>
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . '' . $shipping_quotes[$i]['module'] . ' (' . $shipping_quotes[$i]['methods'][$j]['title'] . '):' . $currencies->format($shipping_cost_value, true, $order->info['currency'], $order->info['currency_value']) . '
products); $i<$n; $i++) { //loop all the products in the order $products_ordered_attributes = ''; if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) { for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) { $products_ordered_attributes .= "\n\t" . $order->products[$i]['attributes'][$j]['option'] . ' ' . $order->products[$i]['attributes'][$j]['value']; } } $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . $products_model . ' = ' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . $products_ordered_attributes . "\n"; } //Build the email $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . (int)$_GET['oID'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . (int)$_GET['oID'], 'SSL') . "\n" . EMAIL_TEXT_DATE_MODIFIED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\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"; } if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . $order->delivery['name'] . "\n"; if ($order->delivery['company']) { $email_order .= $order->delivery['company'] . "\n"; } $email_order .= $order->delivery['street_address'] . "\n"; if ($order->delivery['suburb']) { $email_order .= $order->delivery['suburb'] . "\n"; } $email_order .= $order->customer['city'] . "\n"; if ($order->delivery['state']) { $email_order .= $order->delivery['state'] . "\n"; } $email_order .= $order->customer['postcode'] . "\n" . $order->delivery['country'] . "\n"; } $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . $order->billing['name'] . "\n"; if ($order->billing['company']) { $email_order .= $order->billing['company'] . "\n"; } $email_order .= $order->billing['street_address'] . "\n"; if ($order->billing['suburb']) { $email_order .= $order->billing['suburb'] . "\n"; } $email_order .= $order->customer['city'] . "\n"; if ($order->billing['state']) { $email_order .= $order->billing['state'] . "\n"; } $email_order .= $order->customer['postcode'] . "\n" . $order->billing['country'] . "\n\n"; $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $email_order .= $order->info['payment_method'] . "\n\n"; // if ( ($order->info['payment_method'] == ORDER_EDITOR_SEND_INFO_PAYMENT_METHOD) && (EMAIL_TEXT_PAYMENT_INFO) ) { // $email_order .= EMAIL_TEXT_PAYMENT_INFO . "\n\n"; // } //I'm not entirely sure what the purpose of this is so it is being shelved for now if (EMAIL_TEXT_FOOTER) { $email_order .= EMAIL_TEXT_FOOTER . "\n\n"; } //code for plain text emails which changes the € sign to EUR, otherwise the email will show ? instead of € $email_order = str_replace("€","EUR",$email_order); $email_order = str_replace(" "," ",$email_order); //code which replaces the
tags within EMAIL_TEXT_PAYMENT_INFO and EMAIL_TEXT_FOOTER with the proper \n $email_order = str_replace("
","\n",$email_order); //send the email to the customer tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // send emails to other people as necessary if (SEND_EXTRA_ORDER_EMAILS_TO != '') { tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } ?>
customer['email_address']); ?>