답변 1개
채택된 답변
+20 포인트
7년 전
예전에 제가 그 하위 카테고리를 나오도록 작업해놨습니다.
참고 가 되었으면 합니다.
먼저 listcategory.skin.php 스킨파일을 수정 하셔야 합니다.
</p>
<p><?
$ca_id_len = strlen($ca_id);
$len2 = $ca_id_len + 2;
$len4 = $ca_id_len + 4;</p>
<p>$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)) {</p>
<p> $row2 = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_table']} $sql_common 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' ");</p>
<p>
$str .= '<li>';
$str .= ' <a href="./list.php?ca_id='.$row['ca_id'].'">'.$row['ca_name'].' ('.$row2['cnt'].')</a>';</p>
<p> $sql_sub = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id like '{$row['ca_id']}%' and length(ca_id) = $len4 and ca_use = '1' order by ca_order, ca_id ";
$result_sub = sql_query($sql_sub);</p>
<p> // 아래 카테고리가 있을때만 Display 하도록 한다.
if (mysql_num_rows($result_sub))
{
$str .= ' <div>';
$str .= ' <ul>';</p>
<p> while ($row_sub=sql_fetch_array($result_sub))</p>
<p> $row2_sub = sql_fetch(" select count(*) as cnt from {$g5['g5_shop_item_table']} $sql_common where (ca_id like '{$row_sub['ca_id']}%' or ca_id2 like '{$row_sub['ca_id']}%' or ca_id3 like '{$row_sub['ca_id']}%') and it_use = '1' ");
$str .= ' <li>';
$str .= ' <a href="./list.php?ca_id='.$row_sub['ca_id'].'">'.$row_sub['ca_name'].' ('.$row2_sub['cnt'].')</a>';
$str .= ' </li>';
}</p>
<p> $str .= ' </ul>';
$str .= ' </div>';
}</p>
<p> $str .= '</li>';
$exists = true;</p>
<p>}
?></p>
<p>
1차 분류가 2자리로 되어있다면 그 아래 분류 즉 2차 분류는 4자리고 되어있습니다.
따라서 len4을 추가하여 분류의 4자리를 그아래 에 가지고 오도록 한 예제입니다
http://moasupply.bokslee.com/shop/list.php?ca_id=20">http://moasupply.bokslee.com/shop/list.php?ca_id=20
여기를 참고 해보시기 바랍니다. 이미지와 레이어로 작업을 하였습니다.
1차분류에 마우스를 올리면 그아래 분류가 나오도록 하였습니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
준이징
7년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
적용해보고 안되는저 있으면 한번더 질문드리도록 하겠습니다
너무 감사드립니다