영카트 레벨별 결제금액 설정 > 영카트5 팁자료실

영카트5 팁자료실

영카트 레벨별 결제금액 설정 정보

영카트 레벨별 결제금액 설정

본문

안녕하세요. 매일 눈팅이랑 필요한것만 쏙 빼가다가
마침 레벨별로 결제금액설정 하는 기능을 써야해서 진행하다가

상품올리는 db table과 카트로 옮기는 db table 이 달라서
업데이트 부분만 찾아내면 쉽게 바꿀수 있겠다 생각하여
해본 결과 생각보다 간단하고 쉽게 바꿀수 있게 되어
초보자분들을 위하여 글을 남깁니다.

방식은 상품올리기할때 최하단부분의 필드를 이용하는 방법입니다.

건드릴 부분은

1.  /skin/shop/basic/item.form.skin.php  테마를 사용하시면 /theme/테마폴더/mobile/skin/shop/basic/item.form.skin.php

2.  /shop/cartupdate.php

3. 가격이 표시되는 파일들 메인 리스트 등
  ex) 1-  /mall/theme/kidstore/mobile/skin/shop/basic/main.10.skin.php
      2-  /mall/theme/kidstore/mobile/skin/shop/basic/list.10.skin.php




1. 상세페이지 아이템폼( /skin/shop/basic/item.form.skin.php )



<?php if ($it['it_origin']) { ?>
            <tr>
                <th scope="row">원산지</th>
                <td><?php echo $it['it_origin']; ?></td>
            </tr>
            <?php } ?>

            <?php if ($it['it_brand']) { ?>
            <tr>
                <th scope="row">브랜드</th>
                <td><?php echo $it['it_brand']; ?></td>
            </tr>
            <?php } ?>
            <?php if ($it['it_model']) { ?>
            <tr>
                <th scope="row">모델</th>
                <td><?php echo $it['it_model']; ?></td>
            </tr>
            <?php } ?>
            <?php if (!$it['it_use']) { // 판매가능이 아닐 경우 ?>
            <tr>
                <th scope="row">판매가격</th>
                <td>판매중지</td>
            </tr>
            <?php } else if ($it['it_tel_inq']) { // 전화문의일 경우 ?>
            <tr>
                <th scope="row">판매가격</th>
                <td>전화문의</td>
            </tr>
            <?php } else { // 전화문의가 아닐 경우?>
            <?php if ($it['it_cust_price']) { // 1.00.03?>
            <tr>
                <th scope="row">시중가격</th>
                <td><SPAN style="text-decoration:line-through;"><?php echo display_price($it['it_cust_price']); ?></SPAN></td>
            </tr>
            <?php } ?>

///////////////////////////여기부터////////////////////////

<? if ($member[mb_level] >= 6 | $is_admin == 'super'){ ?>
           
            <tr>
                <th scope="row">판매가격</th>
                <td>
                    <font style="font-size:18px; font-weight:bold; color:#F3435D;"><?php echo display_price($it['it_1']); ?></font>  //요기와
                    <input type="hidden" id="it_price" value="<?php echo $it['it_1']; ?>">  //요기
                </td>
            </tr>
            
            <? }else { ?>            
            
            <tr>
                <th scope="row">판매가격</th>
                <td>
                    <font style="font-size:18px; font-weight:bold; color:#F3435D;"><?php echo display_price(get_price($it)); ?></font>
                    <input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
                </td>
            </tr>  
                               
            <? } ?>


/////////////////////////////여기까지///////////////////////////

 
            <?php } ?>

            <?php
            /* 재고 표시하는 경우 주석 해제
            <tr>
                <th scope="row">재고수량</th>
                <td><?php echo number_format(get_it_stock_qty($it_id)); ?> 개</td>
            </tr>
            */
            ?>



보시면 알겠지만 it_price 를  레벨6이상일때 it_1 으로 치환시켜
필드1에 적은 판매가격을 보여주는 부분을 1번필드값으로 치환합니다.
간단하죠^^

이정도면 다들 아시겠지만 elseif 문으로 나열하면 레벨에 따른
필드사용이 가능합니다. 생초보분들을 위하여 가벼운 예시를 넣겠습니다.






