[TEP-COMMIT] [CVS catalog] use the new database class

hpdl-OfajU3CKLf1/[email protected] 25 Feb 2005 18:39:12 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes/classes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">order.php</a></tt></td><td align="right" id="added">+192</td><td align="right" id="removed">-137</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/order.php?rev=1.35&amp;content-type=text/vnd.viewcvs-markup">1.35</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/order.php.diff?r1=1.35&amp;r2=1.36">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/order.php?rev=1.36&amp;content-type=text/vnd.viewcvs-markup">1.36</a></td></tr>
</table>
<pre class="comment">
use the new database class
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes">classes</a><br /></span>
<div class="fileheader"><big><b>order.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/order.php?rev=1.35&amp;content-type=text/vnd.viewcvs-markup">1.35</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/order.php.diff?r1=1.35&amp;r2=1.36">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/order.php?rev=1.36&amp;content-type=text/vnd.viewcvs-markup">1.36</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.35 -r1.36
--- order.php	2003/12/18 23:52:14	1.35
+++ order.php	2005/02/25 18:39:09	1.36
@@ -5,7 +5,7 @@
</small></pre><pre class="diff" id="context">   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com
 
</pre><pre class="diff" id="removed">-  Copyright (c) 200<span id="removedchars">3</span> osCommerce
</pre><pre class="diff" id="added">+  Copyright (c) 200<span id="addedchars">5</span> osCommerce
</pre><pre class="diff" id="context"> 
   Released under the GNU General Public License
 */
</pre><pre class="diff"><small id="info">@@ -28,97 +28,124 @@
</small></pre><pre class="diff" id="context">     }
 
     function query($order_id) {
</pre><pre class="diff" id="removed">-      global $osC_Session;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Session;
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $order_id = tep_db_prepare_input($order_id);
</pre><pre class="diff" id="added">+      $Qorder = $osC_Database-&gt;query('select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from :table_orders where orders_id = :orders_id');
+      $Qorder-&gt;bindTable(':table_orders', TABLE_ORDERS);
+      $Qorder-&gt;bindInt(':orders_id', $order_id);
+      $Qorder-&gt;execute();
+
+      $Qtotals = $osC_Database-&gt;query('select title, text, class from :table_orders_total where orders_id = :orders_id order by sort_order');
+      $Qtotals-&gt;bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
+      $Qtotals-&gt;bindInt(':orders_id', $order_id);
+      $Qtotals-&gt;execute();
+
+      $shipping_method_string = '';
+      $order_total_string = '';
+
+      while ($Qtotals-&gt;next()) {
+        $this-&gt;totals[] = array('title' =&gt; $Qtotals-&gt;value('title'),
+                                'text' =&gt; $Qtotals-&gt;value('text'));
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
-      $order = tep_db_fetch_array($order_query);
</pre><pre class="diff" id="added">+        if ($Qtotals-&gt;value('class') == 'ot_shipping') {
+          $shipping_method_string = strip_tags($Qtotals-&gt;value('title'));
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
-      while ($totals = tep_db_fetch_array($totals_query)) {
-        $this-&gt;totals[] = array('title' =&gt; $totals['title'],
-                                'text' =&gt; $totals['text']);
-      }
-
-      $order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");
-      $order_total = tep_db_fetch_array($order_total_query);
-
-      $shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");
-      $shipping_method = tep_db_fetch_array($shipping_method_query);
</pre><pre class="diff" id="added">+          if (substr($shipping_method_string, -1) == ':') {
+            $shipping_method_string = substr($Qtotals-&gt;value('title'), 0, -1);
+          }
+        }
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$osC_Session-&gt;value('languages_id') . "'");
-      $order_status = tep_db_fetch_array($order_status_query);
</pre><pre class="diff" id="added">+        if ($Qtotals-&gt;value('class') == 'ot_total') {
+          $order_total_string = strip_tags($Qtotals-&gt;value('text'));
+        }
+      }
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $this-&gt;info = array('currency' =&gt; $order['currency'],
-                          'currency_value' =&gt; $order['currency_value'],
-                          'payment_method' =&gt; $order['payment_method'],
-                          'cc_type' =&gt; $order['cc_type'],
-                          'cc_owner' =&gt; $order['cc_owner'],
-                          'cc_number' =&gt; $order['cc_number'],
-                          'cc_expires' =&gt; $order['cc_expires'],
-                          'date_purchased' =&gt; $order['date_purchased'],
-                          'orders_status' =&gt; $order_status['orders_status_name'],
-                          'last_modified' =&gt; $order['last_modified'],
-                          'total' =&gt; strip_tags($order_total['text']),
-                          'shipping_method' =&gt; ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])));
-
-      $this-&gt;customer = array('id' =&gt; $order['customers_id'],
-                              'name' =&gt; $order['customers_name'],
-                              'company' =&gt; $order['customers_company'],
-                              'street_address' =&gt; $order['customers_street_address'],
-                              'suburb' =&gt; $order['customers_suburb'],
-                              'city' =&gt; $order['customers_city'],
-                              'postcode' =&gt; $order['customers_postcode'],
-                              'state' =&gt; $order['customers_state'],
-                              'country' =&gt; $order['customers_country'],
-                              'format_id' =&gt; $order['customers_address_format_id'],
-                              'telephone' =&gt; $order['customers_telephone'],
-                              'email_address' =&gt; $order['customers_email_address']);
-
-      $this-&gt;delivery = array('name' =&gt; $order['delivery_name'],
-                              'company' =&gt; $order['delivery_company'],
-                              'street_address' =&gt; $order['delivery_street_address'],
-                              'suburb' =&gt; $order['delivery_suburb'],
-                              'city' =&gt; $order['delivery_city'],
-                              'postcode' =&gt; $order['delivery_postcode'],
-                              'state' =&gt; $order['delivery_state'],
-                              'country' =&gt; $order['delivery_country'],
-                              'format_id' =&gt; $order['delivery_address_format_id']);
</pre><pre class="diff" id="added">+      $Qstatus = $osC_Database-&gt;query('select orders_status_name from :table_orders_status where orders_status_id = :orders_status_id and language_id = :language_id');
+      $Qstatus-&gt;bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
+      $Qstatus-&gt;bindInt(':orders_status', $Qorder-&gt;valueInt('orders_status'));
+      $Qstatus-&gt;bindInt(':language_id', $osC_Session-&gt;value('languages_id'));
+      $Qstatus-&gt;execute();
+
+      $this-&gt;info = array('currency' =&gt; $Qorder-&gt;value('currency'),
+                          'currency_value' =&gt; $Qorder-&gt;value('currency_value'),
+                          'payment_method' =&gt; $Qorder-&gt;value('payment_method'),
+                          'cc_type' =&gt; $Qorder-&gt;value('cc_type'),
+                          'cc_owner' =&gt; $Qorder-&gt;valueProtected('cc_owner'),
+                          'cc_number' =&gt; $Qorder-&gt;valueProtected('cc_number'),
+                          'cc_expires' =&gt; $Qorder-&gt;valueProtected('cc_expires'),
+                          'date_purchased' =&gt; $Qorder-&gt;value('date_purchased'),
+                          'orders_status' =&gt; $Qstatus-&gt;value('orders_status_name'),
+                          'last_modified' =&gt; $Qorder-&gt;value('last_modified'),
+                          'total' =&gt; $order_total_string,
+                          'shipping_method' =&gt; $shipping_method_string);
+
+      $this-&gt;customer = array('id' =&gt; $Qorder-&gt;valueInt('customers_id'),
+                              'name' =&gt; $Qorder-&gt;valueProtected('customers_name'),
+                              'company' =&gt; $Qorder-&gt;valueProtected('customers_company'),
+                              'street_address' =&gt; $Qorder-&gt;valueProtected('customers_street_address'),
+                              'suburb' =&gt; $Qorder-&gt;valueProtected('customers_suburb'),
+                              'city' =&gt; $Qorder-&gt;valueProtected('customers_city'),
+                              'postcode' =&gt; $Qorder-&gt;valueProtected('customers_postcode'),
+                              'state' =&gt; $Qorder-&gt;valueProtected('customers_state'),
+                              'country' =&gt; $Qorder-&gt;valueProtected('customers_country'),
+                              'format_id' =&gt; $Qorder-&gt;valueInt('customers_address_format_id'),
+                              'telephone' =&gt; $Qorder-&gt;valueProtected('customers_telephone'),
+                              'email_address' =&gt; $Qorder-&gt;valueProtected('customers_email_address'));
+
+      $this-&gt;delivery = array('name' =&gt; $Qorder-&gt;valueProtected('delivery_name'),
+                              'company' =&gt; $Qorder-&gt;valueProtected('delivery_company'),
+                              'street_address' =&gt; $Qorder-&gt;valueProtected('delivery_street_address'),
+                              'suburb' =&gt; $Qorder-&gt;valueProtected('delivery_suburb'),
+                              'city' =&gt; $Qorder-&gt;valueProtected('delivery_city'),
+                              'postcode' =&gt; $Qorder-&gt;valueProtected('delivery_postcode'),
+                              'state' =&gt; $Qorder-&gt;valueProtected('delivery_state'),
+                              'country' =&gt; $Qorder-&gt;valueProtected('delivery_country'),
+                              'format_id' =&gt; $Qorder-&gt;valueInt('delivery_address_format_id'));
</pre><pre class="diff" id="context"> 
       if (empty($this-&gt;delivery['name']) &amp;&amp; empty($this-&gt;delivery['street_address'])) {
         $this-&gt;delivery = false;
       }
 
