상품포인트 계산할때 $trunc

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
상품포인트 계산할때 $trunc

QA

상품포인트 계산할때 $trunc

본문

shop.lib.php 에서

 

// 상품포인트
function get_item_point($it, $io_id='', $trunc=10)
{
    global $g5;

    $it_point = 0;

    if($it['it_point_type'] > 0) {
        $it_price = $it['it_price'];

        if($it['it_point_type'] == 2 && $io_id) {
            $sql = " select io_id, io_price
                        from {$g5['g5_shop_item_option_table']}
                        where it_id = '{$it['it_id']}'
                          and io_id = '$io_id'
                          and io_type = '0'
                          and io_use = '1' ";
            $opt = sql_fetch($sql);

            if($opt['io_id'])
                $it_price += $opt['io_price'];
        }

        $it_point = ceil(($it_price * ($it['it_point'] / 100) / $trunc)) * $trunc;
    } else {
        $it_point = $it['it_point'];
    }

    return $it_point;
}

 

부분에서

 

$it_point = ceil(($it_price * ($it['it_point'] / 100) / $trunc)) * $trunc;

 

$trunc를 왜 나눴다가 다시 곱하는걸까요? 

이 질문에 댓글 쓰기 :

답변 1

10자리 절삭 하기위한 부분인데 

 

포인트가 96 나오면 90 이렇게 지급하게 됩니다.

 

function get_item_point($it, $io_id='', $trunc=1) 이렇게 변경하시면 

 

1자리까지 지급하고요


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

회원로그인

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