Warning: Undefined array key "mobile_dir" in /home/kagla/new-sir/old/common.php on line 315
장바구니 동일 옵션 중복을 따로 저장하는 방법

장바구니 동일 옵션 중복을 따로 저장하는 방법

장바구니 동일 옵션 중복을 따로 저장하는 방법

QA

장바구니 동일 옵션 중복을 따로 저장하는 방법

답변 2

본문

 // 동일옵션의 상품이 있으면 수량 더함

            $sql2 = " select ct_id, io_type, ct_qty

                        from {$g5['g5_shop_cart_table']}

                        where od_id = '$tmp_cart_id'

                          and it_id = '$it_id'

                          and io_id = '$io_id'

                          and ct_status = '쇼핑' ";

            $row2 = sql_fetch($sql2);

            if($row2['ct_id']) {

                if($it_id != $it_id) { 

                    $sql3 = " INSERT INTO {$g5['g5_shop_cart_table']}

                            ( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty,  it_qty_sub, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_method_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select, ct_select_time,ct_title,ct_msg, ct_file, advice)

                             VALUES ";

                             sql_query($sql3);

                        }

               

                // $sql3 = " update {$g5['g5_shop_cart_table']}

                //             set ct_qty = ct_qty + '$ct_qty'

                //             where ct_id = '{$row2['ct_id']}' ";

                // sql_query($sql3);

                continue;

            }

 

 

안녕하세요 위와같이 코드를 짰는데...

안먹히네요 어디가 잘못된건가요 ㅠㅠ

재고부분은 필요 없어서 날렸습니다..

 

이 질문에 댓글 쓰기 :

답변 2

if($it_id != $it_id) { 

                    $sql3 = " INSERT INTO {$g5['g5_shop_cart_table']}

                            ( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty,  it_qty_sub, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_method_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select, ct_select_time,ct_title,ct_msg, ct_file, advice)

                             VALUES ";

                             sql_query($sql3);

                        }

               

                // $sql3 = " update {$g5['g5_shop_cart_table']}

                //             set ct_qty = ct_qty + '$ct_qty'

                //             where ct_id = '{$row2['ct_id']}' ";

                // sql_query($sql3);

 

이 부분을..  대략 아래처럼 해야할 듯 하네요. 테스트는 안해봄.


    if($it_id != $it_id) { 
        $sql3 = " INSERT INTO {$g5['g5_shop_cart_table']}
                ( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty,  it_qty_sub, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_method_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select, ct_select_time,ct_title,ct_msg, ct_file, advice)
                    VALUES ";
                    sql_query($sql3);
    }else{
        $ct_qty = $row2['ct_qty'];
        $sql3 = " update {$g5['g5_shop_cart_table']}
                    set ct_qty = ct_qty + '$ct_qty'
                    where ct_id = '{$row2['ct_id']}' ";
        sql_query($sql3);
    }
 

주석 처리한 부분은 위에 값넣는걸로 동일하게 변경해보세요.

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 129,406
© SIRSOFT
현재 페이지 제일 처음으로