Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

1620
 
1750
 
1750
 
order.php
_> 11 <?php
  22 /*
<> 3 -  $Id: order.php,v 1.33 2003/06/09 22:25:35 hpdl Exp $
   3+  $Id: order.php 1750 2007-12-21 05:20:28Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
     
 !
7676                               'telephone' => $order['customers_telephone'],
  7777                               'email_address' => $order['customers_email_address']);
  7878 
<> 79 -      $this->delivery = array('name' => $order['delivery_name'],
   79+      $this->delivery = array('name' => trim($order['delivery_name']),
8080                               'company' => $order['delivery_company'],
  8181                               'street_address' => $order['delivery_street_address'],
  8282                               'suburb' => $order['delivery_suburb'],
     
 !
131131     }
  132132 
  133133     function cart() {
<> 134 -      global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment, $comments;
   134+      global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment, $comments, $customer_default_address_id;
135135 
  136136       $this->content_type = $cart->get_content_type();
  137137 
<>  138+      if ( ($this->content_type != 'virtual') && ($sendto == false) ) {
   139+        $sendto = $customer_default_address_id;
   140+      }
   141+
138142       $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)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");
  139143       $customer_address = tep_db_fetch_array($customer_address_query);
  140144 
<> 141 -      $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)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'");
  142 -      $shipping_address = tep_db_fetch_array($shipping_address_query);
  143 -     
  144 -      $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)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");
  145 -      $billing_address = tep_db_fetch_array($billing_address_query);
   145+      if (is_array($sendto) && !empty($sendto)) {
   146+        $shipping_address = array('entry_firstname' => $sendto['firstname'],
   147+                                  'entry_lastname' => $sendto['lastname'],
   148+                                  'entry_company' => $sendto['company'],
   149+                                  'entry_street_address' => $sendto['street_address'],
   150+                                  'entry_suburb' => $sendto['suburb'],
   151+                                  'entry_postcode' => $sendto['postcode'],
   152+                                  'entry_city' => $sendto['city'],
   153+                                  'entry_zone_id' => $sendto['zone_id'],
   154+                                  'zone_name' => $sendto['zone_name'],
   155+                                  'entry_country_id' => $sendto['country_id'],
   156+                                  'countries_id' => $sendto['country_id'],
   157+                                  'countries_name' => $sendto['country_name'],
   158+                                  'countries_iso_code_2' => $sendto['country_iso_code_2'],
   159+                                  'countries_iso_code_3' => $sendto['country_iso_code_3'],
   160+                                  'address_format_id' => $sendto['address_format_id'],
   161+                                  'entry_state' => $sendto['zone_name']);
   162+      } elseif (is_numeric($sendto)) {
   163+        $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)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'");
   164+        $shipping_address = tep_db_fetch_array($shipping_address_query);
   165+      } else {
   166+        $shipping_address = array('entry_firstname' => null,
   167+                                  'entry_lastname' => null,
   168+                                  'entry_company' => null,
   169+                                  'entry_street_address' => null,
   170+                                  'entry_suburb' => null,
   171+                                  'entry_postcode' => null,
   172+                                  'entry_city' => null,
   173+                                  'entry_zone_id' => null,
   174+                                  'zone_name' => null,
   175+                                  'entry_country_id' => null,
   176+                                  'countries_id' => null,
   177+                                  'countries_name' => null,
   178+                                  'countries_iso_code_2' => null,
   179+                                  'countries_iso_code_3' => null,
   180+                                  'address_format_id' => 0,
   181+                                  'entry_state' => null);
   182+      }
146183 
<> 147 -      $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)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'");
  148 -      $tax_address = tep_db_fetch_array($tax_address_query);
   184+      if (is_array($billto) && !empty($billto)) {
   185+        $billing_address = array('entry_firstname' => $billto['firstname'],
   186+                                 'entry_lastname' => $billto['lastname'],
   187+                                 'entry_company' => $billto['company'],
   188+                                 'entry_street_address' => $billto['street_address'],
   189+                                 'entry_suburb' => $billto['suburb'],
   190+                                 'entry_postcode' => $billto['postcode'],
   191+                                 'entry_city' => $billto['city'],
   192+                                 'entry_zone_id' => $billto['zone_id'],
   193+                                 'zone_name' => $billto['zone_name'],
   194+                                 'entry_country_id' => $billto['country_id'],
   195+                                 'countries_id' => $billto['country_id'],
   196+                                 'countries_name' => $billto['country_name'],
   197+                                 'countries_iso_code_2' => $billto['country_iso_code_2'],
   198+                                 'countries_iso_code_3' => $billto['country_iso_code_3'],
   199+                                 'address_format_id' => $billto['address_format_id'],
   200+                                 'entry_state' => $billto['zone_name']);
   201+      } else {
   202+        $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)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");
   203+        $billing_address = tep_db_fetch_array($billing_address_query);
   204+      }
149205 
<>  206+      if ($this->content_type == 'virtual') {
   207+        $tax_address = array('entry_country_id' => $billing_address['entry_country_id'],
   208+                             'entry_zone_id' => $billing_address['entry_zone_id']);
   209+      } else {
   210+        $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'],
   211+                             'entry_zone_id' => $shipping_address['entry_zone_id']);
   212+      }
   213+
150214       $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
  151215                           'currency' => $currency,
  152216                           'currency_value' => $currencies->currencies[$currency]['value'],
  153217                           'payment_method' => $payment,
<> 154 -                          'cc_type' => (isset($HTTP_POST_VARS['cc_type']) ? $HTTP_POST_VARS['cc_type'] : ''),
  155 -                          'cc_owner' => (isset($HTTP_POST_VARS['cc_owner']) ? $HTTP_POST_VARS['cc_owner'] : ''),
  156 -                          'cc_number' => (isset($HTTP_POST_VARS['cc_number_nh-dns']) ? $HTTP_POST_VARS['cc_number_nh-dns'] : ''),
  157 -                          'cc_expires' => (isset($HTTP_POST_VARS['cc_expires']) ? $HTTP_POST_VARS['cc_expires'] : ''),
   218+                          'cc_type' => '',
   219+                          'cc_owner' => '',
   220+                          'cc_number' => '',
   221+                          'cc_expires' => '',
<_ 158222                           'shipping_method' => $shipping['title'],
  159223                           'shipping_cost' => $shipping['cost'],
  160224                           'subtotal' => 0,