これも需要なさそうな気がするんですが、以前開発コミュニティにこんな相談がありました。
「当サイトについて」や「特定商取引に関する法律」の内容をフッターに移動させたい
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=9982&forum=10&post_id=47873
こういうのって、あまり変更がないので手入力で都度変更でも問題なさそうな気はするんですが、
需要がなくはないようなので、適当なアドバイスをした手前、やってみることにしました。
スレ主の意向とは違いますが、ブロックで作成します。
1.管理画面にログインし、デザイン管理>PC>ブロック設定 で、新規ブロックを作成。
ブロック名: 特定商取引法に関する表記
ファイル名: tradelaw.tpl
コードは以下の通り。
<!--{*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2011 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.
*}-->
<!--▼CONTENTS-->
<div id="undercolumn">
<div id="undercolumn_order">
<h2 class="title"><!--{$tpl_title|h}--></h2>
<table summary="特定商取引に関する法律に基づく表記">
<colgroup width="20%"></colgroup>
<colgroup width="80%"></colgroup>
<tr>
<th>販売業者</th>
<td><!--{$arrOrder.law_company|h}--></td>
</tr>
<tr>
<th>運営責任者</th>
<td><!--{$arrOrder.law_manager|h}--></td>
</tr>
<tr>
<th>住所</th>
<td>〒<!--{$arrOrder.law_zip01|h}-->-<!--{$arrOrder.law_zip02|h}--><br /><!--{$arrPref[$arrOrder.law_pref]|h}--><!--{$arrOrder.law_addr01|h}--><!--{$arrOrder.law_addr02|h}--></td>
</tr>
<tr>
<th>電話番号</th>
<td><!--{$arrOrder.law_tel01|h}-->-<!--{$arrOrder.law_tel02|h}-->-<!--{$arrOrder.law_tel03|h}--></td>
</tr>
<tr>
<th>FAX番号</th>
<td><!--{$arrOrder.law_fax01|h}-->-<!--{$arrOrder.law_fax02|h}-->-<!--{$arrOrder.law_fax03|h}--></td>
</tr>
<tr>
<th>メールアドレス</th>
<td><a href="mailto:<!--{$arrOrder.law_email|escape:'hex'}-->"><!--{$arrOrder.law_email|escape:'hexentity'}--></a></td>
</tr>
<tr>
<th>URL</th>
<td><a href="<!--{$arrOrder.law_url|h}-->"><!--{$arrOrder.law_url|h}--></a></td>
</tr>
<tr>
<th>商品以外の必要代金</th>
<td><!--{$arrOrder.law_term01|h|nl2br}--></td>
</tr>
<tr>
<th>注文方法</th>
<td><!--{$arrOrder.law_term02|h|nl2br}--></td>
</tr>
<tr>
<th>支払方法</th>
<td><!--{$arrOrder.law_term03|h|nl2br}--></td>
</tr>
<tr>
<th>支払期限</th>
<td><!--{$arrOrder.law_term04|h|nl2br}--></td>
</tr>
<tr>
<th>引渡し時期</th>
<td><!--{$arrOrder.law_term05|h|nl2br}--></td>
</tr>
<tr>
<th>返品・交換について</th>
<td><!--{$arrOrder.law_term06|h|nl2br}--></td>
</tr>
</table>
</div>
</div>
<!--▲CONTENTS-->
2.html/frontparts/bloc/tradelaw.php を新規作成
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2011 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 realpath(dirname(__FILE__)) . '/../../require.php';
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Tradelaw_Ex.php';
// }}}
// {{{ generate page
$objPage = new LC_Page_FrontParts_BLoc_Tradelaw_Ex();
$objPage->blocItems = $params['items'];
register_shutdown_function(array($objPage, "destroy"));
$objPage->init();
$objPage->process();
?>
3.data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Tradelaw_Ex.php を新規作成。
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2011 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_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Tradelaw.php';
/**
* Tradelaw のページクラス(拡張).
*
* LC_Page_FrontParts_Bloc_Tradelaw をカスタマイズする場合はこのクラスを編集する.
*
* @package Page
*/
class LC_Page_FrontParts_Bloc_Tradelaw_Ex extends LC_Page_FrontParts_Bloc_Tradelaw {
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
parent::process();
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
?>
4.data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Tradelaw.php を新規作成。
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2011 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_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php';
/**
* Tradelaw のページクラス.
*
* @package Page
*/
class LC_Page_FrontParts_Bloc_Tradelaw extends LC_Page_FrontParts_Bloc {
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$this->tpl_page_category = 'order';
$this->tpl_title = '特定商取引に関する法律に基づく表記';
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
$this->action();
$this->sendResponse();
}
/**
* Page のアクション.
*
* @return void
*/
function action() {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$layout = new SC_Helper_PageLayout_Ex();
$objDb = new SC_Helper_DB_Ex();
$this->arrOrder = $objDb->sfGetBasisData();
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
?>
5.ブロック情報を保持している dtb_bloc に新規ブロックの情報を登録する。
phpMyAdmin や phpPgAdmin などデータベース編集ツールを使用して、 dtb_bloc テーブル内のデータを確認します。
device_type_id が 10 のレコードで、一番数字の大きい bloc_id に +1 した数字を、今回の新規ブロックの bloc_id にします。
bloc_id が決まったら、以下のような感じで新しいレコードを挿入します。
device_type_id 10
bloc_id 10
bloc_name 特定商取引法の表示
tpl_path tradelaw.tpl
filename review
create_date now()
update_date now()
php_path frontparts/bloc/tradelaw.php
deletable_flg 0
SQLを直接流す場合はこんな感じですかね。
insert into dtb_bloc values(10,10,’特定商取引法の表示’,’tradelaw.tpl’,’review’,’now()’,’now()’,’frontparts/bloc/tradelaw.php’,0);
6.ここまでできたら、管理画面にログインして、デザイン管理>PC>レイアウト設定 で、
未使用ブロックに「特定商取引法の表示」が追加されているのを確認します。
トップページのフッター上などにドラッグ&ドロップで配置して、ブラウザでトップページを確認してください。
毎日EC-CUBEを触っている自分からすると、ブロック追加ってパターン化された作業なのだけど。
デザイナーさんやEC-CUBEにたまにしか触らないプログラマーさんだと苦労しますよね。
こういうちょっとした機能をプラグインとして安価もしくは無償で提供できれば、EC-CUBEももっと普及するんだろうな。
2.12がリリースされたら、毎週1つプラグイン作るかw











