장바구니 기능 질문드립니다.

장바구니 기능 질문드립니다.

QA

장바구니 기능 질문드립니다.

본문

안녕하세요.

예전에 영카트 장바구니 기능을 그누보드에 이식하여 사용을 하였는데요

게시물에서 장바구니 버튼을 누른 후 장바구니에 넣어 놓고 보면

내가 장바구니에 넣어놓은 내용이 아닌

다른 사람이 넣어놓은 내용까지 전부 보여집니다.

 

로그인은 하지 않고 비회원이 주로 사용합니다.

아래는 장바구니 확인 화면 소스 입니다.

 


<?php
error_reporting ( E_ALL );
ini_set ( "display_errors", 0 );
define('_CART_', true);
include_once('./_common.php');
include_once(G5_THEME_PATH.'/head.php');
if($wr_id && $bo_table){
    $query="insert into yc4_cart set on_uid='$_SESSION[on_uid]', wr_id='$wr_id', ct_status='', ct_qty='1', ct_time=now(), ct_ip='$_SERVER[SERVER_ADDR]',bo_table='$bo_table'";
    $result = sql_query($query);
}
?>

<div id="cart_">
    <form name="form1" method="post" action="cart2.php">
    <table cellspacing="0" border="1">
        <caption>table</caption>
        <colgroup>
        <col width="5%" class="mrs"><col width="15%"><col width="25%"><col width="25%"><col width="20%"><col width="15%">
        </colgroup>
        <thead>
            <tr>
                <th scope="col" class="mrs">번호</th>
                <th scope="col">제품이미지</th>
                <th scope="col">물품명</th>
                <th scope="col">제품사양</th>
                <th scope="col">수량</th>
                <th scope="col">관리</th>
            </tr>
        </thead> 
        <tbody> 
                
        <?
            $query="select * from yc4_cart where on_uid='$_SESSION[on_uid]' order by ct_id";
            $cart_result=sql_query($query);
            if(!$cart_result) echo mysql_error();
            $i=0;
            while($cart=sql_fetch_array($cart_result)){
                $query="select * from g5_write_".$cart[bo_table]." where wr_id='$cart[wr_id]'";
                $it_result=sql_query($query);
                $it=sql_fetch_array($it_result,MYSQL_ASSOC);
                
                $query="select * from g5_board_file where bo_table='$cart[bo_table]' and wr_id='$cart[wr_id]'";
                $file_result=sql_query($query);
                $file_rows=sql_fetch_array($file_result,MYSQL_ASSOC);
        ?>
        
        <input type=hidden name="ct_id[<?php echo $i;?>]" value="<?=$cart[ct_id]?>" target="hiddenframe">
            <tr>
                <td class="mrs"><?=($i+1)?></td>
                <td><?if($file_rows[bf_file]){?><img src="/data/file/<?=$cart[bo_table]?>/<?=$file_rows[bf_file]?>"><?}else{?><?}?></td>
                <td><?=$it[wr_subject]?></td>
                <td>
                    <select id="cc_6[<?php echo $i;?>]" name="cc_6[<?php echo $i;?>]" style="width:80%">
                    <option value="" selected>선택하세요</option>
                    <?php 
                    for($a=1; $a<11; $a++) { 
                    if($it['wr_'.$a]) { 
                    echo "<option value='".$it['wr_'.$a]."'>".$it['wr_'.$a]."</option>"; 
                    } 
                    } 
                    ?> 
                </td>
                <td><input type="text" name="ct_qty[<?php echo $i;?>]" value="<?=$cart[ct_qty]?>" style="text-align:center"><a href="javascript:cartupdate(<?=$i?>)" class="cart_btn01">수정</a> </td>
                <td><a href="cart_delete.php?ct_id=<?=$cart[ct_id]?>" class="cart_btn02">삭제</a></td>
            </tr>
            <? $i++;    }?>
        </tbody> 
    </table>
    
    <input type="hidden" name="product_count" value="<?php echo $i;?>">
    </form>

            <script>
            function cartupdate(no){
                f=document.form1;
                f.action="cart_update.php?no="+no;
                f.submit();
            }
            function submitCart(){
                f=document.form1;
                f.action="cart2.php";
                
                for(i=0;i<f.product_count.value;i++){
                    var e = f['cc_6['+i+']'];
                    console.log(e);
                }
                f.submit();
            }
            </script>
            

</div>
<?php
include_once(G5_THEME_PATH.'/tail.php');
?>

 

섹션부분이 잘못된거 같은데

고수님들 도움 부탁드립니다. ㅠ

이 질문에 댓글 쓰기 :

답변 2

on_uid는 영카트에서 따로 생성을 할텐데 해당도 가지고 오셨나요?

넣는 쿼리문에서 해당 값이 제대로 들어가고 있나 확인을 해보셔야 할거 같습니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 123,528 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT