@@ -122,7 +128,7 @@ $s_uq_id = get_session('ss_uq_id');
|
|
|
- |
+ |
장바구니의 상품을 주문하시려면 주문하기를 클릭하세요. 비우기는 장바구니의 상품을 모두 비웁니다.
쇼핑 계속하기
- 주문하기
- 선택삭제
- 비우기
+
+
+
@@ -258,22 +264,17 @@ function form_check(act) {
if (act == "buy")
{
- f.act.value = act;
-
-
+
+ f.act.value = act;
+ f.submit();
}
else if (act == "alldelete")
{
f.act.value = act;
- f.action = "./cartupdate.php";
f.submit();
}
else if (act == "seldelete")
@@ -284,7 +285,6 @@ function form_check(act) {
}
f.act.value = act;
- f.action = "./cartupdate.php";
f.submit();
}
diff --git a/shop/cartupdate.php b/shop/cartupdate.php
index e8ff31846..e8a7333ec 100644
--- a/shop/cartupdate.php
+++ b/shop/cartupdate.php
@@ -22,8 +22,29 @@ if ($member['mb_level'] < $default['de_level_sell'])
alert('상품을 구입할 수 있는 권한이 없습니다.');
}
+if($act == "buy")
+{
+ if(!count($_POST['ct_chk']))
+ alert("주문하실 상품을 하나이상 선택해 주십시오.");
-if ($act == "d") // 삭제이면
+ $fldcnt = count($_POST['it_id']);
+ for($i=0; $i<$fldcnt; $i++) {
+ $ct_chk = $_POST['ct_chk'][$i];
+ if($ct_chk) {
+ $it_id = $_POST['it_id'][$i];
+ $sql = " update {$g4['shop_cart_table']}
+ set ct_select = '1'
+ where it_id = '$it_id' and uq_id = '$tmp_uq_id' ";
+ sql_query($sql);
+ }
+ }
+
+ if ($is_member) // 회원인 경우
+ goto_url(G4_SHOP_URL.'/orderform.php');
+ else
+ goto_url(G4_BBS_URL.'/login.php?url='.urlencode(G4_SHOP_URL.'/orderform.php'));
+}
+else if ($act == "d") // 삭제이면
{
$sql = " delete from {$g4['shop_cart_table']}
where ct_id = '$ct_id'
@@ -38,10 +59,10 @@ else if ($act == "alldelete") // 모두 삭제이면
}
else if ($act == "seldelete") // 선택삭제
{
- $fldcnt = count($_POST['it_id']);
- if(!$fldcnt)
+ if(!count($_POST['ct_chk']))
alert("삭제하실 상품을 하나이상 선택해 주십시오.");
+ $fldcnt = count($_POST['it_id']);
for($i=0; $i<$fldcnt; $i++) {
$ct_chk = $_POST['ct_chk'][$i];
if($ct_chk) {
@@ -326,10 +347,15 @@ else // 장바구니에 담기
else
$ct_num = 0;
+ if($sw_direct)
+ $ct_select = 1;
+ else
+ $ct_select = 0;
+
$ct_count = 0;
$comma = '';
$sql = " INSERT INTO {$g4['shop_cart_table']}
- ( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct )
+ ( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_select )
VALUES ";
for($i=0; $i<$option_count; $i++) {
@@ -350,7 +376,7 @@ else // 장바구니에 담기
continue;
}
- $sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )";
+ $sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_num++;
$ct_count++;
diff --git a/shop/orderform.php b/shop/orderform.php
index d6e8a60b8..a633b81ee 100644
--- a/shop/orderform.php
+++ b/shop/orderform.php
@@ -18,9 +18,6 @@ else {
if (get_cart_count($tmp_uq_id) == 0)
alert('장바구니가 비어 있습니다.', G4_SHOP_URL.'/cart.php');
-// 포인트 결제 대기 필드 추가
-//sql_query(" ALTER TABLE `$g4[shop_order_table]` ADD `od_temp_point` INT NOT NULL AFTER `od_temp_card` ", false);
-
$g4['title'] = '주문서 작성';
include_once('./_head.php');
@@ -148,6 +145,7 @@ setTimeout("init_pay_button();",300);
b.ca_id3
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$s_uq_id'
+ and a.ct_select = '1'
and a.ct_num = '0' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
@@ -245,7 +243,8 @@ setTimeout("init_pay_button();",300);
} // for 끝
if ($i == 0) {
- echo '| 장바구니에 담긴 상품이 없습니다. |
';
+ //echo '| 장바구니에 담긴 상품이 없습니다. |
';
+ alert('장바구니가 비어 있습니다.', G4_SHOP_URL.'/cart.php');
} else {
// 배송비 계산
if ($default['de_send_cost_case'] == '없음')
diff --git a/shop/orderformupdate.php b/shop/orderformupdate.php
index a920ef833..e77021ca9 100644
--- a/shop/orderformupdate.php
+++ b/shop/orderformupdate.php
@@ -20,7 +20,7 @@ else
$tmp_uq_id = get_session('ss_uq_id');
if (get_cart_count($tmp_uq_id) == 0)// 장바구니에 담기
- alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', './cart.php');
+ alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G4_SHOP_URL.'/cart.php');
$error = "";
// 장바구니 상품 재고 검사
@@ -31,7 +31,8 @@ $sql = " select it_id,
io_type,
ct_option
from {$g4['shop_cart_table']}
- where uq_id = '$tmp_uq_id' ";
+ where uq_id = '$tmp_uq_id'
+ and ct_select = '1' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
@@ -46,6 +47,9 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$error .= "{$row['ct_option']} 의 재고수량이 부족합니다. 현재고수량 : $it_stock_qty 개\\n\\n";
}
+if($i == 0)
+ alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G4_SHOP_URL.'/cart.php');
+
if ($error != "")
{
$error .= "다른 고객님께서 {$od_name}님 보다 먼저 주문하신 경우입니다. 불편을 끼쳐 죄송합니다.";
@@ -59,7 +63,7 @@ $i_temp_point = (int)$_POST['od_temp_point'];
// 주문금액이 상이함
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as od_amount
- from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' ";
+ from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' and ct_select = '1' ";
$row = sql_fetch($sql);
$tot_ct_amount = $row['od_amount'];
@@ -106,7 +110,8 @@ if($is_member) {
$sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price
from {$g4['shop_cart_table']}
where uq_id = '$tmp_uq_id'
- and it_id = '$it_id' ";
+ and it_id = '$it_id'
+ and ct_select = '1' ";
$ct = sql_fetch($sql);
$item_price = $ct['sum_price'];
@@ -366,10 +371,13 @@ else
// 주문번호를 얻는다.
$od_id = get_session('ss_order_uniqid');
+// 주문상품의 uq_id 변경을 위한 uq_id를 얻는다.
+$uq_id = get_uniqid();
+
// 주문서에 입력
$sql = " insert {$g4['shop_order_table']}
set od_id = '$od_id',
- uq_id = '$tmp_uq_id',
+ uq_id = '$uq_id',
mb_id = '{$member['mb_id']}',
od_pwd = '$od_pwd',
od_name = '$od_name',
@@ -431,9 +439,11 @@ if (($od_receipt_card > 0 || $od_receipt_hp > 0) && $default['de_card_point'] ==
$sql_card_point = " , ct_point = '0' ";
}
$sql = "update {$g4['shop_cart_table']}
- set ct_status = '주문'
+ set uq_id = '$uq_id',
+ ct_status = '주문'
$sql_card_point
- where uq_id = '$tmp_uq_id' ";
+ where uq_id = '$tmp_uq_id'
+ and ct_select = '1' ";
$result = sql_query($sql, false);
// 주문정보 입력 오류시 kcp 결제 취소
@@ -446,7 +456,7 @@ if(!$result) {
echo "$sql
" . mysql_errno() . " : " . mysql_error() . "
error file : {$_SERVER['PHP_SELF']}";
// 주문삭제
- sql_query(" delete from {$g4['shop_order_table']} where od_id = '$od_id' and uq_id = '$tmp_uq_id' ");
+ sql_query(" delete from {$g4['shop_order_table']} where od_id = '$od_id' and uq_id = '$uq_id' ");
exit;
}
@@ -482,8 +492,9 @@ if($is_member) {
$cp_amt = (int)$arr_it_cp_amt[$cp_it_id];
$sql = " update {$g4['shop_cart_table']}
set cp_amount = '$cp_amt'
- where uq_id = '$tmp_uq_id'
+ where uq_id = '$uq_id'
and it_id = '$cp_it_id'
+ and ct_select = '1'
and ct_num = '0' ";
sql_query($sql);
}
@@ -556,20 +567,14 @@ if($default['de_sms_use'] && ($default['de_sms_use2'] || $default['de_sms_use3']
// orderview 에서 사용하기 위해 tmp에 넣고
-set_session('ss_temp_uq_id', $tmp_uq_id);
+set_session('ss_temp_uq_id', $uq_id);
// 주문번호제거
set_session('ss_order_uniqid', '');
-// ss_uq_id 기존자료 세션에서 제거
+// 기존자료 세션에서 제거
if (get_session('ss_direct'))
set_session('ss_uq_direct', '');
-else
- set_session('ss_uq_id', '');
-// 비회원장바구니 쿠키 초기화
-if(get_cookie('ck_guest_cart_uqid'))
- set_cookie('ck_guest_cart_uqid', '', 0);
-
-goto_url(G4_SHOP_URL.'/orderinquiryview.php?od_id='.$od_id.'&uq_id='.$tmp_uq_id);
+goto_url(G4_SHOP_URL.'/orderinquiryview.php?od_id='.$od_id.'&uq_id='.$uq_id);
?>
diff --git a/shop/ordermail1.inc.php b/shop/ordermail1.inc.php
index 87f92e62b..25af49c12 100644
--- a/shop/ordermail1.inc.php
+++ b/shop/ordermail1.inc.php
@@ -18,7 +18,8 @@ $sql = " select a.it_id,
b.it_sell_email,
b.it_origin
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
- where a.uq_id = '$tmp_uq_id'
+ where a.uq_id = '$uq_id'
+ and a.ct_select = '1'
and a.ct_num = '0' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
@@ -29,13 +30,14 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
SUM(ct_qty) as qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}'
- and uq_id = '$tmp_uq_id' ";
+ and uq_id = '$uq_id'
+ and ct_select = '1' ";
$sum = sql_fetch($sql);
// 옵션정보
$sql2 = " select ct_option, ct_qty
from {$g4['shop_cart_table']}
- where it_id = '{$row['it_id']}' and uq_id = '$tmp_uq_id'
+ where it_id = '{$row['it_id']}' and uq_id = '$uq_id' and ct_select = '1'
order by io_type asc, ct_num asc, ct_id asc ";
$result2 = sql_query($sql2);
diff --git a/shop/ordermail2.inc.php b/shop/ordermail2.inc.php
index 383110162..e23decc22 100644
--- a/shop/ordermail2.inc.php
+++ b/shop/ordermail2.inc.php
@@ -39,7 +39,8 @@ $sql = " select b.it_sell_email,
a.it_id,
a.it_name
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
- where a.uq_id = '$tmp_uq_id'
+ where a.uq_id = '$uq_id'
+ and a.ct_select = '1'
and a.ct_num = '0'
and b.it_sell_email <> '' ";
$result = sql_query($sql);
@@ -51,13 +52,14 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
SUM(ct_qty) as qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}'
- and uq_id = '$tmp_uq_id' ";
+ and uq_id = '$uq_id'
+ and ct_select = '1' ";
$sum = sql_fetch($sql);
// 옵션정보
$sql2 = " select ct_option, ct_qty
from {$g4['shop_cart_table']}
- where it_id = '{$row['it_id']}' and uq_id = '$tmp_uq_id'
+ where it_id = '{$row['it_id']}' and uq_id = '$uq_id' and ct_select = '1'
order by io_type asc, ct_num asc, ct_id asc ";
$result2 = sql_query($sql2);