バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

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

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
Yasuhiro
投稿日時: 2010/1/13 18:49
対応状況: −−−
半人前
登録日: 2010/1/12
居住地: 新宿区
投稿: 22
Re: サイトマップページの作成
以下の手順で、サイトマップページを作成しようとしていますが、商品カテゴリの表示のみ上手く行きません。
どこが悪いのでしょうか?

1.呼出用ファイル作成
/html/sitemap/index.php
/data/class_extends/pages/sitemap/LC_Page_Sitemap_Ex.php
/data/class/pages/sitemap/LC_Page_Sitemap.php

2.DBの変更
dtb_pagelayoutにサイトマップを追加

3.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();

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

$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;
}
}
?>

4.サイトマップのページ詳細設定の内容
<div id="undercolumn">
<div id="listtitle">
<h2>サイトマップ</h2>
</div>
<div>
<ul>
<li><a href="<!--{$smarty.const.SITE_URL}-->">トップページ</a></li>
<li><a href="<!--{$smarty.const.URL_DIR}-->products/list.php">全商品</a></li>
<!--{assign var=preLev value=1}-->
<!--{assign var=firstdone value=0}-->
<!--{section name=cnt loop=$arrTree}-->
<!--{assign var=level value=`$arrTree[cnt].level`}-->
<!--{assign var=levdiff value=`$level-$preLev`}-->
<!--{if $levdiff > 0}-->
<ul>
<!--{elseif $levdiff == 0 && $firstdone == 1}-->
</li>
<!--{elseif $levdiff < 0}-->
<!--{section name=d loop=`$levdiff*-1`}-->
</li>
</ul>
<!--{/section}-->
</li>
<!--{/if}-->
<li class="level<!--{$level}--><!--{if in_array($arrTree[cnt].category_id, $tpl_category_id) }--> onmark<!--{/if}-->"><a href="<!--{$smarty.const.URL_DIR}-->products/list.php?category_id=<!--{$arrTree[cnt].category_id}-->"<!--{if in_array($arrTree[cnt].category_id, $tpl_category_id) }--> class="onlink"<!--{/if}-->><!--{$arrTree[cnt].category_name|escape}-->(<!--{$arrTree[cnt].product_count|default:0}-->)</a>
<!--{if $firstdone == 0}--><!--{assign var=firstdone value=1}--><!--{/if}-->
<!--{assign var=preLev value=`$level`}-->
<!--{* セクションの最後に閉じタグを追加 *}-->
<!--{if $smarty.section.cnt.last}-->
<!--{if $preLev-1 > 0 }-->
<!--{section name=d loop=`$preLev-1`}-->
</li>
</ul>
<!--{/section}-->
</li>
<!--{else}-->
</li>
<!--{/if}-->
<!--{/if}-->
<!--{/section}-->
<li><a href="<!--{$smarty.const.URL_DIR}-->abouts/index.php">当サイトについて</a></li>
<li><a href="<!--{$smarty.const.SSL_URL}-->contact/index.php">お問い合わせ</a></li>
<li><a href="<!--{$smarty.const.URL_DIR}-->order/index.php">特定商取引に関する法律</a></li>
<li><a href="<!--{$smarty.const.URL_DIR}-->sitemap/index.php">サイトマップ</a></li>
</ul>
</div>
<div>


----------------
Yasuhiro Suzuki
http://www.nishi-shinjuku.net/

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


題名 投稿者 日時
   サイトマップページの作成 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プラグイン

統計情報

総メンバー数は88,711名です
総投稿数は109,948件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1638
8
red
1570
9
mcontact
1285
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.