Exemple #1
0
 function query($order_id)
 {
     $order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     $order = tep_db_fetch_array($order_query);
     $totals_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
     while ($totals = tep_db_fetch_array($totals_query)) {
         $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class'], 'value' => $totals['value'], 'sort_order' => $totals['sort_order'], 'orders_total_id' => $totals['orders_total_id']);
     }
     $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'shipping_tax' => $order['shipping_tax'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']);
     $this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']);
     $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']);
     $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']);
     $countryid = tep_get_country_id($this->delivery["country"]);
     $zoneid = tep_get_zone_id($countryid, $this->delivery["state"]);
     $index = 0;
     $orders_products_query = tep_db_query("\n     SELECT \n\t op.orders_products_id, \n\t op.products_name, \n\t op.products_model, \n\t op.products_price,\n\t op.products_tax, \n\t op.products_quantity, \n\t op.final_price, \n\t p.products_tax_class_id,\n\t p.products_weight\n  FROM " . TABLE_ORDERS_PRODUCTS . " op\n  LEFT JOIN " . TABLE_PRODUCTS . " p\n    ON op.products_id = p.products_id\n WHERE orders_id = '" . (int) $order_id . "'");
     while ($orders_products = tep_db_fetch_array($orders_products_query)) {
         $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'tax_description' => tep_get_tax_description($orders_products['products_tax_class_id'], $countryid, $zoneid), 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price'], 'weight' => $orders_products['products_weight'], 'orders_products_id' => $orders_products['orders_products_id']);
         $subindex = 0;
         $attributes_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
         if (tep_db_num_rows($attributes_query)) {
             while ($attributes = tep_db_fetch_array($attributes_query)) {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
                 $subindex++;
             }
         }
         $index++;
     }
 }
Exemple #2
0
         $Total = $row["total_value"];
         $Query = "update " . TABLE_ORDERS_TOTAL . " set\n\t\t\t\ttext = '<b>" . number_format($Total, 2, ',', '') . ' ' . $order->info['currency'] . "</b>',\n\t\t\t\tvalue = '" . $Total . "'\n\t\t\t\twhere class='ot_total' and orders_id={$oID}";
         tep_db_query($Query);
         // 2.3 REDIRECTION #####
         tep_redirect(tep_href_link("edit_orders.php", tep_get_all_get_params(array('action')) . 'action=edit'));
     }
     break;
 case 'add_non_inv':
     if ($step == 2) {
         $oID = tep_db_prepare_input($_GET['oID']);
         $order = new order($oID);
         $row = array('products_model' => $_POST['products_model'], 'products_price' => $_POST['products_price'], 'products_name' => $_POST['products_name'], 'products_tax_class_id' => $_POST['products_tax_class_id']);
         extract($row, EXTR_PREFIX_ALL, "p");
         // Following functions are defined at the bottom of this file
         $CountryID = tep_get_country_id($order->delivery["country"]);
         $ZoneID = tep_get_zone_id($CountryID, $order->delivery["state"]);
         $ProductsTax = tep_get_tax_rate($p_products_tax_class_id, $CountryID, $ZoneID);
         // 2.2 # UPDATE ORDER #####
         $Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS . " \n\t\t\t\tSET\torders_id = {$oID},\n\t\t\t\tproducts_id = '',\n\t\t\t\tproducts_model = '" . $p_products_model . "',\n\t\t\t\tproducts_name = '" . str_replace("'", "&#39;", $p_products_name) . "',\n\t\t\t\tproducts_price = '" . $p_products_price . "',\n\t\t\t\tfinal_price = '" . $p_products_price . "',\n\t\t\t\tproducts_tax = '" . $ProductsTax . "',\n\t\t\t\tproducts_quantity = '" . $_POST['products_quantity'] . "'";
         tep_db_query($Query);
         $new_product_id = tep_db_insert_id();
         // 2.2.2 Calculate Tax and Sub-Totals
         $order = new order($oID);
         $RunningSubTotal = 0;
         $RunningTax = 0;
         for ($i = 0; $i < sizeof($order->products); $i++) {
             // # Correction of $RunningSubTotal - our SubTotal in our shop is WITH TAX
             // # in line 240 (or near) there was the choice WITH/WITHOUT tax; if WITH tax, then you have to
             // # calculate it here also (or ?) !!!
             $RunningSubTotal += $order->products[$i]['qty'] * $order->products[$i]['final_price'];
             //$RunningSubTotal += (tep_add_tax(($order->products[$i]['qty'] * $order->products[$i]['final_price']), $order->products[$i]['tax'])*20)/20;
Exemple #3
0
    echo TABLE_HEADING_TAX;
    ?>
</td>
	  <td class="dataTableHeadingContent"width="1"><?php 
    echo tep_draw_separator('pixel_trans.gif', '1', '1');
    ?>
</td>
	  </tr>
	  <tr>
	  <td class="smallText" align="right"><b><?php 
    echo TABLE_HEADING_SHIPPING_TAX;
    ?>
</b></td>
	  <td class="smallText" align="right"><input name="update_shipping_tax" size="10" onKeyUp="getTotals('shipping', '<?php 
    $countryid = tep_get_country_id($order->delivery["country"]);
    $zoneid = tep_get_zone_id($countryid, $order->delivery["state"]);
    $default_tax_name = tep_get_tax_description($default_tax_class, $countryid, $zoneid);
    //default tax class is set at the top of the file
    echo $default_tax_name;
    ?>
')" value="<?php 
    echo tep_display_tax_value($order->info['shipping_tax']);
    ?>
" id="shipping_tax_rate" /></td>
	  <td></td>
	   </tr>
		<tr class="dataTableHeadingRow">
	  <td class="dataTableHeadingContent"></td>
	  <td class="dataTableHeadingContent"><?php 
    echo TABLE_HEADING_TOTAL_AMOUNT;
    ?>