listcategory.skin.php 관련 질문 채택완료

listcategory.skin.php

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

$str = '';
$exists = false;

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

// 추가된 부분​
 if ($ca_id_len == 6)
    $len2 = $ca_id_len;
// 추가된 부분​

 

$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)) {
    if (preg_match("/^{$row['ca_id']}/", $ca_id))
        $sct_ct_here = 'sct_ct_here';
    else

    $sct_ct_here = '';

    $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="'.shop_category_url($row['ca_id']).'" class="'.$sct_ct_here.'">'.$row['ca_name'].' ('.$row2['cnt'].')</a></li>';
    $exists = true;    
}

if ($exists) {

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

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

<?php } ?>

listcategory3.php

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

$str = '';
$exists = false;

$depth2_ca_id = substr($ca_id, 0, 2);

$sql = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id like '${depth2_ca_id}%' and length(ca_id) = 4 and ca_use = '1' order by ca_order, ca_id ";
$result = sql_query($sql);
while ($row=sql_fetch_array($result)) {
    if (preg_match("/^{$row['ca_id']}/", $ca_id))
        $sct_ct_here = 'sct_ct_here';
    else
    $sct_ct_here = '';

    $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="'.shop_category_url($row['ca_id']).'" class="'.$sct_ct_here.'">'.$row['ca_name'].' ('.$row2['cnt'].')</a></li>';
    $exists = true;
}

if ($exists) {

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


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

<?php } ?>

위 listcategory.skin.php를 수정하거나 ( 3차는 보여주나 선택된 3차만 보여줌 선택된것 외 모두 보이게 하고 싶은 부분 )

아래 listcategory3.skin.php을  수정해서

 listcategory3.skin.php과 같이 1차에서 2차를 모두 보여주고 선택한 2차를 반전해주는 것을 

1차에서 2차 보여주고 2차에서 3차 보여주고 선택된 3차는 반전되게 보여주려고 합니다.

어디를 수정해야 할까요..

 

 

 

 

 

답변 1개

채택된 답변
+20 포인트

1. 아래와 같이 수정

if ($ca_id_len == 6) {

  $len2 = $ca_id_len;

  $ca_id_tmp = substr($ca_id, 0, 6);

} else {

  $ca_id_tmp = $ca_id;

}

 

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

 

2. 질문이 2가지라서 어떤 걸 원하시는 건지??

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

해결 했습니다..
답변감사합니다..

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고