묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
쇼핑몰에서 배송료를 추가하고 싶은데. 소스좀 알려주세요
2005.07.31 04:22
쇼핑몰에서요........
총 주문한금액이 9만원미만일경우 배송료 5,000원을 추가로 받고 싶은데요.
9만원이상은 무료배송이구요.........
그런데 배송료 5,000원 추가로 더 받게할려는 소스좀 알려주세요~ 파일은 product_basket.php 이구요.
밑에 소스 시작됩니다.
-------------------------------------------------------------------------------
<?
include "../include/common_inc.php";
// 장바구니 코드 생성하기 -----------------------------------------
if (strlen($HTTP_COOKIE_VARS["tempid"])==0) {
$tempid = md5(uniqid(rand()));
SetCookie("tempid","$tempid",0);
}else{
$tempid = $HTTP_COOKIE_VARS["tempid"];
}
// 새로 장바구니에 상품 추가
$basket_id = "tempid = '$tempid' and";
$qry_search = "SELECT * FROM fine_product_basket where $basket_id product_menuid = '$product_menuid'+ '+ ' and product_seqno = '$product_seqno' and product_ordernum = '+ 'X' order by seq_no desc";
$rst_search = mysql_query($qry_search);
$row_search = mysql_fetch_array($rst_search);
// echo "$qry_search <BR><BR>";
// $mode에 따른 작업처리 ----------------------------------------
switch($mode) {
case "update":
// 수량만 변경한(상품특성이 변하지 않은) 경우
$sql = "UPDATE fine_product_basket SET product_amount = $product_amount WHERE $basket_id seq_no='$product_seqno' AND product_ordernum = 'X'";
mysql_query($sql);
// echo "$sql <BR><BR>";
break;
case "del":
$sql = "DELETE FROM fine_product_basket WHERE $basket_id seq_no='$product_seqno' AND product_ordernum = 'X'";
mysql_query($sql);
// echo "$sql <BR><BR>";
break;
default :
if ($row_search){
// 상품 수량 추가
$amount_new = $row_search[product_amount] + $product_amount;
$sql = "update fine_product_basket set product_amount = $amount_new where $basket_id product_menuid = '$product_menuid' and product_seqno = '$product_seqno' and product_ordernum = 'X'";
mysql_query($sql);
// echo "$sql <BR><BR>";
} else {
// 상품 추가
$vdate = date("Ymd");
$sql = "INSERT INTO fine_product_basket
(seq_no, tempid, product_menuid, product_seqno, product_name, product_price, product_amount, product_ordernum, date)
VALUES ('', '$tempid', '$product_menuid', '$product_seqno', '$product_name', $product_price, '1', 'X', $vdate)";
mysql_query($sql);
// echo "$sql <BR><BR>";
}
break;
}
$qry = "SELECT * FROM fine_product_basket where $basket_id product_ordernum = 'X' order by seq_no desc";
$rst = mysql_query($qry);
// echo "$qry <BR><BR>";
function basket()
{
global $tempid,$rst,$product_menuid,$product_seqno,$form_num,$totalprice,$basket_menu_id;
$totalprice = 0;
$form_num = 0;
while($row = mysql_fetch_array($rst)){
$sumprice = $row[product_price] * $row[product_amount];
$form_num = $form_num+1;
echo "
<form name='form$form_num' action='$PHP_SELF' method='post'>
<input type=hidden name=product_seqno value="".$row[seq_no]."">
<input type=hidden name=product_menuid value="".$row[product_menuid]."">
<input type=hidden name=mode>
<TR align=center>
<TD><A HREF='product_detail.php?menu_id=$row[product_menuid]&seq_no=$row[product_seqno]'>$row[product_name]</A></TD>
<TD>".number_format($row[product_price])."</TD>
<TD>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td rowspan=2><input class='box' readonly name=product_amount size=2 value="".$row[product_amount]."" onChange="send(document.form$form_num,'update')" ></td>
<td width=20 align=center><a href=".javascriptfrm_up_qty(document.form$form_num,'update');"><img src="./images/up_icon.gif" width=15 height=13 border=0></a></td>
</tr>
<tr>
<td width=20 align=center><a href=".javascriptfrm_down_qty(document.form$form_num,'update');"><img src="./images/down_icon.gif" width=15 height=12 border=0></a></td>
</tr>
</table>
</TD>
<TD>".number_format($sumprice)."</TD>
<TD><a href=".javascriptsend(document.form$form_num,'del')"><FONT COLOR='red'><B>X</B></FONT></A></TD>
</TR>
</form>
";
$totalprice += $sumprice;
$basket_menu_id = $row[product_menuid];
}
if ($totalprice > 0) {
echo "
<TR height=30 bgcolor='D4E1EC'>
<TD colspan=3 align=right>Total : </TD>
<TD colspan=2 align=center>".number_format($totalprice)." 원</TD>
</TR>
";
}else{
echo "
<TR height=25>
<TD colspan=5 align=center>쇼핑하신 상품이 없습니다.</TD>
</TR>
";
}
}
$_INC_FILE = _BASE_DIR."/product_display/html/product_basket.html";
// 무조건 모든 파일에서 _MAIN_SKIN을 include 한다.
include _MAIN_SKIN;
?>
총 주문한금액이 9만원미만일경우 배송료 5,000원을 추가로 받고 싶은데요.
9만원이상은 무료배송이구요.........
그런데 배송료 5,000원 추가로 더 받게할려는 소스좀 알려주세요~ 파일은 product_basket.php 이구요.
밑에 소스 시작됩니다.
-------------------------------------------------------------------------------
<?
include "../include/common_inc.php";
// 장바구니 코드 생성하기 -----------------------------------------
if (strlen($HTTP_COOKIE_VARS["tempid"])==0) {
$tempid = md5(uniqid(rand()));
SetCookie("tempid","$tempid",0);
}else{
$tempid = $HTTP_COOKIE_VARS["tempid"];
}
// 새로 장바구니에 상품 추가
$basket_id = "tempid = '$tempid' and";
$qry_search = "SELECT * FROM fine_product_basket where $basket_id product_menuid = '$product_menuid'+ '+ ' and product_seqno = '$product_seqno' and product_ordernum = '+ 'X' order by seq_no desc";
$rst_search = mysql_query($qry_search);
$row_search = mysql_fetch_array($rst_search);
// echo "$qry_search <BR><BR>";
// $mode에 따른 작업처리 ----------------------------------------
switch($mode) {
case "update":
// 수량만 변경한(상품특성이 변하지 않은) 경우
$sql = "UPDATE fine_product_basket SET product_amount = $product_amount WHERE $basket_id seq_no='$product_seqno' AND product_ordernum = 'X'";
mysql_query($sql);
// echo "$sql <BR><BR>";
break;
case "del":
$sql = "DELETE FROM fine_product_basket WHERE $basket_id seq_no='$product_seqno' AND product_ordernum = 'X'";
mysql_query($sql);
// echo "$sql <BR><BR>";
break;
default :
if ($row_search){
// 상품 수량 추가
$amount_new = $row_search[product_amount] + $product_amount;
$sql = "update fine_product_basket set product_amount = $amount_new where $basket_id product_menuid = '$product_menuid' and product_seqno = '$product_seqno' and product_ordernum = 'X'";
mysql_query($sql);
// echo "$sql <BR><BR>";
} else {
// 상품 추가
$vdate = date("Ymd");
$sql = "INSERT INTO fine_product_basket
(seq_no, tempid, product_menuid, product_seqno, product_name, product_price, product_amount, product_ordernum, date)
VALUES ('', '$tempid', '$product_menuid', '$product_seqno', '$product_name', $product_price, '1', 'X', $vdate)";
mysql_query($sql);
// echo "$sql <BR><BR>";
}
break;
}
$qry = "SELECT * FROM fine_product_basket where $basket_id product_ordernum = 'X' order by seq_no desc";
$rst = mysql_query($qry);
// echo "$qry <BR><BR>";
function basket()
{
global $tempid,$rst,$product_menuid,$product_seqno,$form_num,$totalprice,$basket_menu_id;
$totalprice = 0;
$form_num = 0;
while($row = mysql_fetch_array($rst)){
$sumprice = $row[product_price] * $row[product_amount];
$form_num = $form_num+1;
echo "
<form name='form$form_num' action='$PHP_SELF' method='post'>
<input type=hidden name=product_seqno value="".$row[seq_no]."">
<input type=hidden name=product_menuid value="".$row[product_menuid]."">
<input type=hidden name=mode>
<TR align=center>
<TD><A HREF='product_detail.php?menu_id=$row[product_menuid]&seq_no=$row[product_seqno]'>$row[product_name]</A></TD>
<TD>".number_format($row[product_price])."</TD>
<TD>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td rowspan=2><input class='box' readonly name=product_amount size=2 value="".$row[product_amount]."" onChange="send(document.form$form_num,'update')" ></td>
<td width=20 align=center><a href=".javascriptfrm_up_qty(document.form$form_num,'update');"><img src="./images/up_icon.gif" width=15 height=13 border=0></a></td>
</tr>
<tr>
<td width=20 align=center><a href=".javascriptfrm_down_qty(document.form$form_num,'update');"><img src="./images/down_icon.gif" width=15 height=12 border=0></a></td>
</tr>
</table>
</TD>
<TD>".number_format($sumprice)."</TD>
<TD><a href=".javascriptsend(document.form$form_num,'del')"><FONT COLOR='red'><B>X</B></FONT></A></TD>
</TR>
</form>
";
$totalprice += $sumprice;
$basket_menu_id = $row[product_menuid];
}
if ($totalprice > 0) {
echo "
<TR height=30 bgcolor='D4E1EC'>
<TD colspan=3 align=right>Total : </TD>
<TD colspan=2 align=center>".number_format($totalprice)." 원</TD>
</TR>
";
}else{
echo "
<TR height=25>
<TD colspan=5 align=center>쇼핑하신 상품이 없습니다.</TD>
</TR>
";
}
}
$_INC_FILE = _BASE_DIR."/product_display/html/product_basket.html";
// 무조건 모든 파일에서 _MAIN_SKIN을 include 한다.
include _MAIN_SKIN;
?>