채택완료

영카트 마이페이지에서 선택한 옵션항목 보는 방법

영카트 마이페이지 에서 각 상품에서 선택한 옵션들을 보고싶은데 어떻게 수정하여야 하나요?? 

 

*해본것

쿼리문을 

$sql3 = "SELECT ct_option 

FROM 테이블 A AS A 

JOIN 테이블 B AS B 

ON A.od_id = B.od_id 

where B.mb_id = '{$member['mb_id']}' ;";

$result3 = sql_query($sql3);

이렇게 사용해서 쿼리를 아래 코드처럼 사용했더니 한 상품에 다른 상품들 옵션까지 나와버려서요..


shop/orderinquiry.sub.php 부분에 없던 코드를 제가 새로 생성하여 입력하였습니다.

Copy
<?php for ($i=0; $row3 = sql_fetch_row($result3); $i++) { ?>옵션 : ( <?php echo $row3['ct_option']; ?> )<? } ?>

어떤식으로 활용해야 할지.. 고수님들 부탁드립니다..ㅜㅜ

답변 3개 / 댓글 2개

채택된 답변
+20 포인트

shop.lib.php 

// 상품 선택옵션

function get_item_options($it_id, $subject)

{

    global $g5, $aslang;

    if(!$it_id || !$subject)

        return '';

    $sql = " select * from {$g5['g5_shop_item_option_table']} where io_type = '0' and it_id = '$it_id' and io_use = '1' order by io_no asc ";

    $result = sql_query($sql);

    if(!sql_num_rows($result))

        return '';

    $str = '';

    $subj = explode(',', $subject);

    $subj_count = count($subj);

    if($subj_count > 1) {

        $options = array();

        // 옵션항목 배열에 저장

        for($i=0; $row=sql_fetch_array($result); $i++) {

            $opt_id = explode(chr(30), $row['io_id']);

            for($k=0; $k<$subj_count; $k++) {

                if(!is_array($options[$k]))

                    $options[$k] = array();

                if($opt_id[$k] && !in_array($opt_id[$k], $options[$k]))

                    $options[$k][] = $opt_id[$k];

            }

        }

        // 옵션선택목록 만들기

        for($i=0; $i<$subj_count; $i++) {

            $opt = $options[$i];

            $opt_count = count($opt);

            $disabled = '';

            if($opt_count) {

                $seq = $i + 1;

                if($i > 0)

                    $disabled = ' disabled="disabled"';

                $str .= '<tr>'.PHP_EOL;

                $str .= '<th><label for="it_option_'.$seq.'">'.$subj[$i].'</label></th>'.PHP_EOL;

                $select = '<select id="it_option_'.$seq.'" class="it_option"'.$disabled.'>'.PHP_EOL;

                $select .= '<option value="">'.$aslang['io_select'].'</option>'.PHP_EOL;

                for($k=0; $k<$opt_count; $k++) {

                    $opt_val = $opt[$k];

                    if(strlen($opt_val)) {

                        $select .= '<option value="'.$opt_val.'">'.$opt_val.'</option>'.PHP_EOL;

                    }

                }

                $select .= '</select>'.PHP_EOL;

                $str .= '<td>'.$select.'</td>'.PHP_EOL;

                $str .= '</tr>'.PHP_EOL;

            }

        }

    } else {

        $str .= '<tr>'.PHP_EOL;

        $str .= '<th><label for="it_option_1">'.$subj[0].'</label></th>'.PHP_EOL;

        $select = '<select id="it_option_1" class="it_option">'.PHP_EOL;

        $select .= '<option value="">'.$aslang['io_select'].'</option>'.PHP_EOL;

        for($i=0; $row=sql_fetch_array($result); $i++) {

            if($row['io_price'] >= 0)

                $price = '&nbsp;&nbsp;+ '.astxt($aslang['io_price'], array(number_format($row['io_price']))); //원

            else

                $price = '&nbsp;&nbsp; '.astxt($aslang['io_price'], array(number_format($row['io_price']))); //원

            if($row['io_stock_qty'] < 1)

                $soldout = '&nbsp;&nbsp;'.$aslang['io_soldout']; //[품절]

            else

                $soldout = '';

            $select .= '<option value="'.$row['io_id'].','.$row['io_price'].','.$row['io_stock_qty'].'">'.$row['io_id'].$price.$soldout.'</option>'.PHP_EOL;

        }

        $select .= '</select>'.PHP_EOL;

        $str .= '<td>'.$select.'</td>'.PHP_EOL;

        $str .= '</tr>'.PHP_EOL;

    }

    return $str;

}


답변에 대한 댓글 1개

덕분에 몰랐던 부분 한가지 더 배워갑니다. 정말 감사합니다!!!

연락처를 쪽지로 주세요 봐드릴게요

shop/cart.php 를 참고하세요 

답변에 대한 댓글 1개

cart.php 확인했는데요, 제목이랑은 나오는데 옵션은 따로 안보이는거같아요... 제가 잘못보고있는건지

cart.php 에서 어느부분을 참고해야하나요?

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