以前「ECCUBEのお問い合わせフォームの複製/別作成 増やし方」で紹介もしましたが。
WordPressも実装しているのであればコチラのContactform7を入れたいくらいです。
主な機能は下記。
基本的なお問い合わせフォーム機能はもちろんのこと。
メール形式チェック
入力必須項目の実装
CAPTCHA(画像認証)
ファイル添付機能
などなど、カスタマイズ性には特化しているかと思います。
なのですが・・・ファーストサーバーで文字化けする・・・orz
クリエイターと名乗ってみた。
EC-CUBEカスタマイズ
以前「ECCUBEのお問い合わせフォームの複製/別作成 増やし方」で紹介もしましたが。
WordPressも実装しているのであればコチラのContactform7を入れたいくらいです。
主な機能は下記。
基本的なお問い合わせフォーム機能はもちろんのこと。
メール形式チェック
入力必須項目の実装
CAPTCHA(画像認証)
ファイル添付機能
などなど、カスタマイズ性には特化しているかと思います。
なのですが・・・ファーストサーバーで文字化けする・・・orz
デフォルトではポイント機能はオンになっています。
それを無効にする方法。
システム設定→パラメータ設定→USE_POINTを
tureからfalseに変更して登録保存すればOK。
※ PHPファイルの作成に失敗しました
と表示される事象に遭遇中です。
「デザイン管理>PC>ページ詳細設定」で新規ページ追加時に起こった現象ですが。
ブロック設定からの新規追加は可能。
パーミッション変更でもらちがあきませんでした。
ん〜どうしよう。。。
面倒なので以下で解決。
phpが作れないとダダをこねるなら。。。。
登録したいファイル名でphpを予め作りFTPで「user_data」にアップロード。
因にファイル内容は下記でアップロード。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
; html-script: false ]<?php require_once '../require.php'; require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php'; /** * ユーザーカスタマイズ用のページクラス * * 管理画面から自動生成される * * @package Page */ class LC_Page_User extends LC_Page_Ex { /** * Page を初期化する. * * @return void */ function init() { parent::init(); } /** * Page のプロセス. * * @return void */ function process() { parent::process(); $this->action(); $this->sendResponse(); } /** * Page のアクション. * * @return void */ function action() { } /** * デストラクタ. * * @return void */ function destroy() { parent::destroy(); } } $objPage = new LC_Page_User(); register_shutdown_function(array($objPage, 'destroy')); $objPage->init(); $objPage->process(); |
そしてブラウザ側で登録ボタンを押すことでtplファイルの生成とSQLへの登録も行えます。
以下余談。
クラスがだめなのかと思い、該当ファイルのみナイトリービルドを突っ込んでみました。
案の定デザインclassだった為か全部書き換えられ、一時的にuser_dataフォルダも認識しない状態に・・・
バックアップとって再インストールして解決。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
; html-script: false ] <table border="0" cellpadding="0" cellspacing="0"> <tr><td> 在庫: <!--{if $arrProduct.stock_unlimited_min == 1}--> 有り <!--{else}--> <!--{if $arrProduct.stock_min != $arrProduct.stock_max}--> 残りあと<!--{$arrProduct.stock_min|escape}-->~<!--{$arrProduct.stock_max|escape}--> <!--{else}--> 残りあと<!--{$arrProduct.stock_min|escape}--> <!--{/if}--> <!--{/if}--> </td></tr></table> |
上記コードを表示させたいところに表示。
商品詳細ページのファイルは下記。
1 2 3 |
; html-script: false ] root/Smarty/templates/my_temp/ ┗products/detail.php |
新規DBを下記のように設定します。
MySQL の文字セット: UTF-8 Unicode (utf8)
MySQL 接続照合順序: UTF-8 Unicode_ci
作成後に変更しても直らないので再インストールになります。
■PHP MyAdminで文字コードを utf8_general_ci に変更
※PHP MyAdminでデータベースを選択後、操作タブ→照合順序 で変更可能
↓
■文字化けが直っていればOK
ですが、もしその手順でインストールしていた、やってみたが直っていなければ下記の手順も試してみましょう。
■.htaccessに、
AddHandler .php
suPHP_ConfigPath
■php.iniを、.htaccessと一緒に指定した階層に置く。
参考サイト↓
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?viewmode=flat&order=ASC&topic_id=9044&forum=10
もう一つの方法が
■下記のUTF-8の部分が別の物になっていれば、修正してからインストール
/data/class/SC_Query.php の79行目、
//$this->conn->setCharset(CHAR_CODE);
$this->conn->setCharset(‘utf8′);
/data/module\MDB2/Driver/mysql.php の539行目、
//if (!empty($this->dsn[‘charset’])) {
//$result = $this->setCharset($this->dsn[‘charset’], $connection);
$result = $this->setCharset(‘utf8′, $connection);
if (PEAR::isError($result)) {
$this->disconnect(false);
return $result;
}
//}
参考サイト↓
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=7678&forum=2&post_id=37349
商品詳細ページに入力項目を追加したいと思います。
例として今回は家具サイトの例として「サイズ(W*D*H)」を追加します。
データベース(以下、DB)にカラムを追加する
dtb_productsに1カラム追加。
カラム名「comment7」
データ型「text」
商品詳細ページの編集
管理ページのデザイン管理>ページ詳細設定>商品詳細ページを開き、サイズを表示したい部分に、
<!–{$arrProduct.comment7}–>
と記述する。
サイズ表示しないようにするには、
<!–{$arrProduct.comment7|escape}–>
と記述する
商品登録ページの編集
data/Smarty/templates/default/admin/products/product.tplのファイルを開き、メーカーサイトの項目の下あたりに、
1 2 3 |
; html-script: false ] <div><code>サイズ &lt;</code><code>span</code> <code>class</code><code>=</code><code>"red12"</code><code>&gt;</code><code>&lt;!--{$arrErr.comment7}--&gt;</code><code>&lt;/</code><code>span</code><code>&gt;</code></div> <div><code>&lt;</code><code>input</code> <code>class</code><code>=</code><code>"box60"</code> <code>maxlength="</code><code>&lt;!--{$smarty.const.URL_LEN}--&gt;</code><code>" name="comment7" size="60" type="text" value="</code><code>&lt;!--{$arrForm.comment7|escape}--&gt;</code><code>" /&gt;&lt;</code><code>span</code> <code>class</code><code>=</code><code>"red"</code><code>&gt; (上限</code><code>&lt;!--{$smarty.const.URL_LEN}--&gt;</code><code>文字)&lt;/</code><code>span</code><code>&gt;</code></div> |
つづく
カテゴリーブロックを以下のように書き換えるだけ。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
; html-script: false ]<div class="bloc_outer"> <div id="category_area"> <div class="bloc_body"> <h2><img src="<!--{$TPL_URLPATH}-->img/title/tit_bloc_category.gif" alt="商品カテゴリー" /></h2> <!--{strip}--> <ul id="categorytree"> <!--{assign var=preLev value=1}--> <!--{assign var=firstdone value=0}--> <!--{section name=cnt loop=$arrTree}--> <!--{* 表示フラグがTRUEなら表示 *}--> <!--{* if $arrTree[cnt].display == 1 *}--> <!--{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}-->"> <p> <a href="<!--{$smarty.const.ROOT_URLPATH}-->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|h}-->(<!--{$arrTree[cnt].product_count|default:0}-->)</a> </p> <!--{if $firstdone == 0}--><!--{assign var=firstdone value=1}--><!--{/if}--> <!--{assign var=preLev value=`$level`}--> <!--{* /if *}--> <!--{* セクションの最後に閉じタグを追加 *}--> <!--{if $smarty.section.cnt.last}--> <!--{if $preLev-1 > 0}--> <!--{section name=d loop=`$preLev-1`}--> </li> </ul> <!--{/section}--> </li> <!--{else}--> </li> <!--{/if}--> <!--{/if}--> <!--{/section}--> </ul> <!--{/strip}--> </div> </div> </div> |
要は元のカテゴリーブロックを下記のように修正。
1 2 3 4 5 6 |
; html-script: false ]※ <!--{* 表示フラグがTRUEなら表示 *}--> ※ <!--{if $arrTree[cnt].display == 1}--> ・・・・ <!--{if $firstdone == 0}--><!--{assign var=firstdone value=1}--><!--{/if}--> <!--{assign var=preLev value=`$level`}--> ※ <!--{/if}--> |
上記の※印の3行を削除。
H1などのHタグや、Pタグの後、改行させないようにするには、inline を使いインライン要素にします。
1 |
; html-script: false ]display:inline; |
.ex
1 2 |
; html-script: false ] <h3 style="display:inline;">タイトル</h3> Hタグの後でも、<p style="display:inline;"> Pタグの後でも、改行されない。 |
↓
タイトル Hタグの後でも、 Pタグの後でも、改行されない。
user_date/packages/default/css/common.css内の記述を変更
(contents.cssの可能性あり)
1 2 3 4 5 6 7 8 9 10 11 |
/* レイアウト ----------------------------------------------- */ div.list_area { padding: 0 0 30px 0; width: 100%; overflow: auto; } div.listphoto { float: left; } |
↓に変更。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/* レイアウト ----------------------------------------------- */ div.list_area { padding: 0 0 30px 0; margin-left:15px; width: 31%; /* 通常横幅3分割だと33%ですが padding margin の都合上30%〜31%程度に分割*/ text-align:center; display:block; overflow: hidden; position: relative; float: left; /*important!*/ } div.listphoto { /*float: left;*/ /*センター合わせの為不要*/ } |
下記はカラムへの回り込み禁則処理
(商品が1つの場合や価格順・新着順のソートバー回り込み禁則)
common.cssの中(100行目あたり)に追記
1 2 |
/* 下層コンテンツ */ #undercolumn{・・・} |
下層コンテンツあたりに追記
1 2 3 4 |
/*追記*/ #undercolumn #page_navi_bottom{ clear:both; } |
多分以上で出来るが、商品名や文字のボリュームで個々のheightがバラバラになることがあります。
なので、「heightLine.js」jQuery等でそろえること。
(面倒であればCSSでdiv.list_areaとdiv.list_area h3 の heightを強制固定)
買い物かごの表記は下記ファイルの200行目前後。
今回は消去しました。
template/default/products/list.php
1 2 3 4 |
; html-script: false ]<!--▼買い物かご--> : : <!--▲買い物かご--> |
2012年1月24日 加筆
html/frontparts/bloc/product_list.php を新規作成
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
; html-script: false ] <?php // {{{ requires require_once(CLASS_EX_REALDIR . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List_Ex.php"); // }}} // {{{ generate page $objPage = new LC_Page_FrontParts_Bloc_Product_List_Ex(); register_shutdown_function(array($objPage, "destroy")); $objPage->init(); $objPage->process(); ?> |
data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List_Ex.php を新規作成
[php]
<?php
// {{{ requires
require_once(CLASS_EX_REALDIR . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List_Ex.php");
// }}}
// {{{ generate page
$objPage = new LC_Page_FrontParts_Bloc_Product_List_Ex();
register_shutdown_function(array($objPage, "destroy"));
$objPage->init();
$objPage->process();
?>
[/php]
data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List.php を新規作成
[php highlight=”44″]
<?php
// {{{ requires
require_once CLASS_REALDIR . ‘pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php’;
/**
* Product_List のページクラス.
*
* @package Page
*/
class LC_Page_FrontParts_Bloc_Product_List extends LC_Page_FrontParts_Bloc {
// }}}
// {{{ functions
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$bloc_file = ‘product_list.tpl’;
$this->setTplMainpage($bloc_file);
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
if (defined("MOBILE_SITE") && MOBILE_SITE) {
$objView = new SC_MobileView();
} else {
$objView = new SC_SiteView();
}
$objQuery = new SC_Query_Ex();
$objProduct = new SC_Product_Ex();
//$objQuery->setLimitOffset(10);
//$objQuery->setOrder("update_date desc");
$this->arrProducts = $objProduct->lists($objQuery);
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
?>
[/php]
$this->arrProducts = $objProduct->lists(&$objQuery);の44行目で過去のバージョン2.11辺りのQueryだとlists(&$objQuery);の表記でしたが&無しで記述。 $this->arrProducts = $objProduct->lists($objQuery); data/Smarty/templates/default/frontparts/bloc/product_list.tpl を新規作成
[php]
<!–{if count($arrProducts) > 0}–>
<div class="bloc_outer clearfix">
<div id="productlist_area">
<h2>商品一覧リスト</h2>
<div class="bloc_body clearfix">
<!–{foreach from=$arrProducts item=arrProduct}–>
<div class="product_item clearfix">
<div class="productImage">
<a href="<!–{$smarty.const.P_DETAIL_URLPATH}–><!–{$arrProduct.product_id|u}–>"><img src="<!–{$smarty.const.ROOT_URLPATH}–>resize_image.php?image=<!–{$arrProduct.main_list_image|sfNoImageMainList|h}–>&width=40&height=40" alt="<!–{$arrProduct.name|h}–>" /></a>
</div>
<div class="productContents">
<h3>
<a href="<!–{$smarty.const.P_DETAIL_URLPATH}–><!–{$arrProduct.product_id|u}–>"><!–{$arrProduct.name|h}–></a>
</h3>
<p class="sale_price">
<span class="price"><!–{$arrProduct.price02_min|sfCalcIncTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}–> 円</span>
</p>
</div>
</div>
</dl>
<div class="clear"></div>
<!–{/foreach}–>
</div>
</div>
</div>
<!–{/if}–>
[/php]
スタイルシート追記
[css]
<style type="text/css">
div#productlist_area h2 {
background-color:#de5e17;
text-align:center;
color:#fff;
padding:7px 0 7px 0;
}
div#productlist_area div.productImage {
float:left;
width:40px;
padding:0 8px 0 0;
}
div#productlist_area div.productContents {
float:left;
width:100px;
}
div#productlist_area div.product_item {
padding:5px 0 5px 5px;
}
</style>
[/css]
データベースに新規ブロック情報を登録
[php]
insert into dtb_bloc values(10,10,’product_list’,’product_list.tpl’,’product_list’,now(),now(),’frontparts/bloc/product_list.php’,0);
[/php]
Warningが表示されたので掲示板等参考に下記を実行。
[php highlight=”7″]
<?php
// {{{ requires
require_once CLASS_REALDIR . ‘pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php’;
////中略////
$this->arrProducts = $objProduct->lists(&$objQuery);
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
?>
[/php]
data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List.phpの部分で、本文44行目(上記7行目) $this->arrProducts = $objProduct->lists(&$objQuery); $this->arrProducts = $objProduct->lists($objQuery);
としたら表示が消えました。