function order_update_delivery($od_id, $mb_id, $change_status, $delivery) { global $g5; if ($change_status != '배송') { return; } $sql = " update {$g5['g5_shop_order_table']} set od_delivery_company = '{$delivery['delivery_company']}', od_invoice = '{$delivery['invoice']}', od_invoice_time = '{$delivery['invoice_time']}' where od_id = '{$od_id}' and od_status = '준비' "; sql_query($sql); $sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' "; $result = sql_query($sql); for ($i = 0; $row = sql_fetch_array($result); $i++) { // 재고를 사용하지 않았다면 $stock_use = $row['ct_stock_use']; if (!$row['ct_stock_use']) { // 재고에서 뺀다. subtract_io_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']); $stock_use = 1; $sql = " update {$g5['g5_shop_cart_table']} set ct_stock_use = '{$stock_use}' where ct_id = '{$row['ct_id']}' "; sql_query($sql); } } }
$sql .= " and ct_status IN ('" . implode("', '", $order_status) . "') "; break; default: } sql_query($sql); } // 배송때 재고반영 if ($info['od_misu'] == 0 && $od_status == '배송') { $sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' "; $result = sql_query($sql); for ($i = 0; $row = sql_fetch_array($result); $i++) { // 재고를 사용하지 않았다면 $stock_use = $row['ct_stock_use']; if (!$row['ct_stock_use']) { // 재고에서 뺀다. subtract_io_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']); $stock_use = 1; $sql = " update {$g5['g5_shop_cart_table']} set ct_stock_use = '{$stock_use}' where ct_id = '{$row['ct_id']}' "; sql_query($sql); } } unset($sql); unset($result); unset($row); } // 메일발송 define("_ORDERMAIL_", true); include "./ordermail.inc.php"; // SMS 문자전송 define("_ORDERSMS_", true); include "./ordersms.inc.php";