<?php if ($it['it_origin']) { ?>
            <tr>
                <th scope="row">원산지</th>
                <td><?php echo $it['it_origin']; ?></td>
            </tr>
            <?php } ?>

            <?php if ($it['it_brand']) { ?>
            <tr>
                <th scope="row">브랜드</th>
                <td><?php echo $it['it_brand']; ?></td>
            </tr>
            <?php } ?>
            <?php if ($it['it_model']) { ?>
            <tr>
                <th scope="row">모델</th>
                <td><?php echo $it['it_model']; ?></td>
            </tr>
            <?php } ?>
            <?php if (!$it['it_use']) { // 판매가능이 아닐 경우 ?>
            <tr>
                <th scope="row">판매가격</th>
                <td>판매중지</td>
            </tr>
            <?php } else if ($it['it_tel_inq']) { // 전화문의일 경우 ?>
            <tr>
                <th scope="row">판매가격</th>
                <td>전화문의</td>
            </tr>
            <?php } else { // 전화문의가 아닐 경우?>
            <?php if ($it['it_cust_price']) { // 1.00.03?>
            <tr>
                <th scope="row">시중가격</th>
                <td><SPAN style="text-decoration:line-through;"><?php echo display_price($it['it_cust_price']); ?></SPAN></td>
            </tr>
            <?php } ?>

///////////////////////////여기부터////////////////////////

<? if ($member[mb_level] >= 6 | $is_admin == 'super'){ ?>
           
            <tr>
                <th scope="row">판매가격</th>
                <td>
                    <font style="font-size:18px; font-weight:bold; color:#F3435D;"><?php echo display_price($it['it_1']); ?></font>  //요기와
                    <input type="hidden" id="it_price" value="<?php echo $it['it_1']; ?>">  //요기
                </td>
            </tr>

            <? }elseif ($member[mb_level] >= 4 ){ ?>
            
            <tr>
                <th scope="row">판매가격</th>
                <td>
                    <font style="font-size:18px; font-weight:bold; color:#F3435D;"><?php echo display_price($it['it_2']); ?></font>
                    <input type="hidden" id="it_price" value="<?php echo $it['it_2']; ?>">
                </td>
            </tr>
            

            <? }else { ?>            
            
            <tr>
                <th scope="row">판매가격</th>
                <td>
                    <font style="font-size:18px; font-weight:bold; color:#F3435D;"><?php echo display_price(get_price($it)); ?></font>
                    <input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
                </td>
            </tr>  
                               
            <? } ?>


/////////////////////////////여기까지///////////////////////////

 
            <?php } ?>

            <?php
            /* 재고 표시하는 경우 주석 해제
            <tr>
                <th scope="row">재고수량</th>
                <td><?php echo number_format(get_it_stock_qty($it_id)); ?> 개</td>
            </tr>
            */
            ?>



보시는 것과 같이 4이하일때 일반가격, 4이상 6이하일때 2번필드,
6이상일때 1번필드로 가격이 나오게 됩니다.

주의할 점은 이렇게 코드를 하면 1번,2번 필드를 가격이 같더라도
무조건 작성을 해주어야 합니다.

가령 2번필드가 필요없어 안적었는데 레벨5인분이 상품을 보면 0원으로
표시가 됩니다.





2. 카트업데이트 ( /shop/cartupdate.php )




            // 배송비결제
            if($it['it_sc_type'] == 1)
                $ct_send_cost = 2; // 무료
            else if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
                $ct_send_cost = 1; // 착불
            

///////////////////////////////////////////////////////////318줄 하단정도에/////////////
			
			if ($member[mb_level] >= 6 | $is_admin == 'super'){ 
			
                  $sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_1']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";
				
				}else{

              $sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";
               } 
			   
            
/////////////////////////여기까지//////////////////////////		
			
            $comma = ' , ';
            $ct_count++;
        }

        if($ct_count > 0)
            sql_query($sql);
    }
}





보시면 알겠지만 it_price 를  레벨6이상일때 it_1 으로 치환시켜
필드1 값을 op_price 테이블로 업데이트시켜버리는 것입니다.

