Ignore:
Timestamp:
2013/02/28 09:30:36 (11 years ago)
Author:
pineray
Message:

#2166 カテゴリーツリーのデータをツリー状に取得

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php

    r22567 r22586  
    132132        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    133133        $objDb = new SC_Helper_DB_Ex(); 
     134 
    134135        $col = '*'; 
    135136        $from = 'dtb_category left join dtb_category_total_count ON dtb_category.category_id = dtb_category_total_count.category_id'; 
     
    142143        $objQuery->setOption('ORDER BY rank DESC'); 
    143144        $arrRet = $objQuery->select($col, $from, $where); 
     145 
     146        $arrTree = SC_Utils_Ex::buildTree('category_id', 'parent_category_id', 10, $arrRet); 
     147 
    144148        foreach ($arrParentCategoryId as $category_id) { 
    145149            $arrParentID = $objDb->sfGetParents( 
     
    162166            ); 
    163167            $this->root_parent_id[] = $arrParentID[0]; 
    164             $arrDispID = array_merge($arrBrothersID, $arrChildrenID); 
    165             foreach ($arrRet as &$arrCategory) { 
    166                 if (in_array($arrCategory['category_id'], $arrDispID)) { 
    167                     $arrCategory['display'] = 1; 
    168                 } 
    169             } 
    170         } 
    171         return $arrRet; 
     168            $this->arrDispID = array_merge($arrBrothersID, $arrChildrenID); 
     169        } 
     170 
     171        return $arrTree; 
    172172    } 
    173173 
Note: See TracChangeset for help on using the changeset viewer.