nanasessさんの
チケット #494 プラグイン機能で、試したい人用にやり方を書いてみました。
・eccube-comu-r18230とGoogleAnalytics_plugin.patchを用意します。
http://downloads.ec-cube.net/nightly/eccube-comu-r18230.tar.gzhttp://svn.ec-cube.net/open_trac/browser/branches/comu-ver2/patches/GoogleAnalytics_plugin.patch?format=raw・eccubeを解凍してパッチを当てます。
※windowsではGNU patchとかでやってください
$ tar zxvfp eccube-comu-r18230.tar.gz
$ mv eccube-comu-r18230 eccube
$ mv GoogneAnalytics_plugin.patch eccube
$ cd eccube
$ patch -p0 < GoogleAnalytics_plugin.patch
※windows gnu patchの場合
> patch -p0 --binary < GoogleAnalytics_plugin.patch
下記はやらなければいけないわけではないですが、一応、私自身がさらに当てたパッチです。diff -rc eccube_org/data/Smarty/templates/default/admin/main_frame.tpl eccube/data/Smarty/templates/default/admin/main_frame.tpl
*** eccube_org/data/Smarty/templates/default/admin/main_frame.tpl 2009-07-22 13:09:16.000000000 +0900
--- eccube/data/Smarty/templates/default/admin/main_frame.tpl 2009-07-22 12:57:24.000000000 +0900
***************
*** 113,120 ****
<a><span>OWNERS STORE</span></a>
<!--{include file="`$smarty.const.TEMPLATE_ADMIN_DIR`ownersstore/subnavi.tpl"}-->
<li id="navi-plugin" class="<!--{if $tpl_mainno eq "plugin"}-->on<!--{/if}-->">
! <a><span>プラグイン設定</span></a>
! <!--{include file="`$smarty.const.PLUGIN_PATH`plugin_menu.tpl"}-->
</li>
</ul>
<div style="clear: both;"></div>
--- 113,121 ----
<a><span>OWNERS STORE</span></a>
<!--{include file="`$smarty.const.TEMPLATE_ADMIN_DIR`ownersstore/subnavi.tpl"}-->
<li id="navi-plugin" class="<!--{if $tpl_mainno eq "plugin"}-->on<!--{/if}-->">
! </li>
! <a><span>プラグイン設定</span></a>
! <!--{include file="`$smarty.const.PLUGIN_PATH`plugin_menu.tpl"}-->
</li>
</ul>
<div style="clear: both;"></div>
Only in eccube_org: GoogleAnalytics_plugin.patch
diff -rc eccube_org/html/user_data/plugins/google_analytics/sql/insert.sql eccube/html/user_data/plugins/google_analytics/sql/insert.sql
*** eccube_org/html/user_data/plugins/google_analytics/sql/insert.sql 2009-07-22 13:09:16.000000000 +0900
--- eccube/html/user_data/plugins/google_analytics/sql/insert.sql 2009-07-22 13:01:48.000000000 +0900
***************
*** 1,2 ****
INSERT INTO dtb_bloc (bloc_name, tpl_path, filename, php_path, del_flg) VALUES ('Google Analytics', 'user_data/plugins/google_analytics/tpl/ga.tpl', 'google_analytics', 'user_data/plugins/google_analytics/ga.php', 1);
- INSERT INTO dtb_blocposition (page_id, target_id, bloc_id, bloc_row, filename, anywhere) VALUES (1, 10, (SELECT bloc_id FROM dtb_bloc WHERE filename = 'google_analytics'), 0, 'google_analytics', 1);
\ No newline at end of file
--- 1 ----
diff -rc eccube_org/html/user_data/plugins/plugin_menu.tpl eccube/html/user_data/plugins/plugin_menu.tpl
*** eccube_org/html/user_data/plugins/plugin_menu.tpl 2009-07-22 13:09:16.000000000 +0900
--- eccube/html/user_data/plugins/plugin_menu.tpl 2009-07-22 13:01:25.000000000 +0900
***************
*** 1,8 ****
<ul id="navi-plugin-menu" class="level1">
</ul>
<script type="text/javascript">
$(function(){
! $.ajax({
url: '<!--{$smarty.const.PLUGIN_URL}-->plugins.xml',
type: 'GET',
dataType: 'xml',
--- 1,9 ----
<ul id="navi-plugin-menu" class="level1">
</ul>
<script type="text/javascript">
+ //<![CDATA[
$(function(){
! $.ajax({
url: '<!--{$smarty.const.PLUGIN_URL}-->plugins.xml',
type: 'GET',
dataType: 'xml',
***************
*** 16,22 ****
var item_path = $(this).find("path").text();
$("<li id='navi-plugin-index'></li>")
! .html("<a href='java script:;'><span>" + item_text + "</span></a>")
.appendTo('ul#navi-plugin-menu')
.click(function() {
win03('<!--{$smarty.const.PLUGIN_URL}-->' + item_path
--- 17,23 ----
var item_path = $(this).find("path").text();
$("<li id='navi-plugin-index'></li>")
! .html("<a href='java script:;'><span>" + item_text + "</span></a>")
.appendTo('ul#navi-plugin-menu')
.click(function() {
win03('<!--{$smarty.const.PLUGIN_URL}-->' + item_path
***************
*** 28,31 ****
--- 29,33 ----
}
});
});
+ //]]>
</script>
※必要なくなりました
・html/user_data/plugins以下、書き込み属性を付加します。
※windowsでは必要ありません
$ chmod -R 777 html/user_data/plugins
・ブラウザからアクセスして普通にec-cubeをインストールします。
・プラグインのデータをDBへインストールします。
※下記はMySQL用です
$ mysql -u eccube_db_user -p --default-character-set=utf8 eccube_db < html/user_data/plugins/google_analytics/sql/insert.sql
・eccubeの管理画面にログインします。
※ただしhttpで(管理画面をhttpsで設定しているとき)・メニューにはプラグイン設定とその項目としてGoogle Analyticsが追加されています。
・デザイン管理のレイアウト設定で未使用ブロックに表示されているGoogle Analyticsをhead領域へ配置し、全ページのチェックを入れ登録します。
・フロントでhtmlソースのheadを確認し、全ページにGoogle Analytics のタグが入っていれば動作OKです。