pm1122dev의 비밀노트

영카트 상품구매시 바로 재고 차감되도록 본문

그누보드

영카트 상품구매시 바로 재고 차감되도록

pm1122Dev 2021. 1. 25. 15:36
728x90
반응형
shop/orderinquireview.php 파일에서 넣으면 된다.   


$ioSql = sql_query("SELECT * FROM {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' and ct_select = 1 ");

//echo "SELECT * FROM {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' and ct_select = 1 "; 

while($ioRow = sql_fetch_array($ioSql)){
    $ct_qty = $ioRow['ct_qty']; //수량
    $it_id_n = $ioRow['it_id'];
    $io_type = $ioRow['io_type'];
    $io_id = $ioRow['io_id'];
    // 재고에서 뺀다.
    if($io_id) {
        
        $io_query = " update {$g5['g5_shop_item_option_table']}
                    set io_stock_qty = io_stock_qty - '{$ct_qty}'
                    where it_id = '{$it_id_n}'
                    and io_id = '{$io_id}'
                    and io_type = '{$io_type}' ";
        sql_query($io_query);

    } else {
        $io_query = " update {$g5['g5_shop_item_table']}
                    set it_stock_qty = it_stock_qty - '{$ct_qty}'
                    where it_id = '{$it_id_n}' ";
        sql_query($io_query);
    }

    //echo $io_query;
}
728x90
반응형
Comments