Example #1
0
  
  </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">
			  <tr>
                <td valign="top" width="100%">
				 <br>
                $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");
$currency_array = array();
while ($currency = vam_db_fetch_array($currency_query)) {
    $currency_array[] = array('id' => $currency['code'], 'text' => $currency['code'] . ' - ' . $currency['title']);
}