skin/shop/basic/listcategory.skin.php에서 ca_id가..

skin/shop/basic/listcategory.skin.php에서 ca_id가..

QA

skin/shop/basic/listcategory.skin.php에서 ca_id가..

답변 2

본문

skin/shop/basic/listcategory.skin.php에서

ca_id가 10 인 1010~10a0까지 있을때 출력되는 분류명을

1010 ~1050까지 따로 디자인해서 출력되게 하고

1060~1080까지 따로 디자인해서 출력되게 하고

1090~10a0까지 따로 디자인해서 출력되게 하고 싶습니다.



10을 (도서아울렛) 누르면

첫번째-(1010)유아그림책  (1020)유아학습책 (1030)창작동화  (1040)옛이야기  (1050)생활,인성

두번째-(1060)외국창작  (1070)명작,문학  (1080)인물,위인

세번째-(1090)1~2학년  10a0)3~4학년

이렇게 3개로 나누어서 출력되게하고 싶습니다.


1.jpg
 




<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$str = '';
$exists = false;

$ca_id_len = strlen($ca_id);
$len2 = $ca_id_len + 2;
$len4 = $ca_id_len + 4;

$sql = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id like '$ca_id%' and length(ca_id) = $len2 and ca_use = '1' order by ca_order, ca_id ";
$result = sql_query($sql);
while ($row=sql_fetch_array($result)) {

    $row2 = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_table']} where (ca_id like '{$row['ca_id']}%' or ca_id2 like '{$row['ca_id']}%' or ca_id3 like '{$row['ca_id']}%') and it_use = '1'  ");

    $str .= '<li><a href="./list.php?ca_id='.$row['ca_id'].'">'.$row['ca_name'].' ('.$row2['cnt'].')</a></li>';
    $exists = true;
}

if ($exists) {

    // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
    add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>

<!-- 상품분류 1 시작 { -->
<aside id="sct_ct_1" class="sct_ct">
    <h2>현재 상품 분류와 관련된 분류</h2>
    <ul>
        <?php echo $str; ?>
    </ul>
</aside>
<!-- } 상품분류 1 끝 -->

<?php } ?>


위에 while문안에서 이리해보고 저리해봐도 막히네요.





이 질문에 댓글 쓰기 :

답변 2

동작여부는 체크 안해봤습니다.



<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$str = '';
$exists = false;

$ca_id_len = strlen($ca_id);
$len2 = $ca_id_len + 2;
$len4 = $ca_id_len + 4;

$sql = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id like '$ca_id%' and length(ca_id) = $len2 and ca_use = '1' order by ca_id ";
$result = sql_query($sql);
while ($row=sql_fetch_array($result)) {

    $row2 = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_table']} where (ca_id like '{$row['ca_id']}%' or ca_id2 like '{$row['ca_id']}%' or ca_id3 like '{$row['ca_id']}%') and it_use = '1'  ");
    if($row['ca_id'] <= "1050" ){
        $str1 .= '<li><a href="./list.php?ca_id='.$row['ca_id'].'">'.$row['ca_name'].' ('.$row2['cnt'].')</a></li>';
    }elseif($row['ca_id'] <= "1080" ){
        $str2 .= '<li><a href="./list.php?ca_id='.$row['ca_id'].'">'.$row['ca_name'].' ('.$row2['cnt'].')</a></li>';
    }else{
        $str3 .= '<li><a href="./list.php?ca_id='.$row['ca_id'].'">'.$row['ca_name'].' ('.$row2['cnt'].')</a></li>';
    }

    $exists = true;
}

if ($exists) {

    // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
    add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>

<!-- 상품분류 1 시작 { -->
<aside id="sct_ct_1" class="sct_ct">
    <h2>현재 상품 분류와 관련된 분류</h2>
    <ul>
        <?php echo $str1; ?>
    </ul>
    <ul>
        <?php echo $str2; ?>
    </ul>
    <ul>
        <?php echo $str3; ?>
    </ul>

</aside>
<!-- } 상품분류 1 끝 -->

<?php } ?>
빨간색의 소스를 보시면
코드 값에 따라,
$str1에는 1050보다 같거나 작은 카테고리
$str2에는 1080보다 같거나 작은 카테고리
$str3에는 에는 남어지 카테고리 들이 담겨져 있습니다.
html 부분에서 잘 분리만 하시면됩니다.
답변을 작성하시기 전에 로그인 해주세요.
전체 2
© SIRSOFT
현재 페이지 제일 처음으로