주문관련 코드 수정중

This commit is contained in:
gnuboard
2013-10-22 10:55:29 +09:00
parent 61fc9655ad
commit eb2b23ce17
7 changed files with 217 additions and 66 deletions

View File

@ -2,6 +2,7 @@
$sub_menu = '400400';
include_once('./_common.php');
//print_r2($_POST); exit;
// 상품옵션별재고 또는 상품재고에 더하기
function add_io_stock($it_id, $ct_qty, $io_id="", $io_type="")
@ -56,40 +57,47 @@ function change_status($od_id, $current_status, $change_status)
}
//print_r2($_POST);
// 주문상태변경 처리
function change_order_status($current_staus, $change_status, $od)
for ($i=0; $i<count($_POST['chk']); $i++)
{
global $g5;
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$od_id = $_POST['od_id'][$k];
// 현재 주문상태와 바뀔 주문상태가 같다면 처리하지 않음
if ($current_staus == $change_status) return;
$invoice = $_POST['od_invoice'][$k];
$invoice_time = $_POST['od_invoice_time'][$k];
$delivery_company = $_POST['od_delivery_company'][$k];
$od_id = $od['od_id'];
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
if (!$od) continue;
//change_order_status($od['od_status'], $_POST['od_status'], $od);
//echo $od_id . "<br>";
switch ($current_staus)
$current_status = $od['od_status'];
$change_status = $_POST['od_status'];
switch ($current_status)
{
case '주문' :
if ($change_status != '입금') return;
if ($od['od_settle_case'] != '무통장') return;
if ($change_status != '입금') continue;
if ($od['od_settle_case'] != '무통장') continue;
change_status($od_id, '주문', '입금');
$sql = " update {$g5['g5_shop_order_table']}
set od_receipt_price = od_misu,
od_misu = 0,
od_receipt_time = '".G5_TIME_YMDHIS."'
where od_id = '$od_id' and od_status = '주문' ";
where od_id = '$od_id' and od_status = '입금' ";
sql_query($sql, true);
change_status($od_id, '주문', '입금');
break;
case '입금' :
if ($change_status != '준비') return;
if ($change_status != '준비') continue;
change_status($od_id, '입금', '준비');
@ -97,15 +105,25 @@ function change_order_status($current_staus, $change_status, $od)
case '준비' :
if ($change_status != '배송') return;
if ($change_status != '배송') continue;
change_status($od_id, '준비', '배송');
$sql = " update {$g5['g5_shop_order_table']}
set od_delivery_company = '$delivery_company',
od_invoice = '$invoice',
od_invoice_time = '$invoice_time'
where od_id = '$od_id' and od_status = '배송' ";
sql_query($sql, true);
$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++) {
// 재고를 이미 사용했다면 (재고에서 이미 뺐다면)
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 재고를 이미 사용했거나 재고에서 이미 뺐다면
$stock_use = $row['ct_stock_use'];
if ($row['ct_stock_use'])
{
if ($ct_status == '주문' || $ct_status == '취소' || $ct_status == '반품' || $ct_status == '품절')
@ -127,8 +145,8 @@ function change_order_status($current_staus, $change_status, $od)
}
$point_use = $row['ct_point_use'];
// 회원이면서 포인트가 0보다 크면
// 이미 포인트를 부여했다면 뺀다.
// 회원이면서 포인트가 0보다 크거나 이미 포인트를 부여했다면 뺀다.
if ($od['mb_id'] && $row['ct_point'] && $row['ct_point_use'])
{
$point_use = 0;
@ -148,8 +166,12 @@ function change_order_status($current_staus, $change_status, $od)
case '배송' :
if ($change_status != '완료') return;
}
if ($change_status != '완료') continue;
change_status($od_id, '배송', '완료');
} // switch end
// 주문정보
$info = get_order_info($od_id);
@ -163,19 +185,7 @@ function change_order_status($current_staus, $change_status, $od)
od_send_cost = '{$info['od_send_cost']}'
where od_id = '$od_id' ";
sql_query($sql, true);
}
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$od_id = $_POST['od_id'][$k];
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
if (!$od) continue;
change_order_status($od['od_status'], $_POST['od_status'], $od);
//echo $od_id . "<br>";
}
$qstr = "sort1=$sort1&amp;sort2=$sort2&amp;sel_field=$sel_field&amp;search=$search";