Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

754
 
757
 
757
 
order.php
_> 11 <?php
  22 /*
<> 3 -  $Id: order.php 754 2006-08-23 11:56:56Z hpdl $
   3+  $Id: order.php 757 2006-08-23 12:22:54Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
     
 !
3030       $this->customer = array();
  3131       $this->delivery = array();
  3232 
<> 33 -      if (tep_not_null($order_id)) {
   33+      if (!empty($order_id)) {
3434         $this->query($order_id);
  3535       } else {
  3636         $this->cart();
     
 !
114114         }
  115115       }
  116116 
<> 117 -      $Qorder = $osC_Database->query('insert into :table_orders (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, customers_ip_address, 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, payment_module, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values (: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, :customers_ip_address, :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, :payment_module, :cc_type, :cc_owner, :cc_number, :cc_expires, now(), :orders_status, :currency, :currency_value)');
   117+      $Qorder = $osC_Database->query('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_state_code, customers_country, customers_country_iso2, customers_country_iso3, customers_telephone, customers_email_address, customers_address_format, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_state_code, delivery_country, delivery_country_iso2, delivery_country_iso3, delivery_address_format, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_state_code, billing_country, billing_country_iso2, billing_country_iso3, billing_address_format, payment_method, payment_module, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_state_code, :customers_country, :customers_country_iso2, :customers_country_iso3, :customers_telephone, :customers_email_address, :customers_address_format, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_state_code, :delivery_country, :delivery_country_iso2, :delivery_country_iso3, :delivery_address_format, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_state_code, :billing_country, :billing_country_iso2, :billing_country_iso3, :billing_address_format, :payment_method, :payment_module, now(), :orders_status, :currency, :currency_value)');
118118       $Qorder->bindTable(':table_orders', TABLE_ORDERS);
  119119       $Qorder->bindInt(':customers_id', $osC_Customer->getID());
  120120       $Qorder->bindValue(':customers_name', $osC_Customer->getName());
     
 !
124124       $Qorder->bindValue(':customers_city', '' /*$order->customer['city']*/);
  125125       $Qorder->bindValue(':customers_postcode', '' /*$order->customer['postcode']*/);
  126126       $Qorder->bindValue(':customers_state', '' /*$order->customer['state']*/);
<>  127+      $Qorder->bindValue(':customers_state_code', '');
127128       $Qorder->bindValue(':customers_country', '' /*$order->customer['country']['title']*/);
<>  129+      $Qorder->bindValue(':customers_country_iso2', '');
   130+      $Qorder->bindValue(':customers_country_iso3', '');
128131       $Qorder->bindValue(':customers_telephone', '' /*$order->customer['telephone']*/);
  129132       $Qorder->bindValue(':customers_email_address', $osC_Customer->getEmailAddress());
<> 130 -      $Qorder->bindInt(':customers_address_format_id', $osC_Customer->getDefaultAddressID());
  131 -      $Qorder->bindValue(':customers_ip_address', tep_get_ip_address());
   133+      $Qorder->bindValue(':customers_address_format', '');
   134+      $Qorder->bindValue(':customers_ip_address', osc_get_ip_address());
132135       $Qorder->bindValue(':delivery_name', $osC_ShoppingCart->getShippingAddress('firstname') . ' ' . $osC_ShoppingCart->getShippingAddress('lastname'));
  133136       $Qorder->bindValue(':delivery_company', $osC_ShoppingCart->getShippingAddress('company'));
  134137       $Qorder->bindValue(':delivery_street_address', $osC_ShoppingCart->getShippingAddress('street_address'));
  135138       $Qorder->bindValue(':delivery_suburb', $osC_ShoppingCart->getShippingAddress('suburb'));
  136139       $Qorder->bindValue(':delivery_city', $osC_ShoppingCart->getShippingAddress('city'));
  137140       $Qorder->bindValue(':delivery_postcode', $osC_ShoppingCart->getShippingAddress('postcode'));
  138141       $Qorder->bindValue(':delivery_state', $osC_ShoppingCart->getShippingAddress('state'));
