Diff
754
757
757
order.php
  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: order.php 754 2006-08-23 11:56:56Z hpdl $ |
| |
| 3 | + | $Id: order.php 757 2006-08-23 12:22:54Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
30 | 30 | | $this->customer = array(); |
| |
31 | 31 | | $this->delivery = array(); |
| |
32 | 32 | | |
  |
33 | | - | if (tep_not_null($order_id)) { |
| |
| 33 | + | if (!empty($order_id)) { |
|
34 | 34 | | $this->query($order_id); |
| |
35 | 35 | | } else { |
| |
36 | 36 | | $this->cart(); |
| |
|
|
 |
… |
|
114 | 114 | | } |
| |
115 | 115 | | } |
| |
116 | 116 | | |
  |
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)'); |
|
118 | 118 | | $Qorder->bindTable(':table_orders', TABLE_ORDERS); |
| |
119 | 119 | | $Qorder->bindInt(':customers_id', $osC_Customer->getID()); |
| |
120 | 120 | | $Qorder->bindValue(':customers_name', $osC_Customer->getName()); |
| |
|
|
 |
… |
|
124 | 124 | | $Qorder->bindValue(':customers_city', '' /*$order->customer['city']*/); |
| |
125 | 125 | | $Qorder->bindValue(':customers_postcode', '' /*$order->customer['postcode']*/); |
| |
126 | 126 | | $Qorder->bindValue(':customers_state', '' /*$order->customer['state']*/); |
  |
| 127 | + | $Qorder->bindValue(':customers_state_code', ''); |
|
127 | 128 | | $Qorder->bindValue(':customers_country', '' /*$order->customer['country']['title']*/); |
  |
| 129 | + | $Qorder->bindValue(':customers_country_iso2', ''); |
| |
| 130 | + | $Qorder->bindValue(':customers_country_iso3', ''); |
|
128 | 131 | | $Qorder->bindValue(':customers_telephone', '' /*$order->customer['telephone']*/); |
| |
129 | 132 | | $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()); |
|
132 | 135 | | $Qorder->bindValue(':delivery_name', $osC_ShoppingCart->getShippingAddress('firstname') . ' ' . $osC_ShoppingCart->getShippingAddress('lastname')); |
| |
133 | 136 | | $Qorder->bindValue(':delivery_company', $osC_ShoppingCart->getShippingAddress('company')); |
| |
134 | 137 | | $Qorder->bindValue(':delivery_street_address', $osC_ShoppingCart->getShippingAddress('street_address')); |
| |
135 | 138 | | $Qorder->bindValue(':delivery_suburb', $osC_ShoppingCart->getShippingAddress('suburb')); |
| |
136 | 139 | | $Qorder->bindValue(':delivery_city', $osC_ShoppingCart->getShippingAddress('city')); |
| |
137 | 140 | | $Qorder->bindValue(':delivery_postcode', $osC_ShoppingCart->getShippingAddress('postcode')); |
| |
138 | 141 | | $Qorder->bindValue(':delivery_state', $osC_ShoppingCart->getShippingAddress('state')); |
  |
| 142 | + | $Qorder->bindValue(':delivery_state_code', $osC_ShoppingCart->getShippingAddress('zone_code')); |
|
139 | 143 | | $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')); |
|
141 | 147 | | $Qorder->bindValue(':billing_name', $osC_ShoppingCart->getBillingAddress('firstname') . ' ' . $osC_ShoppingCart->getBillingAddress('lastname')); |
| |
142 | 148 | | $Qorder->bindValue(':billing_company', $osC_ShoppingCart->getBillingAddress('company')); |
| |
143 | 149 | | $Qorder->bindValue(':billing_street_address', $osC_ShoppingCart->getBillingAddress('street_address')); |
| |
144 | 150 | | $Qorder->bindValue(':billing_suburb', $osC_ShoppingCart->getBillingAddress('suburb')); |
| |
145 | 151 | | $Qorder->bindValue(':billing_city', $osC_ShoppingCart->getBillingAddress('city')); |
| |
146 | 152 | | $Qorder->bindValue(':billing_postcode', $osC_ShoppingCart->getBillingAddress('postcode')); |
| |
147 | 153 | | $Qorder->bindValue(':billing_state', $osC_ShoppingCart->getBillingAddress('state')); |
  |
