답변 1개 / 댓글 3개
누적 판매수량 기록 코드에 오류가 있었습니다. shop_admin/orderlistupdate.php 파일에서 다음 코드를 수정합니다.
Copy
// 완료인 경우에만 상품구입 합계수량을 상품테이블에 저장한다.
$sql2 = " select it_id, sum(ct_qty) as sum_qty from {$g5['g5_shop_cart_table']} where od_id = '$od_id' and ct_status = '완료' group by it_id ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++) {
$sql3 = " update {$g5['g5_shop_item_table']} set it_sum_qty = '{$row3['sum_qty']}' where it_id = '{$row3['it_id']}' ";
sql_query($sql3);
}
break;
위 코드를 아래처럼 수정합니다.
Copy
// 완료인 경우에만 상품구입 합계수량을 상품테이블에 저장한다.
$sql2 = " select it_id, sum(ct_qty) as sum_qty from {$g5['g5_shop_cart_table']} where od_id = '$od_id' and ct_status = '완료' group by it_id ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++) {
$sql3 = " update {$g5['g5_shop_item_table']} set it_sum_qty = it_sum_qty + '{$row2['sum_qty']}' where it_id = '{$row2['it_id']}' ";
sql_query($sql3);
}
break;
답변에 대한 댓글 3개
혹시 admin.shop.lib.php
// 주문서에 배송시 update
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);
}
}
}
이부분도 수정이 필요한가요?
// 주문서에 배송시 update
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);
}
}
}
이부분도 수정이 필요한가요?
답변을 작성하려면 로그인이 필요합니다.
수정후 테스트 하는데 역시나 수량이 입력안되네요...