| 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 = 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 = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id); |
|---|
| 42 | $arrBrothersID = sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID); |
|---|
| 43 | $arrChildrenID = 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 | ?> |
|---|