Changeset 22589
- Timestamp:
- 2013/03/01 10:01:07 (11 years ago)
- Location:
- branches/version-2_12-dev/data/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_Category.php
r22588 r22589 31 31 class SC_Helper_Category 32 32 { 33 private $count_check; 34 35 /** 36 * コンストラクター 37 * 38 * @param boolean $count_check 登録商品数をチェックする場合はtrue 39 */ 40 function __construct($count_check = FALSE) 41 { 42 $this->count_check = $count_check; 43 } 44 33 45 /** 34 46 * カテゴリー一覧の取得. 35 47 * 36 * @param boolean $count_check 登録商品数をチェックする場合はtrue37 48 * @param boolean $cid_to_key 配列のキーをカテゴリーIDにする場合はtrue 38 49 * @return array カテゴリー一覧の配列 39 50 */ 40 public function getList($c ount_check = FALSE, $cid_to_key = FALSE)51 public function getList($cid_to_key = FALSE) 41 52 { 42 53 $objQuery =& SC_Query_Ex::getSingletonInstance(); … … 44 55 $from = 'dtb_category left join dtb_category_total_count ON dtb_category.category_id = dtb_category_total_count.category_id'; 45 56 // 登録商品数のチェック 46 if ($ count_check) {57 if ($this->count_check) { 47 58 $where = 'del_flg = 0 AND product_count > 0'; 48 59 } else { … … 54 65 if ($cid_to_key) { 55 66 // 配列のキーをカテゴリーIDに 56 $arrTmp = array(); 57 foreach ($arrCategory as $category) { 58 $arrTmp[$category['category_id']] = $category; 59 } 60 $arrCategory =& $arrTmp; 61 unset($arrTmp); 67 $arrCategory = SC_Utils_Ex::makeArrayIDToKey('category_id', $arrCategory); 62 68 } 63 69 … … 68 74 * カテゴリーツリーの取得. 69 75 * 70 * @param boolean $count_check 登録商品数をチェックする場合はtrue71 76 * @return type 72 77 */ 73 public function getTree( $count_check = FALSE)78 public function getTree() 74 79 { 75 $arrList = $this->getList( $count_check);80 $arrList = $this->getList(); 76 81 $arrTree = SC_Utils_Ex::buildTree('category_id', 'parent_category_id', LEVEL_MAX, $arrList); 77 82 return $arrTree; -
branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php
r22588 r22589 131 131 { 132 132 $objDb = new SC_Helper_DB_Ex(); 133 $objCategory = new SC_Helper_Category_Ex( );134 $arrTree = $objCategory->getTree( $count_check);135 136 $arrCategory = $objCategory->getList( $count_check);133 $objCategory = new SC_Helper_Category_Ex($count_check); 134 $arrTree = $objCategory->getTree(); 135 136 $arrCategory = $objCategory->getList(); 137 137 foreach ($arrParentCategoryId as $category_id) { 138 138 $arrParentID = $objDb->sfGetParents( -
branches/version-2_12-dev/data/class/util/SC_Utils.php
r22586 r22589 1924 1924 1925 1925 /** 1926 * カテゴリーツリー状の配列を作成. 1926 1927 * 1927 1928 * @param string $primary_key … … 1966 1967 } 1967 1968 } 1969 1970 /** 1971 * 配列のキーをIDにした配列を作成. 1972 * 1973 * @param string $ID_name IDが格納されているキー名 1974 * @param array $correction 元の配列 1975 * @return array 1976 */ 1977 public static function makeArrayIDToKey($ID_name, $correction = array()) 1978 { 1979 $arrTmp = array(); 1980 foreach ($correction as $item) { 1981 $arrTmp[$item[$ID_name]] = $item; 1982 } 1983 $return =& $arrTmp; 1984 unset($arrTmp); 1985 return $return; 1986 } 1968 1987 }
Note: See TracChangeset
for help on using the changeset viewer.