listcategory.skin.php 관련 질문

listcategory.skin.php 관련 질문

QA

listcategory.skin.php 관련 질문

본문

listcategory.skin.php


<?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


<?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

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가지라서 어떤 걸 원하시는 건지??

 

답변을 작성하시기 전에 로그인 해주세요.
전체 16,782
QA 내용 검색

회원로그인

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