전화문의 체크시 가격 표시하고 싶습니다.

전화문의 체크시 가격 표시하고 싶습니다.

QA

전화문의 체크시 가격 표시하고 싶습니다.

답변 1

본문

shop.lib.php 부분에 상품 전화문의 체크를 해도 가격은 판매가격은 표시하고 싶어서요
시 가격표시부분이 아래 부분인거 같은데 전화문의를 체크하면 상품가격은 0원으로 나오는데요 
상품 페이지에 가격을 표시하고 싶은데 어떻게 해야할까요? 


shop.lib.php

// 금액 표시
function display_price($price, $tel_inq=false)
{
    if ($tel_inq)
        $price = '전화문의';
    else
        $price = number_format($price, 0).'원';
    return $price;
}

// 금액표시
// $it : 상품 배열
function get_price($it)
{
    global $member;
    if ($it['it_tel_inq']) return '전화문의';
    $price = $it['it_price'];
    return (int)$price;
}

 

item.form.skin.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']) { ?>
                <tr>
                    <th scope="row">시중가격</th>
                    <td><?php echo display_price($it['it_cust_price']); ?></td>
                </tr>
                <?php } // 시중가격 끝 ?>
                <tr>
                    <th scope="row">판매가격</th>
                    <td>
                        <?php echo display_price(get_price($it)); ?>
                        <input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
                    </td>
                </tr>

 

이 질문에 댓글 쓰기 :

답변 1



// 금액 표시
function display_price($price, $tel_inq=false)
{
    if ($tel_inq)
        $price = '전화문의'.number_format($price, 0).'원' ; //가격표기 추가
    else
        $price = number_format($price, 0).'원';
    return $price;
}

// 금액표시
// $it : 상품 배열
function get_price($it)
{
    global $member;
    if ($it['it_tel_inq']) return '전화문의'.$it['it_price']; //가격표기 추가
    $price = $it['it_price'];
    return (int)$price;
}

 

이런식으로 적용하시면 됩니다.

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