</pre><pre class="diff" id="removed">-      $this-&gt;billing = array('name' =&gt; $order['billing_name'],
-                             'company' =&gt; $order['billing_company'],
-                             'street_address' =&gt; $order['billing_street_address'],
-                             'suburb' =&gt; $order['billing_suburb'],
-                             'city' =&gt; $order['billing_city'],
-                             'postcode' =&gt; $order['billing_postcode'],
-                             'state' =&gt; $order['billing_state'],
-                             'country' =&gt; $order['billing_country'],
-                             'format_id' =&gt; $order['billing_address_format_id']);
</pre><pre class="diff" id="added">+      $this-&gt;billing = array('name' =&gt; $Qorder-&gt;valueProtected('billing_name'),
+                             'company' =&gt; $Qorder-&gt;valueProtected('billing_company'),
+                             'street_address' =&gt; $Qorder-&gt;valueProtected('billing_street_address'),
+                             'suburb' =&gt; $Qorder-&gt;valueProtected('billing_suburb'),
+                             'city' =&gt; $Qorder-&gt;valueProtected('billing_city'),
+                             'postcode' =&gt; $Qorder-&gt;valueProtected('billing_postcode'),
+                             'state' =&gt; $Qorder-&gt;valueProtected('billing_state'),
+                             'country' =&gt; $Qorder-&gt;valueProtected('billing_country'),
+                             'format_id' =&gt; $Qorder-&gt;valueInt('billing_address_format_id'));
+
+      $Qproducts = $osC_Database-&gt;query('select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from :table_orders_products where orders_id = :orders_id');
+      $Qproducts-&gt;bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
+      $Qproducts-&gt;bindInt(':orders_id', $order_id);
+      $Qproducts-&gt;execute();
</pre><pre class="diff" id="context"> 
       $index = 0;
</pre><pre class="diff" id="removed">-      $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
-      while ($orders_products = tep_db_fetch_array($orders_products_query)) {
-        $this-&gt;products[$index] = array('qty' =&gt; $orders_products['products_quantity'],
-                                        'id' =&gt; $orders_products['products_id'],
-                                        'name' =&gt; $orders_products['products_name'],
-                                        'model' =&gt; $orders_products['products_model'],
-                                        'tax' =&gt; $orders_products['products_tax'],
-                                        'price' =&gt; $orders_products['products_price'],
-                                        'final_price' =&gt; $orders_products['final_price']);
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="added">+      while ($Qproducts-&gt;next()) {
</pre><pre class="diff" id="context">         $subindex = 0;
</pre><pre class="diff" id="removed">-        $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix 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-&gt;products[$index]['attributes'][$subindex] = array('option' =&gt; $attributes['products_options'],
-                                                                     'value' =&gt; $attributes['products_options_values'],
-                                                                     'prefix' =&gt; $attributes['price_prefix'],
-                                                                     'price' =&gt; $attributes['options_values_price']);
</pre><pre class="diff" id="added">+
+        $this-&gt;products[$index] = array('qty' =&gt; $Qproducts-&gt;valueInt('products_quantity'),
+                                        'id' =&gt; $Qproducts-&gt;valueInt('products_id'),
+                                        'name' =&gt; $Qproducts-&gt;value('products_name'),
+                                        'model' =&gt; $Qproducts-&gt;value('products_model'),
+                                        'tax' =&gt; $Qproducts-&gt;value('products_tax'),
+                                        'price' =&gt; $Qproducts-&gt;value('products_price'),
+                                        'final_price' =&gt; $Qproducts-&gt;value('final_price'));
+
+        $Qattributes = $osC_Database-&gt;query('select products_options, products_options_values, options_values_price, price_prefix from :table_orders_products_attributes where orders_id = :orders_id and orders_products_id = :orders_products_id');
+        $Qattributes-&gt;bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
+        $Qattributes-&gt;bindInt(':orders_id', $order_id);
+        $Qattributes-&gt;bindInt(':orders_products_id', $Qproducts-&gt;valueInt('orders_products_id'));
+        $Qattributes-&gt;execute();
+
+        if ($Qattributes-&gt;numberOfRows()) {
+          while ($Qattributes-&gt;next()) {
+            $this-&gt;products[$index]['attributes'][$subindex] = array('option' =&gt; $Qattributes-&gt;value('products_options'),
+                                                                     'value' =&gt; $Qattributes-&gt;value('products_options_values'),
+                                                                     'prefix' =&gt; $Qattributes-&gt;value('price_prefix'),
+                                                                     'price' =&gt; $Qattributes-&gt;value('options_values_price'));
</pre><pre class="diff" id="context"> 
             $subindex++;
           }
</pre><pre class="diff"><small id="info">@@ -131,24 +158,44 @@
</small></pre><pre class="diff" id="context">     }
 
     function cart() {
</pre><pre class="diff" id="removed">-      global $osC_Session, $osC_Customer, $osC_Tax, $cart, $osC_Currencies;
</pre><pre class="diff" id="added">+      global $osC_<span id="addedchars">Database,&nbsp;$osC_</span>Session, $osC_Customer, $osC_Tax, $cart, $osC_Currencies;
</pre><pre class="diff" id="context"> 
       $this-&gt;content_type = $cart-&gt;get_content_type();
 
       $shipping =&amp; $osC_Session-&gt;value('shipping');
       $payment =&amp; $osC_Session-&gt;value('payment');
</pre><pre class="diff" id="removed">-
-      $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$osC_Customer-&gt;id . "' and ab.customers_id = '" . (int)$osC_Customer-&gt;id . "' and c.customers_default_address_id = ab.address_book_id");
-      $customer_address = tep_db_fetch_array($customer_address_query);
-
-      $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$osC_Customer-&gt;id . "' and ab.address_book_id = '" . (int)$osC_Session-&gt;value('sendto') . "'");
-      $shipping_address = tep_db_fetch_array($shipping_address_query);
-
-      $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$osC_Customer-&gt;id . "' and ab.address_book_id = '" . (int)$osC_Session-&gt;value('billto') . "'");
-      $billing_address = tep_db_fetch_array($billing_address_query);
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$osC_Customer-&gt;id . "' and ab.address_book_id = '" . (int)($this-&gt;content_type == 'virtual' ? $osC_Session-&gt;value('billto') : $osC_Session-&gt;value('sendto')) . "'");
-      $tax_address = tep_db_fetch_array($tax_address_query);
</pre><pre class="diff" id="added">+      $Qcustomer = $osC_Database-&gt;query('select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from :table_customers c, :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries co on (ab.entry_country_id = co.countries_id) where c.customers_id = :customers_id and ab.customers_id = :customers_id and c.customers_default_address_id = ab.address_book_id');
+      $Qcustomer-&gt;bindTable(':table_customers', TABLE_CUSTOMERS);
+      $Qcustomer-&gt;bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+      $Qcustomer-&gt;bindTable(':table_zones', TABLE_ZONES);
+      $Qcustomer-&gt;bindTable(':table_countries', TABLE_COUNTRIES);
+      $Qcustomer-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qcustomer-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qcustomer-&gt;execute();
+
+      $Qshipping = $osC_Database-&gt;query('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
+      $Qshipping-&gt;bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+      $Qshipping-&gt;bindTable(':table_zones', TABLE_ZONES);
+      $Qshipping-&gt;bindTable(':table_countries', TABLE_COUNTRIES);
+      $Qshipping-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qshipping-&gt;bindInt(':address_book_id', $osC_Session-&gt;value('sendto'));
+      $Qshipping-&gt;execute();
+
+      $Qbilling = $osC_Database-&gt;query('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
+      $Qbilling-&gt;bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+      $Qbilling-&gt;bindTable(':table_zones', TABLE_ZONES);
+      $Qbilling-&gt;bindTable(':table_countries', TABLE_COUNTRIES);
+      $Qbilling-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qbilling-&gt;bindInt(':address_book_id', $osC_Session-&gt;value('billto'));
+      $Qbilling-&gt;execute();
+
+      $Qtax = $osC_Database-&gt;query('select ab.entry_country_id, ab.entry_zone_id from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
+      $Qtax-&gt;bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+      $Qtax-&gt;bindTable(':table_zones', TABLE_ZONES);
+      $Qtax-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qtax-&gt;bindInt(':address_book_id', ($this-&gt;content_type == 'virtual' ? $osC_Session-&gt;value('billto') : $osC_Session-&gt;value('sendto')));
+      $Qtax-&gt;execute();
</pre><pre class="diff" id="context"> 
       $this-&gt;info = array('order_status' =&gt; DEFAULT_ORDERS_STATUS_ID,
                           'currency' =&gt; $osC_Session-&gt;value('currency'),
</pre><pre class="diff"><small id="info">@@ -173,45 +220,45 @@
</small></pre><pre class="diff" id="context">         }
       }
 
</pre><pre class="diff" id="removed">-      $this-&gt;customer = array('firstname' =&gt; $customer_address['customers_firstname'],
-                              'lastname' =&gt; $customer_address['customers_lastname'],
-                              'company' =&gt; $customer_address['entry_company'],
-                              'street_address' =&gt; $customer_address['entry_street_address'],
-                              'suburb' =&gt; $customer_address['entry_suburb'],
-                              'city' =&gt; $customer_address['entry_city'],
-                              'postcode' =&gt; $customer_address['entry_postcode'],
-                              'state' =&gt; ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
-                              'zone_id' =&gt; $customer_address['entry_zone_id'],
-                              'country' =&gt; array('id' =&gt; $customer_address['countries_id'], 'title' =&gt; $customer_address['countries_name'], 'iso_code_2' =&gt; $customer_address['countries_iso_code_2'], 'iso_code_3' =&gt; $customer_address['countries_iso_code_3']),
-                              'format_id' =&gt; $customer_address['address_format_id'],
-                              'telephone' =&gt; $customer_address['customers_telephone'],
-                              'email_address' =&gt; $customer_address['customers_email_address']);
-
-      $this-&gt;delivery = array('firstname' =&gt; $shipping_address['entry_firstname'],
-                              'lastname' =&gt; $shipping_address['entry_lastname'],
-                              'company' =&gt; $shipping_address['entry_company'],
-                              'street_address' =&gt; $shipping_address['entry_street_address'],
-                              'suburb' =&gt; $shipping_address['entry_suburb'],
-                              'city' =&gt; $shipping_address['entry_city'],
-                              'postcode' =&gt; $shipping_address['entry_postcode'],
-                              'state' =&gt; ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
-                              'zone_id' =&gt; $shipping_address['entry_zone_id'],
-                              'country' =&gt; array('id' =&gt; $shipping_address['countries_id'], 'title' =&gt; $shipping_address['countries_name'], 'iso_code_2' =&gt; $shipping_address['countries_iso_code_2'], 'iso_code_3' =&gt; $shipping_address['countries_iso_code_3']),
-                              'country_id' =&gt; $shipping_address['entry_country_id'],
-                              'format_id' =&gt; $shipping_address['address_format_id']);
-
-      $this-&gt;billing = array('firstname' =&gt; $billing_address['entry_firstname'],
-                             'lastname' =&gt; $billing_address['entry_lastname'],
-                             'company' =&gt; $billing_address['entry_company'],
-                             'street_address' =&gt; $billing_address['entry_street_address'],
-                             'suburb' =&gt; $billing_address['entry_suburb'],
-                             'city' =&gt; $billing_address['entry_city'],
-                             'postcode' =&gt; $billing_address['entry_postcode'],
-                             'state' =&gt; ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),
-                             'zone_id' =&gt; $billing_address['entry_zone_id'],
-                             'country' =&gt; array('id' =&gt; $billing_address['countries_id'], 'title' =&gt; $billing_address['countries_name'], 'iso_code_2' =&gt; $billing_address['countries_iso_code_2'], 'iso_code_3' =&gt; $billing_address['countries_iso_code_3']),
-                             'country_id' =&gt; $billing_address['entry_country_id'],
-                             'format_id' =&gt; $billing_address['address_format_id']);
</pre><pre class="diff" id="added">+      $this-&gt;customer = array('firstname' =&gt; $Qcustomer-&gt;valueProtected('customers_firstname'),
+                              'lastname' =&gt; $Qcustomer-&gt;valueProtected('customers_lastname'),
+                              'company' =&gt; $Qcustomer-&gt;valueProtected('entry_company'),
+                              'street_address' =&gt; $Qcustomer-&gt;valueProtected('entry_street_address'),
+                              'suburb' =&gt; $Qcustomer-&gt;valueProtected('entry_suburb'),
+                              'city' =&gt; $Qcustomer-&gt;valueProtected('entry_city'),
+                              'postcode' =&gt; $Qcustomer-&gt;valueProtected('entry_postcode'),
+                              'state' =&gt; (tep_not_null($Qcustomer-&gt;valueProtected('entry_state')) ? $Qcustomer-&gt;valueProtected('entry_state') : $Qcustomer-&gt;valueProtected('zone_name')),
+                              'zone_id' =&gt; $Qcustomer-&gt;valueInt('entry_zone_id'),
+                              'country' =&gt; array('id' =&gt; $Qcustomer-&gt;valueInt('countries_id'), 'title' =&gt; $Qcustomer-&gt;value('countries_name'), 'iso_code_2' =&gt; $Qcustomer-&gt;value('countries_iso_code_2'), 'iso_code_3' =&gt; $Qcustomer-&gt;value('countries_iso_code_3')),
+                              'format_id' =&gt; $Qcustomer-&gt;valueInt('address_format_id'),
+                              'telephone' =&gt; $Qcustomer-&gt;valueProtected('customers_telephone'),
+                              'email_address' =&gt; $Qcustomer-&gt;valueProtected('customers_email_address'));
+
+      $this-&gt;delivery = array('firstname' =&gt; $Qshipping-&gt;valueProtected('entry_firstname'),
+                              'lastname' =&gt; $Qshipping-&gt;valueProtected('entry_lastname'),
+                              'company' =&gt; $Qshipping-&gt;valueProtected('entry_company'),
+                              'street_address' =&gt; $Qshipping-&gt;valueProtected('entry_street_address'),
+                              'suburb' =&gt; $Qshipping-&gt;valueProtected('entry_suburb'),
+                              'city' =&gt; $Qshipping-&gt;valueProtected('entry_city'),
+                              'postcode' =&gt; $Qshipping-&gt;valueProtected('entry_postcode'),
+                              'state' =&gt; (tep_not_null($Qshipping-&gt;valueProtected('entry_state')) ? $Qshipping-&gt;valueProtected('entry_state') : $Qshipping-&gt;valueProtected('zone_name')),
+                              'zone_id' =&gt; $Qshipping-&gt;valueInt('entry_zone_id'),
+                              'country' =&gt; array('id' =&gt; $Qshipping-&gt;valueInt('countries_id'), 'title' =&gt; $Qshipping-&gt;value('countries_name'), 'iso_code_2' =&gt; $Qshipping-&gt;value('countries_iso_code_2'), 'iso_code_3' =&gt; $Qshipping-&gt;value('countries_iso_code_3')),
+                              'country_id' =&gt; $Qshipping-&gt;valueInt('entry_country_id'),
+                              'format_id' =&gt; $Qshipping-&gt;valueInt('address_format_id'));
+
+      $this-&gt;billing = array('firstname' =&gt; $Qbilling-&gt;valueProtected('entry_firstname'),
+                             'lastname' =&gt; $Qbilling-&gt;valueProtected('entry_lastname'),
+                             'company' =&gt; $Qbilling-&gt;valueProtected('entry_company'),
+                             'street_address' =&gt; $Qbilling-&gt;valueProtected('entry_street_address'),
+                             'suburb' =&gt; $Qbilling-&gt;valueProtected('entry_suburb'),
+                             'city' =&gt; $Qbilling-&gt;valueProtected('entry_city'),
+                             'postcode' =&gt; $Qbilling-&gt;valueProtected('entry_postcode'),
+                             'state' =&gt; (tep_not_null($Qbilling-&gt;valueProtected('entry_state')) ? $Qbilling-&gt;valueProtected('entry_state') : $Qbilling-&gt;valueProtected('zone_name')),
+                             'zone_id' =&gt; $Qbilling-&gt;valueInt('entry_zone_id'),
+                             'country' =&gt; array('id' =&gt; $Qbilling-&gt;valueInt('countries_id'), 'title' =&gt; $Qbilling-&gt;value('countries_name'), 'iso_code_2' =&gt; $Qbilling-&gt;value('countries_iso_code_2'), 'iso_code_3' =&gt; $Qbilling-&gt;value('countries_iso_code_3')),
+                             'country_id' =&gt; $Qbilling-&gt;valueInt('entry_country_id'),
+                             'format_id' =&gt; $Qbilling-&gt;valueInt('address_format_id'));
</pre><pre class="diff" id="context"> 
       $index = 0;
       $products = $cart-&gt;get_products();
</pre><pre class="diff"><small id="info">@@ -219,8 +266,8 @@
</small></pre><pre class="diff" id="context">         $this-&gt;products[$index] = array('qty' =&gt; $products[$i]['quantity'],
                                         'name' =&gt; $products[$i]['name'],
                                         'model' =&gt; $products[$i]['model'],
</pre><pre class="diff" id="removed">-                                        'tax' =&gt; $osC_Tax-&gt;getTaxRate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
-                                        'tax_description' =&gt; $osC_Tax-&gt;getTaxRateDescription($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
</pre><pre class="diff" id="added">+                                        'tax' =&gt; $osC_Tax-&gt;getTaxRate($products[$i]['tax_class_id'], $Qtax-&gt;valueInt('entry_country_id'), $Qtax-&gt;valueInt('entry_zone_id')),
+                                        'tax_description' =&gt; $osC_Tax-&gt;getTaxRateDescription($products[$i]['tax_class_id'], $Qtax-&gt;valueInt('entry_country_id'), $Qtax-&gt;valueInt('entry_zone_id')),
</pre><pre class="diff" id="context">                                         'tax_class_id' =&gt; $products[$i]['tax_class_id'],
                                         'price' =&gt; $products[$i]['price'],
                                         'final_price' =&gt; $products[$i]['price'] + $cart-&gt;attributes_price($products[$i]['id']),
</pre><pre class="diff"><small id="info">@@ -231,15 +278,23 @@
</small></pre><pre class="diff" id="context">           $subindex = 0;
           reset($products[$i]['attributes']);
           while (list($option, $value) = each($products[$i]['attributes'])) {
</pre><pre class="diff" id="removed">-            $attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$osC_Session-&gt;value('languages_id') . "' and poval.language_id = '" . (int)$osC_Session-&gt;value('languages_id') . "'");
-            $attributes = tep_db_fetch_array($attributes_query);
</pre><pre class="diff" id="added">+            $Qattributes = $osC_Database-&gt;query('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :language_id and poval.language_id = :language_id');
+            $Qattributes-&gt;bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
+            $Qattributes-&gt;bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
+            $Qattributes-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+            $Qattributes-&gt;bindInt(':products_id', $products[$i]['id']);
+            $Qattributes-&gt;bindInt(':options_id', $option);
+            $Qattributes-&gt;bindInt(':options_values_id', $value);
+            $Qattributes-&gt;bindInt(':language_id', $osC_Session-&gt;value('languages_id'));
+            $Qattributes-&gt;bindInt(':language_id', $osC_Session-&gt;value('languages_id'));
+            $Qattributes-&gt;execute();
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-            $this-&gt;products[$index]['attributes'][$subindex] = array('option' =&gt; $attributes['products_options_name'],
-                                                                     'value' =&gt; $attributes['products_options_values_name'],
</pre><pre class="diff" id="added">+            $this-&gt;products[$index]['attributes'][$subindex] = array('option' =&gt; $Qattributes-&gt;value('products_options_name'),
+                                                                     'value' =&gt; $Qattributes-&gt;value('products_options_values_name'),
</pre><pre class="diff" id="context">                                                                      'option_id' =&gt; $option,
                                                                      'value_id' =&gt; $value,
</pre><pre class="diff" id="removed">-                                                                     'prefix' =&gt; $attributes['price_prefix'],
-                                                                     'price' =&gt; $attributes['options_values_price']);
</pre><pre class="diff" id="added">+                                                                     'prefix' =&gt; $Qattributes-&gt;value('price_prefix'),
+                                                                     'price' =&gt; $Qattributes-&gt;value('options_values_price'));
</pre><pre class="diff" id="context"> 
             $subindex++;
           }
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.9</small></center>
</body></html>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click