| 154 | + | $Qorder->bindValue(':billing_state_code', $osC_ShoppingCart->getBillingAddress('zone_code')); |
|
148 | 155 | | $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')); |
|
150 | 159 | | $Qorder->bindValue(':payment_method', $osC_ShoppingCart->getBillingMethod('title')); |
| |
151 | 160 | | $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']*/); |
|
156 | 161 | | $Qorder->bindInt(':orders_status', 4); |
| |
157 | 162 | | $Qorder->bindValue(':currency', $osC_Currencies->getCode()); |
| |
158 | 163 | | $Qorder->bindValue(':currency_value', $osC_Currencies->value($osC_Currencies->getCode())); |
| |
|
|
 |
… |
|
184 | 189 | | $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)'); |
| |
185 | 190 | | $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); |
| |
186 | 191 | | $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'])); |
|
188 | 193 | | $Qproducts->bindValue(':products_model', '' /*$products['model']*/); |
| |
189 | 194 | | $Qproducts->bindValue(':products_name', $products['name']); |
| |
190 | 195 | | $Qproducts->bindValue(':products_price', $products['price']); |
| |
|
|
 |
… |
|
405 | 410 | | |
| |
406 | 411 | | $email_order .= "\n" . $osC_Language->get('email_order_delivery_address') . "\n" . |
| |
407 | 412 | | $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"; |
|
409 | 414 | | |
| |
410 | 415 | | unset($address); |
| |
411 | 416 | | } |
| |
|
|
 |
… |
|
421 | 426 | | |
| |
422 | 427 | | $email_order .= "\n" . $osC_Language->get('email_order_billing_address') . "\n" . |
| |
423 | 428 | | $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"; |
|
425 | 430 | | |
| |
426 | 431 | | unset($address); |
| |
427 | 432 | | |
| |
|
|
 |
… |
|
457 | 462 | | // } |
| |
458 | 463 | | // } |
| |
459 | 464 | | |
  |
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); |
|
461 | 466 | | |
| |
462 | 467 | | // send emails to other people |
| |
463 | 468 | | 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); |
|
465 | 470 | | } |
| |
466 | 471 | | } |
| |
467 | 472 | | |
| |
|
|
 |
… |
|
574 | 579 | | function query($order_id) { |
| |
575 | 580 | | global $osC_Database, $osC_Language; |
| |
576 | 581 | | |
  |
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'); |
|
578 | 583 | | $Qorder->bindTable(':table_orders', TABLE_ORDERS); |
| |
579 | 584 | | $Qorder->bindInt(':orders_id', $order_id); |
| |
580 | 585 | | $Qorder->execute(); |
| |
|
|
 |
… |
|
613 | 618 | | $this->info = array('currency' => $Qorder->value('currency'), |
| |
614 | 619 | | 'currency_value' => $Qorder->value('currency_value'), |
| |
615 | 620 | | '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'), |
|
620 | 621 | | 'date_purchased' => $Qorder->value('date_purchased'), |
| |
621 | 622 | | 'orders_status' => $Qstatus->value('orders_status_name'), |
| |
622 | 623 | | 'last_modified' => $Qorder->value('last_modified'), |
| |
|
|
 |
… |
|
631 | 632 | | 'city' => $Qorder->valueProtected('customers_city'), |
| |
632 | 633 | | 'postcode' => $Qorder->valueProtected('customers_postcode'), |
| |
633 | 634 | | 'state' => $Qorder->valueProtected('customers_state'), |
  |
| 635 | + | 'state_code' => $Qorder->value('customers_state_code'), |
|
634 | 636 | | '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'), |
|
636 | 640 | | 'telephone' => $Qorder->valueProtected('customers_telephone'), |
| |
637 | 641 | | 'email_address' => $Qorder->valueProtected('customers_email_address')); |
| |
638 | 642 | | |
| |
|
|
 |
… |
|
643 | 647 | | 'city' => $Qorder->valueProtected('delivery_city'), |
| |
644 | 648 | | 'postcode' => $Qorder->valueProtected('delivery_postcode'), |
| |
645 | 649 | | 'state' => $Qorder->valueProtected('delivery_state'), |
  |
| 650 | + | 'state_code' => $Qorder->value('delivery_state_code'), |
|
646 | 651 | | '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')); |
|
648 | 655 | | |
| |
649 | 656 | | if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) { |
| |
650 | 657 | | $this->delivery = false; |
| |
|
|
 |
… |
|
657 | 664 | | 'city' => $Qorder->valueProtected('billing_city'), |
| |
658 | 665 | | 'postcode' => $Qorder->valueProtected('billing_postcode'), |
| |
659 | 666 | | 'state' => $Qorder->valueProtected('billing_state'), |
  |
| 667 | + | 'state_code' => $Qorder->value('billing_state_code'), |
|
660 | 668 | | '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')); |
  |
662 | 672 | | |
| |
663 | 673 | | $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'); |
| |
664 | 674 | | $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); |
|