※ PHPファイルの作成に失敗しました EC-CUBE2.1.4

※ PHPファイルの作成に失敗しました

と表示される事象に遭遇中です。

「デザイン管理>PC>ページ詳細設定」で新規ページ追加時に起こった現象ですが。

ブロック設定からの新規追加は可能。

パーミッション変更でもらちがあきませんでした。

ん〜どうしよう。。。

面倒なので以下で解決。

phpが作れないとダダをこねるなら。。。。

登録したいファイル名でphpを予め作りFTPで「user_data」にアップロード。

因にファイル内容は下記でアップロード。

そしてブラウザ側で登録ボタンを押すことでtplファイルの生成とSQLへの登録も行えます。

以下余談。

クラスがだめなのかと思い、該当ファイルのみナイトリービルドを突っ込んでみました。

案の定デザインclassだった為か全部書き換えられ、一時的にuser_dataフォルダも認識しない状態に・・・

バックアップとって再インストールして解決。

eccube2.11 インストール時の文字化け対策

新規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

EC-CUBEの商品の登録項目内容の追加

「EC-CUBEの商品の登録項目内容の追加」

商品詳細ページに入力項目を追加したいと思います。
例として今回は家具サイトの例として「サイズ(W*D*H)」を追加します。

データベース(以下、DB)にカラムを追加する

dtb_productsに1カラム追加。
カラム名「comment7」
データ型「text」

商品詳細ページの編集

管理ページのデザイン管理>ページ詳細設定>商品詳細ページを開き、サイズを表示したい部分に、

<!–{$arrProduct.comment7}–>

と記述する。

サイズ表示しないようにするには、

<!–{$arrProduct.comment7|escape}–>

と記述する

商品登録ページの編集

data/Smarty/templates/default/admin/products/product.tplのファイルを開き、メーカーサイトの項目の下あたりに、

つづく

商品一覧ブロックを作る 2.11.X

html/frontparts/bloc/product_list.php を新規作成

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);

としたら表示が消えました。

eccube2.11 インストール方法 (ver2.11.4)

eccube2.11.4 インストール方法 一回やりましたがもう既に忘れたのでもう一度トライするところから。

まず、データベースを構築するところからですが user_eccube と適当に設定。

空のDBを作成したら、 EC-CUBE Version 2.11.4(zip)をダウンロード。

この時、不具合修正ファイルの最新版も同時にダウンロード。

上記のうち、ECサイトそして機能するのに必要なデータは「data」「html」の2つのフォルダだけなので他は無視。

セットアップ前に、不具合修正ファイル内にある「data」「html」をeccube-2.11.4の中に入れて上書きしてください。

“eccube2.11 インストール方法 (ver2.11.4)” の続きを読む

EC-CUBE 2.11 Smarty 主要ディレクトリパス一覧

[html]
<!–{$TPL_URLPATH}–>
/html/user_data/packages/XXXX(使用中のテンプレ)

<!–{$smarty.const.USER_TEMPLATE_REALDIR}–>
html/user_data/packages/

<!–{$smarty.const.TOP_URLPATH}–>
/html/

<!–{$smarty.const.ROOT_URLPATH}–>
/html/

<!–{$smarty.const.HTML_REALDIR}–>
/html/

<!–{$smarty.const.HTTPS_URL}–>
https://ドメイン

<!–{$smarty.const.P_DETAIL_URLPATH}–>
/html/products/detail.php?product_id=

<!–{$smarty.const.IMAGE_SAVE_URLPATH}–>
/html/upload/save_image/

<!–{$smarty.const.DATA_REALDIR}–>
/data/

<!–{$smarty.const.CLASS_REALDIR}–>
/data/class/

<!–{$smarty.const.CLASS_EX_REALDIR}–>
/data/class_extends/

<!–{$smarty.const.TEMPLATE_REALDIR}–>
/data/Smarty/templates/default/

<!–{$smarty.const.TEMPLATE_ADMIN_REALDIR}–>
data/Smarty/templates/admin/

