[쇼핑몰] ems 무게별 배송비 추가하기
페이지 정보
본문
adm/zenaplus/zn.upgrade.php
**********
//090426 shop add
sql_query(" ALTER TABLE `{$g4['yc4_default_table']}` ADD `de_send_emscost_case` varchar(255) collate utf8_general_ci NOT NULL after `de_send_cost_list` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_default_table']}` ADD `de_send_emscost_limit` varchar(255) collate utf8_general_ci NOT NULL after `de_send_emscost_case` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_default_table']}` ADD `de_send_emscost_list` varchar(255) collate utf8_general_ci NOT NULL after `de_send_emscost_limit` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_item_table']}` ADD `it_emskg` varchar(255) collate utf8_general_ci NOT NULL after `it_use` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_cart_table']}` ADD `ct_send_emscost` varchar(255) collate utf8_general_ci NOT NULL after `ct_send_cost` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_cart_table']}` ADD `ct_emskg` varchar(255) collate utf8_general_ci NOT NULL after `ct_amount` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_order_table']}` ADD `od_send_emscost` int(11) default 0 NOT NULL after `od_send_cost` ", FALSE);
sql_query(" ALTER TABLE `{$g4['yc4_order_table']}` ADD `od_settle_emsamount` varchar(255) default 0 NOT NULL after `od_send_emscost` ", FALSE);
/shop.config.php
**********
//------------------------------------------------------------------------------
// 쇼핑몰 상수 모음 시작
//------------------------------------------------------------------------------
// 미수금에 대한 QUERY 문
// 테이블 a 는 주문서 ($g4[yc4_order_table])
// 테이블 b 는 장바구니 ($g4[yc4_cart_table])
define(_MISU_QUERY_, "
count(distinct a.od_id) as ordercount, /* 주문서건수 */
count(b.ct_id) as itemcount, /* 상품건수 */
(SUM(b.ct_amount * b.ct_qty) + a.od_send_cost + a.od_send_emscost) as orderamount , /* 주문합계 */
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', b.ct_amount * b.ct_qty, 0))) as ordercancel, /* 주문취소 */
(a.od_receipt_bank + a.od_receipt_card + a.od_receipt_point) as receiptamount, /* 입금합계 */
(a.od_refund_amount + a.od_cancel_card) as receiptcancel, /* 입금취소 */
(
(SUM(b.ct_amount * b.ct_qty) + a.od_send_cost + a.od_send_emscost) -
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', b.ct_amount * b.ct_qty, 0))) -
a.od_dc_amount -
(a.od_receipt_bank + a.od_receipt_card + a.od_receipt_point) +
(a.od_refund_amount + a.od_cancel_card)
) as misu /* 미수금 = 주문합계 - 주문취소 - DC - 입금합계 + 입금취소 */");
//------------------------------------------------------------------------------
// 쇼핑몰 상수 모음 끝
//------------------------------------------------------------------------------
adm/shop_admin/configform.php
**********
<tr>
<td>교환/반품</td>
<td colspan=3><br /><?=cheditor2('de_change_content', $default[de_change_content]);?></td>
</tr>
<tr><td colspan=4 height=1 bgcolor=#CCCCCC></td></tr>
</table>
<p>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width=50%><?=subtitle("EMS배송정보")?></td>
<td width=50% align=right><span class=small><a href='#사업자정보'>사업자정보</a> | <a href='#초기화면'>초기화면</a> | <a href='#결제정보'>결제정보</a> | <a href='#배송정보'>배송정보</a> | <a href='#기타정보'>기타정보</a> | <a href='#SMS정보'>SMS정보</a></span></td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 width=100%>
<colgroup width=15%></colgroup>
<colgroup width=85% bgcolor=#FFFFFF></colgroup>
<tr><td colspan=4 height=2 bgcolor=#0E87F9></td></tr>
<tr class=ht>
<td>EMS배송비유형</td>
<td colspan=3>
<select id=de_send_emscost_case name=de_send_emscost_case>
<option value="상한">상한
<option value="없음">없음
</select>
<script>document.getElementById('de_send_emscost_case').value="<?=$default[de_send_emscost_case]?>";</script>
<?=help("'상한'으로 설정한 경우는 주문총액이 배송비상한가 미만일 경우 배송비를 받습니다.\n\n'없음'으로 설정한 경우에는 배송비상한가, 배송비를 무시하며 착불의 경우도 없음으로 설정하여 사용합니다.", 50);?>
</td>
</tr>
<tr class=ht>
<td>EMS배송비상한무게</td>
<td colspan=3>
<input type=text name=de_send_emscost_limit value='<?=$default[de_send_emscost_limit]?>' size=120 class=ed> g
<?=help("EMS배송비유형이 '상한'일 경우에만 해당되며 EMS배송비상한가를 여러개 두고자 하는 경우는 <b>;</b> 로 구분합니다.\n\n예를 들어 20000원 미만일 경우 4000원, 30000원 미만일 경우 3000원 으로 사용할 경우에는 배송비상한가를 20000;30000 으로 입력하고 배송비를 4000;3000 으로 입력합니다.", 50);?>
</td>
</tr>
<tr class=ht>
<td>EMS배송비</td>
<td colspan=3>
<input type=text name=de_send_emscost_list value='<?=$default[de_send_emscost_list]?>' size=120 class=ed> 엔
</td>
</tr>
<tr><td colspan=6 height=1 bgcolor=#CCCCCC></td></tr>
</table>
<a name="기타정보"></a>
adm/shop_admin/configformupdate.php
**********
de_send_cost_list = '$de_send_cost_list',
de_send_emscost_case = '$de_send_emscost_case',
de_send_emscost_limit = '$de_send_emscost_limit',
de_send_emscost_list = '$de_send_emscost_list',
de_hope_date_use = '$de_hope_date_use',
adm/shop_admin/itemform.php
**********
<tr class=ht>
<td>EMS중량(g)</td>
<td colspan=3>
<input type=text class=ed name=it_emskg required size=10 value='<?=get_text($it[it_emskg])?>'>
</td>
</tr>
<tr class=ht>
<td>기본설명</td>
<td colspan=3>
<input type=text class=ed name=it_basic style='width:97%;' value='<?=get_text($it[it_basic])?>'>
<?=help("상품상세페이지의 상품설명 상단에 표시되는 설명입니다.\nHTML 입력도 가능합니다.", -150, -100);?>
</td>
</tr>
adm/shop_admin/itemformupdate.php
**********
it_use = '$it_use',
it_emskg = '$it_emskg',
it_stock_qty = '$it_stock_qty',
adm/shop_admin/orderform.main.php
<tr class=ht>
<td>주문자 배송비</td>
<!-- <td><? echo number_format($od[od_send_cost]) ?>엔</td> -->
<td><input type=text name='od_send_cost' value='<?=$od[od_send_cost]?>' class=ed size=10 style='text-align:right;'>엔
<?=help("주문취소시 배송비는 취소되지 않으므로 이 배송비를 0으로 설정하여 미수금을 맞추십시오.");?></td>
</tr>
<tr class=ht>
<td>주문자 EMS배송비</td>
<!-- <td><? echo number_format($od[od_send_cost]) ?>엔</td> -->
<td><input type=text name='od_send_emscost' value='<?=$od[od_send_emscost]?>' class=ed size=10 style='text-align:right;'>엔
<?=help("주문취소시 배송비는 취소되지 않으므로 이 배송비를 0으로 설정하여 미수금을 맞추십시오.");?></td>
</tr>
adm/shop_admin/orderreceiptupdate.php
if (isset($od_send_cost))
$sql .= " , od_send_cost = '$od_send_cost' ";
if (isset($od_send_emscost))
$sql .= " , od_send_emscost = '$od_send_emscost' ";
$sql .= " where od_id = '$od_id' ";
sql_query($sql);
shop/cartsub.inc.php
a.it_opt6,
a.ct_amount,
a.ct_emskg,
a.ct_point,
$point = $row[ct_point] * $row[ct_qty];
$sell_amount = $row[ct_amount] * $row[ct_qty];
$sell_emskg = $row[ct_emskg] * $row[ct_qty];
$tot_point += $point;
$tot_sell_amount += $sell_amount;
$tot_sell_emskg += $sell_emskg;
// 배송비가 0 보다 크다면 (있다면)
if ($send_cost > 0)
{
echo "<tr><td colspan='$colspan' height=1 bgcolor=#E7E9E9></td></tr>";
echo "<tr>";
echo "<td height=28 colspan=4 align=right>배송비 : </td>";
echo "<td align=right>" . number_format($send_cost) . "</td>";
echo "<td> </td>";
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php")
echo "<td> </td>";
echo " </tr> ";
}
// ems배송비가 넘어왔다면
if ($_POST[od_send_emscost]) {
$send_emscost = (int)$_POST[od_send_emscost];
} else {
// 배송비 계산
if ($default[de_send_emscost_case] == "없음")
$send_emscost = 0;
else {
// 배송비 상한 : 여러단계의 배송비 적용 가능
$send_emscost_limit = explode(";", $default[de_send_emscost_limit]);
$send_emscost_list = explode(";", $default[de_send_emscost_list]);
$send_emscost = 0;
for ($k=0; $k<count($send_emscost_limit); $k++) {
// 총판매금액이 배송비 상한가 보다 작다면
if ($tot_sell_emskg < $send_emscost_limit[$k]) {
$send_emscost = $send_emscost_list[$k];
break;
}
}
}
// 이미 주문된 내역을 보여주는것이므로 배송비를 주문서에서 얻는다.
$sql = "select od_send_emscost from $g4[yc4_order_table] where od_id = '$od_id' ";
$row = sql_fetch($sql);
if ($row[od_send_emscost] > 0)
$send_emscost = $row[od_send_emscost];
}
if ($send_emscost > 0)
{
echo "<tr><td colspan='$colspan' height=1 bgcolor=#E7E9E9></td></tr>";
echo "<tr>";
echo "<td height=28 colspan=4 align=right>EMS배송비 : </td>";
echo "<td align=right>" . number_format($send_emscost) . "</td>";
echo "<td> </td>";
if ($s_page == "cart.php" || $s_page == "orderinquiryview.php")
echo "<td> </td>";
echo " </tr> ";
}
shop/cartupdate.php
ct_status = '쇼핑',
ct_amount = '{$_POST[it_amount][$i]}',
ct_emskg = '{$_POST[it_emskg][$i]}',
ct_point = '{$_POST[it_point][$i]}',
// 장바구니에 Insert
$sql = " insert $g4[yc4_cart_table]
set on_uid = '$tmp_on_uid',
it_id = '$_POST[it_id]',
it_opt1 = '$_POST[it_opt1]',
it_opt2 = '$_POST[it_opt2]',
it_opt3 = '$_POST[it_opt3]',
it_opt4 = '$_POST[it_opt4]',
it_opt5 = '$_POST[it_opt5]',
it_opt6 = '$_POST[it_opt6]',
ct_status = '쇼핑',
ct_amount = '$_POST[it_amount]',
ct_emskg = '$_POST[it_emskg]',
ct_point = '$_POST[it_point]',
ct_point_use = '0',
ct_stock_use = '0',
ct_qty = '$_POST[ct_qty]',
ct_time = '$g4[time_ymdhis]',
ct_ip = '$REMOTE_ADDR' ";
shop/item.php
<table width=100% cellpadding=0 cellspacing=0>
<form name=fitem method=post action="./cartupdate.php">
<input type=hidden name=it_id value='<?=$it[it_id]?>'>
<input type=hidden name=it_name value='<?=$it[it_name]?>'>
<input type=hidden name=it_emskg value='<?=$it[it_emskg]?>'>
<input type=hidden name=sw_direct>
<input type=hidden name=url>
shop/orderform.php
<form name=forderform method=post action="./orderreceipt.php" onsubmit="return forderform_check(this);" autocomplete=off>
<input type=hidden name=od_amount value='<?=$tot_sell_amount?>'>
<input type=hidden name=od_send_cost value='<?=$send_cost?>'>
<input type=hidden name=od_send_emscost value='<?=$send_emscost?>'>
shop/orderinquirycancel.php
// 주문 취소
$cancel_memo = addslashes($cancel_memo);
//sql_query(" update $g4[yc4_order_table] set od_temp_point = '0', od_receipt_point = '0', od_shop_memo = concat(od_shop_memo,\"\\n주문자 본인 직접 취소 - {$g4['time_ymdhis']} (취소이유 : {$cancel_memo})\") where on_uid = '$on_uid' ");
sql_query(" update $g4[yc4_order_table] set od_send_cost = '0', od_send_emscost = '0', od_temp_point = '0', od_receipt_point = '0', od_shop_memo = concat(od_shop_memo,\"\\n주문자 본인 직접 취소 - {$g4['time_ymdhis']} (취소이유 : {$cancel_memo})\") where on_uid = '$on_uid' ");
shop/ordermail1.inc.php
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
unset($list);
$ttotal_amount = 0;
$ttotal_point = 0;
//==============================================================================
// 메일보내기
//------------------------------------------------------------------------------
// Loop 배열 자료를 만들고
$sql = " select b.it_sell_email,
a.it_id,
b.it_name,
b.it_origin,
a.it_opt1,
a.it_opt2,
a.it_opt3,
a.it_opt4,
a.it_opt5,
a.it_opt6,
a.ct_qty,
a.ct_amount,
a.ct_emskg,
a.ct_point
from $g4[yc4_cart_table] a, $g4[yc4_item_table] b
where a.on_uid = '$tmp_on_uid'
and a.it_id = b.it_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i][g_dir] = $g4[url];
$list[$i][it_id] = $row[it_id];
$list[$i][it_simg] = get_it_image("$row[it_id]_s", $default[de_simg_width], $default[de_simg_height]);
$list[$i][it_name] = $row[it_name];
$list[$i][it_origin] = $row[it_origin];
$list[$i][it_opt] = print_item_options($row[it_id], $row[it_opt1], $row[it_opt2], $row[it_opt3], $row[it_opt4], $row[it_opt5], $row[it_opt6]);
$list[$i][ct_qty] = $row[ct_qty];
$list[$i][ct_amount] = $row[ct_amount];
$list[$i][ct_emskg] = $row[ct_emskg];
$list[$i][stotal_amount] = $row[ct_amount] * $row[ct_qty];
$list[$i][stotal_emskg] = $row[ct_emskg] * $row[ct_qty];
$list[$i][stotal_point] = $row[ct_point] * $row[ct_qty];
$ttotal_amount += $list[$i][stotal_amount];
$ttotal_point += $list[$i][stotal_point];
$ttotal_emskg += $list[$i][stotal_emskg];
}
//------------------------------------------------------------------------------
// 배송비가 있다면 총계에 더한다
if ($od_send_cost)
$ttotal_amount += $od_send_cost;
if ($od_send_emscost)
$ttotal_emskg += $od_send_emscost;
?>
shop/orderreceipt.php
<input type=hidden name=od_amount value="<? echo $tot_sell_amount ?>">
<input type=hidden name=od_send_cost value="<? echo $od_send_cost ?>">
<input type=hidden name=od_send_emscost value="<? echo $od_send_emscost ?>">
<input type=hidden name=od_name value="<? echo proc_quot($od_name) ?>">
<input type=hidden name=od_pwd value="<? echo $od_pwd ?>">
필요부분을 더 삽입....