diff --git a/lib/shop.data.lib.php b/lib/shop.data.lib.php
index 4eef513b1..1cc638768 100644
--- a/lib/shop.data.lib.php
+++ b/lib/shop.data.lib.php
@@ -82,9 +82,49 @@ function get_shop_navigation_data($is_cache, $ca_id, $ca_id2='', $ca_id3=''){
}
}
+ // 공통 전체 분류 트리는 기존 3단계 구조를 유지하고 현재 경로의 깊은 단계만 조회한다.
+ for ($depth = 4; $depth <= 5 && strlen($ca_id) >= $depth * 2; $depth++) {
+ $parent = substr($ca_id, 0, ($depth - 1) * 2);
+ $result = sql_query(get_shop_category_sql($parent, $depth * 2));
+ while ($row = sql_fetch_array($result)) {
+ $row['url'] = shop_category_url($row['ca_id']);
+ $datas[$depth - 1][] = $row;
+ }
+ }
+
return $datas;
}
+// 4·5단계에서는 선택 경로의 5단계를 우선 표시하고, 없으면 4단계 형제를 표시한다.
+function get_shop_category_menu_groups($ca_id)
+{
+ $length = strlen($ca_id);
+ $groups = array();
+ if ($length >= 8) {
+ $queries = array(
+ array('5단계 분류', substr($ca_id, 0, 8), 10),
+ array('4단계 분류', substr($ca_id, 0, 6), 8),
+ );
+ } else {
+ $queries = array(array('하위 분류', $ca_id, $length + 2));
+ }
+ foreach ($queries as $query) {
+ $rows = array();
+ $result = sql_query(get_shop_category_sql($query[1], $query[2]));
+ while ($row = sql_fetch_array($result)) $rows[] = $row;
+ if (!$rows && $length < 8) {
+ $query[0] = '현재 단계 분류';
+ $result = sql_query(get_shop_category_sql(substr($ca_id, 0, -2), $length));
+ while ($row = sql_fetch_array($result)) $rows[] = $row;
+ }
+ if ($rows) {
+ $groups[] = array('label' => $query[0], 'categories' => $rows);
+ break;
+ }
+ }
+ return $groups;
+}
+
function get_shop_category_by($is_cache, $case, $value){
if( $case === 'ca_id' ){
@@ -268,4 +308,4 @@ function get_shop_item_options($it_id, $subject, $no)
}
return $str;
-}
\ No newline at end of file
+}
diff --git a/mobile/skin/shop/basic/listcategory.skin.php b/mobile/skin/shop/basic/listcategory.skin.php
index ddd995594..f966ab733 100644
--- a/mobile/skin/shop/basic/listcategory.skin.php
+++ b/mobile/skin/shop/basic/listcategory.skin.php
@@ -1,44 +1,25 @@
'.$row['ca_name'].' '.$row2['cnt'].'';
- $exists = true;
-}
-
-if ($exists) {
-
- // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
+$category_groups = get_shop_category_menu_groups($ca_id);
+if ($category_groups) {
add_stylesheet('', 0);
?>
-
-
-
-
-'.$row['ca_name'].' ('.$row2['cnt'].')';
- $exists = true;
-}
-
-if ($exists) {
-
- // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
+$category_groups = get_shop_category_menu_groups($ca_id);
+if ($category_groups) {
add_stylesheet('', 0);
?>
-
-
-
-
- substr($ca_id,0,2),
- 'ca_id2' => substr($ca_id,0,4),
- 'ca_id3' => substr($ca_id,0,6),
- );
-} else if( $is_item_view && isset($it) && is_array($it) ) {
- $navi_datas = get_shop_navigation_data(true, $it['ca_id']);
- $ca_ids = array(
- 'ca_id' => substr($it['ca_id'],0,2),
- 'ca_id2' => substr($it['ca_id'],0,4),
- 'ca_id3' => substr($it['ca_id'],0,6)
- );
-}
+$is_item_view = (isset($it_id, $it['it_id']) && $it_id === $it['it_id']);
+$navigation_ca_id = $is_item_view ? $it['ca_id'] : $ca_id;
+$navi_datas = $navigation_ca_id ? get_shop_navigation_data(true, $navigation_ca_id) : array();
$location_class = array();
if($is_item_view){
@@ -27,7 +12,7 @@ if($is_item_view){
$location_class[] = 'is_list is_right'; // view_location는 리스트 말고 상품보기에서만 표시
}
-// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
+// add_stylesheet('css 구문', 출력순서);
add_stylesheet('', 0);
add_javascript('', 10);
?>
@@ -37,26 +22,14 @@ add_javascript('
-
-
-
-
+ $categories) {
+ $selected_ca_id = substr($navigation_ca_id, 0, ($depth + 1) * 2);
+ if ($depth > 0) { ?>
-
-
-
-