보관함에서 상품담기와 주문하기 기능 수정
This commit is contained in:
@ -10,7 +10,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
|
||||
<div id="sod_ws">
|
||||
|
||||
<form name="fwishlist" method="post" action="">
|
||||
<form name="fwishlist" method="post" action="./cartupdate.php">
|
||||
<input type="hidden" name="act" value="multi">
|
||||
<input type="hidden" name="sw_direct" value="">
|
||||
<input type="hidden" name="prog" value="wish">
|
||||
@ -26,31 +26,25 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = " select *
|
||||
from {$g4['shop_wish_table']} a,
|
||||
{$g4['shop_item_table']} b
|
||||
$sql = " select a.wi_id, a.wi_time, b.*
|
||||
from {$g4['shop_wish_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.mb_id = '{$member['mb_id']}'
|
||||
and a.it_id = b.it_id
|
||||
order by a.wi_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row = mysql_fetch_array($result); $i++) {
|
||||
|
||||
$out_cd = '';
|
||||
for($k=1; $k<=6; $k++){
|
||||
$opt = trim($row['it_opt'.$k]);
|
||||
if(preg_match("/\n/", $opt)||preg_match("/;/" , $opt)) {
|
||||
$out_cd = 'no';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sql = " select count(*) as cnt from {$g4['shop_item_option_table']} where it_id = '{$row['it_id']}' and io_type = '0' ";
|
||||
$tmp = sql_fetch($sql);
|
||||
if($tmp['cnt'])
|
||||
$out_cd = 'no';
|
||||
|
||||
$it_price = get_price($row);
|
||||
|
||||
if ($row['it_tel_inq']) $out_cd = 'tel_inq';
|
||||
|
||||
$image = get_it_image($row['it_id'], 70, 70);
|
||||
|
||||
$s_del = '';
|
||||
$it_point = get_item_point($row);
|
||||
?>
|
||||
|
||||
<tr>
|
||||
@ -73,7 +67,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
<?php } ?>
|
||||
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo $row['it_name']; ?>">
|
||||
<input type="hidden" name="it_price[<?php echo $i; ?>]" value="<?php echo $it_price; ?>">
|
||||
<input type="hidden" name="it_point[<?php echo $i; ?>]" value="<?php echo $row['it_point']; ?>">
|
||||
<input type="hidden" name="it_point[<?php echo $i; ?>]" value="<?php echo $it_point; ?>">
|
||||
<input type="hidden" name="ct_qty[<?php echo $i; ?>]" value="1">
|
||||
</td>
|
||||
<td class="td_smallmng"><a href="<?php echo G4_SHOP_URL; ?>/wishupdate.php?w=d&wi_id=<?php echo $row['wi_id']; ?>">삭제</a></td>
|
||||
@ -86,11 +80,10 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div id="sod_ws_act">
|
||||
<a href="javascript:fwishlist_check(document.fwishlist,'');" class="btn01">장바구니 담기</a>
|
||||
<a href="javascript:fwishlist_check(document.fwishlist,'direct_buy');" class="btn02">주문하기</a>
|
||||
<button type="submit" class="btn01" onclick="return fwishlist_check(document.fwishlist,'');">장바구니 담기</button>
|
||||
<button type="submit" class="btn02" onclick="return fwishlist_check(document.fwishlist,'direct_buy');">주문하기</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -125,7 +118,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
if(k == 0)
|
||||
{
|
||||
alert("상품을 하나 이상 체크 하십시오");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (act == "direct_buy")
|
||||
@ -137,9 +130,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
f.sw_direct.value = 0;
|
||||
}
|
||||
|
||||
f.action="<?php echo G4_SHOP_URL; ?>/cartupdate.php";
|
||||
|
||||
f.submit();
|
||||
return true;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
@ -72,9 +72,8 @@ else if ($act == "seldelete") // 선택삭제
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($act == "multi") // 온라인견적(등)에서 여러개의 상품이 한꺼번에 들어옴.
|
||||
else if ($act == "multi") // 여러개의 상품이 한꺼번에 들어옴.
|
||||
{
|
||||
// 보관함에서 금액이 제대로 반영되지 않던 오류를 수정
|
||||
$fldcnt = count($_POST['it_name']);
|
||||
|
||||
// 재고등을 검사
|
||||
@ -83,6 +82,11 @@ else if ($act == "multi") // 온라인견적(등)에서 여러개의 상품이
|
||||
{
|
||||
if ($_POST['it_id'][$i] == "" || $_POST['ct_qty'][$i] <= 0) { continue; }
|
||||
|
||||
//옵션있는 상품은 건너뜀
|
||||
$sql = " select count(*) as cnt from {$g4['shop_item_option_table']} where it_id = '{$_POST['it_id'][$i]}' and io_type = '0' ";
|
||||
$tmp = sql_fetch($sql);
|
||||
if($tmp['cnt']) continue;
|
||||
|
||||
//--------------------------------------------------------
|
||||
// 변조 검사
|
||||
//--------------------------------------------------------
|
||||
@ -94,7 +98,7 @@ else if ($act == "multi") // 온라인견적(등)에서 여러개의 상품이
|
||||
if ((int)$price !== (int)$_POST['it_price'][$i])
|
||||
die("Error..");
|
||||
|
||||
$point = $it['it_point'];
|
||||
$point = get_item_point($it);
|
||||
// 포인트가 다름
|
||||
if ((int)$point !== (int)$_POST['it_point'][$i] && $config['cf_use_point'])
|
||||
die("Error...");
|
||||
@ -115,6 +119,15 @@ else if ($act == "multi") // 온라인견적(등)에서 여러개의 상품이
|
||||
// 오류가 있다면 오류메세지 출력
|
||||
if ($error != "") { alert($error); }
|
||||
|
||||
$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_send_cost, ct_direct, ct_select )
|
||||
VALUES ";
|
||||
$ct_select = 0;
|
||||
if($sw_direct)
|
||||
$ct_select = 1;
|
||||
|
||||
for ($i=0; $i<$fldcnt; $i++)
|
||||
{
|
||||
if ($_POST['it_id'][$i] == "" || $_POST['ct_qty'][$i] <= 0) continue;
|
||||
@ -122,21 +135,29 @@ else if ($act == "multi") // 온라인견적(등)에서 여러개의 상품이
|
||||
// 포인트 사용하지 않는다면
|
||||
if (!$config['cf_use_point']) $_POST['it_point'][$i] = 0;
|
||||
|
||||
// 장바구니에 Insert
|
||||
$sql = " insert {$g4['shop_cart_table']}
|
||||
set uq_id = '$tmp_uq_id',
|
||||
it_id = '{$_POST['it_id'][$i]}',
|
||||
it_name = '{$_POST['it_name'][$i]}',
|
||||
ct_status = '쇼핑',
|
||||
ct_price = '{$_POST['it_price'][$i]}',
|
||||
ct_point = '{$_POST['it_point'][$i]}',
|
||||
ct_point_use = '0',
|
||||
ct_stock_use = '0',
|
||||
ct_qty = '{$_POST['ct_qty'][$i]}',
|
||||
ct_time = '".G4_TIME_YMDHIS."',
|
||||
ct_ip = '$REMOTE_ADDR' ";
|
||||
sql_query($sql);
|
||||
// 동일옵션의 상품이 있으면 수량 더함
|
||||
$sql2 = " select ct_id
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '$tmp_uq_id'
|
||||
and it_id = '{$_POST['it_id'][$i]}'
|
||||
and ct_status = '쇼핑' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
if($row2['ct_id']) {
|
||||
$sql3 = " update {$g4['shop_cart_table']}
|
||||
set ct_qty = ct_qty + {$_POST['ct_qty'][$i]}
|
||||
where ct_id = '{$row2['ct_id']}' ";
|
||||
sql_query($sql3);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id'][$i]}', '{$_POST['it_name'][$i]}', '쇼핑', '{$_POST['it_price'][$i]}', '{$_POST['it_point'][$i]}', '0', '0', '{$_POST['it_name'][$i]}', '{$_POST['ct_qty'][$i]}', '0', '', '0', '0', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
|
||||
$comma = ' , ';
|
||||
$ct_count++;
|
||||
}
|
||||
|
||||
if($ct_count > 0)
|
||||
sql_query($sql);
|
||||
}
|
||||
else if ($act == "optionmod") // 장바구니에서 옵션변경
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@ include_once('./_head.php');
|
||||
|
||||
<div id="sod_ws">
|
||||
|
||||
<form name="fwishlist" method="post" action="">
|
||||
<form name="fwishlist" method="post" action="./cartupdate.php">
|
||||
<input type="hidden" name="act" value="multi">
|
||||
<input type="hidden" name="sw_direct" value="">
|
||||
<input type="hidden" name="prog" value="wish">
|
||||
@ -32,31 +32,25 @@ include_once('./_head.php');
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = " select *
|
||||
from {$g4['shop_wish_table']} a,
|
||||
{$g4['shop_item_table']} b
|
||||
$sql = " select a.wi_id, a.wi_time, b.*
|
||||
from {$g4['shop_wish_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.mb_id = '{$member['mb_id']}'
|
||||
and a.it_id = b.it_id
|
||||
order by a.wi_id desc ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row = mysql_fetch_array($result); $i++) {
|
||||
|
||||
$out_cd = '';
|
||||
for($k=1; $k<=6; $k++){
|
||||
$opt = trim($row['it_opt'.$k]);
|
||||
if(preg_match("/\n/", $opt)||preg_match("/;/" , $opt)) {
|
||||
$out_cd = 'no';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sql = " select count(*) as cnt from {$g4['shop_item_option_table']} where it_id = '{$row['it_id']}' and io_type = '0' ";
|
||||
$tmp = sql_fetch($sql);
|
||||
if($tmp['cnt'])
|
||||
$out_cd = 'no';
|
||||
|
||||
$it_price = get_price($row);
|
||||
|
||||
if ($row['it_tel_inq']) $out_cd = 'tel_inq';
|
||||
|
||||
$image = get_it_image($row['it_id'], 70, 70);
|
||||
|
||||
$s_del = '';
|
||||
$it_point = get_item_point($row);
|
||||
?>
|
||||
|
||||
<tr>
|
||||
@ -68,13 +62,13 @@ include_once('./_head.php');
|
||||
{
|
||||
?>
|
||||
품절
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" >
|
||||
<?php } else { //품절이 아니면 체크할수 있도록한다 ?>
|
||||
<input type="checkbox" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>" onclick="out_cd_check(this, '<?php echo $out_cd; ?>');">
|
||||
<input type="checkbox" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>" onclick="out_cd_check(this, '<?php echo $out_cd; ?>');">
|
||||
<?php } ?>
|
||||
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo $row['it_name']; ?>">
|
||||
<input type="hidden" name="it_price[<?php echo $i; ?>]" value="<?php echo $it_price; ?>">
|
||||
<input type="hidden" name="it_point[<?php echo $i; ?>]" value="<?php echo $row['it_point']; ?>">
|
||||
<input type="hidden" name="it_point[<?php echo $i; ?>]" value="<?php echo $it_point; ?>">
|
||||
<input type="hidden" name="ct_qty[<?php echo $i; ?>]" value="1">
|
||||
</td>
|
||||
<td class="sod_ws_img"><?php echo $image; ?></td>
|
||||
@ -90,12 +84,12 @@ include_once('./_head.php');
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div id="sod_ws_act">
|
||||
<a href="javascript:fwishlist_check(document.fwishlist,'');" class="btn01">장바구니 담기</a>
|
||||
<a href="javascript:fwishlist_check(document.fwishlist,'direct_buy');" class="btn02">주문하기</a>
|
||||
<button type="submit" class="btn01" onclick="return fwishlist_check(document.fwishlist,'');">장바구니 담기</button>
|
||||
<button type="submit" class="btn02" onclick="return fwishlist_check(document.fwishlist,'direct_buy');">주문하기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -129,7 +123,7 @@ include_once('./_head.php');
|
||||
if(k == 0)
|
||||
{
|
||||
alert("상품을 하나 이상 체크 하십시오");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (act == "direct_buy")
|
||||
@ -141,9 +135,7 @@ include_once('./_head.php');
|
||||
f.sw_direct.value = 0;
|
||||
}
|
||||
|
||||
f.action="./cartupdate.php";
|
||||
|
||||
f.submit();
|
||||
return true;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user