프리샵 추가
4
shop/_common.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?
|
||||
$g4_path = "..";
|
||||
include_once("$g4_path/common.php");
|
||||
?>
|
||||
4
shop/_head.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
include_once("$g4[path]/head.php");
|
||||
?>
|
||||
4
shop/_tail.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
include_once("$g4[path]/tail.php");
|
||||
?>
|
||||
13
shop/bannerhit.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
if ($_COOKIE[ck_bn_id] != $bn_id)
|
||||
{
|
||||
$sql = " update $g4[yc4_banner_table] set bn_hit = bn_hit + 1 where bn_id = '$bn_id' ";
|
||||
sql_query($sql);
|
||||
// 하루 동안
|
||||
setcookie("ck_bn_id", $bn_id, 60*60*24, $default[de_cookie_dir], $default[de_cookie_domain]);
|
||||
}
|
||||
|
||||
goto_url($url);
|
||||
?>
|
||||
34
shop/boxbanner.inc.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?
|
||||
// 배너 출력
|
||||
$sql = " select * from $g4[yc4_banner_table]
|
||||
where '$g4[time_ymdhis]' between bn_begin_time and bn_end_time
|
||||
and bn_position = '$position'
|
||||
order by bn_order, bn_id desc ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
<table width=100% cellpadding=0 cellspacing=0>
|
||||
<?
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
//print_r2($row);
|
||||
// 테두리 있는지
|
||||
$bn_border = $row[bn_border];
|
||||
// 새창 띄우기인지
|
||||
$bn_new_win = ($row[bn_new_win]) ? "target=".$row[bn_new_win] : "";
|
||||
|
||||
$bimg = "$g4[path]/data/banner/$row[bn_id]";
|
||||
if (file_exists($bimg))
|
||||
{
|
||||
$size = getimagesize($bimg);
|
||||
echo "<tr><td>";
|
||||
if ($row[bn_url][0] == "#")
|
||||
echo "<a href='$row[bn_url]'>";
|
||||
else if ($row[bn_url] && $row[bn_url] != "http://") {
|
||||
echo "<a href='$g4[shop_path]/bannerhit.php?bn_id={$row[bn_id]}&url=".urlencode($row[bn_url])."' $bn_new_win>";
|
||||
}
|
||||
echo "<img src='$bimg' border='{$bn_border}' alt='{$row[bn_alt]}' width='$size[0]' height='$size[1]'></a>";
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
38
shop/boxcart.inc.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<table cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>
|
||||
<tr><td><a href='<?=$g4['shop_path']?>/cart.php'><img src='<?=$g4['shop_img_path']?>/bar_cart.gif' border=0></a></td></tr>
|
||||
<?
|
||||
if($is_member)
|
||||
$hsql_where = " ( a.uq_id = '".get_session('ss_uniqid')."' or a.mb_id = '{$member['mb_id']}' ) ";
|
||||
else
|
||||
$hsql_where = " a.uq_id = '".get_session('ss_uniqid')."' ";
|
||||
|
||||
if($sw_direct != 1)
|
||||
$hsw_direct = 0;
|
||||
else
|
||||
$hsw_direct = 1;
|
||||
|
||||
$hsql = " select a.it_id, b.it_name, a.ct_qty from {$g4['yc4_cart_table']} a left join {$g4['yc4_item_table']} b on ( a.it_id = b.it_id )
|
||||
where $hsql_where
|
||||
and a.it_id = b.it_id
|
||||
and a.ct_direct = '$hsw_direct'
|
||||
and a.ct_status = '쇼핑'
|
||||
group by a.it_id
|
||||
order by a.ct_id ";
|
||||
$hresult = sql_query($hsql);
|
||||
for ($i=0; $row=sql_fetch_array($hresult); $i++)
|
||||
{
|
||||
echo "<tr><td height=22><nobr style='display:block; overflow:hidden; width:170px;'> · ";
|
||||
$it_name = get_text($row['it_name']);
|
||||
// 이미지로 할 경우
|
||||
//$it_name = get_it_image($row[it_id]."_s", 50, 50, $row[it_id]);
|
||||
echo "<a href=\"{$g4['shop_path']}/cart.php\">$it_name</a></nobr></td></tr>\n";
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
echo "<tr><td><img src='{$g4['shop_img_path']}/nocart.gif'></td></tr>\n";
|
||||
?>
|
||||
</table>
|
||||
102
shop/boxcategory.inc.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
//
|
||||
// 2단계 분류 레이어 표시
|
||||
//
|
||||
$menu = ""; // 메뉴 레이어 임시저장 변수 (처음엔 아무값도 없어야 합니다.)
|
||||
$sub_menu_left = 100; // 2단계 메뉴 왼쪽 좌표 (1단계 좌표에서 부터)
|
||||
?>
|
||||
|
||||
<table bgcolor=#FFFFFF width=100% cellpadding=0 cellspacing=0>
|
||||
<tr><td align=center valign=top height=50><img src='<?=$g4[shop_img_path]?>/bar_category.gif'></td></tr>
|
||||
<?
|
||||
// 1단계 분류 판매가능한것만
|
||||
$hsql = " select ca_id, ca_name from $g4[yc4_category_table]
|
||||
where length(ca_id) = '2'
|
||||
and ca_use = '1'
|
||||
order by ca_id ";
|
||||
$hresult = sql_query($hsql);
|
||||
$hnum = @mysql_num_rows($hresult);
|
||||
for ($i=0; $row=sql_fetch_array($hresult); $i++)
|
||||
{
|
||||
// 2단계 분류
|
||||
$menubody = "";
|
||||
$onmouseover = "";
|
||||
$onmouseout = "";
|
||||
$sql2 = " select ca_id, ca_name from $g4[yc4_category_table]
|
||||
where LENGTH(ca_id) = '4'
|
||||
and SUBSTRING(ca_id,1,2) = '$row[ca_id]'
|
||||
and ca_use = '1'
|
||||
order by ca_id ";
|
||||
$result2 = sql_query($sql2);
|
||||
$hnum2 = @mysql_num_rows($result2);
|
||||
for ($j=0; $row2=sql_fetch_array($result2); $j++)
|
||||
{
|
||||
$menubody .= "<tr height='22'><td> · <a href='$g4[shop_path]/list.php?ca_id=$row2[ca_id]'>$row2[ca_name]</a></td></tr>";
|
||||
// 맨밑줄은 출력하지 않음
|
||||
if ($j < $hnum2)
|
||||
$menubody .= "<tr><td align=center><img src='$g4[shop_img_path]/dot_line.gif'></td></tr>";
|
||||
}
|
||||
|
||||
if ($menubody)
|
||||
{
|
||||
$onmouseover = " layer_view('lmenu{$i}', 'lmenu_layer{$i}', 'view', $sub_menu_left, -22); ";
|
||||
$onmouseout = " layer_view('lmenu{$i}', 'lmenu_layer{$i}', 'hide'); ";
|
||||
}
|
||||
|
||||
$category_link = "<a href='$g4[shop_path]/list.php?ca_id=$row[ca_id]'>";
|
||||
echo "<tr id='lmenu{$i}' onmouseover=\"$onmouseover\" onmouseout=\"$onmouseout\">";
|
||||
echo "<td height='22'> · $category_link$row[ca_name]</a>\n";
|
||||
|
||||
if ($menubody)
|
||||
{
|
||||
//echo "<div id='lmenu_layer{$i}' style='width:180px; display:none; position:absolute; FILTER: alpha(opacity=95); z-index:999;'>";
|
||||
echo "<div id='lmenu_layer{$i}' style='width:180px; display:none; position:absolute; z-index:999;'>";
|
||||
echo "<table cellpadding=1 cellspacing=0 bgcolor=#CCCCCC width=100%><tr><td>";
|
||||
echo "<table border=0 width=100% bgcolor=#FFFFFF cellpadding=0 cellspacing=0>$menubody</table>";
|
||||
echo "</td></tr></table>";
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
echo "</td></tr>\n";
|
||||
|
||||
if ($i<$hnum-1) // 맨밑줄은 출력하지 않음
|
||||
echo "<tr><td align=center><img src='$g4[shop_img_path]/dot_line.gif'></td></tr>\n";
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
echo "<tr><td height=50 align=center>등록된 자료가 없습니다.</td></tr>\n";
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?=$menu?>
|
||||
|
||||
<script language="JavaScript">
|
||||
var save_layer = null;
|
||||
function layer_view(link_id, menu_id, opt, x, y)
|
||||
{
|
||||
var link = document.getElementById(link_id);
|
||||
var menu = document.getElementById(menu_id);
|
||||
|
||||
//for (i in link) { document.write(i + '<br/>'); } return;
|
||||
|
||||
if (save_layer != null)
|
||||
save_layer.style.display = "none";
|
||||
|
||||
if (opt == 'hide')
|
||||
{
|
||||
menu.style.display = 'none';
|
||||
}
|
||||
else
|
||||
{
|
||||
x = parseInt(x);
|
||||
y = parseInt(y);
|
||||
menu.style.left = get_left_pos(link) + x + 'px';
|
||||
menu.style.top = get_top_pos(link) + link.offsetHeight + y + 'px';
|
||||
menu.style.display = 'block';
|
||||
}
|
||||
|
||||
save_layer = menu;
|
||||
}
|
||||
</script>
|
||||
21
shop/boxcommunity.inc.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<table bgcolor=#FFFFFF width=100% cellpadding=0 cellspacing=0>
|
||||
<tr><td align=center valign=top height=50><img src='<?=$g4[shop_img_path]?>/bar_community.gif'></td></tr>
|
||||
<?
|
||||
$hsql = " select bo_table, bo_subject from $g4[board_table] order by gr_id, bo_table ";
|
||||
$hresult = sql_query($hsql);
|
||||
for ($i=0; $row=sql_fetch_array($hresult); $i++)
|
||||
{
|
||||
if ($i > 0)
|
||||
echo "<tr><td align=center><img src='$g4[shop_img_path]/dot_line.gif'></td></tr>\n";
|
||||
|
||||
echo "<tr><td height=22> · <a href='$g4[path]/bbs/board.php?bo_table=$row[bo_table]'>$row[bo_subject]</a></td></tr>\n";
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
echo "<tr><td height=50 align=center>등록된 게시판이 없습니다.</td></tr>\n";
|
||||
?>
|
||||
</table>
|
||||
30
shop/boxevent.inc.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<table bgcolor=#FFFFFF width=100% cellpadding=0 cellspacing=0>
|
||||
<tr><td align=center valign=top height=50><img src='<?=$g4[shop_img_path]?>/bar_event.gif'></td></tr>
|
||||
<?
|
||||
$hsql = " select ev_id, ev_subject from $g4[yc4_event_table] where ev_use = '1' order by ev_id desc ";
|
||||
$hresult = sql_query($hsql);
|
||||
for ($i=0; $row=sql_fetch_array($hresult); $i++)
|
||||
{
|
||||
if ($i > 0)
|
||||
echo "<tr><td align=center><img src='$g4[shop_img_path]/dot_line.gif'></td></tr>\n";
|
||||
|
||||
$href = "$g4[shop_path]/event.php?ev_id=$row[ev_id]";
|
||||
|
||||
// 이벤트 메뉴이미지가 있다면
|
||||
$event_img = "$g4[path]/data/event/$row[ev_id]_m";
|
||||
if (file_exists($event_img)) {
|
||||
echo "<tr><td><a href='$href'><img src='$event_img' border=0 align=absmiddle></a></td></tr>";
|
||||
} else {
|
||||
echo "<tr><td height=22> · <a href='$href'>$row[ev_subject]</a></td></tr>\n";;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
echo "<tr><td height=50 align=center>등록된 자료가 없습니다.</td></tr>\n";
|
||||
?>
|
||||
</table>
|
||||
180
shop/boxtodayview.inc.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?
|
||||
$tv_idx = get_session("ss_tv_idx");
|
||||
|
||||
$tv_div[top] = 0;
|
||||
$tv_div[img_width] = 70;
|
||||
$tv_div[img_height] = 70;
|
||||
$tv_div[img_length] = 4; // 보여지는 최대 이미지수
|
||||
?>
|
||||
|
||||
<div id='divTodayHidden' style="position:relative; top:<?=$tv_div[top]?>;display:none;"><a href='javascript:todayview_visible();'><img src='<?=$g4[shop_img_path]?>/todayview.gif' border=0></a></div>
|
||||
<div id='divToday' style="position:relative; top:0;">
|
||||
<table cellpadding=0 cellspacing=0 border="0" bgcolor="#FFFFFF">
|
||||
<tr><td background='<?=$g4[shop_img_path]?>/todayview01.gif' height=31 align=right><span id='todayviewcount'></span> </td></tr>
|
||||
<?
|
||||
// 오늘 본 상품이 있다면
|
||||
if ($tv_idx)
|
||||
{
|
||||
// 오늘 본 상품갯수가 보여지는 최대 이미지 수 보다 크다면 위로 화살표를 보임
|
||||
if ($tv_idx > $tv_div[img_length])
|
||||
echo "<tr><td><img src='$g4[shop_img_path]/todayview02.gif' border='0' onclick='javascript:todayview_up();' style='cursor:pointer;'></td></tr>";
|
||||
|
||||
// 오늘 본 상품 이미지 출력
|
||||
echo "<tr><td background='$g4[shop_img_path]/todayview03.gif'><table width=100% cellpadding=2>";
|
||||
for ($i=1; $i<=$tv_div[img_length]; $i++)
|
||||
{
|
||||
echo "<tr><td align=center>";
|
||||
echo "<span id='todayview_{$i}'></span>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table></td></tr>";
|
||||
|
||||
// 오늘 본 상품갯수가 보여지는 최대 이미지 수 보다 크다면 아래로 화살표를 보임
|
||||
if ($tv_idx > $tv_div[img_length])
|
||||
echo "<tr><td><img src='$g4[shop_img_path]/todayview05.gif' border='0' onclick='javascript:todayview_dn();' style='cursor:pointer;'></td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr><td><img src='$g4[shop_img_path]/todayview04.gif'></td></tr>";
|
||||
}
|
||||
?>
|
||||
<tr><td><a href='javascript:todayview_hidden();'><img src='<?=$g4[shop_img_path]?>/todayview06.gif' border=0></a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 오늘 본 상품 -->
|
||||
<script language="JavaScript">
|
||||
var goods_link = new Array();
|
||||
<?
|
||||
echo "var goods_max = ".(int)$tv_idx.";\n";
|
||||
echo "var goods_length = ".(int)$tv_div[img_length].";\n";
|
||||
echo "var goods_current = goods_max;\n";
|
||||
echo "\n";
|
||||
|
||||
for ($i=1; $i<=$tv_idx; $i++)
|
||||
{
|
||||
$tv_it_id = get_session("ss_tv[$i]");
|
||||
$rowx = sql_fetch(" select it_name from $g4[yc4_item_table] where it_id = '$tv_it_id' ");
|
||||
$it_name = get_text(addslashes($rowx['it_name']));
|
||||
$img = get_it_image($tv_it_id."_s", $tv_div['img_width'], $tv_div['img_height'], $tv_it_id);
|
||||
$img = preg_replace("/\<a /", "<a title='$it_name' ", $img);
|
||||
echo "goods_link[$i] = \"{$img}<br/><span class=small>".cut_str($it_name,10,"")."</span>\";\n";
|
||||
}
|
||||
?>
|
||||
|
||||
var divSave = null;
|
||||
|
||||
function todayview_visible()
|
||||
{
|
||||
set_cookie('ck_tvhidden', '', 1);
|
||||
|
||||
document.getElementById('divToday').innerHTML = divSave;
|
||||
}
|
||||
|
||||
function todayview_hidden()
|
||||
{
|
||||
divSave = document.getElementById('divToday').innerHTML;
|
||||
|
||||
set_cookie('ck_tvhidden', '1', 1);
|
||||
|
||||
document.getElementById('divToday').innerHTML = document.getElementById('divTodayHidden').innerHTML;
|
||||
}
|
||||
|
||||
function todayview_move(current)
|
||||
{
|
||||
k = 0;
|
||||
for (i=goods_current; i>0 ; i--)
|
||||
{
|
||||
k++;
|
||||
if (k > goods_length)
|
||||
break;
|
||||
document.getElementById('todayview_'+k).innerHTML = goods_link[i];
|
||||
}
|
||||
}
|
||||
|
||||
function todayview_up()
|
||||
{
|
||||
if (goods_current + 1 > goods_max)
|
||||
alert("오늘 본 마지막 상품입니다.");
|
||||
else
|
||||
todayview_move(goods_current++);
|
||||
}
|
||||
|
||||
function todayview_dn()
|
||||
{
|
||||
if (goods_current - goods_length == 0)
|
||||
alert("오늘 본 처음 상품입니다.");
|
||||
else
|
||||
todayview_move(goods_current--);
|
||||
}
|
||||
|
||||
<?
|
||||
$k=0;
|
||||
for ($i=$tv_idx; $i>0; $i--)
|
||||
{
|
||||
$k++;
|
||||
if ($k > $tv_div[img_length])
|
||||
break;
|
||||
|
||||
$tv_it_id = get_session("ss_tv[$i]");
|
||||
echo "document.getElementById('todayview_{$k}').innerHTML = goods_link[$i];\n";
|
||||
}
|
||||
|
||||
if ($tv_idx)
|
||||
{
|
||||
echo "if (document.getElementById('todayviewcount')) document.getElementById('todayviewcount').innerHTML = '$tv_idx';\n";
|
||||
}
|
||||
?>
|
||||
</script>
|
||||
|
||||
<script language=javascript>
|
||||
function CheckUIElements()
|
||||
{
|
||||
var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
|
||||
|
||||
yMenuFrom = parseInt (document.getElementById('divToday').style.top, 10);
|
||||
if ( g4_is_gecko )
|
||||
yMenuTo = top.pageYOffset + <?=$tv_div[top]?>;
|
||||
else if ( g4_is_ie )
|
||||
yMenuTo = document.body.scrollTop + parseInt('<?=$tv_div[top]?>');
|
||||
|
||||
timeoutNextCheck = 500;
|
||||
|
||||
if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom )
|
||||
{
|
||||
setTimeout ("CheckUIElements()", timeoutNextCheck);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( yMenuFrom != yMenuTo )
|
||||
{
|
||||
yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 10 );
|
||||
if ( yMenuTo < yMenuFrom )
|
||||
yOffset = -yOffset;
|
||||
|
||||
document.getElementById('divToday').style.top = parseInt(document.getElementById('divToday').style.top) + yOffset;
|
||||
|
||||
timeoutNextCheck = 10;
|
||||
}
|
||||
|
||||
setTimeout ("CheckUIElements()", timeoutNextCheck);
|
||||
}
|
||||
|
||||
function OnLoad() {
|
||||
var y;
|
||||
|
||||
if ( top.frames.length )
|
||||
document.getElementById('divToday').style.display = '';
|
||||
|
||||
CheckUIElements();
|
||||
return true;
|
||||
}
|
||||
|
||||
OnLoad();
|
||||
|
||||
<?
|
||||
if ($_COOKIE['ck_tvhidden'])
|
||||
echo "todayview_hidden();";
|
||||
?>
|
||||
//-->
|
||||
</script>
|
||||
25
shop/boxwish.inc.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<table cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>
|
||||
<tr><td><a href='<?=$g4[shop_path]?>/wishlist.php'><img src='<?=$g4[shop_img_path]?>/bar_wishlist.gif' border=0></a></td></tr>
|
||||
<?
|
||||
$hsql = " select a.it_id, b.it_name from $g4[yc4_wish_table] a, $g4[yc4_item_table] b
|
||||
where a.mb_id = '$member[mb_id]'
|
||||
and a.it_id = b.it_id
|
||||
order by a.wi_id desc ";
|
||||
$hresult = sql_query($hsql);
|
||||
for ($i=0; $row=sql_fetch_array($hresult); $i++)
|
||||
{
|
||||
echo "<tr><td height=22><nobr style='display:block; overflow:hidden; width:170px;'> · ";
|
||||
$it_name = get_text($row[it_name]);
|
||||
// 이미지로 할 경우
|
||||
//$it_name = get_it_image($row[it_id]."_s", 50, 50, $row[it_id]);
|
||||
echo "<a href=\"$g4[shop_path]/wishlist.php\">$it_name</a></nobr></td></tr>\n";
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
echo "<tr><td><img src='$g4[shop_img_path]/nowishlist.gif'></td></tr>\n";
|
||||
?>
|
||||
</table>
|
||||
20
shop/cart.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?
|
||||
include_once('./_common.php');
|
||||
|
||||
$g4['title'] = "장바구니";
|
||||
include_once('./_head.php');
|
||||
?>
|
||||
|
||||
<img src="<?=$g4['shop_img_path']?>/top_cart.gif" border="0"><p>
|
||||
|
||||
<?
|
||||
$s_page = 'cart.php';
|
||||
$s_uq_id = get_session('ss_uniqid');
|
||||
|
||||
include $g4['shop_path'].'/cartsub.inc.php';
|
||||
?>
|
||||
<br><br>
|
||||
|
||||
<?
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
384
shop/cartcoupon.php
Normal file
@ -0,0 +1,384 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if(!$is_member) {
|
||||
alert_close('회원 로그인 후 이용해 주세요.');
|
||||
}
|
||||
|
||||
// 상품정보
|
||||
$sql = " select it_id, it_nocoupon, ca_id, ca_id2, ca_id3, it_notax
|
||||
from {$g4['yc4_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
if(!$it['it_id']) {
|
||||
alert_close('상품정보가 존재하지 않습니다.');
|
||||
}
|
||||
|
||||
if($it['it_nocoupon']) {
|
||||
alert_close('쿠폰 사용이 제한된 상품입니다.');
|
||||
}
|
||||
|
||||
// 카테고리쿠폰설정체크
|
||||
$no = '';
|
||||
for($i=0; $i<3; $i++) {
|
||||
if($i > 0) {
|
||||
$no = $i + 1;
|
||||
}
|
||||
|
||||
$ca_id = $it["ca_id$no"];
|
||||
$sql = " select ca_nocoupon from {$g4['yc4_category_table']} where ca_id = '$ca_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['ca_nocoupon']) {
|
||||
alert_close('쿠폰사용이 제한된 카테고리에 속한 상품입니다.');
|
||||
}
|
||||
}
|
||||
|
||||
// 장바구니정보
|
||||
$uq_id = get_session('ss_uniqid');
|
||||
|
||||
if($sw_direct != 1)
|
||||
$sw_direct = 0;
|
||||
|
||||
$sql_common = " from ( select * from {$g4['yc4_cart_table']}
|
||||
where uq_id = '$uq_id'
|
||||
and it_id = '$it_id'
|
||||
and ct_direct = '$sw_direct'
|
||||
order by ct_id asc ) as a ";
|
||||
|
||||
$sql = " select a.ct_id, a.ct_send_cost_pay,
|
||||
SUM((a.ct_amount + a.it_amount) * a.ct_qty) as item_amount,
|
||||
SUM(a.ct_qty) as item_qty
|
||||
$sql_common
|
||||
group by a.it_id ";
|
||||
$ct = sql_fetch($sql);
|
||||
|
||||
// 상품총금액
|
||||
if($ct['item_amount']) {
|
||||
$item_amount = $ct['item_amount'];
|
||||
} else {
|
||||
alert_close('상품의 주문금액이 0원입니다.');
|
||||
}
|
||||
|
||||
// 총주문금액
|
||||
$sql = " select SUM((ct_amount + it_amount) * ct_qty) as total_amount
|
||||
from {$g4['yc4_cart_table']}
|
||||
where uq_id = '$uq_id'
|
||||
and ct_direct = '$sw_direct' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['total_amount']) {
|
||||
$total_amount = $row['total_amount'];
|
||||
} else {
|
||||
alert_close('주문하신 상품이 없습니다.');
|
||||
}
|
||||
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == "없음" || $default['de_send_cost_case'] == "착불")
|
||||
$send_cost = 0;
|
||||
else if($default['de_send_cost_case'] == "상한") {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($total_amount < $send_cost_limit[$k]) {
|
||||
$send_cost = $send_cost_list[$k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if($default['de_send_cost_case'] == "개별배송") {
|
||||
$send_cost = 0;
|
||||
|
||||
$sql = " select a.ct_id,
|
||||
a.it_id,
|
||||
a.ct_send_cost_pay,
|
||||
SUM((a.ct_amount + a.it_amount) * a.ct_qty) as sum_amount,
|
||||
SUM(a.ct_qty) as sum_qty,
|
||||
b.it_sc_type,
|
||||
b.it_sc_basic,
|
||||
b.it_sc_condition
|
||||
from ( select * from {$g4['yc4_cart_table']} where uq_id = '$uq_id' and ct_direct = '$sw_direct' order by ct_id asc ) as a,
|
||||
{$g4['yc4_item_table']} b
|
||||
where a.it_id = b.it_id
|
||||
group by a.it_id
|
||||
order by a.ct_id ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
if($row['ct_send_cost_pay'] == "착불") {
|
||||
$send_cost += 0;
|
||||
} else {
|
||||
if($row['it_sc_type'] == 1) { // 조건부무료
|
||||
if($row['sum_amount'] >= $row['it_sc_condition']) {
|
||||
$send_cost += 0;
|
||||
} else {
|
||||
$send_cost += $row['it_sc_basic'];
|
||||
}
|
||||
} else if($row['it_sc_type'] == 2) { // 유료
|
||||
$send_cost += $row['it_sc_basic'];
|
||||
} else if($row['it_sc_type'] == 3) { // 수량별부과
|
||||
$qty = ceil($row['sum_qty'] / $row['it_sc_condition']);
|
||||
$send_cost += ($row['it_sc_basic'] * $qty);
|
||||
} else {
|
||||
$send_cost += 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 쿠폰정보
|
||||
$sql = " select *
|
||||
from {$g4['yc4_coupon_table']}
|
||||
where cp_use = '1'
|
||||
and cp_type = '0'
|
||||
and cp_start <= '{$g4['time_ymd']}'
|
||||
and cp_end >= '{$g4['time_ymd']}'
|
||||
and ( it_id = '{$it['it_id']}' or cp_target = '2' )
|
||||
and mb_id in ( '{$member['mb_id']}', '전체회원' )
|
||||
and ca_id in ( '{$it['ca_id']}', '{$it['ca_id2']}', '{$it['ca_id3']}', '전체카테고리' )
|
||||
order by cp_no asc ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
if(!mysql_num_rows($result)) {
|
||||
alert_close('쿠폰 정보가 존재하지 않습니다.');
|
||||
}
|
||||
|
||||
$coupon_list = '<li><input type="radio" name="cp_id[]" value="" checked="checked" />적용안함</li>';
|
||||
|
||||
$cnt = 0;
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 정액할인쿠폰에서 할인금액이 상품주문금액보다 크다면
|
||||
if(!$row['cp_method'] && $row['cp_amount'] > $item_amount) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 쿠폰사용내역체크
|
||||
$sql = " select ch_no
|
||||
from {$g4['yc4_coupon_history_table']}
|
||||
where cp_id = '{$row['cp_id']}'
|
||||
and it_id = '$it_id'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and uq_id <> '$uq_id' ";
|
||||
$ch = sql_fetch($sql);
|
||||
if($ch['ch_no']) { // 이미 사용한 쿠폰
|
||||
continue;
|
||||
} else {
|
||||
$cnt++;
|
||||
}
|
||||
|
||||
$cp_limit = $row['cp_limit'];
|
||||
if($row['cp_id'] == $coupon) {
|
||||
$checked = ' checked="checked"';
|
||||
} else {
|
||||
$checked = '';
|
||||
}
|
||||
$coupon_list .= '<li>'."\n";
|
||||
$coupon_list .= '<input type="hidden" name="cp_method[]" value="'.$row['cp_method'].'" />'."\n";
|
||||
$coupon_list .= '<input type="hidden" name="cp_maximum[]" value="'.$row['cp_maximum'].'" />'."\n";
|
||||
$coupon_list .= '<input type="hidden" name="cp_trunc[]" value="'.$row['cp_trunc'].'" />'."\n";
|
||||
$coupon_list .= '<input type="hidden" name="cp_amount[]" value="'.$row['cp_amount'].'" />'."\n";
|
||||
$coupon_list .= '<input type="radio" name="cp_id[]" value="'.$row['cp_id'].'"'.$checked.' />'."\n".$row['cp_subject']."\n";
|
||||
$coupon_list .= '</li>'."\n";
|
||||
}
|
||||
|
||||
if(!$cnt) {
|
||||
alert_close('사용할 수 있는 쿠폰이 없습니다.');
|
||||
}
|
||||
|
||||
$g4['title'] = '쿠폰적용';
|
||||
include_once ($g4['path'].'/head.sub.php');
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#container { width: 540px; margin: 0 auto; }
|
||||
form { display: inline; }
|
||||
ul { margin: 0; padding: 0; list-style: none; }
|
||||
li { height: 20px; }
|
||||
-->
|
||||
</style>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td height="40" align="center">쿠폰선택</td>
|
||||
<td colspan="2">
|
||||
<ul>
|
||||
<? echo $coupon_list; ?>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180" height="20" align="center">상품금액</td>
|
||||
<td width="180" align="center">할인금액</td>
|
||||
<td width="180" align="center">최종결제금액</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="30" align="center"><?php echo number_format($item_amount); ?>원</td>
|
||||
<td align="center"><span id="dc_amount">0</span>원</td>
|
||||
<td align="center"><span id="res_amount"><?php echo number_format($item_amount); ?></span>원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" height="50" align="right"><button type="button" id="couponapply">적용</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
var $opener = window.opener;
|
||||
var result = dc = 0;
|
||||
var total_amount = parseInt(<? echo $total_amount; ?>);
|
||||
var send_cost = parseInt(<? echo $send_cost; ?>);
|
||||
var area_send_cost = parseInt($opener.$("input[name=od_send_cost_area]").val());
|
||||
var item_amount = parseInt(<? echo $item_amount; ?>);
|
||||
var item_dc_amount = 0;
|
||||
var notax = <? echo $it['it_notax']; ?>;
|
||||
|
||||
// 쿠폰할인총금액
|
||||
var total_dc_amount = 0;
|
||||
var val;
|
||||
$opener.$("input[name^=ch_amount]").each(function(index) {
|
||||
val = $(this).val();
|
||||
|
||||
if(val == "") {
|
||||
val = 0;
|
||||
} else {
|
||||
val = parseInt(val);
|
||||
}
|
||||
|
||||
total_dc_amount += val;
|
||||
|
||||
// 쿠폰적용 상품의 기존 쿠폰적용 금액
|
||||
if(index == parseInt(<? echo $idx; ?>)) {
|
||||
item_dc_amount = val;
|
||||
}
|
||||
});
|
||||
|
||||
// 쿠폰할인금액적용
|
||||
$("#dc_amount").text(number_format(String(item_dc_amount)));
|
||||
$("#res_amount").text(number_format(String(item_amount - item_dc_amount)));
|
||||
|
||||
$("input[name^=cp_id]").click(function() {
|
||||
var $li = $(this).closest("li");
|
||||
var val = $(this).val();
|
||||
|
||||
if(val != "") {
|
||||
var cp_method = parseInt($li.find("input[name^=cp_method]").val());
|
||||
var cp_amount = parseInt($li.find("input[name^=cp_amount]").val());
|
||||
var cp_maximum = parseInt($li.find("input[name^=cp_maximum]").val());
|
||||
var cp_trunc = parseInt($li.find("input[name^=cp_trunc]").val());
|
||||
|
||||
// 할인금액
|
||||
if(cp_method == 1) {
|
||||
dc = Math.floor(((item_amount * (cp_amount / 100)) / cp_trunc)) * cp_trunc;
|
||||
if(dc > cp_maximum) { // 최대할인금액보다 크다면
|
||||
dc = cp_maximum;
|
||||
}
|
||||
} else {
|
||||
dc = cp_amount;
|
||||
}
|
||||
} else {
|
||||
dc = 0;
|
||||
}
|
||||
|
||||
// 할인금액이 상품금액보다 크다면
|
||||
if(dc > item_amount) {
|
||||
alert("할인금액이 주문금액보다 크기때문에 사용할 수 없는 쿠폰입니다.");
|
||||
$("input[name^=cp_id]:checked").attr("checked", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = item_amount - dc;
|
||||
|
||||
$("#dc_amount").text(number_format(String(dc)));
|
||||
$("#res_amount").text(number_format(String(result)));
|
||||
});
|
||||
|
||||
$("#couponapply").click(function() {
|
||||
var tot_amount = total_amount - (total_dc_amount - item_dc_amount) + send_cost + area_send_cost - dc;
|
||||
var cp_id = $("input[name^=cp_id]:checked").val();
|
||||
if(cp_id == "") {
|
||||
result = item_amount;
|
||||
tot_amount = total_amount - (total_dc_amount - item_dc_amount) + send_cost + area_send_cost;
|
||||
}
|
||||
|
||||
$opener.$("input[name^=cp_id]").eq(<? echo $idx; ?>).val(cp_id);
|
||||
$opener.$("input[name^=ch_amount]").eq(<? echo $idx; ?>).val(dc);
|
||||
$opener.$(".sell_amount").eq(<? echo $idx; ?>).text(number_format(String(result)));
|
||||
$opener.$("#tot_amount b").text(number_format(String(tot_amount)));
|
||||
$opener.$("input[name^=od_cp_id]").eq(<? echo $idx; ?>).val(cp_id);
|
||||
$opener.$("input[name^=od_ch_amount]").eq(<? echo $idx; ?>).val(dc);
|
||||
$opener.$("input[name=good_mny]").val(tot_amount);
|
||||
|
||||
// 결제, 배송비할인 쿠폰 초기화
|
||||
$opener.$("span#send_cost").text(number_format(String(send_cost)));
|
||||
$opener.$("input[name=od_coupon]").val("");
|
||||
$opener.$("input[name=od_coupon_amount]").val(0);
|
||||
$opener.$("input[name=od_send_coupon]").val("");
|
||||
$opener.$("input[name=od_send_coupon_amount]").val(0);
|
||||
$opener.$("select[name=s_cp_id]").val("");
|
||||
$opener.$("select[name=o_cp_id]").val("");
|
||||
|
||||
<? if($default['de_compound_tax_use']) { ?>
|
||||
// 과세, 면세금액
|
||||
var tax_mny = vat_mny = free_mny = 0;
|
||||
if(notax == 1) { // 면세
|
||||
free_mny = result;
|
||||
} else { // 과세
|
||||
tax_mny = Math.round(result / 1.1);
|
||||
vat_mny = result - tax_mny;
|
||||
}
|
||||
|
||||
$opener.$("input[name^=tax_mny]").eq(<? echo $idx; ?>).val(tax_mny);
|
||||
$opener.$("input[name^=vat_mny]").eq(<? echo $idx; ?>).val(vat_mny);
|
||||
$opener.$("input[name^=free_mny]").eq(<? echo $idx; ?>).val(free_mny);
|
||||
|
||||
// 과세, 면세 금액 합
|
||||
var $t_el = $opener.$("input[name^=tax_mny]");
|
||||
var $v_el = $opener.$("input[name^=vat_mny]");
|
||||
var $f_el = $opener.$("input[name^=free_mny]");
|
||||
var comm_tax = comm_vat = comm_free = 0;
|
||||
|
||||
$t_el.each(function(index) {
|
||||
var t_val = parseInt($(this).val());
|
||||
var v_val = parseInt($v_el.eq(index).val());
|
||||
var f_val = parseInt($f_el.eq(index).val());
|
||||
|
||||
comm_tax += t_val;
|
||||
comm_vat += v_val;
|
||||
comm_free += f_val;
|
||||
});
|
||||
|
||||
// 배송비과세계산
|
||||
if(send_cost > 0) {
|
||||
var s_tax = Math.round(send_cost / 1.1);
|
||||
var s_vat = send_cost - s_tax;
|
||||
|
||||
comm_tax += s_tax;
|
||||
comm_vat += s_vat;
|
||||
}
|
||||
|
||||
// 추가배송비계산
|
||||
if(area_send_cost > 0) {
|
||||
var as_tax = Math.round(area_send_cost / 1.1);
|
||||
var as_vat = area_send_cost - as_tax;
|
||||
|
||||
comm_tax += as_tax;
|
||||
comm_vat += as_vat;
|
||||
}
|
||||
|
||||
$opener.$("input[name=comm_tax_mny]").val(comm_tax);
|
||||
$opener.$("input[name=comm_vat_mny]").val(comm_vat);
|
||||
$opener.$("input[name=comm_free_mny]").val(comm_free);
|
||||
<? } ?>
|
||||
|
||||
self.close();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once($g4['path'] . '/tail.sub.php');
|
||||
?>
|
||||
514
shop/cartoption.php
Normal file
@ -0,0 +1,514 @@
|
||||
<?
|
||||
include_once('./_common.php');
|
||||
|
||||
// 상품정보
|
||||
$sql = " select it_id, it_option_use, it_opt1_subject, it_opt2_subject, it_opt3_subject, it_opt1, it_opt2, it_opt3, it_supplement_use
|
||||
from {$g4['yc4_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
if(!$it['it_id']) {
|
||||
alert_close('상품 정보가 존재하지 않아 선택사항을 변경할 수 없습니다.');
|
||||
}
|
||||
|
||||
if($sw_direct != 1)
|
||||
$sw_direct = 0;
|
||||
|
||||
$s_uq_id = get_session('ss_uniqid');
|
||||
|
||||
$sql = " select ct_id, ct_send_cost_pay
|
||||
from {$g4['yc4_cart_table']}
|
||||
where uq_id = '$s_uq_id' and it_id = '$it_id' and ct_direct = '$sw_direct' and ct_status = '쇼핑'
|
||||
order by ct_id asc
|
||||
limit 0, 1 ";
|
||||
$temp = sql_fetch($sql);
|
||||
$ct_send_cost_pay = $temp['ct_send_cost_pay'];
|
||||
$ct_parent = $temp['ct_id'];
|
||||
|
||||
// 장바구니정보
|
||||
$sql_where = " where uq_id = '$s_uq_id' and it_id = '$it_id' and ct_direct = '$sw_direct' ";
|
||||
|
||||
$sql = " select ct_id, ct_parent, is_option, it_id, it_name, opt_id, ct_option, it_amount, ct_amount, ct_qty
|
||||
from {$g4['yc4_cart_table']}
|
||||
$sql_where
|
||||
order by ct_id asc ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$ct_count = mysql_num_rows($result);
|
||||
|
||||
if(!$ct_count) {
|
||||
alert_close('장바구니 정보가 존재하지 않습니다.');
|
||||
}
|
||||
|
||||
$g4['title'] = '선택사항/수량 변경';
|
||||
include_once ($g4['path'].'/head.sub.php');
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#container { width: 650px; margin: 0 auto; }
|
||||
ul { margin: 0; padding: 0; list-style: none; }
|
||||
form { display: inline; }
|
||||
#optionform { width: 600px; margin: 0 auto; padding: 10px 0 30px 0; }
|
||||
#optionlist { width: 580px; height: 180px; margin: 0 auto; padding: 10px 0 10px 20px; border: 1px solid #ccc; }
|
||||
#fbutton { width: 600px; padding-top: 15px; margin: 0 auto; text-align: center; }
|
||||
.option-delete { cursor: pointer; }
|
||||
.option-stock { display: none; }
|
||||
.item-count input { width: 45px; text-align: right; padding-right: 5px; }
|
||||
.add-item { cursor: pointer; }
|
||||
.subtract-item { cursor: pointer; }
|
||||
#total-price { }
|
||||
-->
|
||||
</style>
|
||||
|
||||
<div id="container">
|
||||
<div id="optionform">
|
||||
<table width="600" cellpadding="0" cellspacing="0" border="0">
|
||||
<? // 선택옵션
|
||||
if($it['it_option_use']) {
|
||||
$disabled = '';
|
||||
for($i = 1; $i <= 3; $i++) {
|
||||
if($i > 1) {
|
||||
$disabled = 'disabled';
|
||||
}
|
||||
|
||||
$str = conv_item_options(trim($it["it_opt{$i}_subject"]), trim($it["it_opt{$i}"]), $i, $disabled);
|
||||
if($str) {
|
||||
echo '<tr height="25">';
|
||||
echo '<td width="100"> · <span class="opt_subject">'.$it["it_opt{$i}_subject"].'</span></td>';
|
||||
echo '<td width="20" align="center">:</td>';
|
||||
echo '<td style="word-break:break-all;">'.$str.'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<? // 추가옵션
|
||||
if($it['it_supplement_use']) {
|
||||
$subject = get_supplement_subject($it_id);
|
||||
if($subject) {
|
||||
$index = 1;
|
||||
|
||||
foreach($subject as $value) {
|
||||
$sp_id = $value;
|
||||
$opt = get_supplement_option($it_id, $sp_id, $index);
|
||||
|
||||
if($opt) {
|
||||
echo '<tr height="25">';
|
||||
echo '<td width="100"> · <span class="spl_subject">'.$value.'</span></td>';
|
||||
echo '<td width="20" align="center">:</td>';
|
||||
echo '<td style="word-break:break-all;">'.$opt.'</td></tr>';
|
||||
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<form id="fcartoption" method="post" action="./cartoptionupdate.php">
|
||||
<input type="hidden" name="it_id" value="<? echo $it_id; ?>" />
|
||||
<input type="hidden" name="ct_parent" value="<? echo $ct_parent; ?>" />
|
||||
<input type="hidden" name="sw_direct" value="<? echo $sw_direct; ?>" />
|
||||
<input type="hidden" name="ct_send_cost_pay" value="<? echo $ct_send_cost_pay; ?>" />
|
||||
<div id="optionlist">
|
||||
<ul>
|
||||
<? // 옵션
|
||||
$total_price = 0;
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 상품가격
|
||||
if($i == 0) {
|
||||
$item_amount = $row['it_amount'];
|
||||
}
|
||||
// 재고수량
|
||||
if($row['is_option']) {
|
||||
$stock_qty = get_option_stock_qty($row['it_id'], $row['opt_id'], $row['is_option']);
|
||||
} else {
|
||||
$stock_qty = get_it_stock_qty($row['it_id']);
|
||||
}
|
||||
$total_price += ($row['it_amount'] + $row['ct_amount']) * $row['ct_qty'];
|
||||
if($row['ct_option']) {
|
||||
$ct_option = $row['ct_option'];
|
||||
} else {
|
||||
$ct_option = $row['it_name'];
|
||||
}
|
||||
$option_price = ' (+'.number_format($row['ct_amount']).'원)';
|
||||
|
||||
echo '<li>';
|
||||
echo '<input type="hidden" name="ct_id[]" value="'.$row['ct_id'] .'" />';
|
||||
echo '<input type="hidden" name="is_delete[]" value="0" />';
|
||||
echo '<input type="hidden" name="is_option[]" value="'.$row['is_option'].'" />';
|
||||
echo '<input type="hidden" name="opt_id[]" value="'.$row['opt_id'].'" />';
|
||||
echo '<input type="hidden" name="ct_option[]" value="' . $row['ct_option'].'" />';
|
||||
echo '<input type="hidden" name="it_amount[]" value="'.$row['it_amount'].'" />';
|
||||
echo '<input type="hidden" name="ct_amount[]" value="'.$row['ct_amount'].'" />';
|
||||
echo '<span class="option-stock">'. $stock_qty . '</span>';
|
||||
if($row['is_option'] == 1) {
|
||||
echo '<span class="selected-option">' . $ct_option . '</span>';
|
||||
} else if($row['is_option'] == 2) {
|
||||
echo '<span class="selected-supplement">' . $ct_option . '</span>';
|
||||
} else {
|
||||
echo '<span class="basic-option">' . $ct_option . '</span>';
|
||||
}
|
||||
echo '<span class="option-price">' . $option_price . '</span>';
|
||||
echo '<span class="item-count"> <input type="text" name="ct_qty[]" value="'.$row['ct_qty'].'" maxlength="4" /></span>';
|
||||
echo '<span class="add-item"> + </span><span class="subtract-item"> - </span>';
|
||||
echo '<span class="option-delete"> 삭제</span>';
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div id="total-price">총 금액 : <span><? echo number_format($total_price); ?>원</span></div>
|
||||
</div>
|
||||
<div id="fbutton"><input type="submit" value="변경" /> <button type="button" id="winclose">닫기</button></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// 선택옵션
|
||||
var $option_select = $("select[name^=item-option-]");
|
||||
var option_count = $option_select.size();
|
||||
|
||||
// 추가옵션
|
||||
var $supplement_select = $("select[name^=item-supplement-]");
|
||||
var supplement_count = $supplement_select.size();
|
||||
|
||||
// 선택옵션이 1개일 때 옵션항목 갱신
|
||||
if(option_count == 1) {
|
||||
var opt_id = "";
|
||||
$.post(
|
||||
"./itemoptiondata.php",
|
||||
{ it_id: "<?php echo $it_id; ?>", opt_id: opt_id, idx: -1, showinfo: "showinfo" },
|
||||
function(data) {
|
||||
$option_select.html(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 선택옵션선택
|
||||
$option_select.change(function() {
|
||||
var idx = $option_select.index($(this));
|
||||
var val = $(this).val();
|
||||
|
||||
if((idx + 1) < option_count) {
|
||||
if(val == '') {
|
||||
var $gt_select = $("select[name^=item-option-]:gt(" + idx + ")");
|
||||
$gt_select.val("");
|
||||
$gt_select.attr("disabled", true);
|
||||
} else {
|
||||
var $next_select = $option_select.eq(idx + 1);
|
||||
|
||||
// 옵션정보갱신
|
||||
var opt_id = "";
|
||||
var deli = "";
|
||||
$option_select.each(function(index) {
|
||||
if(idx < index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var s_val = $(this).val();
|
||||
if(s_val != "") {
|
||||
opt_id += deli + s_val
|
||||
}
|
||||
|
||||
deli = chr(30);
|
||||
});
|
||||
|
||||
// 마지막 직전 select 변경시 마지막 select 옵션에 가격정보 표시하도록
|
||||
var showinfo = "";
|
||||
if(idx == (option_count - 2)) {
|
||||
showinfo = "showinfo";
|
||||
}
|
||||
|
||||
$.post(
|
||||
"./itemoptiondata.php",
|
||||
{ it_id: "<? echo $it_id; ?>", opt_id: opt_id, idx: idx, showinfo: showinfo },
|
||||
function(data) {
|
||||
$option_select.eq(idx + 1).html(data);
|
||||
}
|
||||
);
|
||||
|
||||
$next_select.val("");
|
||||
if($next_select.is(":disabled")) {
|
||||
$next_select.attr("disabled", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((idx + 1) == option_count) {
|
||||
if(val != "") {
|
||||
optionDisplay();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 추가옵션선택
|
||||
$supplement_select.change(function() {
|
||||
var val = $(this).val();
|
||||
var idx = $supplement_select.index($(this));
|
||||
|
||||
if(val != "") {
|
||||
var subj = $("span.spl_subject:eq("+idx+")").text();
|
||||
var sp_id = subj+chr(30)+val;
|
||||
var splcontent = "";
|
||||
var spladd = true;
|
||||
var ct_option = subj+" : "+val;
|
||||
|
||||
// 선택된 옵션체크
|
||||
$("#optionlist ul li:visible span.selected-supplement").each(function() {
|
||||
var oldval = $(this).text();
|
||||
if(oldval == ct_option) {
|
||||
alert("이미 선택된 옵션입니다.");
|
||||
spladd = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// 추가옵션정보
|
||||
$.post(
|
||||
"./itemsupplementinfo.php",
|
||||
{ it_id: "<? echo $it_id; ?>", sp_id: sp_id },
|
||||
function(data) {
|
||||
// 재고체크
|
||||
if(parseInt(data.qty) < 1) {
|
||||
alert("해당 상품은 재고가 부족하여 구매할 수 없습니다.");
|
||||
spladd = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(spladd) {
|
||||
splcontent += "<li>";
|
||||
splcontent += "<input type=\"hidden\" name=\"ct_id[]\" value=\"\" />";
|
||||
splcontent += "<input type=\"hidden\" name=\"is_delete[]\" value=\"0\" />";
|
||||
splcontent += "<input type=\"hidden\" name=\"is_option[]\" value=\"2\" />";
|
||||
splcontent += "<input type=\"hidden\" name=\"opt_id[]\" value=\""+ sp_id + "\" />";
|
||||
splcontent += "<input type=\"hidden\" name=\"ct_option[]\" value=\""+ct_option+"\" />";
|
||||
splcontent += "<input type=\"hidden\" name=\"it_amount[]\" value=\"0\" />";
|
||||
splcontent += "<input type=\"hidden\" name=\"ct_amount[]\" value=\"" + data.amount + "\" />";
|
||||
splcontent += "<span class=\"option-stock\">" + data.qty + "</span>";
|
||||
splcontent += "<span class=\"selected-supplement\">" + ct_option + "</span>";
|
||||
splcontent += "<span class=\"supplement-price\"> (+" + number_format(String(data.amount)) + "원)</span>";
|
||||
splcontent += "<span class=\"item-count\"> <input type=\"text\" name=\"ct_qty[]\" value=\"1\" maxlength=\"4\" /></span>";
|
||||
splcontent += "<span class=\"add-item\"> + </span><span class=\"subtract-item\"> - </span>";
|
||||
splcontent += "<span class=\"option-delete\"> 삭제</span>";
|
||||
splcontent += "</li>";
|
||||
|
||||
var resultcount = $("#optionlist ul li").size();
|
||||
if(resultcount > 0) {
|
||||
$("#optionlist ul li:last").after(splcontent);
|
||||
} else {
|
||||
$("#optionlist ul").html(splcontent);
|
||||
}
|
||||
|
||||
calculatePrice();
|
||||
}
|
||||
}, "json"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// 상품개수증가
|
||||
$("span.add-item").live("click", function() {
|
||||
var $cntinput = $(this).closest("li").find("input[name^=ct_qty]");
|
||||
var count = parseInt($cntinput.val());
|
||||
count++;
|
||||
|
||||
// 재고체크
|
||||
var option_stock = $(this).closest("li").find("span.option-stock").text().replace(/[^0-9]/g, "");
|
||||
if(option_stock == "") {
|
||||
option_stock = 0;
|
||||
} else {
|
||||
option_stock = parseInt(option_stock);
|
||||
}
|
||||
|
||||
if(option_stock < count) {
|
||||
alert("해당 상품은 " + count + "개 이상 주문할 수 없습니다.");
|
||||
$(this).val(option_stock);
|
||||
return false;
|
||||
}
|
||||
|
||||
$cntinput.val(count);
|
||||
|
||||
calculatePrice();
|
||||
});
|
||||
|
||||
// 상품개수감소
|
||||
$("span.subtract-item").live("click", function() {
|
||||
var $cntinput = $(this).closest("li").find("input[name^=ct_qty]");
|
||||
var count = parseInt($cntinput.val());
|
||||
count--;
|
||||
|
||||
if(count < 1) {
|
||||
alert("상품개수는 1이상 입력해 주십시오.");
|
||||
count = 1;
|
||||
}
|
||||
|
||||
$cntinput.val(count);
|
||||
|
||||
calculatePrice();
|
||||
});
|
||||
|
||||
// 옵션삭제
|
||||
$("span.option-delete").live("click", function() {
|
||||
if(confirm("해당 옵션을 삭제하시겠습니까?")) {
|
||||
var $li = $(this).closest("li");
|
||||
var is_option = parseInt($li.find("input[name^=is_option]").val());
|
||||
|
||||
if(is_option != 2) { // 선택옵션 삭제일 때 체크
|
||||
// 추가옵션 개수 체크
|
||||
var sp_count = $("#optionlist li:visible input[name^=is_option]").filter("input[value=2]").size();
|
||||
|
||||
// 추가옵션있을 경우 선택옵션이 반드시 1개는 있어야 함
|
||||
if(sp_count > 0) {
|
||||
var opt_count = $("#optionlist li:visible input[name^=is_option]").not("input[value=2]").size();
|
||||
if(opt_count < 2) {
|
||||
alert("추가옵션이 있을 경우 선택옵션을 모두 삭제할 수 없습니다.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$li.css("display", "none");
|
||||
$li.find("input[name^=is_delete]").val(1);
|
||||
|
||||
calculatePrice();
|
||||
}
|
||||
});
|
||||
|
||||
// 수량변경
|
||||
$("input[name^=ct_qty]").live("keyup", function() {
|
||||
var val = $(this).val().replace(/[^0-9]/g, "");
|
||||
if(val == "") {
|
||||
//alert('구매수량을 입력해 주세요.');
|
||||
return false;
|
||||
}
|
||||
|
||||
qty = parseInt(val);
|
||||
|
||||
if(qty < 1) {
|
||||
alert("수량은 1이상만 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(qty > 9999) {
|
||||
alert("수량은 9999이하만 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 옵션재고체크
|
||||
var option_stock = $(this).closest("li").find("span.option-stock").text().replace(/[^0-9]/g, "");
|
||||
if(option_stock == "") {
|
||||
option_stock = 0;
|
||||
} else {
|
||||
option_stock = parseInt(option_stock);
|
||||
}
|
||||
|
||||
if(option_stock < qty) {
|
||||
alert("해당 상품은 " + qty + "개 이상 주문할 수 없습니다.");
|
||||
$(this).val(option_stock);
|
||||
}
|
||||
|
||||
calculatePrice();
|
||||
});
|
||||
|
||||
// 창닫기
|
||||
$("#winclose").click(function() {
|
||||
self.close();
|
||||
});
|
||||
});
|
||||
|
||||
function optionDisplay()
|
||||
{
|
||||
var option = "";
|
||||
var opt_id = "";
|
||||
var sep = "";
|
||||
var deli = "";
|
||||
var optionadd = true;
|
||||
|
||||
$("select[name^=item-option-]").each(function(index) {
|
||||
var opt = $(this).val();
|
||||
var subj = $("span.opt_subject:eq("+index+")").text();
|
||||
|
||||
option += sep + subj + " : " + opt;
|
||||
opt_id += deli + opt;
|
||||
|
||||
sep = " / ";
|
||||
deli = chr(30);
|
||||
});
|
||||
|
||||
// 선택된 옵션체크
|
||||
$("#optionlist ul li:visible span.selected-option").each(function() {
|
||||
var oldoption = $(this).html();
|
||||
|
||||
if(oldoption == option) {
|
||||
alert("이미 선택된 옵션입니다.");
|
||||
optionadd = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if(optionadd) {
|
||||
// 옵션정보
|
||||
$.post(
|
||||
"./itemoptioninfo.php",
|
||||
{ it_id: "<? echo $it_id; ?>", opt_id: opt_id },
|
||||
function(data) {
|
||||
if(parseInt(data.qty) < 1) {
|
||||
alert("해당 상품은 재고가 부족하여 구매할 수 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var resultcount = $("#optionlist ul li").size();
|
||||
var optioncontent = "<li>";
|
||||
optioncontent += "<input type=\"hidden\" name=\"ct_id[]\" value=\"\" />";
|
||||
optioncontent += "<input type=\"hidden\" name=\"is_delete[]\" value=\"0\" />";
|
||||
optioncontent += "<input type=\"hidden\" name=\"is_option[]\" value=\"1\" />";
|
||||
optioncontent += "<input type=\"hidden\" name=\"opt_id[]\" value=\""+ opt_id + "\" />";
|
||||
optioncontent += "<input type=\"hidden\" name=\"ct_option[]\" value=\""+ option + "\" />";
|
||||
optioncontent += "<input type=\"hidden\" name=\"it_amount[]\" value=\"<? echo $item_amount; ?>\" />";
|
||||
optioncontent += "<input type=\"hidden\" name=\"ct_amount[]\" value=\"" + data.amount + "\" />";
|
||||
optioncontent += "<span class=\"option-stock\">" + data.qty + "</span>";
|
||||
optioncontent += "<span class=\"selected-option\">" + option + "</span>";
|
||||
optioncontent += "<span class=\"option-price\"> (+" + number_format(String(data.amount)) + "원)</span>";
|
||||
optioncontent += "<span class=\"item-count\"> <input type=\"text\" name=\"ct_qty[]\" value=\"1\" maxlength=\"4\" /></span>";
|
||||
optioncontent += "<span class=\"add-item\"> + </span><span class=\"subtract-item\"> - </span>";
|
||||
optioncontent += "<span class=\"option-delete\"> 삭제</span>";
|
||||
optioncontent += "</li>";
|
||||
|
||||
if(resultcount > 0) {
|
||||
$("#optionlist ul li:last").after(optioncontent);
|
||||
} else {
|
||||
$("#optionlist ul").html(optioncontent);
|
||||
}
|
||||
|
||||
calculatePrice();
|
||||
}, "json"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function calculatePrice()
|
||||
{
|
||||
var itemprice = parseInt(<?php echo $item_amount; ?>);
|
||||
var optiontotalprice = 0;
|
||||
|
||||
$("#optionlist ul li:visible").each(function() {
|
||||
var optprc = parseInt($(this).find("input[name^=ct_amount]").val());
|
||||
var itcnt = parseInt($(this).find("input[name^=ct_qty]").val());
|
||||
var is_option = parseInt($(this).find("input[name^=is_option]").val());
|
||||
|
||||
if(is_option != 2) {
|
||||
optiontotalprice += (itemprice + optprc) * itcnt;
|
||||
} else {
|
||||
optiontotalprice += optprc * itcnt;
|
||||
}
|
||||
});
|
||||
|
||||
$("#total-price span").text(number_format(String(optiontotalprice)) + "원");
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once($g4['path'] . '/tail.sub.php');
|
||||
?>
|
||||
116
shop/cartoptionupdate.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 상품정보
|
||||
$sql = " select it_id, it_name from {$g4['yc4_item_table']} where it_id = '$it_id' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
if(!$it['it_id']) {
|
||||
alert_close('상품 정보가 존재하지 않아 선택사항을 변경할 수 없습니다.');
|
||||
}
|
||||
|
||||
$it_name = get_text($it['it_name']);
|
||||
|
||||
$s_uq_id = get_session('ss_uniqid');
|
||||
|
||||
$count = count($_POST['ct_id']);
|
||||
|
||||
// 옵션개수
|
||||
$opt_count = 0;
|
||||
$spl_count = 0;
|
||||
for($k=0; $k<$count; $k++) {
|
||||
$is_delete = $_POST['is_delete'][$k];
|
||||
if(!$is_delete) {
|
||||
$is_option = $_POST['is_option'][$k];
|
||||
|
||||
if($is_option != 2) {
|
||||
$opt_count++;
|
||||
} else {
|
||||
$spl_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 추가옵션이 있을 때 선택옵션이 없으면 에러
|
||||
if($spl_count > 0 && $opt_count == 0) {
|
||||
alert('추가옵션이 있을 경우 선택옵션을 모두 삭제할 수 없습니다.');
|
||||
}
|
||||
|
||||
$ct_parent = $_POST['ct_parent'];
|
||||
$ct_parent_check = true;
|
||||
|
||||
for($i=0; $i<$count; $i++) {
|
||||
$ct_id = $_POST['ct_id'][$i];
|
||||
|
||||
if($ct_id) {
|
||||
$is_delete = $_POST['is_delete'][$i];
|
||||
|
||||
if($is_delete) { // 옵션삭제
|
||||
$sql = " delete from {$g4['yc4_cart_table']} where uq_id = '$s_uq_id' and ct_id = '$ct_id' ";
|
||||
sql_query($sql);
|
||||
} else { // 옵션수정
|
||||
$ct_qty = $_POST['ct_qty'][$i];
|
||||
$sql = " update {$g4['yc4_cart_table']} set ct_qty = '$ct_qty' where uq_id = '$s_uq_id' and ct_id = '$ct_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
} else { // 옵션추가
|
||||
$it_id = $_POST['it_id'];
|
||||
$it_amount = $_POST['it_amount'][$i];
|
||||
$opt_id = $_POST['opt_id'][$i];
|
||||
$is_option = $_POST['is_option'][$i];
|
||||
$ct_option = $_POST['ct_option'][$i];
|
||||
$ct_amount = $_POST['ct_amount'][$i];
|
||||
$ct_qty = $_POST['ct_qty'][$i];
|
||||
$ct_point = 0;
|
||||
$ct_send_cost_pay = $_POST['ct_send_cost_pay'];
|
||||
if($is_option == 1 || $is_option == 0) {
|
||||
$amount = $it_amount;
|
||||
} else {
|
||||
$amount = 0;
|
||||
}
|
||||
|
||||
$sql = " insert into {$g4['yc4_cart_table']}
|
||||
set uq_id = '$s_uq_id',
|
||||
ct_parent = '$ct_parent',
|
||||
mb_id = '{$member['mb_id']}',
|
||||
is_option = '$is_option',
|
||||
it_id = '$it_id',
|
||||
it_name = '$it_name',
|
||||
opt_id = '$opt_id',
|
||||
ct_option = '$ct_option',
|
||||
ct_status = '쇼핑',
|
||||
it_amount = '$it_amount',
|
||||
ct_amount = '$ct_amount',
|
||||
ct_qty = '$ct_qty',
|
||||
ct_point = '$ct_point',
|
||||
ct_stock_use = '0',
|
||||
ct_point_use = '0',
|
||||
ct_send_cost_pay = '$ct_send_cost_pay',
|
||||
ct_time = '{$g4['time_ymdhis']}',
|
||||
ct_ip = '$REMOTE_ADDR',
|
||||
ct_direct = '$sw_direct' ";
|
||||
|
||||
sql_query($sql);
|
||||
|
||||
// ct_parent 처리
|
||||
if($ct_parent_check) {
|
||||
$temp_ct_id = mysql_insert_id();
|
||||
|
||||
$sql1 = " select count(*) as cnt from {$g4['yc4_cart_table']} where uq_id = '$s_uq_id' and it_id = '$it_id' and ct_direct = '$sw_direct' ";
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
if($row1['cnt'] == 1) {
|
||||
sql_query(" update {$g4['yc4_cart_table']} set ct_parent = '0' where ct_id = '$temp_ct_id' ");
|
||||
$ct_parent = $temp_ct_id;
|
||||
}
|
||||
|
||||
$ct_parent_check = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<script>';
|
||||
echo 'window.opener.location.reload();';
|
||||
echo 'self.close();';
|
||||
echo '</script>';
|
||||
?>
|
||||
585
shop/cartsub.inc.php
Normal file
@ -0,0 +1,585 @@
|
||||
<?
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
/*
|
||||
$s_page 는 cart.php 일때 수량의 수정, 물품의 삭제를 위한 변수이다.
|
||||
orderinquiryview.php 일때 배송상태등을 나타내는 변수이다.
|
||||
*/
|
||||
|
||||
if($sw_direct != 1)
|
||||
$sw_direct = 0;
|
||||
|
||||
if ($s_page == 'orderinquiryview.php')
|
||||
$colspan = 7;
|
||||
else
|
||||
$colspan = 6;
|
||||
|
||||
if($s_page == 'cart.php')
|
||||
$colspan2 = 3;
|
||||
else
|
||||
$colspan2 = 4;
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
.view-options { cursor: pointer; }
|
||||
.edit-options { cursor: pointer; }
|
||||
.options-list { display: none; }
|
||||
.coupon-link { cursor: pointer; }
|
||||
-->
|
||||
</style>
|
||||
|
||||
<form name="frmcartlist" method="post" style="padding:0px;">
|
||||
<table width="98%" cellpadding="0" cellspacing="0" align="center">
|
||||
<colgroup width="80">
|
||||
<colgroup width="">
|
||||
<?php if($s_page == 'orderform.php') { ?>
|
||||
<colgroup width="80">
|
||||
<?php } ?>
|
||||
<colgroup width="80">
|
||||
<colgroup width="80">
|
||||
<colgroup width="80">
|
||||
<?php if($s_page == 'orderinquiryview.php') echo '<colgroup width=80>'; ?>
|
||||
<?php if ($s_page == 'cart.php' || $s_page == 'orderinquiryview.php') echo '<colgroup width="50">'; ?>
|
||||
<tr><td colspan="<? echo $colspan; ?>" height="2" class="c1"></td></tr>
|
||||
<tr align="center" height="28" class="c2">
|
||||
<td colspan="2">상품명</td>
|
||||
<?php if($s_page == 'orderform.php') { ?>
|
||||
<td>쿠폰</td>
|
||||
<?php } ?>
|
||||
<?php if($s_page == 'orderinquiryview.php') { ?>
|
||||
<td>쿠폰할인</td>
|
||||
<? } ?>
|
||||
<td>수량</td>
|
||||
<td>주문금액</td>
|
||||
<td>포인트</td>
|
||||
<?
|
||||
if ($s_page == 'cart.php')
|
||||
echo '<td><input type="checkbox" name="all_chk" value="1" /></td>';
|
||||
else if ($s_page == 'orderinquiryview.php')
|
||||
echo '<td>상태</td>';
|
||||
?>
|
||||
</tr>
|
||||
<tr><td colspan="<? echo $colspan; ?>" height="1" class="c1"></td></tr>
|
||||
<?
|
||||
$tot_point = 0;
|
||||
$tot_sell_amount = 0;
|
||||
$tot_cancel_amount = 0;
|
||||
|
||||
// 장바구니 자료 쿼리
|
||||
if($is_member && ($s_page == "cart.php" || $s_page == "orderform.php"))
|
||||
$sql_where = " ( a.uq_id = '$s_uq_id' or a.mb_id = '{$member['mb_id']}' ) ";
|
||||
else
|
||||
$sql_where = " a.uq_id = '$s_uq_id' ";
|
||||
|
||||
$sql = " select a.ct_id,
|
||||
a.uq_id,
|
||||
a.it_id,
|
||||
a.it_name,
|
||||
a.is_option,
|
||||
a.it_amount,
|
||||
a.ct_point,
|
||||
a.ct_qty,
|
||||
a.ct_status,
|
||||
a.ct_send_cost_pay,
|
||||
b.ca_id,
|
||||
b.ca_id2,
|
||||
b.ca_id3,
|
||||
b.it_option_use,
|
||||
b.it_supplement_use,
|
||||
b.it_nocoupon,
|
||||
b.it_notax
|
||||
from {$g4['yc4_cart_table']} as a left join {$g4['yc4_item_table']} as b on ( a.it_id = b.it_id )
|
||||
where $sql_where
|
||||
and a.ct_parent = '0'
|
||||
and a.ct_direct = '$sw_direct' ";
|
||||
|
||||
if($w == "selectedbuy")
|
||||
$sql .= " and a.ct_selected = '1' ";
|
||||
|
||||
if($s_page == "cart.php" || $s_page == "orderform.php")
|
||||
$sql .= " and a.ct_status = '쇼핑' ";
|
||||
|
||||
$sql .= " order by a.ct_id ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
|
||||
$goods_count = 0;
|
||||
$itemlist = array();
|
||||
for ($i=0; $row=mysql_fetch_array($result); $i++)
|
||||
{
|
||||
// 합계금액등 계산
|
||||
$sql = " select SUM((ct_amount + it_amount) * ct_qty) as sum_amount,
|
||||
SUM(cp_amount) as dc_amount,
|
||||
SUM(ct_point * ct_qty) as sum_point,
|
||||
SUM(ct_qty) as sum_qty
|
||||
from {$g4['yc4_cart_table']}
|
||||
where ct_id = '{$row['ct_id']}'
|
||||
or ct_parent = '{$row['ct_id']}' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
// 상품관련정보 $itemlist 에 저장해 배송비계산, 주문폼에서 사용
|
||||
$itemlist[$i]['ct_id'] = $row['ct_id'];
|
||||
$itemlist[$i]['it_id'] = $row['it_id'];
|
||||
$itemlist[$i]['it_name'] = $row['it_name'];
|
||||
$itemlist[$i]['amount'] = $sum['sum_amount'];
|
||||
$itemlist[$i]['qty'] = $sum['sum_qty'];
|
||||
$itemlist[$i]['pay'] = $row['ct_send_cost_pay'];
|
||||
$itemlist[$i]['notax'] = $row['it_notax'];
|
||||
$goods_count++;
|
||||
|
||||
// 선택, 추가 옵션개수
|
||||
$opt_count = $spl_count = 0;
|
||||
if($row['it_option_use']) {
|
||||
$sql2 = " select COUNT(*) as cnt from {$g4['yc4_option_table']} where it_id = '{$row['it_id']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$opt_count = (int)$row2['cnt'];
|
||||
}
|
||||
$spl_count = 0;
|
||||
if($row['it_supplement_use']) {
|
||||
$sql2 = " select COUNT(*) as cnt from {$g4['yc4_supplement_table']} where it_id = '{$row['it_id']}' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$spl_count = (int)$row2['cnt'];
|
||||
}
|
||||
|
||||
if ($i==0) { // 계속쇼핑
|
||||
$continue_ca_id = $row['ca_id'];
|
||||
}
|
||||
|
||||
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php") { // 링크를 붙이고
|
||||
$a1 = "<a href='./item.php?it_id={$row['it_id']}'>";
|
||||
$a2 = "</a>";
|
||||
$image = get_it_image($row['it_id']."_s", 50, 50, $row['it_id']);
|
||||
} else { // 붙이지 않고
|
||||
$a1 = "";
|
||||
$a2 = "";
|
||||
$image = get_it_image($row['it_id']."_s", 50, 50);
|
||||
}
|
||||
|
||||
$it_name = $a1 . stripslashes($row['it_name']) . $a2 . '<br />';
|
||||
if($opt_count > 0 || $spl_count > 0) {
|
||||
$it_name .= "\n".'<span class="view-options">선택사항보기</span>'."\n";
|
||||
if($s_page == "cart.php") {
|
||||
$it_name .= ' <span id="cartitem-'.$row['it_id']. '" class="edit-options">선택사항/수량변경</span>';
|
||||
}
|
||||
|
||||
$it_name .= '<br />'."\n".'<span class="options-list">' . print_cart_options($row['uq_id'], $row['it_id'], $sw_direct) . '</span>';
|
||||
}
|
||||
|
||||
// 주문금액, 포인트
|
||||
$sell_amount = $sum['sum_amount'];
|
||||
$point = $sum['sum_point'];
|
||||
|
||||
if ($i > 0)
|
||||
echo '<tr><td colspan="'.$colspan.'" height="1" bgcolor="#E7E9E9"></td></tr>'."\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td align=\"left\" style=\"padding:5px;\">$image</td>\n";
|
||||
echo "<td><input type=\"hidden\" name=\"ct_id[$i]\" value=\"{$row['ct_id']}\">\n";
|
||||
echo "<input type=\"hidden\" name=\"it_id[$i]\" value=\"{$row['it_id']}\">\n";
|
||||
echo "<input type=\"hidden\" name=\"cp_id[$i]\" value=\"\">\n";
|
||||
echo "<input type=\"hidden\" name=\"ch_amount[$i]\" value=\"0\">\n";
|
||||
echo "<input type=\"hidden\" name=\"it_name[$i]\" value=\"".get_text($row['it_name'])."\">\n";
|
||||
// 복합과세 사용한다면 쿠폰 적용 시 사용하기 위해 필드 생성
|
||||
if($default['de_compound_tax_use']) {
|
||||
$ct_tax_mny = 0;
|
||||
$ct_vat_mny = 0;
|
||||
$ct_free_mny = 0;
|
||||
|
||||
// 과세, 면세금액
|
||||
if($row['it_notax']) { // 면세상품
|
||||
$ct_free_mny = (int)$sum['sum_amount'];
|
||||
} else { // 과세상품
|
||||
$ct_tax_mny = round((int)$sum['sum_amount'] / 1.1);
|
||||
$ct_vat_mny = (int)$sum['sum_amount'] - $ct_tax_mny;
|
||||
}
|
||||
echo "<input type=\"hidden\" name=\"tax_mny[$i]\" value=\"$ct_tax_mny\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"vat_mny[$i]\" value=\"$ct_vat_mny\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"free_mny[$i]\" value=\"$ct_free_mny\" />\n";
|
||||
}
|
||||
echo $it_name;
|
||||
echo "</td>\n";
|
||||
|
||||
if($s_page == 'orderform.php') { // 쿠폰표시
|
||||
$coupon = '<span class="coupon-apply">없음</span>';
|
||||
if(!$row['it_nocoupon']) {
|
||||
if($is_member) {
|
||||
// 상품에 쿠폰 있는지 체크
|
||||
$sql3 = " select cp_id, ca_id
|
||||
from {$g4['yc4_coupon_table']}
|
||||
where cp_use = '1'
|
||||
and cp_type = '0'
|
||||
and cp_start <= '{$g4['time_ymd']}'
|
||||
and cp_end >= '{$g4['time_ymd']}'
|
||||
and ( it_id = '{$row['it_id']}' or cp_target = '2' )
|
||||
and mb_id in ( '{$member['mb_id']}', '전체회원' )
|
||||
and ca_id in ( '{$row['ca_id']}', '{$row['ca_id2']}', '{$row['ca_id3']}', '전체카테고리' ) ";
|
||||
$result3 = sql_query($sql3);
|
||||
|
||||
$cnt = 0;
|
||||
for($k=0; $row3=sql_fetch_array($result3); $k++) {
|
||||
// 쿠폰제외카테고리체크
|
||||
$sql4 = " select ca_nocoupon
|
||||
from {$g4['yc4_category_table']}
|
||||
where ca_id = '{$row3['ca_id']}' ";
|
||||
$row4 = sql_fetch($sql4);
|
||||
if($row4['ca_nocoupon']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 쿠폰사용여부체크
|
||||
$sql4 = " select uq_id
|
||||
from {$g4['yc4_coupon_history_table']}
|
||||
where cp_id = '{$row3['cp_id']}'
|
||||
and it_id = '{$row['it_id']}'
|
||||
and mb_id = '{$member['mb_id']}' ";
|
||||
$row4 = sql_fetch($sql4);
|
||||
|
||||
if(!$row4['uq_id'] || $row4['uq_id'] == $s_uq_id) {
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if($cnt) {
|
||||
$coupon = '<span class="coupon-apply coupon-link">쿠폰적용</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "<td align=\"center\">$coupon</td>\n";
|
||||
}
|
||||
|
||||
if($s_page == 'orderinquiryview.php') { // 할인금액 표시
|
||||
$dc_amount = $sum['dc_amount'];
|
||||
echo "<td align=\"center\">".number_format($sum['dc_amount'])."</td>\n";
|
||||
}
|
||||
|
||||
// 수량, 입력(수량)
|
||||
if ($s_page == "cart.php") {
|
||||
if($opt_count > 0 || $spl_count > 0) {
|
||||
echo "<td align=\"center\"><input type=\"text\" id=\"ct_qty_{$i}\" name=\"ct_qty[$i]\" value=\"{$row['ct_qty']}\" class=\"has-option\" size=\"4\" maxlength=\"4\" readonly=\"readonly\" class=\"ed\" style=\"text-align:right;\" autocomplete=\"off\"></td>\n";
|
||||
} else {
|
||||
echo "<td align=\"center\"><input type=\"text\" id=\"ct_qty_{$i}\" name=\"ct_qty[$i]\" value=\"{$row['ct_qty']}\" size=\"4\" maxlength=\"4\" class=\"ed\" style=\"text-align:right;\" autocomplete=\"off\"></td>\n";
|
||||
}
|
||||
} else {
|
||||
echo "<td align=\"center\">{$row['ct_qty']}</td>\n";
|
||||
}
|
||||
|
||||
echo "<td align=\"right\"><span class=\"sell_amount\">" . number_format($sell_amount - $dc_amount) . "</span></td>\n";
|
||||
echo "<td align=\"right\">" . number_format($point) . " </td>\n";
|
||||
|
||||
if ($s_page == "cart.php")
|
||||
//echo "<td align=center><a href='./cartupdate.php?w=d&it_id={$row['it_id']}'><img src='{$g4['shop_img_path']}/btn_del.gif' border='0' align=absmiddle alt='삭제'></a></td>";
|
||||
echo '<td align="center"><input type="checkbox" name="ct_chk['.$i.']" value="'.$row['ct_id'].'" /></td>'."\n";
|
||||
else if ($s_page == "orderinquiryview.php")
|
||||
{
|
||||
switch($row['ct_status'])
|
||||
{
|
||||
case '주문' : $icon = "<img src=\"{$g4['shop_img_path']}/status01.gif\">"; break;
|
||||
case '준비' : $icon = "<img src=\"{$g4['shop_img_path']}/status02.gif\">"; break;
|
||||
case '배송' : $icon = "<img src=\"{$g4['shop_img_path']}/status03.gif\">"; break;
|
||||
case '완료' : $icon = "<img src=\"{$g4['shop_img_path']}/status04.gif\">"; break;
|
||||
default : $icon = $row['ct_status']; break;
|
||||
}
|
||||
echo "<td align=\"center\">$icon</td>\n";
|
||||
}
|
||||
|
||||
echo "</tr>\n";
|
||||
echo "<tr><td colspan=\"$colspan\" class=\"dotline\"></td></tr>\n";
|
||||
|
||||
//$tot_point += $point;
|
||||
//$tot_sell_amount += $sell_amount;
|
||||
|
||||
if ($row['ct_status'] == '취소' || $row['ct_status'] == '반품' || $row['ct_status'] == '품절') {
|
||||
$tot_cancel_amount += $sell_amount;
|
||||
}
|
||||
else {
|
||||
$tot_point += $point;
|
||||
$tot_sell_amount += $sell_amount;
|
||||
$item_dc_amount += $dc_amount; // 총 할인금액
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan=\"$colspan\" align=\"center\" height=\"100\"><span class=\"textpoint\">장바구니가 비어 있습니다.</span></td>\n";
|
||||
echo "</tr>";
|
||||
} else {
|
||||
// 배송비가 넘어왔다면
|
||||
if ($_POST['od_send_cost']) {
|
||||
$send_cost = (int)$_POST['od_send_cost'];
|
||||
} else {
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == "없음" || $default['de_send_cost_case'] == "착불")
|
||||
$send_cost = 0;
|
||||
else if($default['de_send_cost_case'] == "상한") {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_amount < $send_cost_limit[$k]) {
|
||||
$send_cost = $send_cost_list[$k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if($default['de_send_cost_case'] == "개별배송") {
|
||||
$send_cost = 0;
|
||||
|
||||
for($i=0; $i<$goods_count; $i++) {
|
||||
if($itemlist[$i]['pay'] == "착불") {
|
||||
$send_cost += 0;
|
||||
} else {
|
||||
$sql = " select it_sc_type, it_sc_basic, it_sc_method, it_sc_condition
|
||||
from {$g4['yc4_item_table']}
|
||||
where it_id = '{$itemlist[$i]['it_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['it_sc_type'] == 1) { // 조건부무료
|
||||
if($itemlist[$i]['amount'] >= $row['it_sc_condition']) {
|
||||
$send_cost += 0;
|
||||
} else {
|
||||
$send_cost += $row['it_sc_basic'];
|
||||
}
|
||||
} else if($row['it_sc_type'] == 2) { // 유료
|
||||
$send_cost += $row['it_sc_basic'];
|
||||
} else if($row['it_sc_type'] == 3) { // 수량별부과
|
||||
$qty = ceil($itemlist[$i]['qty'] / $row['it_sc_condition']);
|
||||
$send_cost += ($row['it_sc_basic'] * $qty);
|
||||
} else {
|
||||
$send_cost += 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이미 주문된 내역을 보여주는것이므로 주문서에서 얻는다.
|
||||
$sql = "select od_send_cost, od_send_coupon, od_send_cost_area, od_coupon_amount from {$g4['yc4_order_table']} where od_id = '$od_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['od_send_cost'] > 0)
|
||||
$send_cost = $row['od_send_cost'] - $row['od_send_coupon'];
|
||||
|
||||
if($row['od_coupon_amount'] > 0)
|
||||
$od_coupon_amount = $row['od_coupon_amount'];
|
||||
|
||||
if($row['od_send_cost_area'])
|
||||
$od_send_cost_area = $row['od_send_cost_area'];
|
||||
}
|
||||
|
||||
// 배송비가 0 보다 크다면 (있다면)
|
||||
if ($send_cost > 0)
|
||||
{
|
||||
echo "<tr><td colspan=\"$colspan\" height=\"1\" bgcolor=\"#E7E9E9\"></td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td height=\"28\" colspan=\"$colspan2\" align=\"right\">배송비 : </td>\n";
|
||||
echo "<td align=\"right\"><span id=\"send_cost\">" . number_format($send_cost) . "</span></td>\n";
|
||||
echo "<td> </td>\n";
|
||||
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php")
|
||||
echo "<td> </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
// 추가배송비가 0 보다 크다면 (있다면)
|
||||
if ($od_send_cost_area > 0)
|
||||
{
|
||||
echo "<tr><td colspan=\"$colspan\" height=\"1\" bgcolor=\"#E7E9E9\"></td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td height=\"28\" colspan=\"$colspan2\" align=\"right\">추가배송비 : </td>\n";
|
||||
echo "<td align=\"right\"><span id=\"send_cost\">" . number_format($od_send_cost_area) . "</span></td>\n";
|
||||
echo "<td> </td>\n";
|
||||
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php")
|
||||
echo "<td> </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
// 결제할인금액 0 보다 크다면 (있다면)
|
||||
if ($od_coupon_amount > 0)
|
||||
{
|
||||
echo "<tr><td colspan=\"$colspan\" height=\"1\" bgcolor=\"#E7E9E9\"></td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td height=\"28\" colspan=\"$colspan2\" align=\"right\">결제할인 : </td>\n";
|
||||
echo "<td align=\"right\"><span id=\"send_cost\">" . number_format($od_coupon_amount) . "</span></td>\n";
|
||||
echo "<td> </td>\n";
|
||||
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php")
|
||||
echo "<td> </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
// 총계 = 주문상품금액합계 - 할인금액합계 + 배송비 + 추가배송비
|
||||
$tot_amount = $tot_sell_amount - $item_dc_amount + $send_cost - $od_coupon_amount + $od_send_cost_area;
|
||||
|
||||
echo "<tr><td colspan=\"$colspan\" height=\"1\" bgcolor=\"#94D7E7\"></td></tr>\n";
|
||||
echo "<tr align=\"center\" height=\"28\" bgcolor=\"#E7F3F7\">\n";
|
||||
echo "<td colspan=\"$colspan2\" align=\"right\"><b>총계 : </b></td>\n";
|
||||
echo "<td align=\"right\"><span id=\"tot_amount\" class=amount><b>" . number_format($tot_amount) . "</b></span></td>\n";
|
||||
echo "<td align=\"right\">" . number_format($tot_point) . " </td>\n";
|
||||
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php")
|
||||
echo "<td> </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<input type=\"hidden\" name=\"w\" value=\"\">\n";
|
||||
echo "<input type=\"hidden\" name=\"records\" value=\"$i\">\n";
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="<? echo $colspan; ?>" height="2" bgcolor="#94D7E7"></td></tr>
|
||||
<tr>
|
||||
<td colspan="<? echo $colspan; ?>" align="center">
|
||||
<?
|
||||
if ($s_page == "cart.php") {
|
||||
if ($i == 0) {
|
||||
echo "<br><a href=\"{$g4['path']}\"><img src=\"{$g4['shop_img_path']}/btn_shopping.gif\" border=\"0\"></a>";
|
||||
} else {
|
||||
echo "
|
||||
<br><input type=\"hidden\" name=\"url\" value=\"./orderform.php\">
|
||||
<a href=\"javascript:form_check('buy')\"><img src=\"{$g4['shop_img_path']}/btn_buy.gif\" border=\"0\" alt=\"구매하기\"></a>
|
||||
<a href=\"javascript:form_check('selectedbuy')\"><img src=\"{$g4['shop_img_path']}/btn_buy1.gif\" border=\"0\" alt=\"선택주문\"></a>
|
||||
<a href=\"javascript:form_check('allupdate')\"><img src=\"{$g4['shop_img_path']}/btn_cart_quan.gif\" border=\"0\" alt=\"장바구니 수량 변경\"></a>
|
||||
<a href=\"javascript:form_check('alldelete');\"><img src=\"{$g4['shop_img_path']}/btn_cart_out.gif\" border=\"0\" alt=\"장바구니 비우기\"></a>
|
||||
<a href=\"javascript:form_check('seldelete');\"><img src=\"{$g4['shop_img_path']}/btn_cart_out1.gif\" border=\"0\" alt=\"선택삭제\"></a>
|
||||
<a href=\"./list.php?ca_id=$continue_ca_id\"><img src=\"{$g4['shop_img_path']}/btn_shopping.gif\" border=\"0\" alt=\"계속쇼핑하기\"></a>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// 선택사항보기
|
||||
$(".view-options").click(function() {
|
||||
$(this).closest("tr").find(".options-list").toggle();
|
||||
});
|
||||
|
||||
// 선택사항/수량변경
|
||||
$(".edit-options").click(function() {
|
||||
var it_id = $(this).closest("tr").find("input[name^=it_id]").val();
|
||||
window.open("./cartoption.php?it_id="+it_id+"&sw_direct=<? echo $sw_direct; ?>", "optionform", "width=700, height=700, left=100, top=50, scrollbars=yes");
|
||||
});
|
||||
|
||||
// 수량 input click
|
||||
$("input[name^=ct_qty]").click(function() {
|
||||
if($(this).hasClass("has-option")) {
|
||||
var it_id = $(this).closest("tr").find("input[name^=it_id]").val();
|
||||
window.open("./cartoption.php?it_id="+it_id+"&sw_direct=<? echo $sw_direct; ?>", "optionform", "width=700, height=700, left=100, top=50, scrollbars=yes");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<? if ($s_page == "cart.php") { ?>
|
||||
<script>
|
||||
<? if ($i != 0) { ?>
|
||||
$(function() {
|
||||
$("input[name=all_chk]").click(function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("input[name^=ct_chk]").attr("checked", true);
|
||||
} else {
|
||||
$("input[name^=ct_chk]").attr("checked", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function form_check(act) {
|
||||
var f = document.frmcartlist;
|
||||
var cnt = f.records.value;
|
||||
|
||||
if (act == "buy")
|
||||
{
|
||||
f.w.value = act;
|
||||
|
||||
<?
|
||||
if (get_session('ss_mb_id')) // 회원인 겨우
|
||||
{
|
||||
echo "f.action = \"./orderform.php\";";
|
||||
echo "f.submit();";
|
||||
}
|
||||
else
|
||||
echo "document.location.href = \"".$g4['bbs_path']."/login.php?url=".urlencode($g4['shop_path'].'/orderform.php')."\";";
|
||||
?>
|
||||
} else if (act == "selectedbuy")
|
||||
{
|
||||
var cnt = 0;
|
||||
var inputs = f.getElementsByTagName("input");
|
||||
for(i=0; i<inputs.length; i++) {
|
||||
if(inputs[i].type == "checkbox" && inputs[i].name.search("ct_chk") > - 1 && inputs[i].checked) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if(!cnt) {
|
||||
alert("주문하실 상품을 1개 이상 선택해 주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
f.w.value = act;
|
||||
f.action = "./cartupdate.php";
|
||||
f.submit();
|
||||
}
|
||||
else if (act == "alldelete")
|
||||
{
|
||||
f.w.value = act;
|
||||
f.action = "./cartupdate.php";
|
||||
f.submit();
|
||||
}
|
||||
else if(act == "seldelete")
|
||||
{
|
||||
f.w.value = act;
|
||||
f.action = "./cartupdate.php";
|
||||
f.submit();
|
||||
}
|
||||
else if (act == "allupdate")
|
||||
{
|
||||
for (i=0; i<cnt; i++)
|
||||
{
|
||||
//if (f.elements("ct_qty[" + i + "]").value == "")
|
||||
if (document.getElementById("ct_qty_"+i).value == "")
|
||||
{
|
||||
alert("수량을 입력해 주십시오.");
|
||||
//f.elements("ct_qty[" + i + "]").focus();
|
||||
document.getElementById("ct_qty_"+i).focus();
|
||||
return;
|
||||
}
|
||||
//else if (isNaN(f.elements("ct_qty[" + i + "]").value))
|
||||
else if (isNaN(document.getElementById("ct_qty_"+i).value))
|
||||
{
|
||||
alert("수량을 숫자로 입력해 주십시오.");
|
||||
//f.elements("ct_qty[" + i + "]").focus();
|
||||
document.getElementById("ct_qty_"+i).focus();
|
||||
return;
|
||||
}
|
||||
//else if (f.elements("ct_qty[" + i + "]").value < 1)
|
||||
else if (document.getElementById("ct_qty_"+i).value < 1)
|
||||
{
|
||||
alert("수량은 1 이상 입력해 주십시오.");
|
||||
//f.elements("ct_qty[" + i + "]").focus();
|
||||
document.getElementById("ct_qty_"+i).focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
f.w.value = act;
|
||||
f.action = "./cartupdate.php";
|
||||
f.submit();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
<? } ?>
|
||||
</script>
|
||||
<? } ?>
|
||||
|
||||
<? if ($s_page == "cart.php") { ?>
|
||||
<br><br>
|
||||
<table align="center" cellpadding="0" cellspacing="0">
|
||||
<tr><td><img src="<? echo $g4['shop_img_path']; ?>/info_box01.gif"></td></tr>
|
||||
<tr><td background="<? echo $g4['shop_img_path']; ?>/info_box03.gif" style="line-height:180%; padding-left:20px">
|
||||
· <FONT COLOR="#FF8200">상품 주문하기</FONT> : 주문서를 작성하시려면 '주문하기' 버튼을 누르세요.<BR>
|
||||
· <FONT COLOR="#FF8200">상품 수량변경</FONT> : 주문수량을 변경하시려면 원하시는 수량을 입력하신 후 '수량변경' 버튼을 누르세요.<BR>
|
||||
· <FONT COLOR="#FF8200">상품 삭제하기</FONT> : 모든 주문내용을 삭제하시려면 '삭제하기' 버튼을 누르세요.<BR>
|
||||
· <FONT COLOR="#FF8200">쇼핑 계속하기</FONT> : 쇼핑하시던 페이지로 돌아가시려면 '쇼핑 계속하기' 버튼을 누르세요.
|
||||
</td></tr>
|
||||
<tr><td><img src="<? echo $g4['shop_img_path']?>/info_box02.gif"></td></tr>
|
||||
</table><br><br>
|
||||
<? } ?>
|
||||
330
shop/cartupdate.php
Normal file
@ -0,0 +1,330 @@
|
||||
<?
|
||||
include_once('./_common.php');
|
||||
|
||||
// wish item 처리
|
||||
if(trim($wish_update) || $submit_button == 'wish_update') {
|
||||
include($g4['shop_path'].'/wishupdate.php');
|
||||
}
|
||||
|
||||
if (trim($direct_buy) || $submit_button == 'direct_buy') { // 바로구매
|
||||
$sw_direct = 1;
|
||||
}
|
||||
else {
|
||||
$sw_direct = 0;
|
||||
}
|
||||
|
||||
$uq_id = get_session('ss_uniqid');
|
||||
|
||||
// 브라우저에서 쿠키를 허용하지 않은 경우라고 볼 수 있음.
|
||||
if (!$uq_id)
|
||||
{
|
||||
alert("더 이상 작업을 진행할 수 없습니다.\\n\\n브라우저의 쿠키 허용을 사용하지 않음으로 설정한것 같습니다.\\n\\n브라우저의 인터넷 옵션에서 쿠키 허용을 사용으로 설정해 주십시오.\\n\\n그래도 진행이 되지 않는다면 쇼핑몰 운영자에게 문의 바랍니다.");
|
||||
}
|
||||
|
||||
// 레벨(권한)이 상품구입 권한보다 작다면 상품을 구입할 수 없음.
|
||||
if ($member['mb_level'] < $default['de_level_sell'])
|
||||
{
|
||||
alert('상품을 구입할 수 있는 권한이 없습니다.');
|
||||
}
|
||||
|
||||
// 비회원장바구니
|
||||
if($default['de_guest_cart_use']) {
|
||||
if(!get_cookie('ck_guest_cart_uqid')) {
|
||||
set_cookie('ck_guest_cart_uqid', $uq_id, 24*60*60*30); // 30일간 보관
|
||||
}
|
||||
} else {
|
||||
if(get_cookie('ck_guest_cart_uqid')) {
|
||||
set_cookie('ck_guest_cart_uqid', '', 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ($w == 'alldelete') // 모두 삭제이면
|
||||
{
|
||||
$sql = " delete from {$g4['yc4_cart_table']}
|
||||
where uq_id = '$uq_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
else if ($w == 'seldelete') // 선택 삭제이면
|
||||
{
|
||||
$sel_count = count($_POST['ct_chk']);
|
||||
if(!$sel_count) {
|
||||
alert('삭제할 상품을 1개이상 선택해 주세요.');
|
||||
}
|
||||
|
||||
for($k=0; $k<$sel_count; $k++) {
|
||||
$ct_id = $_POST['ct_chk'][$k];
|
||||
$sql = " delete from {$g4['yc4_cart_table']} where uq_id = '$uq_id' and ( ct_id = '$ct_id' or ct_parent = '$ct_id' ) ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
else if($w == 'selectedbuy') // 선택주문이면
|
||||
{
|
||||
$chk_count = count($_POST['ct_chk']);
|
||||
if(!$chk_count)
|
||||
alert("주문하실 상품을 1개 이상 선택해 주세요.");
|
||||
|
||||
// 이전 선택주문 상품 초기화
|
||||
$sql = " update {$g4['yc4_cart_table']}
|
||||
set ct_selected = '0'
|
||||
where uq_id = '$uq_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
$count = count($_POST['ct_id']);
|
||||
for($i=0; $i<$count; $i++) {
|
||||
$chk_id = $_POST['ct_chk'][$i];
|
||||
if(!$chk_id)
|
||||
continue;
|
||||
|
||||
$sql = " update {$g4['yc4_cart_table']}
|
||||
set ct_selected = '1'
|
||||
where ct_id = '$chk_id'
|
||||
or ct_parent = '$chk_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if ($is_member)
|
||||
{
|
||||
goto_url("{$g4['shop_url']}/orderform.php?w=selectedbuy");
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_url("{$g4['url']}/{$g4['bbs']}/login.php?url=".urlencode("{$g4['shop_path']}/orderform.php?w=selectedbuy"));
|
||||
}
|
||||
}
|
||||
else if ($w == 'allupdate') // 수량 변경이면 : 모두 수정이면
|
||||
{
|
||||
$fldcnt = count($_POST['ct_id']);
|
||||
|
||||
// 수량 변경, 재고등을 검사
|
||||
$error = "";
|
||||
for ($i=0; $i<$fldcnt; $i++)
|
||||
{
|
||||
$ct_id = $_POST['ct_id'][$i];
|
||||
if($ct_id) {
|
||||
// 상품1개일 때만 수량변경
|
||||
$sql = " select count(ct_id) as cnt from {$g4['yc4_cart_table']} where uq_id = '$uq_id' and it_id = '{$_POST['it_id'][$i]}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if($row['cnt'] > 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 재고 구함
|
||||
$stock_qty = get_it_stock_qty($_POST['it_id'][$i]);
|
||||
|
||||
// 변경된 수량이 재고수량보다 크면 오류
|
||||
if ($_POST['ct_qty'][$i] > $stock_qty) {
|
||||
$error .= "{$_POST['it_name'][$i]} 의 재고수량이 부족합니다. 현재 재고수량 : $stock_qty 개\\n\\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// 수량수정
|
||||
$sql = " update {$g4['yc4_cart_table']}
|
||||
set ct_qty = '{$_POST['ct_qty'][$i]}'
|
||||
where ct_id = '$ct_id'
|
||||
and uq_id = '$uq_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// 오류가 있다면 오류메세지 출력
|
||||
if ($error != "") { alert($error); }
|
||||
}
|
||||
else // 장바구니에 담기
|
||||
{
|
||||
if (!$_POST['it_id'])
|
||||
alert('장바구니에 담을 상품을 선택하여 주십시오.');
|
||||
|
||||
$ct_count = count($_POST['ct_qty']);
|
||||
|
||||
// 상품정보
|
||||
$sql = " select it_id, it_use, it_gallery, it_tel_inq, it_option_use, it_supplement_use
|
||||
from {$g4['yc4_item_table']} where it_id = '{$_POST['it_id']}' ";
|
||||
$it = sql_fetch($sql);
|
||||
|
||||
// 주문가능한 상품인지
|
||||
if(!$it['it_use'] || $it['it_gallery'] || $it['it_tel_inq']) {
|
||||
alert($_POST['it_name'].'은(는) 주문할 수 없습니다.');
|
||||
}
|
||||
|
||||
// 비회원가격과 회원가격이 다르다면
|
||||
if (!$is_member && $default['de_different_msg'])
|
||||
{
|
||||
$sql = " select it_amount, it_amount2 from {$g4['yc4_item_table']} where it_id = '{$_POST['it_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['it_amount2'] && $row['it_amount'] != $row['it_amount2']) {
|
||||
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=".$g4['charset']."\">";
|
||||
echo "<script>alert('비회원가격과 회원가격이 다릅니다. 로그인 후 구입하여 주십시오.');</script>";
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
// 변조 검사
|
||||
//--------------------------------------------------------
|
||||
//$is_option : 1-> 선택옵션, 2->추가옵션, 0->옵션없는 상품
|
||||
$total_amount = (int)$_POST['total_amount'];
|
||||
$total_price = 0;
|
||||
$item_price = (int)$_POST['it_amount'];
|
||||
|
||||
for($i=0; $i<$ct_count; $i++) {
|
||||
$is_option = (int)$_POST['is_option'][$i];
|
||||
$ct_price = (int)$_POST['ct_amount'][$i];
|
||||
$it_qty = $_POST['ct_qty'][$i];
|
||||
|
||||
if($is_option == 2) {
|
||||
$total_price += ($ct_price * $it_qty);
|
||||
} else {
|
||||
$total_price += ($item_price + $ct_price) * $it_qty;
|
||||
}
|
||||
}
|
||||
|
||||
// 총 금액 다름
|
||||
if($total_amount != $total_price) {
|
||||
die('Error.');
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
||||
//--------------------------------------------------------
|
||||
// 재고 및 사용여부 검사
|
||||
//--------------------------------------------------------
|
||||
// $is_option : 1-> 선택옵션, 2->추가옵션, 0->옵션없는 상품
|
||||
for($i=0; $i<$ct_count; $i++) {
|
||||
$is_option = $_POST['is_option'][$i];
|
||||
$it_name = get_text($_POST['it_name']);
|
||||
$opt_id = $_POST['opt_id'][$i];
|
||||
$ct_qty = $_POST['ct_qty'][$i];
|
||||
|
||||
if($is_option) {
|
||||
// 주문가능한 옵션인지
|
||||
if($is_option == 1) {
|
||||
$sql1 = " select opt_use as option_use from {$g4['yc4_option_table']}
|
||||
where it_id = '{$_POST['it_id']}' and opt_id = '$opt_id' ";
|
||||
} else {
|
||||
$sql1 = " select sp_use as option_use from {$g4['yc4_supplement_table']}
|
||||
where it_id = '{$_POST['it_id']}' and sp_id = '$opt_id' ";
|
||||
}
|
||||
$row1 = sql_fetch($sql1);
|
||||
|
||||
if(!$row1['option_use']) {
|
||||
$ct_option = $_POST['ct_option'][$i];
|
||||
$msg = '선택하신 상품 : '.$it_name.'('.$ct_option.')은(는) 구매할 수 없습니다.';
|
||||
|
||||
alert($msg);
|
||||
}
|
||||
|
||||
// 이미 장바구니에 있는 같은 옵션의 수량합계를 구한다.
|
||||
$sql = " select SUM(ct_qty) as cnt from {$g4['yc4_cart_table']}
|
||||
where it_id = '{$_POST['it_id']}' and opt_id = '$opt_id' and uq_id <> '$uq_id' and is_option = '$is_option' and ct_status = '쇼핑' ";
|
||||
$row = sql_fetch($sql);
|
||||
$cart_qty = $row['cnt'];
|
||||
$stock_qty = get_option_stock_qty($_POST['it_id'], $opt_id, $is_option);
|
||||
} else {
|
||||
// 이미 장바구니에 있는 같은 상품의 수량합계를 구한다.
|
||||
$sql = " select SUM(ct_qty) as cnt from {$g4['yc4_cart_table']}
|
||||
where it_id = '{$_POST['it_id']}' and uq_id <> '$uq_id' and is_option = '$is_option' and ct_status = '쇼핑' ";
|
||||
$row = sql_fetch($sql);
|
||||
$cart_qty = $row['cnt'];
|
||||
$stock_qty = get_it_stock_qty($_POST['it_id']);
|
||||
}
|
||||
|
||||
if($stock_qty < $ct_qty + $cart_qty) {
|
||||
if($is_option) {
|
||||
$ct_option = $_POST['ct_option'][$i];
|
||||
$msg = '선택하신 상품 : '.$it_name.'('.$ct_option.')은(는) 재고가 부족하여 구매할 수 없습니다.';
|
||||
} else {
|
||||
$msg = '선택하신 상품 : '.$it_name.'은(는) 재고가 부족하여 구매할 수 없습니다.';
|
||||
}
|
||||
|
||||
alert($msg);
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
|
||||
// 바로구매에 있던 장바구니 자료를 지운다.
|
||||
$result = sql_query(" delete from {$g4['yc4_cart_table']} where uq_id = '$uq_id' and ct_direct = 1 ", false);
|
||||
if (!$result) {
|
||||
// 삭제중 에러가 발생했다면 필드가 없다는 것이므로 바로구매 필드를 생성한다.
|
||||
sql_query(" ALTER TABLE `{$g4['yc4_cart_table']}` ADD `ct_direct` TINYINT NOT NULL ");
|
||||
}
|
||||
|
||||
// 포인트 사용하지 않는다면
|
||||
if (!$config['cf_use_point']) { $_POST['it_point'] = 0; }
|
||||
|
||||
// 장바구니에 Insert
|
||||
$it_name = get_text($_POST['it_name']);
|
||||
$ct_parent = 0;
|
||||
|
||||
for($i=0; $i<$ct_count; $i++) {
|
||||
$is_option = $_POST['is_option'][$i];
|
||||
if($is_option == 1 || $is_option == 0) {
|
||||
$it_amount = $_POST['it_amount'];
|
||||
} else {
|
||||
$it_amount = 0;
|
||||
}
|
||||
$opt_id = $_POST['opt_id'][$i];
|
||||
$ct_amount = $_POST['ct_amount'][$i];
|
||||
$ct_qty = $_POST['ct_qty'][$i];
|
||||
$ct_point = 0;
|
||||
$ct_option = get_text($_POST['ct_option'][$i]);
|
||||
$opt_space = '';
|
||||
$ct_send_cost_pay = trim($_POST['ct_send_cost_pay']);
|
||||
|
||||
// No옵션 상품이 장바구니에 있는치 체크, 있으면 수량변경
|
||||
$nopt_count = 0;
|
||||
if($is_option == 0 && !$sw_direct) {
|
||||
$sql2 = " select count(*) as cnt from {$g4['yc4_cart_table']}
|
||||
where uq_id = '$uq_id' and it_id = '{$_POST['it_id']}' and is_option = '0' and ct_direct = '0' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
$nopt_count = (int)$row2['cnt'];
|
||||
}
|
||||
|
||||
if($nopt_count) {
|
||||
$sql = " update {$g4['yc4_cart_table']} set ct_qty = ct_qty + $ct_qty
|
||||
where uq_id = '$uq_id' and it_id = '{$_POST['it_id']}' and is_option = '0' and ct_direct = '0' ";
|
||||
} else {
|
||||
$sql = " insert into {$g4['yc4_cart_table']}
|
||||
set uq_id = '$uq_id',
|
||||
ct_parent = '$ct_parent',
|
||||
mb_id = '{$member['mb_id']}',
|
||||
is_option = '$is_option',
|
||||
it_id = '{$_POST['it_id']}',
|
||||
it_name = '$it_name',
|
||||
opt_id = '$opt_id',
|
||||
ct_option = '$ct_option',
|
||||
ct_status = '쇼핑',
|
||||
it_amount = '$it_amount',
|
||||
ct_amount = '$ct_amount',
|
||||
ct_qty = '$ct_qty',
|
||||
ct_point = '$ct_point',
|
||||
ct_send_cost_pay = '$ct_send_cost_pay',
|
||||
ct_stock_use = '0',
|
||||
ct_point_use = '0',
|
||||
ct_time = '{$g4['time_ymdhis']}',
|
||||
ct_ip = '$REMOTE_ADDR',
|
||||
ct_direct = '$sw_direct' ";
|
||||
}
|
||||
|
||||
sql_query($sql);
|
||||
|
||||
if($ct_parent == 0)
|
||||
$ct_parent = mysql_insert_id();
|
||||
}
|
||||
}
|
||||
|
||||
// 바로 구매일 경우
|
||||
if ($sw_direct)
|
||||
{
|
||||
if ($is_member)
|
||||
{
|
||||
goto_url("{$g4['shop_url']}/orderform.php?sw_direct=$sw_direct");
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_url("{$g4['url']}/{$g4['bbs']}/login.php?url=".urlencode("{$g4['shop_path']}/orderform.php?sw_direct=$sw_direct"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_url("{$g4['shop_url']}/cart.php");
|
||||
}
|
||||
?>
|
||||
93
shop/cat1.ajax.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
$ca_name = stripslashes($_POST['ca_name']);
|
||||
$ca_number = (int)$_POST['ca_number'];
|
||||
$start = 2 * $ca_number - 1;
|
||||
$end = 2 * $ca_number;
|
||||
|
||||
$sql = " SELECT MAX(SUBSTRING(ca_id,$start,$end)) AS ca_id FROM {$g4['yc4_category_table']} ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['ca_id']) {
|
||||
$ca_id = base_convert($row['ca_id'], 36, 10);
|
||||
$ca_id += 36;
|
||||
$ca_id = base_convert($ca_id, 10, 36);
|
||||
} else {
|
||||
$ca_id = "10";
|
||||
}
|
||||
|
||||
$sql = " INSERT INTO {$g4['yc4_category_table']} SET ca_id = '$ca_id', ca_name = '$ca_name' ";
|
||||
sql_query($sql);
|
||||
|
||||
die("{\"ca_id\":\"$ca_id\", \"ca_name\":\"$ca_name\"}");
|
||||
|
||||
exit;
|
||||
if ($is_guest) {
|
||||
die("{\"error\":\"회원님만 신고 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.\"}");
|
||||
}
|
||||
|
||||
$reason = get_text(strip_tags($_POST['reason']));
|
||||
|
||||
$sql = " select sg_reason from `$g4[singo_table]` where `bo_table` = '$bo_table' and `wr_id` = '$wr_id' and (`mb_id` = '$member[mb_id]' or `sg_ip` = '{$_SERVER['REMOTE_ADDR']}') ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row) {
|
||||
//die("{\"error\":\"이미 (".get_text(strip_tags($row[sg_reason])).") 사유로 '신고' 하셨습니다.\"}");
|
||||
die("{\"error\":\"이미 이 게시물을 '신고' 하셨습니다.\"}");
|
||||
}
|
||||
|
||||
if ($write['mb_id'] && $write['mb_id'] == $member['mb_id']) {
|
||||
die("{\"error\":\"자신의 게시물은 '신고' 할 수 없습니다.\"}");
|
||||
}
|
||||
|
||||
$gap = gap_days($write['wr_datetime']);
|
||||
if ($gap > 7) {
|
||||
die("{\"error\":\"일주일 이내에 등록된 게시물에만 '신고' 할 수 있습니다.\"}");
|
||||
}
|
||||
|
||||
// 글쓴이 회원정보 (신고가 되는 상대 회원정보)
|
||||
$target = get_member($write['mb_id'], 'mb_id,mb_level,mb_jisu_rank');
|
||||
|
||||
if ($target['mb_level'] > $member['mb_level']) {
|
||||
die("{\"error\":\"자신보다 권한이 높은 회원의 게시물은 신고할 수 없습니다.\"}");
|
||||
}
|
||||
|
||||
if ($target['mb_jisu_rank'] <= $member['mb_jisu_rank']) {
|
||||
die("{\"error\":\"자신보다 활동지수 순위가 높거나 같은 회원의 게시물은 신고할 수 없습니다.\"}");
|
||||
}
|
||||
|
||||
/*
|
||||
// 회원가입후 몇일째인지? + 1 은 당일을 포함한다는 뜻
|
||||
$sql = " select (TO_DAYS('$g4[time_ymdhis]') - TO_DAYS('$target[mb_datetime]') + 1) as days ";
|
||||
$row = sql_fetch($sql);
|
||||
$mb_reg_after = $row[days];
|
||||
if ($mb_reg_after >= 365) {
|
||||
die("{\"error\":\"회원가입후 1년이 지난 회원님의 글은 신고할 수 없습니다.\"}");
|
||||
}
|
||||
*/
|
||||
|
||||
// '싫어요'도 하나 더 드세요.
|
||||
$sql = " insert into $g4[board_good_table] ( bo_table, wr_id, mb_id, bg_flag, bg_datetime, bg_ip, tar_mb_id ) values ( '$bo_table', '$wr_id', '$member[mb_id]', 'nogood', '$g4[time_ymdhis]', '$_SERVER[REMOTE_ADDR]', '$write[mb_id]' ) ";
|
||||
sql_query($sql);
|
||||
|
||||
// 신고 테이블에 레코드를 추가한다.
|
||||
$sql = " insert into `$g4[singo_table]` set bo_table = '$bo_table', wr_id = '$wr_id', wr_parent = '{$write['wr_parent']}', mb_id = '{$target['mb_id']}', sg_mb_id = '{$member['mb_id']}', sg_reason = '$reason', sg_datetime = '{$g4['time_ymdhis']}', sg_ip = '$_SERVER[REMOTE_ADDR]' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 신고가 되면 일정 시간이 지난후 부터 글쓰기가 가능함
|
||||
$time = date("Y-m-d H:i:s", $g4[server_time] + (3600 * 3));
|
||||
// 상대 회원의 글쓰기등을 금지하기 위하여 상대 회원의 신고수를 누적하고 신고 시간을 업데이트 한다.
|
||||
$sql = " UPDATE `{$g4['member_table']}` SET `mb_singo_count` = `mb_singo_count` + 1, `mb_singo_time` = '$time' WHERE `mb_id` = '{$target['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 게시글에 신고수를 누적한다.
|
||||
$sql = " update `$write_table` set `wr_singo` = `wr_singo` + 1 where `wr_id` = '$wr_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 게시글의 신고수를 얻는다.
|
||||
$sql = " select `wr_singo` as cnt from `$write_table` where `wr_id` = '$wr_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$message = "신고 하셨습니다.";
|
||||
|
||||
die("{\"error\":\"\", \"message\":\"$message\", \"count\":\"$row[cnt]\"}");
|
||||
?>
|
||||
134
shop/cat1.php
Normal file
@ -0,0 +1,134 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>jQuery UI Sortable - Default functionality</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
|
||||
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
|
||||
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
|
||||
<style>
|
||||
#category-1 { list-style-type: none; margin: 0; padding: 0; }
|
||||
#category-1 li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; border:1px dotted;}
|
||||
#category-1 li span { position: absolute; margin-left: -1.3em; }
|
||||
|
||||
#category-2 { list-style-type: none; margin: 0; padding: 0; }
|
||||
#category-2 li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; border:1px dotted;}
|
||||
#category-2 li span { position: absolute; margin-left: -1.3em; }
|
||||
|
||||
#category-3 { list-style-type: none; margin: 0; padding: 0; }
|
||||
#category-3 li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; border:1px dotted;}
|
||||
#category-3 li span { position: absolute; margin-left: -1.3em; }
|
||||
|
||||
#sortable4 { list-style-type: none; margin: 0; padding: 0; }
|
||||
#sortable4 li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; border:1px dotted;}
|
||||
#sortable4 li span { position: absolute; margin-left: -1.3em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<fieldset style="float:left;" id="fieldset-1">
|
||||
<legend>1단계</legend>
|
||||
<ul class="category" id="category-1"></ul>
|
||||
</fieldset>
|
||||
|
||||
<fieldset style="float:left;" id="fieldset-2">
|
||||
<legend>2단계</legend>
|
||||
<ul class="category" id="category-2"></ul>
|
||||
</fieldset>
|
||||
|
||||
<fieldset style="float:left;" id="fieldset-3">
|
||||
<legend>3단계</legend>
|
||||
<ul class="category" id="category-3"></ul>
|
||||
</fieldset>
|
||||
|
||||
<div style="clear:both;">
|
||||
<fieldset style="float:left;">
|
||||
<legend>등록/수정</legend>
|
||||
<input type="text" id="category_number" size="1" />단계 분류 선택중<br />
|
||||
분류명 : <input type="text" id="ca_name" />
|
||||
<button id="btn_add">추가</button>
|
||||
<button id="btn_upd">수정</button>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
var ca_number = -1; // 카테고리 셀렉트박스 번호
|
||||
function get_ca_number($elem) {
|
||||
return $elem.attr("id").split("-")[1];
|
||||
}
|
||||
|
||||
$("fieldset[id^=fieldset-]").click(function(){
|
||||
ca_number = get_ca_number($(this));
|
||||
$("#category_number").val(ca_number);
|
||||
});
|
||||
|
||||
$(".category").sortable();
|
||||
$(".category").disableSelection();
|
||||
//$( "#category-1" ).bind( "sortstop", function(event, ui) {
|
||||
$("#category-1").bind( "sortstop", function(event, ui) {
|
||||
|
||||
/*
|
||||
var childList = $(this).children();
|
||||
for(i=0;i<childList.length;i++){
|
||||
var child = childList[i];
|
||||
var orderBy = 4 - i;
|
||||
var id = $(child).attr( "id" );
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "서버프로그램주소",
|
||||
dataType : 'json',
|
||||
// 서버로 전송할 데이터
|
||||
data : {
|
||||
"id":id,
|
||||
"orderBy":orderBy
|
||||
},
|
||||
success : function(msg){
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
$("#btn_add").click(function(){
|
||||
if (ca_number == -1) {
|
||||
alert("추가하실 분류 단계를 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var $ca_name = $("#ca_name");
|
||||
var ca_name = $.trim($ca_name.val());
|
||||
if (ca_name == "") {
|
||||
alert("분류명을 입력하세요.");
|
||||
$ca_name.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var $current = $("#category-"+ca_number); // 현재 카테고리 셀렉트박스
|
||||
var ca_id = $current.children("option:selected").val();
|
||||
|
||||
$.ajax({
|
||||
url: "category.ajax.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
"ca_id": ca_id,
|
||||
"ca_name": ca_name,
|
||||
"ca_number": ca_number
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(data, textStatus) {
|
||||
if (data.error) {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
$current.append('<option value="'+data.ca_id+'" title="'+data.ca_id+'">'+data.ca_name+'</option>');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
93
shop/category.ajax.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
$ca_name = stripslashes($_POST['ca_name']);
|
||||
$ca_number = (int)$_POST['ca_number'];
|
||||
$start = 2 * $ca_number - 1;
|
||||
$end = 2 * $ca_number;
|
||||
|
||||
$sql = " SELECT MAX(SUBSTRING(ca_id,$start,$end)) AS ca_id FROM {$g4['yc4_category_table']} ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['ca_id']) {
|
||||
$ca_id = base_convert($row['ca_id'], 36, 10);
|
||||
$ca_id += 36;
|
||||
$ca_id = base_convert($ca_id, 10, 36);
|
||||
} else {
|
||||
$ca_id = "10";
|
||||
}
|
||||
|
||||
$sql = " INSERT INTO {$g4['yc4_category_table']} SET ca_id = '$ca_id', ca_name = '$ca_name' ";
|
||||
sql_query($sql);
|
||||
|
||||
die("{\"ca_id\":\"$ca_id\", \"ca_name\":\"$ca_name\"}");
|
||||
|
||||
exit;
|
||||
if ($is_guest) {
|
||||
die("{\"error\":\"회원님만 신고 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.\"}");
|
||||
}
|
||||
|
||||
$reason = get_text(strip_tags($_POST['reason']));
|
||||
|
||||
$sql = " select sg_reason from `$g4[singo_table]` where `bo_table` = '$bo_table' and `wr_id` = '$wr_id' and (`mb_id` = '$member[mb_id]' or `sg_ip` = '{$_SERVER['REMOTE_ADDR']}') ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row) {
|
||||
//die("{\"error\":\"이미 (".get_text(strip_tags($row[sg_reason])).") 사유로 '신고' 하셨습니다.\"}");
|
||||
die("{\"error\":\"이미 이 게시물을 '신고' 하셨습니다.\"}");
|
||||
}
|
||||
|
||||
if ($write['mb_id'] && $write['mb_id'] == $member['mb_id']) {
|
||||
die("{\"error\":\"자신의 게시물은 '신고' 할 수 없습니다.\"}");
|
||||
}
|
||||
|
||||
$gap = gap_days($write['wr_datetime']);
|
||||
if ($gap > 7) {
|
||||
die("{\"error\":\"일주일 이내에 등록된 게시물에만 '신고' 할 수 있습니다.\"}");
|
||||
}
|
||||
|
||||
// 글쓴이 회원정보 (신고가 되는 상대 회원정보)
|
||||
$target = get_member($write['mb_id'], 'mb_id,mb_level,mb_jisu_rank');
|
||||
|
||||
if ($target['mb_level'] > $member['mb_level']) {
|
||||
die("{\"error\":\"자신보다 권한이 높은 회원의 게시물은 신고할 수 없습니다.\"}");
|
||||
}
|
||||
|
||||
if ($target['mb_jisu_rank'] <= $member['mb_jisu_rank']) {
|
||||
die("{\"error\":\"자신보다 활동지수 순위가 높거나 같은 회원의 게시물은 신고할 수 없습니다.\"}");
|
||||
}
|
||||
|
||||
/*
|
||||
// 회원가입후 몇일째인지? + 1 은 당일을 포함한다는 뜻
|
||||
$sql = " select (TO_DAYS('$g4[time_ymdhis]') - TO_DAYS('$target[mb_datetime]') + 1) as days ";
|
||||
$row = sql_fetch($sql);
|
||||
$mb_reg_after = $row[days];
|
||||
if ($mb_reg_after >= 365) {
|
||||
die("{\"error\":\"회원가입후 1년이 지난 회원님의 글은 신고할 수 없습니다.\"}");
|
||||
}
|
||||
*/
|
||||
|
||||
// '싫어요'도 하나 더 드세요.
|
||||
$sql = " insert into $g4[board_good_table] ( bo_table, wr_id, mb_id, bg_flag, bg_datetime, bg_ip, tar_mb_id ) values ( '$bo_table', '$wr_id', '$member[mb_id]', 'nogood', '$g4[time_ymdhis]', '$_SERVER[REMOTE_ADDR]', '$write[mb_id]' ) ";
|
||||
sql_query($sql);
|
||||
|
||||
// 신고 테이블에 레코드를 추가한다.
|
||||
$sql = " insert into `$g4[singo_table]` set bo_table = '$bo_table', wr_id = '$wr_id', wr_parent = '{$write['wr_parent']}', mb_id = '{$target['mb_id']}', sg_mb_id = '{$member['mb_id']}', sg_reason = '$reason', sg_datetime = '{$g4['time_ymdhis']}', sg_ip = '$_SERVER[REMOTE_ADDR]' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 신고가 되면 일정 시간이 지난후 부터 글쓰기가 가능함
|
||||
$time = date("Y-m-d H:i:s", $g4[server_time] + (3600 * 3));
|
||||
// 상대 회원의 글쓰기등을 금지하기 위하여 상대 회원의 신고수를 누적하고 신고 시간을 업데이트 한다.
|
||||
$sql = " UPDATE `{$g4['member_table']}` SET `mb_singo_count` = `mb_singo_count` + 1, `mb_singo_time` = '$time' WHERE `mb_id` = '{$target['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 게시글에 신고수를 누적한다.
|
||||
$sql = " update `$write_table` set `wr_singo` = `wr_singo` + 1 where `wr_id` = '$wr_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 게시글의 신고수를 얻는다.
|
||||
$sql = " select `wr_singo` as cnt from `$write_table` where `wr_id` = '$wr_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$message = "신고 하셨습니다.";
|
||||
|
||||
die("{\"error\":\"\", \"message\":\"$message\", \"count\":\"$row[cnt]\"}");
|
||||
?>
|
||||
88
shop/category.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
$g4['title'] = "카테고리";
|
||||
include_once("{$g4['path']}/head.sub.php");
|
||||
|
||||
for ($i=1; $i<=5; $i++) {
|
||||
echo '<select id="category-'.$i.'" class="category" size="20" style="width:180px;">';
|
||||
if ($i == 1) {
|
||||
$sql = " select ca_id, ca_name from $g4[yc4_category_table] where length(ca_id) = 2 order by ca_order, ca_id ";
|
||||
$result = sql_query($sql);
|
||||
while ($row=sql_fetch_array($result)) {
|
||||
echo '<option value="'.$row['ca_id'].'" title="'.$row['ca_id'].'">'.$row['ca_name'].'</option>'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
echo '</select>'.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
|
||||
<div>
|
||||
<input type="text" id="category_number" size="1" />단계 분류 선택중<br />
|
||||
분류명 : <input type="text" id="ca_name" />
|
||||
<button id="btn_add">추가</button>
|
||||
<button id="btn_upd">수정</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var ca_number = -1; // 카테고리 셀렉트박스 번호
|
||||
function get_ca_number($elem) {
|
||||
return $elem.attr("id").split("-")[1];
|
||||
}
|
||||
|
||||
//$("select.category").focus(function(e){
|
||||
$("select.category").click(function(){
|
||||
ca_number = get_ca_number($(this));
|
||||
$("#category_number").val(ca_number);
|
||||
});
|
||||
|
||||
$("select.category option").click(function(e){
|
||||
ca_number = get_ca_number($(this).parent("select"));
|
||||
if (ca_number < 5) {
|
||||
alert(ca_number);
|
||||
}
|
||||
});
|
||||
|
||||
$("#btn_add").click(function(){
|
||||
if (ca_number == -1) {
|
||||
alert("추가하실 분류 단계를 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var $ca_name = $("#ca_name");
|
||||
var ca_name = $.trim($ca_name.val());
|
||||
if (ca_name == "") {
|
||||
alert("분류명을 입력하세요.");
|
||||
$ca_name.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var $current = $("#category-"+ca_number); // 현재 카테고리 셀렉트박스
|
||||
var ca_id = $current.children("option:selected").val();
|
||||
|
||||
$.ajax({
|
||||
url: "category.ajax.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
"ca_id": ca_id,
|
||||
"ca_name": ca_name,
|
||||
"ca_number": ca_number
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(data, textStatus) {
|
||||
if (data.error) {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
$current.append('<option value="'+data.ca_id+'" title="'+data.ca_id+'">'+data.ca_name+'</option>');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?
|
||||
include_once("{$g4['path']}/tail.sub.php");
|
||||
?>
|
||||
48
shop/community.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
include_once("$g4[path]/lib/latest.lib.php");
|
||||
|
||||
$list_mod = 2; // 한라인에 몇개씩 출력할것인지?
|
||||
$list_row = 3; // 한게시판당 몇행씩 출력할것인지?
|
||||
$subject_len = 70; // 제목의 길이는?
|
||||
|
||||
$g4[title] = "커뮤니티";
|
||||
include_once("./_head.php");
|
||||
?>
|
||||
|
||||
<table width=100% cellpadding=0 cellspacing=0 border=0>
|
||||
<tr>
|
||||
<?
|
||||
// 최신글 시작
|
||||
$sql = " select bo_table, bo_subject from $g4[board_table] order by gr_id, bo_table ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
|
||||
// tr 바꾸기
|
||||
if (($i > 0) && ($i % $list_mod == 0))
|
||||
echo "</tr><tr>";
|
||||
|
||||
echo "
|
||||
<td width=50% valign=top>
|
||||
<table width=98% cellpadding=0 cellspacing=0 align=center>
|
||||
<tr>
|
||||
<td colspan=2>";
|
||||
|
||||
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
|
||||
// 사용방법
|
||||
// latest(스킨, 게시판아이디, 출력라인, 글자수);
|
||||
// 스킨은 입력하지 않을 경우 운영자 > 환경설정의 최신글 스킨경로를 기본 스킨으로 합니다.
|
||||
echo latest("", $row[bo_table], $list_row, $subject_len);
|
||||
|
||||
echo "</td></tr></table><br></td>";
|
||||
}
|
||||
|
||||
if ($i > 0 && ($i % $list_mod == 1))
|
||||
echo "<td width=50% valign=top> </td>";
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?
|
||||
include_once("./_tail.php");
|
||||
?>
|
||||
72
shop/content.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
// 내용
|
||||
$sql = " select * from $g4[yc4_content_table] where co_id = '$co_id' ";
|
||||
$co = sql_fetch($sql);
|
||||
if (!$co[co_id])
|
||||
alert("등록된 내용이 없습니다.");
|
||||
|
||||
$g4[title] = $co[co_subject];
|
||||
//include_once("./_head.php");
|
||||
|
||||
if ($co[co_include_head])
|
||||
@include_once($co[co_include_head]);
|
||||
else
|
||||
include_once("./_head.php");
|
||||
|
||||
$himg = "$g4[path]/data/content/{$co_id}_h";
|
||||
if (file_exists($himg))
|
||||
echo "<img src='$himg' border=0><br>";
|
||||
|
||||
if ($is_admin)
|
||||
echo "<p align=center><a href='./$g4[shop_admin_path]/contentform.php?w=u&co_id=$co_id'><img src='$g4[shop_img_path]/btn_admin_modify.gif' border=0></a></p>";
|
||||
|
||||
$str = conv_content($co[co_content], $co[co_html]);
|
||||
|
||||
// $src 를 $dst 로 변환
|
||||
unset($src);
|
||||
unset($dst);
|
||||
$src[] = "/{{쇼핑몰명}}|{{홈페이지제목}}/";
|
||||
//$dst[] = $default[de_subject];
|
||||
$dst[] = $config[cf_title];
|
||||
$src[] = "/{{회사명}}|{{상호}}/";
|
||||
$dst[] = $default[de_admin_company_name];
|
||||
$src[] = "/{{대표자명}}/";
|
||||
$dst[] = $default[de_admin_company_owner];
|
||||
$src[] = "/{{사업자등록번호}}/";
|
||||
$dst[] = $default[de_admin_company_saupja_no];
|
||||
$src[] = "/{{대표전화번호}}/";
|
||||
$dst[] = $default[de_admin_company_tel];
|
||||
$src[] = "/{{팩스번호}}/";
|
||||
$dst[] = $default[de_admin_company_fax];
|
||||
$src[] = "/{{통신판매업신고번호}}/";
|
||||
$dst[] = $default[de_admin_company_tongsin_no];
|
||||
$src[] = "/{{사업장우편번호}}/";
|
||||
$dst[] = $default[de_admin_company_zip];
|
||||
$src[] = "/{{사업장주소}}/";
|
||||
$dst[] = $default[de_admin_company_addr];
|
||||
$src[] = "/{{운영자명}}|{{관리자명}}/";
|
||||
$dst[] = $default[de_admin_name];
|
||||
$src[] = "/{{운영자e-mail}}|{{관리자e-mail}}/i";
|
||||
$dst[] = $default[de_admin_email];
|
||||
$src[] = "/{{정보관리책임자명}}/";
|
||||
$dst[] = $default[de_admin_info_name];
|
||||
$src[] = "/{{정보관리책임자e-mail}}|{{정보책임자e-mail}}/i";
|
||||
$dst[] = $default[de_admin_info_email];
|
||||
|
||||
$str = preg_replace($src, $dst, $str);
|
||||
|
||||
echo $str;
|
||||
|
||||
$timg = "$g4[path]/data/content/{$co_id}_t";
|
||||
if (file_exists($timg))
|
||||
echo "<br><img src='$timg' border=0><br>";
|
||||
|
||||
if ($co[co_include_tail])
|
||||
@include_once($co[co_include_tail]);
|
||||
else
|
||||
include_once("./_tail.php");
|
||||
|
||||
//include_once("./_tail.php");
|
||||
?>
|
||||
129
shop/event.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
$sql = " select * from $g4[yc4_event_table]
|
||||
where ev_id = '$ev_id'
|
||||
and ev_use = 1 ";
|
||||
$ev = sql_fetch($sql);
|
||||
if (!$ev[ev_id])
|
||||
alert("등록된 이벤트가 없습니다.");
|
||||
|
||||
$g4[title] = $ev[ev_subject];
|
||||
include_once("./_head.php");
|
||||
|
||||
$himg = "$g4[path]/data/event/{$ev_id}_h";
|
||||
if (file_exists($himg))
|
||||
echo "<img src='$himg' border=0><br>";
|
||||
|
||||
if ($is_admin)
|
||||
echo "<p align=center><a href='$g4[shop_admin_path]/itemeventform.php?w=u&ev_id=$ev[ev_id]'><img src='$g4[shop_img_path]/btn_admin_modify.gif' border=0></a></p>";
|
||||
|
||||
// 상단 HTML
|
||||
echo stripslashes($ev[ev_head_html]);
|
||||
?>
|
||||
|
||||
<table width=100% cellpadding=0 cellspacing=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<?
|
||||
// 상품 출력순서가 있다면
|
||||
if ($sort != "")
|
||||
$order_by = $sort . " , ";
|
||||
|
||||
// 상품 (하위 분류의 상품을 모두 포함한다.)
|
||||
// 1.02.00
|
||||
// a.it_order 추가
|
||||
/*
|
||||
$sql_list1 = " select a.ca_id,
|
||||
a.it_id,
|
||||
a.it_name,
|
||||
a.it_maker,
|
||||
a.it_point,
|
||||
a.it_amount,
|
||||
a.it_stock_qty,
|
||||
a.it_cust_amount,
|
||||
a.it_amount,
|
||||
a.it_amount2,
|
||||
a.it_amount3,
|
||||
it_basic,
|
||||
it_opt1,
|
||||
it_opt2,
|
||||
it_opt3,
|
||||
it_opt4,
|
||||
it_opt5,
|
||||
it_opt6,
|
||||
a.it_type1,
|
||||
a.it_type2,
|
||||
a.it_type3,
|
||||
a.it_type4,
|
||||
a.it_type5 ";
|
||||
*/
|
||||
$sql_list1 = " select * ";
|
||||
$sql_list2 = " order by $order_by a.it_order, a.it_id desc ";
|
||||
|
||||
$sql_common = " from $g4[yc4_item_table] a
|
||||
left join $g4[yc4_event_item_table] b on (a.it_id=b.it_id)
|
||||
where b.ev_id = '$ev_id'
|
||||
and a.it_use = '1' ";
|
||||
|
||||
$error = "<img src='$g4[shop_img_path]/no_item.gif' border=0>";
|
||||
|
||||
if ($skin)
|
||||
$ev[ev_skin] = $skin;
|
||||
|
||||
$td_width = (int)($mod / 100);
|
||||
|
||||
// 리스트 유형별로 출력
|
||||
$list_file = "$g4[shop_path]/$ev[ev_skin]";
|
||||
if (file_exists($list_file))
|
||||
{
|
||||
$list_mod = $ev[ev_list_mod];
|
||||
$list_row = $ev[ev_list_row];
|
||||
$img_width = $ev[ev_img_width];
|
||||
$img_height = $ev[ev_img_height];
|
||||
|
||||
include "$g4[shop_path]/list.sub.php";
|
||||
include "$g4[shop_path]/list.sort.php";
|
||||
|
||||
$sql = $sql_list1 . $sql_common . $sql_list2 . " limit $from_record, $items ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
include $list_file;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$i = 0;
|
||||
$error = "<p>$ev[ev_skin] 파일을 찾을 수 없습니다.<p>관리자에게 알려주시면 감사하겠습니다.";
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
{
|
||||
echo "<br>";
|
||||
echo "<div align=center>$error</div>";
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<div align=center>
|
||||
<?
|
||||
$qstr .= "ca_id=$ca_id&skin=$skin&ev_id=$ev_id&sort=$sort";
|
||||
echo get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");
|
||||
?>
|
||||
</div><br>
|
||||
|
||||
<?
|
||||
// 하단 HTML
|
||||
echo stripslashes($ev[ev_tail_html]);
|
||||
|
||||
$timg = "$g4[path]/data/event/{$ev_id}_t";
|
||||
if (file_exists($timg))
|
||||
echo "<br><img src='$timg' border=0><br>";
|
||||
|
||||
include_once("./_tail.php");
|
||||
?>
|
||||
71
shop/faq.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?
|
||||
include_once("./_common.php");
|
||||
|
||||
if (!$fm_id) $fm_id = 1;
|
||||
|
||||
// FAQ MASTER
|
||||
$sql = " select * from $g4[yc4_faq_master_table] where fm_id = '$fm_id' ";
|
||||
$fm = sql_fetch($sql);
|
||||
if (!$fm[fm_id])
|
||||
alert("등록된 내용이 없습니다.");
|
||||
|
||||
$g4[title] = $fm[fm_subject];
|
||||
include_once("./_head.php");
|
||||
?>
|
||||
|
||||
<img src="<?=$g4[shop_img_path]?>/top_faq.gif" border=0><p>
|
||||
|
||||
<?
|
||||
$himg = "$g4[path]/data/faq/{$fm_id}_h";
|
||||
if (file_exists($himg))
|
||||
echo "<img src='$himg' border=0><br>";
|
||||
|
||||
if ($is_admin)
|
||||
echo "<p align=center><a href='$g4[shop_admin_path]/faqmasterform.php?w=u&fm_id=$fm_id'><img src='$g4[shop_img_path]/btn_admin_modify.gif' border=0></a></p>";
|
||||
|
||||
// 상단 HTML
|
||||
echo stripslashes($fm[fm_head_html]);
|
||||
echo "<br>";
|
||||
|
||||
echo "<table width=95% align=center cellpadding=1 cellspacing=0>\n";
|
||||
echo "<tr><td class=bg_faq><table width=100% cellpadding=2 cellspacing=1 border=0 bgcolor=#FFFFFF>\n";
|
||||
|
||||
$sql = " select * from $g4[yc4_faq_table]
|
||||
where fm_id = '$fm_id'
|
||||
order by fa_order , fa_id ";
|
||||
$result = sql_query($sql);
|
||||
$str = "";
|
||||
for ($i=1; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td width=20 align=right valign=top>$i.</td>";
|
||||
echo "<td valign=top><a href='#faq_{$fm_id}_{$i}' class=faq>" . stripslashes($row[fa_subject]) . "</a></td>";
|
||||
echo "</tr>\n";
|
||||
|
||||
$str .= "<a name='faq_{$fm_id}_{$i}'><br></a><table cellpadding=2 cellspacing=1 width=100%>";
|
||||
$str .= "<tr>";
|
||||
$str .= "<td width=38 valign=top align=right><img src='$g4[shop_img_path]/icon_poll_q.gif'></td>";
|
||||
$str .= "<td class=point valign=top>" . stripslashes($row[fa_subject]) . "</td>";
|
||||
$str .= "</tr>";
|
||||
$str .= "<tr>";
|
||||
$str .= "<td valign=top align=right><img src='$g4[shop_img_path]/icon_answer.gif'></td>";
|
||||
$str .= "<td class=leading valign=top>" . stripslashes($row[fa_content]) . "</td>";
|
||||
$str .= "</tr>";
|
||||
$str .= "<tr>";
|
||||
$str .= "<td colspan=2 align=right><a href='#g4_head'><img src='$g4[shop_img_path]/icon_top.gif' border=0></a></td>";
|
||||
$str .= "</tr>";
|
||||
$str .= "</table>";
|
||||
}
|
||||
echo "</table></td></tr></table>\n";
|
||||
|
||||
echo $str;
|
||||
|
||||
echo "<br>";
|
||||
echo stripslashes($fm[fm_tail_html]);
|
||||
|
||||
$timg = "$g4[path]/data/faq/{$fm_id}_t";
|
||||
if (file_exists($timg))
|
||||
echo "<br><img src='$timg' border=0><br>";
|
||||
|
||||
include_once("./_tail.php");
|
||||
?>
|
||||
BIN
shop/img/bar0.gif
Normal file
|
After Width: | Height: | Size: 35 B |
BIN
shop/img/bar_auction.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
shop/img/bar_cart.gif
Normal file
|
After Width: | Height: | Size: 354 B |
BIN
shop/img/bar_category.gif
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
shop/img/bar_community.gif
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
shop/img/bar_count.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
shop/img/bar_event.gif
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
shop/img/bar_gong9.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
shop/img/bar_notice.gif
Normal file
|
After Width: | Height: | Size: 277 B |
BIN
shop/img/bar_search.gif
Normal file
|
After Width: | Height: | Size: 181 B |
BIN
shop/img/bar_type1.gif
Normal file
|
After Width: | Height: | Size: 702 B |
BIN
shop/img/bar_type2.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
shop/img/bar_type3.gif
Normal file
|
After Width: | Height: | Size: 960 B |
BIN
shop/img/bar_type4.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
shop/img/bar_type5.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
shop/img/bar_wishlist.gif
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
shop/img/bg_item.gif
Normal file
|
After Width: | Height: | Size: 53 B |
BIN
shop/img/box_bg01.gif
Normal file
|
After Width: | Height: | Size: 46 B |
BIN
shop/img/box_bg02.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/box_bg03.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/box_bg04.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/btn2_cart.gif
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
shop/img/btn2_now_buy.gif
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
shop/img/btn2_wish.gif
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
shop/img/btn_admin.gif
Normal file
|
After Width: | Height: | Size: 111 B |
BIN
shop/img/btn_admin_modify.gif
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
shop/img/btn_ag1.gif
Normal file
|
After Width: | Height: | Size: 161 B |
BIN
shop/img/btn_ag2.gif
Normal file
|
After Width: | Height: | Size: 143 B |
BIN
shop/img/btn_ag3.gif
Normal file
|
After Width: | Height: | Size: 158 B |
BIN
shop/img/btn_ag4.gif
Normal file
|
After Width: | Height: | Size: 161 B |
BIN
shop/img/btn_ag5.gif
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
shop/img/btn_back1.gif
Normal file
|
After Width: | Height: | Size: 183 B |
BIN
shop/img/btn_buy.gif
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
shop/img/btn_card.gif
Normal file
|
After Width: | Height: | Size: 250 B |
BIN
shop/img/btn_cart_in.gif
Normal file
|
After Width: | Height: | Size: 273 B |
BIN
shop/img/btn_cart_out.gif
Normal file
|
After Width: | Height: | Size: 224 B |
BIN
shop/img/btn_cart_quan.gif
Normal file
|
After Width: | Height: | Size: 218 B |
BIN
shop/img/btn_close.gif
Normal file
|
After Width: | Height: | Size: 200 B |
BIN
shop/img/btn_confirm.gif
Normal file
|
After Width: | Height: | Size: 182 B |
BIN
shop/img/btn_del.gif
Normal file
|
After Width: | Height: | Size: 118 B |
BIN
shop/img/btn_iche.gif
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
shop/img/btn_item_ps.gif
Normal file
|
After Width: | Height: | Size: 546 B |
BIN
shop/img/btn_item_recommend.gif
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
shop/img/btn_next2.gif
Normal file
|
After Width: | Height: | Size: 169 B |
BIN
shop/img/btn_order.gif
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
shop/img/btn_order_end.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
shop/img/btn_print.gif
Normal file
|
After Width: | Height: | Size: 332 B |
BIN
shop/img/btn_qa.gif
Normal file
|
After Width: | Height: | Size: 215 B |
BIN
shop/img/btn_settle.gif
Normal file
|
After Width: | Height: | Size: 213 B |
BIN
shop/img/btn_shopping.gif
Normal file
|
After Width: | Height: | Size: 275 B |
BIN
shop/img/btn_story.gif
Normal file
|
After Width: | Height: | Size: 216 B |
BIN
shop/img/btn_tab01.gif
Normal file
|
After Width: | Height: | Size: 869 B |
BIN
shop/img/btn_tab02.gif
Normal file
|
After Width: | Height: | Size: 873 B |
BIN
shop/img/btn_tab03.gif
Normal file
|
After Width: | Height: | Size: 875 B |
BIN
shop/img/btn_tab04.gif
Normal file
|
After Width: | Height: | Size: 881 B |
BIN
shop/img/btn_tab05.gif
Normal file
|
After Width: | Height: | Size: 884 B |
BIN
shop/img/btn_tab06.gif
Normal file
|
After Width: | Height: | Size: 875 B |
BIN
shop/img/btn_wish2.gif
Normal file
|
After Width: | Height: | Size: 560 B |
BIN
shop/img/btn_zip_find.gif
Normal file
|
After Width: | Height: | Size: 165 B |
BIN
shop/img/btn_zoom.gif
Normal file
|
After Width: | Height: | Size: 705 B |
BIN
shop/img/btn_zoom2.gif
Normal file
|
After Width: | Height: | Size: 115 B |
BIN
shop/img/ca_bg01.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/ca_bg02.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/ca_bg03.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/ca_bg04.gif
Normal file
|
After Width: | Height: | Size: 44 B |
BIN
shop/img/ca_box01.gif
Normal file
|
After Width: | Height: | Size: 175 B |
BIN
shop/img/ca_box02.gif
Normal file
|
After Width: | Height: | Size: 171 B |
BIN
shop/img/ca_box03.gif
Normal file
|
After Width: | Height: | Size: 170 B |
BIN
shop/img/ca_box04.gif
Normal file
|
After Width: | Height: | Size: 169 B |
BIN
shop/img/corner01.gif
Normal file
|
After Width: | Height: | Size: 208 B |
BIN
shop/img/corner02.gif
Normal file
|
After Width: | Height: | Size: 196 B |
BIN
shop/img/corner03.gif
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
shop/img/corner04.gif
Normal file
|
After Width: | Height: | Size: 173 B |
BIN
shop/img/dot.gif
Normal file
|
After Width: | Height: | Size: 35 B |
BIN
shop/img/dot_line.gif
Normal file
|
After Width: | Height: | Size: 63 B |