이정도면 다들 아시겠지만 elseif 문으로 나열하면 레벨에 따른
필드사용이 가능합니다. 생초보분들을 위하여 가벼운 예시를 넣겠습니다.




            // 배송비결제
            if($it['it_sc_type'] == 1)
                $ct_send_cost = 2; // 무료
            else if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
                $ct_send_cost = 1; // 착불
            

///////////////////////////////////////////////////////////318줄 하단정도에/////////////
			
			if ($member[mb_level] >= 6 | $is_admin == 'super'){ 
			
                  $sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_1']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";

				  
				}elseif ($member[mb_level] >= 4){
                  $sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}',
				   '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_2']}', '$point', '0', '0',
				    '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";
                  
				
				}else{
              $sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";
               } 
			   
            
/////////////////////////여기까지/////////////			
			
            $comma = ' , ';
            $ct_count++;
        }

        if($ct_count > 0)
            sql_query($sql);
    }
}




이것은 4이하일때 일반가격, 4이상 6이하일때 2번필드,
6이상일때 1번필드로 가격이 나오게 됩니다.

주의할 점은 이렇게 코드를 하면 1번,2번 필드를 가격이 같더라도
무조건 작성을 해주어야 합니다.

가령 2번필드가 필요없어 안적었는데 레벨5인분이 상품을 보면 0원으로
업데이트가 됩니다.





3. 가격이 표시되는 파일들 메인 리스트 등
  ex) 1-  /mall/theme/kidstore/mobile/skin/shop/basic/main.10.skin.php
      2-  /mall/theme/kidstore/mobile/skin/shop/basic/list.10.skin.php
      등등







if ($this->view_it_cust_price || $this->view_it_price) {
         
		//레벨별 가격설정
		 
        if ($member[mb_level] >= 6 | $is_admin == 'super'){
			
        echo "<div class=\"sct_cost\">\n";

        if ($this->view_it_cust_price && $row['it_cust_price']) {
            echo "<span class=\"cust_price\">".display_price($row['it_cust_price'])."</span>\n";
        }
        
		
        if ($this->view_it_price) {
           echo display_price($row['it_1'], $row['it_tel_inq'])."\n";  //판매가격을 1번필드로 설정
        }

        echo "</div>\n";
		
		}else{
			
		echo "<div class=\"sct_cost\">\n";

        if ($this->view_it_cust_price && $row['it_cust_price']) {
            echo "<span class=\"cust_price\">".display_price($row['it_cust_price'])."</span>\n";
        }
        
		
		
        if ($this->view_it_price) {
            echo display_price(get_price($row), $row['it_tel_inq'])."\n";
        }

        echo "</div>\n";	
		
		}
		//레벨별 가격설정

    }




mian.10.skin.php등의 파일을 보면

if ($this->view_it_cust_price || $this->view_it_price) 이런식으로 되어있는

부분이 있습니다. 그 가격 부분을 수정하는 것인데 위 처럼 if, else 기본문으로

레벨설정하고 가격 부분에 1번 필드로 치환하면 끝입니다.



와~ 생각보다 팁쓰는일이 힘드네요. 매일 훔쳐가기만하다가 이제야 하나 공유하네요.
고수님들은 이런 쉬운 팁은 필요없으시니 백버튼 눌러주시고 초보님들은 질문하여주시면
시간되는데로 댓글쪽지 나누겠습니다.

감사합니다~
추천
8

댓글 21개

좋은팁 너무 감사합니다 즉시구매는 되는데 장바구니로 가면 판매가격으로 나오게 되는데 그부분을 어떻게 처리해야 할까요
cart.php 혹은 cart.skin.php 중 수정을 해야할텐데 어딜 어떻게 해야할지 모르겠네요 ㅠㅠ
<? }elseif ($member[mb_level] = 5 ){ ?>

           

            <tr>

                <th scope="row">판매가격</th>

                <td>

                    <font style="font-size:18px; font-weight:bold; color:#F3435D;"><?php echo display_price($it['it_3']); ?></font>

                    <input type="hidden" id="it_price" value="<?php echo $it['it_3']; ?>">

                </td>

            </tr>

이경우 5레벨인 경우 필드값 3번째꺼가 출력이 되어야하는거 같은데 필드 2번째값으로 나오네요 ㅠㅠ
전체 391
영카트5 팁자료실 내용 검색

회원로그인

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