バージョン選択

フォーラム

メニュー

オンライン状況

130 人のユーザが現在オンラインです。 (119 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 130
もっと...

サイト内検索

質問 > フロント機能 > サイトマップページの作成

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
flealog
投稿日時: 2010/1/14 15:56
対応状況: −−−
仙人
登録日: 2008/6/10
居住地:
投稿: 485
Re: サイトマップページの作成
ぐはっ!?
編集ミスった・・・orz

ソースを参考に少し書き足したら表示されましたよ〜
参考になるようでしたら使ってください^^

LC_Page_Sitemap.php

<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

// {{{ requires
require_once(CLASS_PATH . "pages/LC_Page.php");

/**
* サイトマップ のページクラス.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Entry_Kiyaku.php 16741 2007-11-08 00:43:24Z adachi $
*/
class LC_Page_Sitemap extends LC_Page {

    // {{{ properties

    /** ページナンバー */
    var $tpl_pageno;

    // }}}
    // {{{ functions

    /**
    * Page を初期化する.
    *
    * @return void
    */
    function init() {
        parent::init();
        $this->tpl_mainpage = 'sitemap/index.tpl';
        $this->tpl_title = "サイトマップ";
    }

    /**
    * Page のプロセス.
    *
    * @return void
    */
    function process() {
        $objView = new SC_SiteView();
        $objQuery = new SC_Query();
        $objCustomer = new SC_Customer();
        $objDb = new SC_Helper_DB_Ex();

        // レイアウトデザインを取得
        $objLayout = new SC_Helper_PageLayout_Ex();
        $objLayout->sfGetPageLayout($this, false, "sitemap/index.php");

        $this->lfGetCatTree($this->tpl_category_id, true, $this);

        $objView->assignobj($this);
        $objView->display(SITE_FRAME);
    }

    /**
    * モバイルページを初期化する.
    *
    * @return void
    */
    function mobileInit() {
        $this->init();
    }

    /**
    * Page のプロセス(モバイル).
    *
    * @return void
    */
    function mobileProcess() {
        $objView = new SC_MobileView();
        $objCustomer = new SC_Customer();

        $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
        $next = $offset;

        // レイアウトデザインを取得
        $objLayout = new SC_Helper_PageLayout_Ex();
        $objLayout->sfGetPageLayout($this, false, "sitemap/index.php");

        $objView->assignobj($this);
        $objView->display(SITE_FRAME);
    }

    /**
    * デストラクタ.
    *
    * @return void
    */
    function destroy() {
        parent::destroy();
    }

    // カテゴリツリーの取得
    function lfGetCatTree($arrParent_category_id, $count_check = false) {
        $objQuery = new SC_Query();
        $objDb = new SC_Helper_DB_Ex();
        $col = "*";
        $from = "dtb_category left join dtb_category_total_count using (category_id)";
        // 登録商品数のチェック
        if($count_check) {
            $where = "del_flg = 0 AND product_count > 0";
        } else {
            $where = "del_flg = 0";
        }
        $objQuery->setoption("ORDER BY rank DESC");
        $arrRet = $objQuery->select($col, $from, $where);

        foreach ($arrParent_category_id as $category_id) {
            $arrParentID = $objDb->sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id);
            $arrBrothersID = SC_Utils_Ex::sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID);
            $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $category_id);

            $this->root_parent_id[] = $arrParentID[0];

            $arrDispID = array_merge($arrBrothersID, $arrChildrenID);

            foreach($arrRet as $key => $array) {
                foreach($arrDispID as $val) {
                    if($array['category_id'] == $val) {
                        $arrRet[$key]['display'] = 1;
                        break;
                    }
                }
            }
        }

        $this->arrTree = $arrRet;
    }

    // メインカテゴリーの取得
    function lfGetMainCat($count_check = false, &$objSubPage) {
        $objQuery = new SC_Query();
        $col = "*";
        $from = "dtb_category left join dtb_category_total_count using (category_id)";
        // メインカテゴリーとその直下のカテゴリーを取得する。
        $where = 'level <= 2 AND del_flg = 0';
        // 登録商品数のチェック
        if($count_check) {
            $where .= " AND product_count > 0";
        }
        $objQuery->setoption("ORDER BY rank DESC");
        $arrRet = $objQuery->select($col, $from, $where);

        // メインカテゴリーを抽出する。
        $arrMainCat = array();
        foreach ($arrRet as $cat) {
            if ($cat['level'] != 1) {
                continue;
            }

            // 子カテゴリーを持つかどうかを調べる。
            $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']);
            $cat['has_children'] = count($arrChildrenID) > 0;
            $arrMainCat[] = $cat;
        }

        $objSubPage->arrCat = $arrMainCat;
        return $objSubPage;
    }
}
?>


----------------
EC-CUBE3っぽいテンプレート
GitHub で公開中
https://github.com/bluestylejp

お問い合わせ番号CSV登録&メール送信プラグイン
http://urx.red/qDT6

フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   サイトマップページの作成 Yasuhiro 2010/1/12 15:21
     Re: サイトマップページの作成 seasoft 2010/1/12 16:19
       Re: サイトマップページの作成 Yasuhiro 2010/1/12 16:38
         Re: サイトマップページの作成 seasoft 2010/1/12 16:47
           Re: サイトマップページの作成 Yasuhiro 2010/1/12 17:37
             Re: サイトマップページの作成 seasoft 2010/1/12 17:47
               Re: サイトマップページの作成 tao_s 2010/1/12 17:57
     Re: サイトマップページの作成 AMUAMU 2010/1/12 16:39
       Re: サイトマップページの作成 Yasuhiro 2010/1/12 18:04
         Re: サイトマップページの作成 tao_s 2010/1/12 21:22
           Re: サイトマップページの作成 tao_s 2010/1/13 4:17
             Re: サイトマップページの作成 Yasuhiro 2010/1/13 12:31
               Re: サイトマップページの作成 tao_s 2010/1/13 14:57
                 Re: サイトマップページの作成 Yasuhiro 2010/1/13 18:49
                   Re: サイトマップページの作成 tao_s 2010/1/14 5:11
                     Re: サイトマップページの作成 Yasuhiro 2010/1/14 12:20
                     » Re: サイトマップページの作成 flealog 2010/1/14 15:56
                         Re: サイトマップページの作成 flealog 2010/1/14 18:43
                         Re: サイトマップページの作成 Yasuhiro 2010/1/15 13:19
                           Re: サイトマップページの作成 flealog 2010/1/18 11:41
                             Re: サイトマップページの作成 DDR 2010/11/1 14:44
                               Re: サイトマップページの作成 flealog 2010/11/1 15:38
                                 Re: サイトマップページの作成 DDR 2010/11/1 16:52
     Re: サイトマップページの作成 zibaj 2010/1/12 17:38
       Re: サイトマップページの作成 Yasuhiro 2010/1/12 18:07
         Re: サイトマップページの作成 seasoft 2010/1/12 18:13

 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は90,032名です
総投稿数は110,282件です

投稿数ランキング

1
seasoft
7369
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1677
8
red
1570
9
mcontact
1343
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.