채택완료

상품분류와 상세페이지에 1차분류 모두 뿌릴려면..

2016-09-28 (수) 13:40:51 5,386

navigation.skin.php 이파일을 수정하면 될거 같은데 초보라 잘 모르겠습니다.

해당 분류만 뿌려지는거 같은데 해당 분류외에도 모든 1차분류를 뿌리고 싶습니다..가능하다면 해당분류에는 진하게표시(페이지유지?)되면 더욱좋구요..

도움부탁드립니당..ㅠ.ㅠ

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

if ($ca_id)
{
    $navigation = $bar = "";
    $len = strlen($ca_id) / 2;
    for ($i=1; $i<=$len; $i++)
    {
        $code = substr($ca_id,0,$i*2);

        $sql = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '$code' ";
        $row = sql_fetch($sql);

        $sct_here = '';
        if ($ca_id == $code) // 현재 분류와 일치하면
            $sct_here = 'sct_here';

        if ($i != $len) // 현재 위치의 마지막 단계가 아니라면
            $sct_bg = 'sct_bg';
        else $sct_bg = '';

        $navigation .= $bar.'<a href="./list.php?ca_id='.$code.'" class="'.$sct_here.' '.$sct_bg.'">'.$row['ca_name'].'</a>';
    }
}
else
    $navigation = $g5['title'];

//if ($it_id) $navigation .= " > $it[it_name]";

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

<div id="sct_location">
    <a href='<?php echo G5_SHOP_URL; ?>/' class="sct_bg">Home</a>
    <?php echo $navigation; ?>
</div>
 

|

답변 1개

채택된 답변
+20 포인트

navigation.skin.php 는  

현재 카테고리의 상위를 나타나는  부분이구요.

navigation.skin.php

파일을 수정하셔야 합니다. 

Copy
$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 ";
 

을

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

로 변경하시면 1차 모든 카테고리가 나옵니다.

파일 위치는 스킨폴더 내에 존재합니다. 설정하신 shop 스킨폴더 내에서 해당 파일을 찾을 수 있습니다. 

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