//// // Edit Order case 'edit': if (!isset($_GET['oID'])) { $messageStack->add(ERROR_NO_ORDER_SELECTED, 'error'); break; } $oID = vam_db_prepare_input($_GET['oID']); $orders_query = vam_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int) $oID . "'"); $order_exists = true; if (!vam_db_num_rows($orders_query)) { $order_exists = false; $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error'); break; } $order = new manualOrder($oID); $vamPrice = new vamPrice($order->info['currency'], $order->info['status'], $order->customer['ID']); $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(); // Get the shipping quotes $shipping_modules = new shipping(); $shipping_quotes = $shipping_modules->quote(); break; } } // currecies drop-down array $currency_query = vam_db_query("select distinct title, code from " . TABLE_CURRENCIES . " order by code ASC");
echo ' <tr>' . "\n" . ' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table> <?php } // end if ($action == 'insert_new_comment') { //12. insert shipping method when one doesn't already exist if ($action == 'insert_shipping') { $order = new manualOrder($_GET['oID']); $Query = "INSERT INTO " . TABLE_ORDERS_TOTAL . " SET\n\t orders_id = '" . $_GET['oID'] . "', \n\t\t\t\t\ttitle = '" . $_GET['title'] . "', \n\t\t\t\t\ttext = '" . $currencies->format($_GET['value'], true, $order->info['currency'], $order->info['currency_value']) . "',\n\t\t\t\t\tvalue = '" . $_GET['value'] . "',\n\t\t\t\t\tclass = 'ot_shipping',\n\t\t\t\t\tsort_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(); ?> <table width="100%"> <tr><td> <table border="0" width="100%" cellspacing="0" cellpadding="0">
} ?> </td> </tr> </table> </td></tr> </table> <?php } //end if ($action == 'insert_shipping') { //13. new order email if ($action == 'new_order_email') { $order = new manualOrder($_GET['oID']); $vamPrice = new vamPrice($order->info['currency'], $order->info['status'], $order->customer['ID']); for ($i = 0, $n = sizeof($order->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(vam_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . $products_ordered_attributes . "\n"; } $oID = $_GET['oID']; $vamTemplate->assign('address_label_customer', vam_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />')); $vamTemplate->assign('address_label_shipping', vam_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />')); if ($_SESSION['credit_covers'] != '1') {