質問 > フロント機能 > サイトマップページの作成 |
フロント機能
スレッド表示 | 古いものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
DDR |
投稿日時: 2010/11/1 16:52
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/6/21 居住地: 大阪 投稿: 307 |
Re: サイトマップページの作成 flealog様
いつも有難う御座います! なるほどです!tpl側だけで調整できたんですね 申し訳ありません。 無事に実装できました! いつもご丁寧に有難う御座います
|
flealog |
投稿日時: 2010/11/1 15:38
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/6/10 居住地: 投稿: 485 |
Re: サイトマップページの作成 .tpl側で対処ではダメですか?
これで一応、第一階層のカテゴリのみ表示されました。
|
DDR |
投稿日時: 2010/11/1 14:44
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/6/21 居住地: 大阪 投稿: 307 |
Re: サイトマップページの作成 ソースの公開有難う御座います
スムーズに実装まで至りました! カテゴリの数が多い場合などは サイトマップは 親カテゴリだけに留めた方が良いとどこかのサイトで見たのですが 確かに数が多いとCSSで調整しても長くなってしまうので そこで親カテゴリだけの抽出をしたいのですが 書き換えしながら更新してみたのですが、 level1だけを表示させるだけかと思うのですが levelの部分を level == 1 かなと思ったのですが 違うようで、アドバイス頂ければ幸いです。 宜しくお願い致します。
|
flealog |
投稿日時: 2010/1/18 11:41
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/6/10 居住地: 投稿: 485 |
Re: サイトマップページの作成 引用:
私はコミュ版ですので、その違いかもしれませんね^^; 素人なのでWarningの内容でどこが悪いかはさっぱりわかりません。 ごめんなさいm(_ _)m
|
Yasuhiro |
投稿日時: 2010/1/15 13:19
対応状況: −−−
|
半人前 ![]() ![]() 登録日: 2010/1/12 居住地: 新宿区 投稿: 22 |
Re: サイトマップページの作成 ありがとうございます。
早速、ソースを書換えたところ、カテゴリの表示がされそうです。 しかし、ワーニングが出てしまい、うまく表示できません。 EC-CUBEでのデバックも不慣れで、何から何まで聞いてしまって申し訳ございません。 以下のようなワーニングが出ています。 どこを調べれば良いでしょうか? Warning: Invalid argument supplied for foreach() in /home/tomokos-net/www/test/data/class/pages/sitemap/LC_Page_Sitemap.php on line 129 Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/tomokos-net/www/test/data/Smarty/templates_c/tomokos/%%87^871^8714BD12%%index.tpl.php on line 79
|
flealog |
投稿日時: 2010/1/14 18:43
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/6/10 居住地: 投稿: 485 |
Re: サイトマップページの作成 ↑これってカテゴリ以外は取得できてません。
カテゴリ以外も取得するにはLC_Page_Sitemap.phpを参考にしてみてください^^
|
flealog |
投稿日時: 2010/1/14 15:56
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/6/10 居住地: 投稿: 485 |
Re: サイトマップページの作成 ぐはっ!?
編集ミスった・・・orz ソースを参考に少し書き足したら表示されましたよ〜 参考になるようでしたら使ってください^^
|
Yasuhiro |
投稿日時: 2010/1/14 12:20
対応状況: −−−
|
半人前 ![]() ![]() 登録日: 2010/1/12 居住地: 新宿区 投稿: 22 |
Re: サイトマップページの作成 引用:
つまり、全てphp内で処理させる方法ですね? その場合のLC_Page_Sitemap.phpのソースは、どのようになるのでしょうか? http://eccube-customize.xross-cube.com/sitemap/index.php 具体的にこちらのケースでは、どのように記述しているか、参考にさせて下さい。
|
tao_s |
投稿日時: 2010/1/14 5:11
対応状況: −−−
|
仙人 ![]() ![]() 登録日: 2008/8/20 居住地: 東京 投稿: 794 |
Re: サイトマップページの作成 EC-CUBEではinit()の後にprocess()が実行されます。
なので、メインのロジックはprocess()内に書かないとダメですよ。
|
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>
|
(1) 2 3 » |
スレッド表示 | 古いものから | 前のトピック | 次のトピック | トップ |