<>  142+      $Qorder->bindValue(':delivery_state_code', $osC_ShoppingCart->getShippingAddress('zone_code'));
139143       $Qorder->bindValue(':delivery_country', $osC_ShoppingCart->getShippingAddress('country_title'));
<> 140 -      $Qorder->bindInt(':delivery_address_format_id', $osC_ShoppingCart->getShippingAddress('format_id'));
   144+      $Qorder->bindValue(':delivery_country_iso2', $osC_ShoppingCart->getShippingAddress('country_iso_code_2'));
   145+      $Qorder->bindValue(':delivery_country_iso3', $osC_ShoppingCart->getShippingAddress('country_iso_code_3'));
   146+      $Qorder->bindValue(':delivery_address_format', $osC_ShoppingCart->getShippingAddress('format'));
141147       $Qorder->bindValue(':billing_name', $osC_ShoppingCart->getBillingAddress('firstname') . ' ' . $osC_ShoppingCart->getBillingAddress('lastname'));
  142148       $Qorder->bindValue(':billing_company', $osC_ShoppingCart->getBillingAddress('company'));
  143149       $Qorder->bindValue(':billing_street_address', $osC_ShoppingCart->getBillingAddress('street_address'));
  144150       $Qorder->bindValue(':billing_suburb', $osC_ShoppingCart->getBillingAddress('suburb'));
  145151       $Qorder->bindValue(':billing_city', $osC_ShoppingCart->getBillingAddress('city'));
  146152       $Qorder->bindValue(':billing_postcode', $osC_ShoppingCart->getBillingAddress('postcode'));
  147153       $Qorder->bindValue(':billing_state', $osC_ShoppingCart->getBillingAddress('state'));
<>  154+      $Qorder->bindValue(':billing_state_code', $osC_ShoppingCart->getBillingAddress('zone_code'));
148155       $Qorder->bindValue(':billing_country', $osC_ShoppingCart->getBillingAddress('country_title'));
<> 149 -      $Qorder->bindInt(':billing_address_format_id', $osC_ShoppingCart->getBillingAddress('format_id'));
   156+      $Qorder->bindValue(':billing_country_iso2', $osC_ShoppingCart->getBillingAddress('country_iso_code_2'));
   157+      $Qorder->bindValue(':billing_country_iso3', $osC_ShoppingCart->getBillingAddress('country_iso_code_3'));
   158+      $Qorder->bindValue(':billing_address_format', $osC_ShoppingCart->getBillingAddress('format'));
150159       $Qorder->bindValue(':payment_method', $osC_ShoppingCart->getBillingMethod('title'));
  151160       $Qorder->bindValue(':payment_module', $GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]->getCode());
<> 152 -      $Qorder->bindValue(':cc_type', '' /*$order->info['cc_type']*/);
  153 -      $Qorder->bindValue(':cc_owner', '' /*$order->info['cc_owner']*/);
  154 -      $Qorder->bindValue(':cc_number', '' /*$order->info['cc_number']*/);
  155 -      $Qorder->bindValue(':cc_expires', '' /*$order->info['cc_expires']*/);
156161       $Qorder->bindInt(':orders_status', 4);
  157162       $Qorder->bindValue(':currency', $osC_Currencies->getCode());
  158163       $Qorder->bindValue(':currency_value', $osC_Currencies->value($osC_Currencies->getCode()));
     
 !
184189         $Qproducts = $osC_Database->query('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :final_price, :products_tax, :products_quantity)');
  185190         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
  186191         $Qproducts->bindInt(':orders_id', $insert_id);
<> 187 -        $Qproducts->bindInt(':products_id', tep_get_prid($products['id']));
   192+        $Qproducts->bindInt(':products_id', osc_get_product_id($products['id']));
188193         $Qproducts->bindValue(':products_model', '' /*$products['model']*/);
  189194         $Qproducts->bindValue(':products_name', $products['name']);
  190195         $Qproducts->bindValue(':products_price', $products['price']);
     
 !
405410 
  406411           $email_order .= "\n" . $osC_Language->get('email_order_delivery_address') . "\n" .
  407412                           $osC_Language->get('email_order_separator') . "\n" .
<> 408 -                          tep_address_format($Qorder->valueInt('delivery_address_format_id'), $address, false, '', "\n") . "\n";
   413+                          osC_Address::format($address, "\n") . "\n";
409414 
  410415           unset($address);
  411416         }
     
 !
421426 
  422427         $email_order .= "\n" . $osC_Language->get('email_order_billing_address') . "\n" .
  423428                         $osC_Language->get('email_order_separator') . "\n" .
<> 424 -                        tep_address_format($Qorder->valueInt('billing_address_format_id'), $address, false, '', "\n") . "\n\n";
   429+                        osC_Address::format($address, "\n") . "\n\n";
