Home > EC-CUBE Archive
EC-CUBE Archive
EC-CUBEのカスタマイズ ギフト包装・のし対応
- 2008-12-21 (日)
- 参考になるサイトリンク
ギフト包装・のし対応にカスタマイズ方法を書いたサイトです。
使用バージョン:EC-CUBE 2.1.2
- Comments: 0
- Trackbacks: 0
EC-CUBEでFCKeditorを使う
商品登録ページの詳細-メインコメントの部分を、WYSIWYG編集できるようにFCKeditorを使えるようにする。
EC-CUBE 2.3.0
まず、こちらのサイト
AjaxなWYSIWYGエディタ、FCKeditor 2.6 日本語版をリリースしたよ。
から FCKeditor_2.6_ja.zip をダウンロードし、解凍してから fckeditor ディレクトリをアップロード。
(アップロードする場所は html/fckeditor)
/data/Smarty/templates/default/admin/main_frame.tpl の39行目あたりに下記の3行目の部分を挿入。
<script type=”text/javascript” src=”<!–{$TPL_DIR}–>js/css.js”></script>
<script type=”text/javascript” src=”<!–{$TPL_DIR}–>js/file_manager.js”></script>
<script type=”text/javascript” src=”<!–{$smarty.const.URL_DIR}–>/fckeditor/fckeditor.js”></script>
/data/Smarty/templates/default/admin/products/product.tpl に
<script type=”text/javascript”>
$(function(){
var oFCKeditor = new FCKeditor( ‘main_comment’ ) ;
oFCKeditor.ReplaceTextarea() ;
oFCKeditor.ToolbarSet = ‘EC-CUBE‘ ; //ツールバーの設定
});
</script>
を追加。
html/fckeditor/fckeditor.js 下記のように適宜修正。
var FCKeditor = function( instanceName, width, height, toolbarSet, value )
{
// Properties
this.InstanceName = instanceName ;
this.Width = width || ’100%’ ;
this.Height = height || ‘300‘ ;// 初期設定は200
this.ToolbarSet = toolbarSet || ‘EC-CUBE‘ ;// ←ツールバーセットの指定
this.Value = value || ” ;
this.BasePath = FCKeditor.BasePath ;
this.CheckBrowser = true ;
this.DisplayErrors = true ;
this.Config = new Object() ;
// Events
this.OnError = null ; // function( source, errorNumber, errorDescription )
}
そして、50行目あたり
FCKeditor.BasePath = ‘/fckeditor/’ ;
を
FCKeditor.BasePath = ‘/html/fckeditor/’ ;
に修正。
html/fckeditor/fckconfig.js の45行目あたりでスキンの指定をする。(これはスキンを変更したいときだけ)
FCKConfig.SkinPath = FCKConfig.BasePath + ‘skins/silver/’ ;
137行目あたりにツールバーセットを追加。(下記はEC-CUBE用にシンプルにしてみたサンプル)
FCKConfig.ToolbarSets["EC-CUBE"] = [
['Source'],
['Bold','Italic','Underline','StrikeThrough'],
['OrderedList','UnorderedList'],
['JustifyLeft','JustifyCenter','JustifyRight'],
['Table','Rule','Smiley'],
['TextColor'],
['FitWindow'],
‘/’,
['FontFormat','FontSize'],['RemoveFormat'],
// No comma for the last row.
] ;
これでOK!
- Comments: 3
- Trackbacks: 0
EC-CUBE 注文を削除してもマイページの購入履歴に残ってしまう
- 2008-05-21 (水)
- EC-CUBE | EC-CUBEの不具合
EC-CUBEで注文のキャンセルが入った時に、受注管理画面で削除してもマイページにログインして確認すると購入履歴に出てきます。
この不具合の解決策がカゴラボ的EC-CUBE開発ブログにありました。こちらでの説明は1.3.x~1.4.x向けの対策なので、その記事を参考にしながら2.0.1用に修正した。
引用
受注管理からキャンセル処理をした場合、データベースの「dtb_order」テーブルの「status」カラムに”3”が記録されます。受注のステータスに関しては、/data/conf/conf.php で設定されています。
一方、マイページのトップ(/html/mypage/index.php)で購入履歴が出てくるようになっていますが、この場合の条件には「削除フラグが立っていない」と「customer_idが何であるか」だけで、statusが何であるかは全く影響されません。
なので、この条件の中に「statusが3以外の時にだけ、購入履歴として出す」を入れれば良いことになります。
ということで、2.0.1用に読み直してみると、
data/class/pages/mypage/LC_Page_Mypage.php の92行目
$where = “del_flg = 0 AND customer_id=?”;
を
$where = “del_flg = 0 AND customer_id=? AND status <> 3″;
に
data/class/pages/mypage/LC_Page_Mypage_History.php の72行目
$where = “del_flg = 0 AND customer_id = ? AND order_id = ? “;
を
$where = “del_flg = 0 AND customer_id = ? AND order_id = ? AND status <> 3″;
に修正することで回避できた。
次は受注管理の売り上げ集計にも残らないようにしないといけない。
- Comments: 0
- Trackbacks: 0
EC-CUBE 携帯(モバイル)サイトへのリダイレクトの不具合
- 2008-05-21 (水)
- EC-CUBE | EC-CUBEの不具合
EC-CUBEのトップページが、http://[サイトのドメイン]/html/ だとすると、携帯からそのURLにアクセスすると、
http://[サイトのドメイン]/html/html/mobile/ と余分なディレクトリ(html)が入り存在しないディレクトリににアクセスしてしまい、モバイルサイトが表示されなかった。
これはうちだけの問題かなぁ・・・。
【回避策】
http://[サイトのドメイン]/html/require.php の98行目の
. SC_Utils_Ex::sfRmDupSlash($url . URL_DIR . “mobile/” . $path));
を
. SC_Utils_Ex::sfRmDupSlash($url . URL_DIR . “/../mobile/” . $path));
に修正することでうまくいった。
- Comments: 0
- Trackbacks: 0
EC-CUBE Google Analytics を SSL なページで使う
- 2008-04-24 (木)
- EC-CUBE
EC-CUBEに Google Analytics のデータ取得スクリプトを埋め込むと、SSLがかかったページに移動するとブラウザー(Firefox)のロケーションバーに色がつかず、壊れた鍵マークがつく。
これを回避する策がこれだ
<script type=”text/javascript”>
if (location.protocol == ‘https:’){
document.write(“<script src=¥”https:¥/¥/ssl.google-analytics.com¥/urchin.js¥” type=¥”text¥/javascript¥”><¥/script>”);
}else{
document.write(“<script src=¥”http:¥/¥/www.google-analytics.com¥/urchin.js¥” type=¥”text¥/javascript¥”><¥/script>”);
}
</script>
<script type=”text/javascript”>
_uacct = “xx-xxxxxx-x”;
_udn=”none”;
_ulink=1;
urchinTracker();
</script>
これを footer 部に入れてやればいい。
下記サイトで紹介されていた。
「Google Analytics を HTTPS(SSL)なページで使う」を少し改造する。
- Comments: 0
- Trackbacks: 0
EC-CUBE 商品詳細ページにお問合せボタン
商品詳細ページにお問合せボタンを作り、そのボタンをクリックするとお問い合わせ内容の textarea にその商品名を挿入する方法。
EC-CUBE 開発コミュニティの 商品詳細ページからお問い合わせへ遷移するには のスレッドで ryo さんが答えていた方法。
管理画面の「デザイン管理」から「ページ詳細設定」で「商品詳細ページ」を編集。
その時の例は下のformを追加する感じ
<form method=”post” action=”<!–{$smarty.const.SITE_URL}–>contact/”>
<input type=”hidden” name=”products_name” value=”<!–{$arrProduct.name|escape}–>” /><input type=”submit” name=”" value=”この商品について問い合わせる” />
</form>※ 赤字の部分はSSLに飛ばすなら「$smarty.const.SSL_URL」に変更。
※ 既存のformタグの内側に挿入しないように注意。その場合はgetが無難?
それから、「data/Smarty/templates/contact/index.tpl」を下記のように編集。
152行目あたり:
<textarea name=”contents” cols=”60″ rows=”20″ class=”area60″ wrap=”hard”
maxlength=”<!–{$smarty.const.LTEXT_LEN}–>” style=”<!–{$arrErr.contents|sfGetErrorColor}–>”>
<!–{$smarty.post.products_name|escape}–><!–{$contents|escape}–>
</textarea>※ 赤字を追加。
これでOK
- Comments: 0
- Trackbacks: 0
EC-CUBE 詳細ページ毎にキーワードを入れる
EC-CUBE 2.0.1
現段階では、[基本情報管理]→[SEO管理]の商品詳細ページ欄の[メタタグ:Description]や[メタタグ:Keywords]の欄に入力をすると、すべての詳細ページに同じ内容がはいってしまうので使えなかったが、EC-CUBE開発コミュニティのこのスレッドに解決策が投稿されていた。
/data/Smarty/templates/site_frame.tplの
<meta name="keywords" content="<!--{$arrPageLayout.keyword|escape}-->">
を
<meta name=”keywords” content=”<!–{$arrPageLayout.keyword|escape}–><!–{if $arrProduct.comment3}–>,<!–{$arrProduct.comment3|escape}–><!–{/if}–>“>
に入れ替えることでキーワードが個別に表示されるようになった。
Descriptionはまだうまくいっていないようですが・・・。
- Comments: 0
- Trackbacks: 0
ECC-CUBE カテゴリ一覧に説明文を入れる
データベース(postgresql)の、テーブル dtb_category にフィールドを1つ追加
フィールド(カラム)名:description 型:text
■修正するファイル
data/Smarty/templates/default/admin/products/category.tpl
data/Smarty/templates/default/list.tpl
data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
data/class/pages/products/LC_Page_Products_List.php
shop/user_data/css/common.css
■data/Smarty/templates/default/admin/products/category.tpl
113行目あたり
<td width=”428″ valign=”top”>
<span class=”red12″><!–{$arrErr.category_name}–></span>
●この行を変更 <input type=”text” name=”category_name” value=”<!–{$arrForm.category_name|escape}–>” size=”30″ class=”box30″ maxlength=”<!–{$smarty.const.STEXT_LEN}–>”/>
<input type=”submit” name=”button” value=”登録”/><span class=”red10″> (上限<!–{$smarty.const.STEXT_LEN}–>文字)</span>
<table width=”428″ border=”0″ cellspacing=”0″ cellpadding=”0″ summary=” “>
<tr><td height=”15″></td></tr>
次のように変更
<td width=”428″ valign=”top”>
<span class=”red12″><!–{$arrErr.category_name}–></span>
●この行を変更 <input type=”text” name=”category_name” value=”<!–{$arrForm.category_name|escape}–>” size=”30″ class=”box30″ maxlength=”<!–{$smarty.const.STEXT_LEN}–>”/><br/>
■この行を追加 <textarea name=”description” cols=80 rows=10><!–{$arrForm.description|escape}–></textarea><br/>
<input type=”submit” name=”button” value=”登録”/><span class=”red10″> (上限<!–{$smarty.const.STEXT_LEN}–>文字)</span>
<table width=”428″ border=”0″ cellspacing=”0″ cellpadding=”0″ summary=” “>
<tr><td height=”15″></td></tr>
■data/Smarty/templates/default/list.tpl
57行あたり
<input type=”hidden” name=”orderby” value=”<!–{$orderby}–>” />
<input type=”hidden” name=”product_id” value=”" />
<div id=”listtitle”><h2><!–★タイトル★–><!–{$tpl_subtitle}–></h2></div>
■この行を追加 <div id=”category_description”><!–{$arrSearch.description}–></div>
<!–検索条件ここから–>
<!–{if $tpl_subtitle == “検索結果”}–>
<ul class=”pagecondarea”>
■data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
111行あたり
$oquery = new SC_Query();
$where = “category_id = ?”;
$cat_name = $oquery->get(“dtb_category”, “category_name”, $where, array($_POST['category_id']));
■この行を追加 $cat_desc = $oquery->get(“dtb_category”, “description”, $where, array($_POST['category_id']));
// 入力項目にカテゴリ名を入力する。
$this->arrForm['category_name'] = $cat_name;
■この行を追加 $this->arrForm['description'] = $cat_desc;
// POSTデータを引き継ぐ
$this->arrForm['category_id'] = $_POST['category_id'];
break;
223行あたり
// 入力データを渡す。
$sqlval = $this->objFormParam->getHashArray();
■この行を追加 GC_Utils_Ex::gfPrintLog($sqlval['category_name']);
■この行を追加 GC_Utils_Ex::gfPrintLog($sqlval['description']);
$sqlval['create_date'] = “Now()”;
$sqlval['update_date'] = “Now()”;
$sqlval['creator_id'] = $_SESSION['member_id'];
254行あたり
$parent_category_id = ’0′;
}●この行を変更 $col = “category_id, category_name, level, rank”;
$where = “del_flg = 0 AND parent_category_id = ?”;
$objQuery->setoption(“ORDER BY rank DESC”);
$arrRet = $objQuery->select($col, “dtb_category”, $where, array($parent_category_id));
次のように変更
$parent_category_id = ’0′;
}●この行を変更 $col = “category_id, category_name, description, level, rank”;
$where = “del_flg = 0 AND parent_category_id = ?”;
$objQuery->setoption(“ORDER BY rank DESC”);
$arrRet = $objQuery->select($col, “dtb_category”, $where, array($parent_category_id));
264行あたり
/* パラメータ情報の初期化 */
function lfInitParam() {
$this->objFormParam->addParam(“カテゴリ名”, “category_name”, STEXT_LEN, “KVa”, array(“EXIST_CHECK”,”SPTAB_CHECK”,”MAX_LENGTH_CHECK”));
■この行を追加 $this->objFormParam->addParam(“カテゴリ説明”, “description”, STEXT_LEN, “KVa”);
}/* 入力内容のチェック */
■data/class/pages/products/LC_Page_Products_List.php
133行あたり
}else{
$arrCat = $conn->getOne(“SELECT category_name FROM dtb_category WHERE category_id = ?”, $arrCategory_id);
$arrSearch['category'] = $arrCat;
■この行を追加 $arrDesc = $conn->getOne(“SELECT description FROM dtb_category WHERE category_id = ?”, $arrCategory_id);
■この行を追加 $arrSearch['description'] = $arrDesc;
}// 商品名検索条件
これは、EC-CUBE開発コミュニティの「カテゴリに説明を」 でktsさんの投稿で説明されている。
次に、カテゴリに説明を加えない場合には表示しないようにする設定をしておいた。
デザイン管理→ページ詳細設定→商品一覧ページ(data/Smarty/templates/default/list.tpl)
追加した行を if 文で表示・非表示にする
<!–{if $arrSearch.description != “”}–><!–●追加行●–>
<div id=”category_description”><!–{$arrSearch.description}–></div>
<!–{/if}–><!–●追加行●–>
あとはCSSで体裁を整える。
- Comments: 0
- Trackbacks: 0
EC-CUBE 受注メールの不具合
- 2008-03-10 (月)
- EC-CUBE | EC-CUBEの不具合
受注完了時に購入者と管理人に受注メールが届かないといけないのだが、EC-CUBEのデフォルト設定のままでは管理者に受注メールが届かない。
【解決方法】
基本情報管理 → パラメータ設定
MAIL_BACKENDの設定が “smtp” になっているのを “mail” に変更することで管理者にもメールが届くようになった。
これでだめだったらこちらにも詳しく書かれていますので参照してみてください。
- Comments: 0
- Trackbacks: 0
Home > EC-CUBE Archive

