장바구니에서 브랜드명 출력문제..돠주세요 ㅇ ㅠㅠ 채택완료
비코즈
4년 전
조회 1,286
장바구니에서 브랜드명이 출력되게 할방법이 없을까요?
</p>
<pre>
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(ct_point * ct_qty) as point,
SUM(ct_qty) as qty
from {$g5['g5_shop_cart_table']}
where it_id = '{$row['it_id']}'
and od_id = '$s_cart_id' ";
$sum = sql_fetch($sql);
if ($i==0) { // 계속쇼핑
$continue_ca_id = $row['ca_id'];
}
$a1 = '<a href="'.shop_item_url($row['it_id']).'" class="prd_name"><b>';
$a2 = '</b></a>';
$image = get_it_image($row['it_id'], 80, 80);
$it_name = $a1 . stripslashes($row['it_name']) . $a2;
$it_brand = $a1 . stripslashes($row['it_brand']) . $a2; //손본부분..
$it_options = print_item_options($row['it_id'], $s_cart_id);
if($it_options) {
$mod_options = '<div class="sod_option_btn"><button type="button" class="mod_options">선택사항수정</button></div>';
$it_name .= '<div class="sod_opt">'.$it_options.'</div>';
}
// 배송비
switch($row['ct_send_cost'])
{
case 1:
$ct_send_cost = '착불';
break;
case 2:
$ct_send_cost = '무료';
break;
default:
$ct_send_cost = '선불';
break;
}
// 조건부무료
if($row['it_sc_type'] == 2) {
$sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $s_cart_id);
if($sendcost == 0)
$ct_send_cost = '무료';
}
$point = $sum['point'];
$sell_price = $sum['price'];
?>
<tr>
<td class="td_chk chk_box">
<input type="checkbox" name="ct_chk[<?php echo $i; ?>]" value="1" id="ct_chk_<?php echo $i; ?>" checked="checked" class="selec_chk">
<label for="ct_chk_<?php echo $i; ?>"><span></span><b class="sound_only">상품</b></label>
</td>
<td class="td_prd">
<div class="sod_img"><a href="<?php echo shop_item_url($row['it_id']); ?>"><?php echo $image; ?></a></div>
<div class="sod_name">
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo get_text($row['it_name']); ?>">
<?php echo $it_brand.$it_name.$mod_options; ?> //손본부분..
</div></pre>
<p> </p>
<p>
제가 해본부분을
//손본부분이라고 표시했어요
그런데 브랜드명이 출력이 안되는데 ㅠㅠ
뭐가 문제인가요?
$sql = " select a.ct_id,
a.it_id,
a.it_name,
a.ct_price,
a.ct_point,
a.ct_qty,
이부분에다가도 a.it_brand를 추가했는데 에러가나는데 도와주실분 계신가요 ㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
4년 전
위의 나열한 코드보다 좀더 상단영역 쿼리에서
it_brand를 추가해야
아래 추가한 코드들이 작동합니다.
</p>
<p> </p>
<p>// $s_cart_id 로 현재 장바구니 자료 쿼리</p>
<p>$sql = " select a.ct_id,</p>
<p> a.it_id,</p>
<p> a.it_name,</p>
<p> a.ct_price,</p>
<p> a.ct_point,</p>
<p> a.ct_qty,</p>
<p> a.ct_status,</p>
<p> a.ct_send_cost,</p>
<p> a.it_sc_type,</p>
<p> b.ca_id,</p>
<p> b.ca_id2,</p>
<p> b.ca_id3,</p>
<p> b.pt_it,</p>
<p> b.pt_msg1,</p>
<p> b.pt_msg2,</p>
<p> b.pt_msg3</p>
<p> , b.it_brand --브랜드추가</p>
<p> from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )</p>
<p> where a.od_id = '$s_cart_id' ";</p>
<p>$sql .= " group by a.it_id ";</p>
<p>$sql .= " order by a.ct_id ";</p>
<p>$result = sql_query($sql);</p>
<p> </p>
<p>// 이하 질문한 영역</p>
<p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
�
비코즈
4년 전
�
플래토
4년 전
from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b
를 보시면
table alias 를 cart를 a 로
shop_item 을 b로
alias가 되어있는것을 보고
it_brand는 item에 들어있는 값이라서
join을 해서 값을 가져올때 해당테이블의 정보를 가져와야죠
를 보시면
table alias 를 cart를 a 로
shop_item 을 b로
alias가 되어있는것을 보고
it_brand는 item에 들어있는 값이라서
join을 해서 값을 가져올때 해당테이블의 정보를 가져와야죠
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
이거 워크벤치가서 확인해야하는건가요? 테이블이름인가용?ㅠㅠ완전초짜라서 ㅠㅠ감사합니다..