Diff
521
531
531
order.php
  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: order.php 521 2006-04-25 14:33:00Z hpdl $ |
| |
| 3 | + | $Id: order.php 531 2006-04-25 15:42:48Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
93 | 93 | | $Qdel->bindInt(':orders_id', $id); |
| |
94 | 94 | | $Qdel->execute(); |
| |
95 | 95 | | } |
  |
| 96 | + | |
| |
| 97 | + | if (isset($_SESSION['prepOrderID'])) { |
| |
| 98 | + | unset($_SESSION['prepOrderID']); |
| |
| 99 | + | } |
|
96 | 100 | | } |
| |
97 | 101 | | |
| |
98 | 102 | | function insert() { |
| |
99 | 103 | | global $osC_Database, $osC_Customer, $osC_Language, $osC_Currencies, $osC_ShoppingCart; |
| |
100 | 104 | | |
  |
| 105 | + | if (isset($_SESSION['prepOrderID'])) { |
| |
| 106 | + | $_prep = explode('-', $_SESSION['prepOrderID']); |
| |
| 107 | + | |
| |
| 108 | + | if ($_prep[0] == $osC_ShoppingCart->getCartID()) { |
| |
| 109 | + | return $_prep[1]; // order_id |
| |
| 110 | + | } else { |
| |
| 111 | + | if (osC_Order::getStatusID($_prep[1]) === 4) { |
| |
| 112 | + | osC_Order::remove($_prep[1]); |
| |
| 113 | + | } |
| |
| 114 | + | } |
| |
| 115 | + | } |
| |
| 116 | + | |
|
101 | 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)'); |
| |
102 | 118 | | $Qorder->bindTable(':table_orders', TABLE_ORDERS); |
| |
103 | 119 | | $Qorder->bindInt(':customers_id', $osC_Customer->getID()); |
| |
|
|
 |
… |
|
229 | 245 | | } |
| |
230 | 246 | | } |
| |
231 | 247 | | |
  |
| 248 | + | $_SESSION['prepOrderID'] = $osC_ShoppingCart->getCartID() . '-' . $insert_id; |
| |
| 249 | + | |
|
232 | 250 | | return $insert_id; |
| |
233 | 251 | | } |
| |
234 | 252 | | |
| |
|
|
 |
… |
|
317 | 335 | | $Qupdate->bindInt(':products_id', $Qproducts->valueInt('products_id')); |
| |
318 | 336 | | $Qupdate->execute(); |
| |
319 | 337 | | } |
  |
| 338 | + | |
| |
| 339 | + | unset($_SESSION['prepOrderID']); |
|
320 | 340 | | } |
| |
321 | 341 | | |
  |
322 | | - | |
| |
323 | | - | |
  |
324 | 342 | | function &getListing($limit = null, $page_keyword = 'page') { |
| |
325 | 343 | | global $osC_Database, $osC_Customer, $osC_Language; |
| |
326 | 344 | | |
|