425430 
  426431         unset($address);
  427432 
     
 !
457462 //          }
  458463 //        }
  459464 
<> 460 -        tep_mail($Qorder->value('customers_name'), $Qorder->value('customers_email_address'), $osC_Language->get('email_order_subject'), $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
   465+        osc_email($Qorder->value('customers_name'), $Qorder->value('customers_email_address'), $osC_Language->get('email_order_subject'), $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
461466 
  462467 // send emails to other people
  463468         if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
<> 464 -          tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, $osC_Language->get('email_order_subject'), $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
   469+          osc_email('', SEND_EXTRA_ORDER_EMAILS_TO, $osC_Language->get('email_order_subject'), $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
465470         }
  466471       }
  467472 
     
 !
574579     function query($order_id) {
  575580       global $osC_Database, $osC_Language;
  576581 
<> 577 -      $Qorder = $osC_Database->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');
   582+      $Qorder = $osC_Database->query('select * from :table_orders where orders_id = :orders_id');
578583       $Qorder->bindTable(':table_orders', TABLE_ORDERS);
  579584       $Qorder->bindInt(':orders_id', $order_id);
  580585       $Qorder->execute();
     
 !
613618       $this->info = array('currency' => $Qorder->value('currency'),
  614619                           'currency_value' => $Qorder->value('currency_value'),
  615620                           'payment_method' => $Qorder->value('payment_method'),
<> 616 -                          'cc_type' => $Qorder->value('cc_type'),
  617 -                          'cc_owner' => $Qorder->valueProtected('cc_owner'),
  618 -                          'cc_number' => $Qorder->valueProtected('cc_number'),
  619 -                          'cc_expires' => $Qorder->valueProtected('cc_expires'),
620621                           'date_purchased' => $Qorder->value('date_purchased'),
  621622                           'orders_status' => $Qstatus->value('orders_status_name'),
  622623                           'last_modified' => $Qorder->value('last_modified'),
     
 !
631632                               'city' => $Qorder->valueProtected('customers_city'),
  632633                               'postcode' => $Qorder->valueProtected('customers_postcode'),
  633634                               'state' => $Qorder->valueProtected('customers_state'),
<>  635+                              'state_code' => $Qorder->value('customers_state_code'),
634636                               'country' => $Qorder->valueProtected('customers_country'),
<> 635 -                              'format_id' => $Qorder->valueInt('customers_address_format_id'),
   637+                              'country_iso2' => $Qorder->value('customers_country_iso2'),
   638+                              'country_iso3' => $Qorder->value('customers_country_iso3'),
   639+                              'format' => $Qorder->value('customers_address_format'),
636640                               'telephone' => $Qorder->valueProtected('customers_telephone'),
  637641                               'email_address' => $Qorder->valueProtected('customers_email_address'));
  638642 
     
 !
643647                               'city' => $Qorder->valueProtected('delivery_city'),
  644648                               'postcode' => $Qorder->valueProtected('delivery_postcode'),
  645649                               'state' => $Qorder->valueProtected('delivery_state'),
<>  650+                              'state_code' => $Qorder->value('delivery_state_code'),
646651                               'country' => $Qorder->valueProtected('delivery_country'),
<> 647 -                              'format_id' => $Qorder->valueInt('delivery_address_format_id'));
   652+                              'country_iso2' => $Qorder->value('delivery_country_iso2'),
   653+                              'country_iso3' => $Qorder->value('delivery_country_iso3'),
   654+                              'format' => $Qorder->value('delivery_address_format'));
648655 
  649656       if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
  650657         $this->delivery = false;
     
 !
657664                              'city' => $Qorder->valueProtected('billing_city'),
  658665                              'postcode' => $Qorder->valueProtected('billing_postcode'),
  659666                              'state' => $Qorder->valueProtected('billing_state'),
<>  667+                             'state_code' => $Qorder->value('billing_state_code'),
660668                              'country' => $Qorder->valueProtected('billing_country'),
<> 661 -                             'format_id' => $Qorder->valueInt('billing_address_format_id'));
   669+                             'country_iso2' => $Qorder->value('billing_country_iso2'),
   670+                             'country_iso3' => $Qorder->value('billing_country_iso3'),
   671+                             'format' => $Qorder->value('billing_address_format'));
<_ 662672 
  663673       $Qproducts = $osC_Database->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');
  664674       $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);