引用:
デフォルトで用意されている商品検索ブロックで$arrMakerListをdumpすると表示されたので新規のブロックでも実装できるものと思っておりましたが新規ブロックでdumpしたところNULLでした^^;
そこで調べてみたところ以下のファイルが出力しておりました。
/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php
ひとまずこれを複製しLC_Page_FrontParts_Bloc_SearchProducts.php2で保存し表示するtplファイルを変えました。
新規ブロックを作成した際にtplしか作成されていないのですがこれをからませるにはどのような手順になるのでしょうか?
この記事を見て、おぉ・・・ぜひ実装したいと思いやってみました^^
きっかけを与えてもらったので恩返しです。♪
管理ページでmaker.tplを作成。
/html/frontparts/bloc/maker.php
/data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Maker_Ex.php
を他のファイルからコピーして作成
やり方はここ(フォーラム)で何度も出てます。
わからなかったら調べてください^^
/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Maker.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/frontparts/bloc/LC_Page_FrontParts_Bloc.php");
/**
* メーカー のページクラス.
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id:LC_Page_FrontParts_Bloc_Maker.php 15532 2007-08-31 14:39:46Z nanasess $
*/
class LC_Page_FrontParts_Bloc_Maker extends LC_Page_FrontParts_Bloc {
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$bloc_file = 'maker.tpl';
$this->setTplMainpage($bloc_file);
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
$objView = new SC_SiteView();
$objCustomer = new SC_Customer();
$objQuery = new SC_Query();
$objDb = new SC_Helper_DB_Ex();
// メーカーの読込
$where = "del_flg <> 1";
$objQuery->setorder("rank DESC");
$this->arrMaker = $objQuery->select("maker_id, name", "dtb_maker", $where);
$objView->assignobj($this);
$objSubView = new SC_SiteView();
$objSubView->assignobj($this);
$objSubView->display($this->tpl_mainpage);
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
?>
DBでdtb_blocにあるmaker.tplのphp_pathをfrontparts/bloc/maker.phpに変更
管理画面ブロック編集でmaker.tplに下記記載
<!--メーカーここから-->
<ul>
<!--{section name=cnt loop=$arrMaker}-->
<!--{assign var=maker_id value=$arrMaker[cnt].maker_id}-->
<li class="maker_list"><a href="<!--{$smarty.const.URL_DIR}-->products/list.php?maker_id=<!--{$arrMaker[cnt].maker_id}-->"><!--{$arrMaker[cnt].name|escape}--></a>
</li>
<!--{/section}-->
</ul>
<!--メーカーここまで-->
多分いけると思います^^;
私はこれで表示されました。
ちなみに私はド素人なので、ゴミや間違いがあると思います。
どんどんご指摘して、修正してください。
あと質問にも答えられないことが多いです。
ごめんなさい^^;
----------------
EC-CUBE3っぽいテンプレート
GitHub で公開中
https://github.com/bluestylejp
お問い合わせ番号CSV登録&メール送信プラグイン
http://urx.red/qDT6