1 | <?php |
---|
2 | /* |
---|
3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
4 | * |
---|
5 | * http://www.lockon.co.jp/ |
---|
6 | */ |
---|
7 | class LC_CatPage { |
---|
8 | function LC_CatPage() { |
---|
9 | /** 必ず変更する **/ |
---|
10 | $this->tpl_mainpage = BLOC_PATH . 'category.tpl'; // メイン |
---|
11 | } |
---|
12 | } |
---|
13 | |
---|
14 | $objSubPage = new LC_CatPage(); |
---|
15 | $objSubView = new SC_SiteView(); |
---|
16 | |
---|
17 | // 選択中のカテゴリIDを判定する |
---|
18 | $category_id = SC_Utils::sfGetCategoryId($_GET['product_id'], $_GET['category_id']); |
---|
19 | |
---|
20 | // 選択中のカテゴリID |
---|
21 | $objSubPage->tpl_category_id = $category_id; |
---|
22 | $objSubPage = lfGetCatTree($category_id, true, $objSubPage); |
---|
23 | |
---|
24 | $objSubView->assignobj($objSubPage); |
---|
25 | $objSubView->display($objSubPage->tpl_mainpage); |
---|
26 | //----------------------------------------------------------------------------------------------------------------------------------- |
---|
27 | // カテゴリツリーの取得 |
---|
28 | function lfGetCatTree($parent_category_id, $count_check = false, $objSubPage) { |
---|
29 | $objQuery = new SC_Query(); |
---|
30 | $col = "*"; |
---|
31 | $from = "dtb_category left join dtb_category_total_count using (category_id)"; |
---|
32 | // 登録商品数のチェック |
---|
33 | if($count_check) { |
---|
34 | $where = "del_flg = 0 AND product_count > 0"; |
---|
35 | } else { |
---|
36 | $where = "del_flg = 0"; |
---|
37 | } |
---|
38 | $objQuery->setoption("ORDER BY rank DESC"); |
---|
39 | $arrRet = $objQuery->select($col, $from, $where); |
---|
40 | |
---|
41 | $arrParentID = SC_Utils::sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id); |
---|
42 | $arrBrothersID = SC_Utils::sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID); |
---|
43 | $arrChildrenID = SC_Utils::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $parent_category_id); |
---|
44 | |
---|
45 | $objSubPage->root_parent_id = $arrParentID[0]; |
---|
46 | |
---|
47 | $arrDispID = array_merge($arrBrothersID, $arrChildrenID); |
---|
48 | |
---|
49 | foreach($arrRet as $key => $array) { |
---|
50 | foreach($arrDispID as $val) { |
---|
51 | if($array['category_id'] == $val) { |
---|
52 | $arrRet[$key]['display'] = 1; |
---|
53 | break; |
---|
54 | } |
---|
55 | } |
---|
56 | } |
---|
57 | |
---|
58 | $objSubPage->arrTree = $arrRet; |
---|
59 | return $objSubPage; |
---|
60 | } |
---|
61 | ?> |
---|