2026, 새로운 도약을 시작합니다.

장바구니에서 브랜드명 출력문제..돠주세요 ㅇ ㅠㅠ 채택완료

장바구니에서 브랜드명이 출력되게 할방법이 없을까요?

Copy



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 = '';
    $a2 = '';
    $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 = '선택사항수정';
        $it_name .= ''.$it_options.'';

    }

    // 배송비
    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'];
?>


    
        

제가 해본부분을

//손본부분이라고 표시했어요

그런데 브랜드명이 출력이 안되는데 ㅠㅠ

뭐가 문제인가요?

$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 포인트

위의 나열한 코드보다 좀더 상단영역 쿼리에서

it_brand를 추가해야 

아래 추가한 코드들이 작동합니다.

Copy


 

// $s_cart_id 로 현재 장바구니 자료 쿼리

$sql = " select a.ct_id,

                a.it_id,

                a.it_name,

                a.ct_price,

                a.ct_point,

                a.ct_qty,

                a.ct_status,

                a.ct_send_cost,

                a.it_sc_type,

                b.ca_id,

                b.ca_id2,

                b.ca_id3,

                b.pt_it,

                b.pt_msg1,

                b.pt_msg2,

                b.pt_msg3

                , b.it_brand  --브랜드추가

           from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )

          where a.od_id = '$s_cart_id' ";

$sql .= " group by a.it_id ";

$sql .= " order by a.ct_id ";

$result = sql_query($sql);

 

// 이하 질문한 영역

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

와우.. 감동입니다!! 한방에 해결됐어요 전 b.it_brand가 아니고 a.it_brand로 했더니 안먹던데..
이거 워크벤치가서 확인해야하는건가요? 테이블이름인가용?ㅠㅠ완전초짜라서 ㅠㅠ감사합니다..
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을 해서 값을 가져올때 해당테이블의 정보를 가져와야죠

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고