[12157] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | *
|
---|
| 4 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
|
---|
| 5 | *
|
---|
| 6 | * http://www.lockon.co.jp/
|
---|
| 7 | *
|
---|
| 8 | * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼
|
---|
| 9 | */
|
---|
| 10 |
|
---|
| 11 | class LC_CatPage {
|
---|
| 12 | function LC_CatPage() {
|
---|
| 13 | /** ɬ¤ºÊѹ¹¤¹¤ë **/
|
---|
| 14 | $this->tpl_mainpage = 'frontparts/bloc/category.tpl'; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
|
---|
| 15 | }
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | $objSubPage = new LC_CatPage();
|
---|
| 19 | $objSubView = new SC_MobileView();
|
---|
| 20 |
|
---|
| 21 | $objSubPage = lfGetMainCat(true, $objSubPage);
|
---|
| 22 |
|
---|
| 23 | $objSubView->assignobj($objSubPage);
|
---|
| 24 | $objSubView->display($objSubPage->tpl_mainpage);
|
---|
| 25 |
|
---|
| 26 | //-----------------------------------------------------------------------------------------------------------------------------------
|
---|
| 27 |
|
---|
| 28 | // ¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼¤Î¼èÆÀ
|
---|
| 29 | function lfGetMainCat($count_check = false, $objSubPage) {
|
---|
| 30 | $objQuery = new SC_Query();
|
---|
| 31 | $col = "*";
|
---|
| 32 | $from = "dtb_category left join dtb_category_total_count using (category_id)";
|
---|
| 33 | // ¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼¤È¤½¤Îľ²¼¤Î¥«¥Æ¥´¥ê¡¼¤ò¼èÆÀ¤¹¤ë¡£
|
---|
| 34 | $where = 'level <= 2 AND del_flg = 0';
|
---|
| 35 | // ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
|
---|
| 36 | if($count_check) {
|
---|
| 37 | $where .= " AND product_count > 0";
|
---|
| 38 | }
|
---|
| 39 | $objQuery->setoption("ORDER BY rank DESC");
|
---|
| 40 | $arrRet = $objQuery->select($col, $from, $where);
|
---|
| 41 |
|
---|
| 42 | // ¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼¤òÃê½Ð¤¹¤ë¡£
|
---|
| 43 | $arrMainCat = array();
|
---|
| 44 | foreach ($arrRet as $cat) {
|
---|
| 45 | if ($cat['level'] != 1) {
|
---|
| 46 | continue;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | // »Ò¥«¥Æ¥´¥ê¡¼¤ò»ý¤Ä¤«¤É¤¦¤«¤òÄ´¤Ù¤ë¡£
|
---|
| 50 | $arrChildrenID = sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']);
|
---|
| 51 | $cat['has_children'] = count($arrChildrenID) > 0;
|
---|
| 52 | $arrMainCat[] = $cat;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | $objSubPage->arrCat = $arrMainCat;
|
---|
| 56 | return $objSubPage;
|
---|
| 57 | }
|
---|
| 58 | ?>
|
---|