<!–{$smarty.const.TEMPLATE_TEMP_REALDIR}–>
html/upload/temp_template/

<!–{$smarty.const.GRAPH_URLPATH}–>
/html/upload/graph_image/

<!–{$smarty.const.IMAGE_TEMP_URLPATH}–>
/html/upload/temp_image/

<!–{$smarty.const.CART_URLPATH}–>
/html/cart/

<!–{$smarty.const.ADMIN_LOGIN_URLPATH}–>
/html/shopmng/

<!–{$smarty.const.ADMIN_SYSTEM_URLPATH}–>
/html/shopmng/system/

<!–{$smarty.const.ADMIN_PRODUCTS_URLPATH}–>
/html/shopmng/products/

<!–{$smarty.const.ADMIN_ORDER_URLPATH}–>
/html/shopmng/order/

<!–{$smarty.const.MOBILE_IMAGE_URLPATH}–>
/html/upload/mobile_image/

<!–{$smarty.const.MOBILE_TOP_URLPATH}–>
/html/

<!–{$smarty.const.MOBILE_CART_URLPATH}–>
/html/cart/

<!–{$smarty.const.MOBILE_P_DETAIL_URLPATH}–>
/html/products/detail.php?product_id=

[/html]

EC-CUBE テンプレートのファイル構成

テンプレートをパッケージングしながら作成中です。
テンプレ用に格納場所と概要を寄せ集めてみました。
デフォルトの状態では、下記に格納されています。

[html gutter=”false” highlight=”1,2″]
root/data/Smarty/templates/default
root/user_data/default
[/html]

以下フォルダ構成
“EC-CUBE テンプレートのファイル構成” の続きを読む

レビュー一覧ページ作成 ec-cube2.11以降

まず管理画面にログインして、デザイン管理>PC>レイアウト設定 から、ページを新規入力します。
URLは review_list.php として、以下のコードを貼り付けて保存します。

次に、html/user_data/review_list.php を開いて、次のように修正します。

data/Smarty/templates/default/user_data/review_list.tpl を以下のように変更します。

以上。

ブロック化は以下。

デザイン管理>PC>ブロックの設定新規ブロックで下記を作成。
ブロック名:お客様の声一覧
ファイル名:review_list_bloc

トップページのブロックで表示する場合、html直下のindex.php下記のような感じで書き換え。

基本的には同じ作業。
画像とかは適当にかえましょう。
(レビュー自体未投稿だと空欄なので適当に用意しておきましょう。)

EC-CUBEからメールが送信されない

メモ

Netowl の Firebird というサーバーに EC-CUBE をインストールした場合、デフォルトのままでは注文完了時や通知のメールが送信されなかった。

送信できるようにするには、
/data/mtb_constants_init.php と
/data/cash/mtb_constants.php
の532 行目の

define(‘MAIL_BACKEND’, “smtp”);

define(‘MAIL_BACKEND’, “mail”);

に変更すれば解決した。

SEO対策 titleタグ編

内部SEO対策を行う上で、重要なのはタグです。

・Titleタグ
・Metaタグ
・Hタグ
・Altタグ
・Aタグ
・Strongタグ

とSEOに関連するタグはありますが、SEOを行う上で重要なのがTITLEタグです。
特にみずいろ堂では商品詳細のページにランディングしてもらおうという考えですので
商品詳細ページのタイトルは重要です!

しかしながら、デフォルトの商品詳細ページのTitleタグは納得がいきません!

商品詳細ページは、各々の商品の物販サイトであるということを意識したタイトルにしました。

【対象ファイル】
data\class\pages\products\LC_Page_Products_Detail.php

【変更箇所】
$this->tpl_title = “商品詳細 “. $this->arrProduct[“name”];

$this->tpl_title = “通販 “. $this->arrProduct[“name”];
などに変更するだけです。

SEOにとって重要でありますが、変更は非常に簡単ですので、やってみるべき変更だと思います。