회원 등급별 할인율 적용 시 바로구매 문제

회원 등급별 할인율 적용 시 바로구매 문제

QA

회원 등급별 할인율 적용 시 바로구매 문제

답변 2

본문

회원 등급별로 별도의 할인율을 적용해서 사용중입니다.

상품 상세페이지에서 장바구니에 넣어 주문을 하면 결제까지 정상적으로 이루어지는데

상세페이지에서 바로 구매를 사용할 경우 장바구니 금액에 변동 내역이 있습니다. 장바구니를 확인해주세요. 라고 경고창이 뜨면서 장바구니에 상품 목록이 없는 빈 화면만 나오는데 어딜 살펴봐야 할까요?

 

orderform.php에서 


if (function_exists('before_check_cart_price')) {
    if(! before_check_cart_price($tmp_cart_id) ) alert('장바구니 금액에 변동사항이 있습니다.\n장바구니를 다시 확인해 주세요.', G5_SHOP_URL.'/cart.php');
}

 

해당 코드를 삭제하면 주문까지는 이루어지긴 하는데 삭제하면 안될거같아서요.

sql g5_shop_cart에 데이터는 할인이 적용 된 금액으로 정상적으로 들어옵니다.

이 질문에 댓글 쓰기 :

답변 2

/lib/shop.lib.php 파일의 before_check_cart_price 함수를 수정하셔서 

2529라인


        if( $it['it_price'] !== $row['ct_price'] ){
            // 장바구니 테이블 상품 가격과 상품 테이블의 상품 가격이 다를경우
            $update_querys['ct_price'] = $it['it_price'];
        }

부분을 회원 등급에 따라 가격을 새로 계산해서 비교할 수 있도록 변경하셔야 합니다.

제 버전 소스는 조금 다른데


function get_price($it)

{
//레벨별 할인금액 계산 추가
    global $member, $config;
    if ($it['it_tel_inq']) return '전화문의';
    if ($member['mb_level'] >= 10) { 
		$price = $it['it_price10']; 
	} else if ($member['mb_level'] == 9) { 
		$price = $it['it_price9']; 
	} else if ($member['mb_level'] == 8) { 
		$price = $it['it_price8']; 
	} else if ($member['mb_level'] == 7) { 
		$price = $it['it_price7']; 
	} else if ($member['mb_level'] == 6) { 
		$price = $it['it_price6']; 
	} else if ($member['mb_level'] == 5) { 
		$price = $it['it_price5']; 
	} else if ($member['mb_level'] == 4) { 
		$price = $it['it_price'] - ($it['it_price'] * ($config['lev_4_price'] / 100)); 
	} else if ($member['mb_level'] == 3) { 
		$price = $it['it_price'] - ($it['it_price'] * ($config['lev_3_price'] / 100)); 
	} else if ($member['mb_level'] == 2 && $it['it_price2'] > 0) { 
		$price = $it['it_price2'];
	} else {
	$price = $it['it_price']; 
	} 
	return (int)$price; 
}
.
.
.
        if( (int)$it['it_price'] !== (int)$row['ct_price'] ){

            // 장바구니 테이블 상품 가격과 상품 테이블의 상품 가격이 다를경우


            if ($member['mb_level'] == 4) {
            }
            $update_querys['ct_price'] = $it['it_price'];

        }


if( (int)$it['it_price'] !== (int)$row['ct_price'] ) 이부분에 저런식으로 추가해주는게 맞을까요?
저부분을 아예 제거를 해도 장바구니 금액에 변동사항이 있다고 떠서 다른 부분도 함께 봐줘야 하는지 궁금해서요

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