이니시스 모바일 결제시 장바구니 체크 과정 추가
This commit is contained in:
@ -22,6 +22,49 @@ if(isset($data['pp_id']) && $data['pp_id']) {
|
|||||||
$page_return_url = G5_SHOP_URL.'/orderform.php';
|
$page_return_url = G5_SHOP_URL.'/orderform.php';
|
||||||
if($_SESSION['ss_direct'])
|
if($_SESSION['ss_direct'])
|
||||||
$page_return_url .= '?sw_direct=1';
|
$page_return_url .= '?sw_direct=1';
|
||||||
|
|
||||||
|
// 장바구니가 비어있는가?
|
||||||
|
if (get_session('ss_direct'))
|
||||||
|
$tmp_cart_id = get_session('ss_cart_direct');
|
||||||
|
else
|
||||||
|
$tmp_cart_id = get_session('ss_cart_id');
|
||||||
|
|
||||||
|
if (get_cart_count($tmp_cart_id) == 0)// 장바구니에 담기
|
||||||
|
alert('세션을 잃거나 다른 브라우저에서 데이터가 변경된 경우입니다. 장바구니 상태를 확인후에 다시 시도해 주세요.', G5_SHOP_URL.'/cart.php');
|
||||||
|
|
||||||
|
$error = "";
|
||||||
|
// 장바구니 상품 재고 검사
|
||||||
|
$sql = " select it_id,
|
||||||
|
ct_qty,
|
||||||
|
it_name,
|
||||||
|
io_id,
|
||||||
|
io_type,
|
||||||
|
ct_option
|
||||||
|
from {$g5['g5_shop_cart_table']}
|
||||||
|
where od_id = '$tmp_cart_id'
|
||||||
|
and ct_select = '1' ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||||
|
{
|
||||||
|
// 상품에 대한 현재고수량
|
||||||
|
if($row['io_id']) {
|
||||||
|
$it_stock_qty = (int)get_option_stock_qty($row['it_id'], $row['io_id'], $row['io_type']);
|
||||||
|
} else {
|
||||||
|
$it_stock_qty = (int)get_it_stock_qty($row['it_id']);
|
||||||
|
}
|
||||||
|
// 장바구니 수량이 재고수량보다 많다면 오류
|
||||||
|
if ($row['ct_qty'] > $it_stock_qty)
|
||||||
|
$error .= "{$row['ct_option']} 의 재고수량이 부족합니다. 현재고수량 : $it_stock_qty 개\\n\\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($i == 0)
|
||||||
|
alert('장바구니가 비어 있습니다.', G5_SHOP_URL.'/cart.php');
|
||||||
|
|
||||||
|
if ($error != "")
|
||||||
|
{
|
||||||
|
$error .= "결제진행이 중단 되었습니다.";
|
||||||
|
alert($error, G5_SHOP_URL.'/cart.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_REQUEST['P_STATUS'] != '00') {
|
if($_REQUEST['P_STATUS'] != '00') {
|
||||||
|
|||||||
Reference in New Issue
Block a user