변경된 옵션 기능에 맞게 장바구니 쿼리 수정
This commit is contained in:
@ -90,18 +90,16 @@ $sql = " select ct_id,
|
|||||||
it_id,
|
it_id,
|
||||||
it_name,
|
it_name,
|
||||||
ct_qty,
|
ct_qty,
|
||||||
|
ct_option,
|
||||||
ct_price,
|
ct_price,
|
||||||
ct_point,
|
ct_point,
|
||||||
ct_status,
|
ct_status,
|
||||||
ct_time,
|
ct_time,
|
||||||
ct_point_use,
|
ct_point_use,
|
||||||
ct_stock_use,
|
ct_stock_use,
|
||||||
it_opt1,
|
io_type,
|
||||||
it_opt2,
|
io_price,
|
||||||
it_opt3,
|
ct_num
|
||||||
it_opt4,
|
|
||||||
it_opt5,
|
|
||||||
it_opt6
|
|
||||||
from {$g4['shop_cart_table']}
|
from {$g4['shop_cart_table']}
|
||||||
where uq_id = '{$od['uq_id']}'
|
where uq_id = '{$od['uq_id']}'
|
||||||
order by ct_id ";
|
order by ct_id ";
|
||||||
@ -111,7 +109,12 @@ $lines = array();
|
|||||||
$total_order = 0;
|
$total_order = 0;
|
||||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
$lines[$i] = $row;
|
$lines[$i] = $row;
|
||||||
$total_order += ($row['ct_price'] * $row['ct_qty']);
|
if($row['io_type'])
|
||||||
|
$total_price = $row['io_price'] * $row['ct_qty'];
|
||||||
|
else
|
||||||
|
$total_price = ($row['ct_price'] + $row['io_price']) * $row['ct_qty'];
|
||||||
|
$lines[$i]['price'] = $total_price;
|
||||||
|
$total_order += $total_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pg_anchor = '<ul class="anchor">
|
$pg_anchor = '<ul class="anchor">
|
||||||
@ -165,26 +168,28 @@ $pg_anchor = '<ul class="anchor">
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
for ($i=0; $i<count($lines); $i++) {
|
for ($i=0; $i<count($lines); $i++) {
|
||||||
$ct_amount['소계'] = $lines[$i]['ct_price'] * $lines[$i]['ct_qty'];
|
$ct_amount['소계'] = $lines[$i]['price'];
|
||||||
$ct_point['소계'] = $lines[$i]['ct_point'] * $lines[$i]['ct_qty'];
|
$ct_point['소계'] = $lines[$i]['ct_point'] * $lines[$i]['ct_qty'];
|
||||||
if ($lines[$i]['ct_status']=='주문' || $lines[$i]['ct_status']=='준비' || $lines[$i]['ct_status']=='배송' || $lines[$i]['ct_status']=='완료')
|
if ($lines[$i]['ct_status']=='주문' || $lines[$i]['ct_status']=='준비' || $lines[$i]['ct_status']=='배송' || $lines[$i]['ct_status']=='완료')
|
||||||
$t_ct_amount['정상'] += $lines[$i]['ct_price'] * $lines[$i]['ct_qty'];
|
$t_ct_amount['정상'] += $lines[$i]['price'];
|
||||||
else if ($lines[$i]['ct_status']=='취소' || $lines[$i]['ct_status']=='반품' || $lines[$i]['ct_status']=='품절')
|
else if ($lines[$i]['ct_status']=='취소' || $lines[$i]['ct_status']=='반품' || $lines[$i]['ct_status']=='품절')
|
||||||
$t_ct_amount['취소'] += $lines[$i]['ct_price'] * $lines[$i]['ct_qty'];
|
$t_ct_amount['취소'] += $lines[$i]['price'];
|
||||||
|
|
||||||
$image = get_it_image($lines[$i]['it_id'], 50, 50);
|
$image = get_it_image($lines[$i]['it_id'], 50, 50);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<? if($lines[$i]['ct_num'] == 0) { ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="9"><a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?><?php echo stripslashes($lines[$i]['it_name']); ?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td_chk">
|
<td class="td_chk">
|
||||||
<input type="hidden" name="ct_id[<?php echo $i; ?>]" value="<?php echo $row['ct_id']; ?>">
|
<input type="hidden" name="ct_id[<?php echo $i; ?>]" value="<?php echo $lines[$i]['ct_id']; ?>">
|
||||||
<label for="ct_chk_<?php echo $i; ?>" class="sound_only"><?php echo $lines[$i]['it_name']; ?> 체크</label>
|
<label for="ct_chk_<?php echo $i; ?>" class="sound_only"><?php echo $lines[$i]['it_name']; ?> 체크</label>
|
||||||
<input type="checkbox" name="ct_chk[<?php echo $i; ?>]" value="1" id="ct_chk_<?php echo $i; ?>">
|
<input type="checkbox" name="ct_chk[<?php echo $i; ?>]" value="1" id="ct_chk_<?php echo $i; ?>">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td><?php echo $lines[$i]['ct_option']; ?></td>
|
||||||
<a href="./itemform.php?w=u&it_id=<?php echo $row['it_id']; ?>"><?php echo $image; ?><?php echo stripslashes($lines[$i]['it_name']); ?></a><br>
|
|
||||||
<?php echo print_item_options($lines[$i]['it_id'], $lines[$i]['it_opt1'], $lines[$i]['it_opt2'], $lines[$i]['it_opt3'], $lines[$i]['it_opt4'], $lines[$i]['it_opt5'], $lines[$i]['it_opt6']); ?>
|
|
||||||
</td>
|
|
||||||
<td class="td_small_stats"><?php echo $lines[$i]['ct_status']; ?></td>
|
<td class="td_small_stats"><?php echo $lines[$i]['ct_status']; ?></td>
|
||||||
<td class="td_num"><?php echo $lines[$i]['ct_qty']; ?></td>
|
<td class="td_num"><?php echo $lines[$i]['ct_qty']; ?></td>
|
||||||
<td class="td_num"><?php echo number_format($lines[$i]['ct_price']); ?></td>
|
<td class="td_num"><?php echo number_format($lines[$i]['ct_price']); ?></td>
|
||||||
|
|||||||
@ -39,7 +39,7 @@ if ($csv == 'csv')
|
|||||||
$to_date = date_conv($to_date);
|
$to_date = date_conv($to_date);
|
||||||
|
|
||||||
|
|
||||||
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice
|
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice, b.ct_option
|
||||||
FROM {$g4['shop_order_table']} a, {$g4['shop_cart_table']} b
|
FROM {$g4['shop_order_table']} a, {$g4['shop_cart_table']} b
|
||||||
where a.uq_id = b.uq_id ";
|
where a.uq_id = b.uq_id ";
|
||||||
if ($case == 1) // 출력기간
|
if ($case == 1) // 출력기간
|
||||||
@ -62,7 +62,7 @@ if ($csv == 'csv')
|
|||||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
//echo "우편번호,주소,이름,전화1,전화2,상품명,수량,비고,전하실말씀\n";
|
//echo "우편번호,주소,이름,전화1,전화2,상품명,수량,비고,전하실말씀\n";
|
||||||
echo "우편번호,주소,이름,전화1,전화2,상품명,수량,상품코드,주문번호,운송장번호,전하실말씀\n";
|
echo "우편번호,주소,이름,전화1,전화2,상품명,수량,선택사항,상품코드,주문번호,운송장번호,전하실말씀\n";
|
||||||
for ($i=0; $row=mysql_fetch_array($result); $i++)
|
for ($i=0; $row=mysql_fetch_array($result); $i++)
|
||||||
{
|
{
|
||||||
echo '"'.$row['od_b_zip1'].'-'.$row['od_b_zip2'].'"'.',';
|
echo '"'.$row['od_b_zip1'].'-'.$row['od_b_zip2'].'"'.',';
|
||||||
@ -74,6 +74,7 @@ if ($csv == 'csv')
|
|||||||
echo '"'.conv_telno($row['od_b_hp']) . '"'.',';
|
echo '"'.conv_telno($row['od_b_hp']) . '"'.',';
|
||||||
echo '"'.preg_replace("/\"/", """, $row['it_name']) . '"'.',';
|
echo '"'.preg_replace("/\"/", """, $row['it_name']) . '"'.',';
|
||||||
echo '"'.$row['ct_qty'].'"'.',';
|
echo '"'.$row['ct_qty'].'"'.',';
|
||||||
|
echo '"'.$row['ct_option'].'"'.',';
|
||||||
echo '"\''.$row['it_id'].'\'"'.',';
|
echo '"\''.$row['it_id'].'\'"'.',';
|
||||||
echo '"\''.$row['od_id'].'\'"'.',';
|
echo '"\''.$row['od_id'].'\'"'.',';
|
||||||
echo '"'.$row['od_invoice'].'"'.',';
|
echo '"'.$row['od_invoice'].'"'.',';
|
||||||
@ -94,7 +95,7 @@ if ($csv == 'xls')
|
|||||||
$to_date = date_conv($to_date);
|
$to_date = date_conv($to_date);
|
||||||
|
|
||||||
|
|
||||||
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice, b.it_opt1, b.it_opt2, b.it_opt3, b.it_opt4, b.it_opt5, b.it_opt6
|
$sql = " SELECT od_b_zip1, od_b_zip2, od_b_addr1, od_b_addr2, od_b_name, od_b_tel, od_b_hp, b.it_name, ct_qty, b.it_id, a.od_id, od_memo, od_invoice, b.ct_option
|
||||||
FROM {$g4['shop_order_table']} a, {$g4['shop_cart_table']} b
|
FROM {$g4['shop_order_table']} a, {$g4['shop_cart_table']} b
|
||||||
where a.uq_id = b.uq_id ";
|
where a.uq_id = b.uq_id ";
|
||||||
if ($case == 1) // 출력기간
|
if ($case == 1) // 출력기간
|
||||||
@ -130,6 +131,7 @@ if ($csv == 'xls')
|
|||||||
echo '<td>전화2</td>';
|
echo '<td>전화2</td>';
|
||||||
echo '<td>상품명</td>';
|
echo '<td>상품명</td>';
|
||||||
echo '<td>수량</td>';
|
echo '<td>수량</td>';
|
||||||
|
echo '<td>선택사항</td>';
|
||||||
echo '<td>상품코드</td>';
|
echo '<td>상품코드</td>';
|
||||||
echo '<td>주문번호</td>';
|
echo '<td>주문번호</td>';
|
||||||
echo '<td>운송장번호</td>';
|
echo '<td>운송장번호</td>';
|
||||||
@ -148,6 +150,7 @@ if ($csv == 'xls')
|
|||||||
echo '<td class="mso_txt">'.$row['od_b_hp'].'</td>';
|
echo '<td class="mso_txt">'.$row['od_b_hp'].'</td>';
|
||||||
echo '<td>'.$it_name.'</td>';
|
echo '<td>'.$it_name.'</td>';
|
||||||
echo '<td>'.$row['ct_qty'].'</td>';
|
echo '<td>'.$row['ct_qty'].'</td>';
|
||||||
|
echo '<td>'.$row['ct_option'].'</td>';
|
||||||
echo '<td class="mso_txt">'.$row['it_id'].'</td>';
|
echo '<td class="mso_txt">'.$row['it_id'].'</td>';
|
||||||
echo '<td class="mso_txt">'. urlencode($row['od_id']).'</td>';
|
echo '<td class="mso_txt">'. urlencode($row['od_id']).'</td>';
|
||||||
echo '<td class="mso_txt">'.$row['od_invoice'].'</td>';
|
echo '<td class="mso_txt">'.$row['od_invoice'].'</td>';
|
||||||
@ -265,7 +268,7 @@ if (mysql_num_rows($result) == 0)
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">상품명(주문번호)</th>
|
<th scope="col">상품명(선택사항)</th>
|
||||||
<th scope="col">판매가</th>
|
<th scope="col">판매가</th>
|
||||||
<th scope="col">수량</th>
|
<th scope="col">수량</th>
|
||||||
<th scope="col">소계</th>
|
<th scope="col">소계</th>
|
||||||
@ -273,13 +276,7 @@ if (mysql_num_rows($result) == 0)
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$sql2 = " select a.*,
|
$sql2 = " select a.*
|
||||||
b.it_opt1_subject,
|
|
||||||
b.it_opt2_subject,
|
|
||||||
b.it_opt3_subject,
|
|
||||||
b.it_opt4_subject,
|
|
||||||
b.it_opt5_subject,
|
|
||||||
b.it_opt6_subject
|
|
||||||
from {$g4['shop_cart_table']} a, {$g4['shop_item_table']} b
|
from {$g4['shop_cart_table']} a, {$g4['shop_item_table']} b
|
||||||
where a.it_id = b.it_id
|
where a.it_id = b.it_id
|
||||||
and a.uq_id = '{$row['uq_id']}' ";
|
and a.uq_id = '{$row['uq_id']}' ";
|
||||||
@ -291,34 +288,15 @@ if (mysql_num_rows($result) == 0)
|
|||||||
$cnt = $sub_tot_qty = $sub_tot_amount = 0;
|
$cnt = $sub_tot_qty = $sub_tot_amount = 0;
|
||||||
while ($row2 = sql_fetch_array($res2))
|
while ($row2 = sql_fetch_array($res2))
|
||||||
{
|
{
|
||||||
$row2_tot_amount = $row2['ct_price'] * $row2['ct_qty'];
|
if($row2['io_type'])
|
||||||
|
$row2_tot_amount = $row2['io_price'] * $row2['ct_qty'];
|
||||||
|
else
|
||||||
|
$row2_tot_amount = ($row2['ct_price'] + $row2['io_price']) * $row2['ct_qty'];
|
||||||
$sub_tot_qty += $row2['ct_qty'];
|
$sub_tot_qty += $row2['ct_qty'];
|
||||||
$sub_tot_amount += $row2_tot_amount;
|
$sub_tot_amount += $row2_tot_amount;
|
||||||
|
|
||||||
$it_name = stripslashes($row2['it_name']);
|
$it_name = stripslashes($row2['it_name']);
|
||||||
$it_name = "$it_name ($row2[it_id])";
|
$it_name = "$it_name ({$row2['ct_option']})";
|
||||||
|
|
||||||
$str_split = "";
|
|
||||||
for ($k=1; $k<=6; $k++)
|
|
||||||
{
|
|
||||||
if ($row2["it_opt{$k}"] == "") continue;
|
|
||||||
$it_name .= $str_split;
|
|
||||||
$it_opt_subject = $row2["it_opt{$k}_subject"];
|
|
||||||
$opt = explode( ";", trim($row2["it_opt{$k}"]) );
|
|
||||||
$it_name .= $it_opt_subject.' = '.$opt[0];
|
|
||||||
|
|
||||||
if ($opt[1] != 0)
|
|
||||||
{
|
|
||||||
$it_name .= " (";
|
|
||||||
//if (ereg("[+]", $opt[1]) == true)
|
|
||||||
if (preg_match("/[+]/", $opt[1]) == true)
|
|
||||||
$it_name .= "+";
|
|
||||||
// 금액을 전화문의 표시로
|
|
||||||
$it_name .= display_price($opt[1]) . ")";
|
|
||||||
}
|
|
||||||
$str_split = "<br />";
|
|
||||||
}
|
|
||||||
$it_name .= "";
|
|
||||||
|
|
||||||
$fontqty1 = $fontqty2 = "";
|
$fontqty1 = $fontqty2 = "";
|
||||||
if ($row2['ct_qty'] >= 2)
|
if ($row2['ct_qty'] >= 2)
|
||||||
|
|||||||
@ -48,26 +48,15 @@ $sql = " select a.od_id,
|
|||||||
a.od_deposit_name,
|
a.od_deposit_name,
|
||||||
a.od_time,
|
a.od_time,
|
||||||
a.od_mobile,
|
a.od_mobile,
|
||||||
b.it_opt1,
|
|
||||||
b.it_opt2,
|
|
||||||
b.it_opt3,
|
|
||||||
b.it_opt4,
|
|
||||||
b.it_opt5,
|
|
||||||
b.it_opt6,
|
|
||||||
b.ct_status,
|
b.ct_status,
|
||||||
b.ct_qty,
|
b.ct_qty,
|
||||||
b.ct_price,
|
b.ct_price,
|
||||||
b.ct_point,
|
b.ct_point,
|
||||||
(b.ct_qty * b.ct_price) as ct_sub_amount,
|
b.ct_option,
|
||||||
|
(IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)) as ct_sub_amount,
|
||||||
(b.ct_qty * b.ct_point) as ct_sub_point,
|
(b.ct_qty * b.ct_point) as ct_sub_point,
|
||||||
b.it_id,
|
b.it_id,
|
||||||
b.it_name,
|
b.it_name
|
||||||
c.it_opt1_subject,
|
|
||||||
c.it_opt2_subject,
|
|
||||||
c.it_opt3_subject,
|
|
||||||
c.it_opt4_subject,
|
|
||||||
c.it_opt5_subject,
|
|
||||||
c.it_opt6_subject
|
|
||||||
$sql_common
|
$sql_common
|
||||||
order by $sort1 $sort2
|
order by $sort1 $sort2
|
||||||
limit $from_record, $rows ";
|
limit $from_record, $rows ";
|
||||||
@ -183,7 +172,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_id&search=<?php echo $lines[$i]['od_id']; ?>"><?php echo $lines[$i]['od_id']; ?></a><br>
|
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_id&search=<?php echo $lines[$i]['od_id']; ?>"><?php echo $lines[$i]['od_id']; ?></a><br>
|
||||||
<?php echo $lines[$i]['od_time']; ?>
|
<?php echo $lines[$i]['od_time']; ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="td_it_img"><a href="<?php echo $href; ?>"><?php echo get_it_image($lines[$i]['it_id'], 50, 50); ?><?php echo $it_name; ?></a></td>
|
<td class="td_it_img"><a href="<?php echo $href; ?>"><?php echo get_it_image($lines[$i]['it_id'], 50, 50); ?><?php echo $it_name; ?></a><br><?php echo $lines[$i]['ct_option']; ?></td>
|
||||||
<td class="td_name">
|
<td class="td_name">
|
||||||
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_name&search=<?php echo $lines[$i]['od_name']; ?>"><?php echo cut_str($lines[$i]['od_name'],10,""); ?></a>
|
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?sort1=<?php echo $sort1; ?>&sort2=<?php echo $sort2; ?>&sel_field=od_name&search=<?php echo $lines[$i]['od_name']; ?>"><?php echo cut_str($lines[$i]['od_name'],10,""); ?></a>
|
||||||
<?php if ($lines[$i]['od_deposit_name'] != "") echo '<br>'.$lines[$i]['od_deposit_name']?>
|
<?php if ($lines[$i]['od_deposit_name'] != "") echo '<br>'.$lines[$i]['od_deposit_name']?>
|
||||||
|
|||||||
Reference in New Issue
Block a user