アメリカ、香港、中国でのライフハック、お勧めレストランなどの情報も交えてのブログ -16ページ目

アメリカ、香港、中国でのライフハック、お勧めレストランなどの情報も交えてのブログ

アメリカ、香港、中国でのライフハック、お勧めレストランなどの情報も交えてのブログです。よろしくお願いいたします。

当たり前なのですが、
EC CUBEのデフォルトのままではfaviconの設定とスマートフォンのホーム画面に
表示されるアイコンが EC CUBEのロゴのままになっています。

さすがにクライアントさんに納品する際にこのままではまずいので変更したいと思います。

まずこれらを指定しているファイルですが、
それぞれ、
data/Smarty内のsite_frame.tplのファイルに記述してあります。



faviconの変更

site_frame.tpl内52行目付近

<link rel="shortcut icon" href="<!--{$TPL_URLPATH}-->img/common/favicon.ico" />

<link rel="icon" type="image/vnd.microsoft.icon" href="<!--{$TPL_URLPATH}-->img/common/favicon.ico" />

の部分です。





スマホ : アイコン変更
sphone : site_frame.tpl内81行目付近

<!--{* iPhone用アイコン画像 *}-->

<link rel="apple-touch-icon" href="<!--{$TPL_URLPATH}-->img/common/s_garacon_touch.gif" />
の部分です。

それぞれのファイルを上書き等すれば、変更可能です。

管理画面で修正できます

ECCUBEで自動的に表示されてしまう、販売価格という部分ですが
<!--{$smarty.const.SALE_PRICE_TITLE}-->というコードで表示されいます。

わからない人は、ここを直接書き換えてしまったりしてしまうでしょうが、ここは管理画面から簡単に変更できます。

管理画面>システム設定>パラメーター設定
そこのSALE_PRICE_TITLEという定数名の値を変更すれば、価格表示されている場所は、全て一括で変更されます。

しかし、残った(税込):という表示は、自分で消すしかありませんね。
面倒ですが、ちまちまとやりましょう。

/data/Smarty/templates/default/products/detail.tpl
/data/Smarty/templates/default/products/list.tpl
/data/Smarty/templates/default/frontparts/bloc/recommend.tpl

何も手を加えてなければ、上記の3ファイルを修正すれば事足ります。


data/config/config.php の HTTP_URL は www 有りで, スマートフォンでは www 無しでアクセスしていませんか?
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=10078&forum=10



url rewording
http://lolipop.jp/manual/hp/htaccess-08/

初期設定ですと、/data/config/config.phpにおいて

define ('HTTP_URL', 'http://www.●●●.net/' )
define ('HTTPS_URL', 'http://www.●●●.net/' );

と定義されており、www無しのURLでアクセスすると、
商品をかごに入れた際システムエラーになってしまいます。

define ('HTTP_URL', 'http://●●●.net/' )
define ('HTTPS_URL', 'http://●●●.net/' );

に修正すると、www無しのURLでもエラーにならないのですが、今度は
wwwありのURLでアクセスした際にエラーになってしまいます。。。

URLにwwwが含まれているかどうかにかかわらず、エラーが出ないようにしたいのですが)

http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=8875&forum=11
resize

default/frontparts/bloc/recommend.tpl
smartphone/frontparts/bloc/recommend.tpl
smartphone/products/list.tpl
cart/index
default/car/index


    //商品写真をセット
    $($(".list_area .listphoto img").get(maxCnt)).attr({
        src: imagePath + product.main_list_image,
        alt: product.name


cart/index
<img src="<!--{$smarty.const.ROOT_URLPATH}-->resize_image.php?image=<!--{$arrItem.productsClass.main_list_image|sfNoImageMainList|h}-->&amp;width=80&amp;height=80" alt="<!--{$arrItem.productsClass.name|h}-->" class="photoL" />

<img src="<!--{$smarty.const.ROOT_URLPATH}-->/<!--{$arrItem.productsClass.main_list_image|sfNoImageMainList|h}-->" alt="<!--{$arrItem.productsClass.name|h}-->" class="photoL" />

default/car/index

<img src="<!--{$smarty.const.ROOT_URLPATH}-->resize_image.php?image=<!--{$item.productsClass.main_list_image|sfNoImageMainList|h}-->&amp;width=65&amp;height=65" alt="<!--{$item.productsClass.name|h}-->" />


<img src="<!--{$smarty.const.ROOT_URLPATH}-->/<!--{$item.productsClass.main_list_image|sfNoImageMainList|h}-->" alt="<!--{$item.productsClass.name|h}-->" />
data/Smarty/templates/sphone/products/list.tpl
178~182行目
<修正前>
    //商品写真をセット
    $($(".list_area .listphoto img").get(maxCnt)).attr({
        src: imagePath + product.main_list_image,
        alt: product.name
    });

<修正後>
    //商品写真をセット
    $($(".list_area .listphoto img").get(maxCnt)).attr({
        src: imagePath + product.main_list_image,
        alt: product.name,
        width: 80,
        height: 80


参考
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=8714&forum=8

オリジナル
//商品写真をセット
$($(".list_area .listphoto img").get(maxCnt)).attr({
src: "<!--{$smarty.const.ROOT_URLPATH}-->resize_image.php?image=" + product.main_list_image + '&width=80&height=80',




変更後

<!--{*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2013 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.
*}-->

<script type="text/javascript" src="<!--{$smarty.const.ROOT_URLPATH}-->js/products.js"></script>
<script type="text/javascript">//<![CDATA[
// 並び順を変更
function fnChangeOrderby(orderby) {
fnSetVal('orderby', orderby);
fnSetVal('pageno', 1);
fnSubmit();
}
// 表示件数を変更
function fnChangeDispNumber(dispNumber) {
fnSetVal('disp_number', dispNumber);
fnSetVal('pageno', 1);
fnSubmit();
}
//]]></script>

<section id="product_list">
<form name="form1" id="form1" method="get" action="<!--{$smarty.const.ROOT_URLPATH}-->products/list.php">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="<!--{$mode|h}-->" />
<input type="hidden" name="category_id" value="<!--{$arrSearchData.category_id|h}-->" />
<input type="hidden" name="maker_id" value="<!--{$arrSearchData.maker_id|h}-->" />
<input type="hidden" name="name" value="<!--{$arrSearchData.name|h}-->" />
<input type="hidden" name="orderby" value="<!--{$orderby|h}-->" />
<input type="hidden" name="disp_number" value="<!--{$disp_number|h}-->" />
<input type="hidden" name="pageno" value="<!--{$tpl_pageno|h}-->" />
<input type="hidden" name="rnd" value="<!--{$tpl_rnd|h}-->" />
</form>

<h2 class="title"><!--{$tpl_subtitle|h}--></h2>
<p class="intro clear"><span class="attention"><span id="productscount"><!--{$tpl_linemax}--></span>件< /span>の商品がござい ます。</p>

<!--▼ページナビ(本文)-->
<section class="pagenumberarea clearfix">
<ul>
<!--{if $orderby != 'price'}-->
<li><a href="javascript:fnChangeOrderby('price');" rel="external">価格順</a></li>
<!--{else}-->
<li class="on_number">価格順</li>
<!--{/if}-->
<!--{if $orderby != "date"}-->
<li><a href="javascript:fnChangeOrderby('date');" rel="external">新着順</a></li>
<!--{else}-->
<li class="on_number">新着順</li>
<!--{/if}-->
</ul>
</section>
<!--▲ページナビ(本文)-->

<!--{foreach from=$arrProducts item=arrProduct name=arrProducts}-->
<!--{assign var=id value=$arrProduct.product_id}-->
<!--{assign var=arrErr value=$arrProduct.arrErr}-->
<!--▼商品-->
<div class="list_area clearfix">
<!--★画像★-->
<p class="listphoto"><img src="http:/  <!--{$smarty.const.ROOT_URLPATH}-->/<!--{$arrProduct.main_list_image|sfNoImageMainList|h}-->" alt="<!--{$arrProduct.name|h}-->" /></p>

<div class="listrightblock">
<div class="statusArea">
<!--▼商品ステータス-->
<!--{if count($productStatus[$id]) > 0}-->
<ul class="status_icon">
<!--{foreach from=$productStatus[$id] item=status}-->
<li><!--{$arrSTATUS[$status]}--></li>
<!--{/foreach}-->
</ul>
<!--{/if}-->
<!--▲商品ステータス-->
</div>
<!--★商品名★-->
<h3><a rel="external" href="<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}-->" name="product<!--{$arrProduct.product_id}-->" class="productName"><!--{$arrProduct.name|h}--></a></h3>

<!--★商品価格★-->
<p>
<span class="pricebox sale_price"><span class="mini">販売価格(税込):</span></span>
<span class="price">
<span id="price02_default_<!--{$id}-->">
<!--{if $arrProduct.price02_min_inctax == $arrProduct.price02_max_inctax}-->
<!--{$arrProduct.price02_min_inctax|number_format}-->
<!--{else}-->
<!--{$arrProduct.price02_min_inctax|number_format}-->~ <!--{$arrProduct.price02_max_inctax|number_format}-->
<!--{/if}-->
</span><span id="price02_dynamic_<!--{$id}-->">
</span>円
</span>
</p>

<!--★商品コメント★-->
<p class="listcomment"><!--{$arrProduct.main_list_comment|h|nl2br}--></p>
</div>
</div>
<!--▲商品-->

<!--{foreachelse}-->
<!--{include file="frontparts/search_zero.tpl"}-->
<!--{/foreach}-->

<!--{if count($arrProducts) < $tpl_linemax}-->
<div class="btn_area">
<p><a rel="external" href="javascript: void(0);" class="btn_more" id="btn_more_product" onClick="getProducts(<!--{$disp_number|h}-->); return false;">もっとみる (+<!--{$disp_number|h}-->件)</a></p>
</div>
<!--{/if}-->
</section>

<!--▼検索バー -->
<section id="search_area">
<form method="get" action="<!--{$smarty.const.ROOT_URLPATH}-->products/list.php">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="search" />
<input type="search" name="name" id="search" value="" placeholder="キーワードを入力" class="searchbox" >
</form>
</section>
<!--▲検索バー -->

<script>
var pageNo = 2;
var url = "<!--{$smarty.const.P_DETAIL_URLPATH}-->";
var imagePath = "<!--{$smarty.const.IMAGE_SAVE_URLPATH|sfTrimURL}-->/";
var statusImagePath = "<!--{$TPL_URLPATH}-->";

function getProducts(limit) {
$.mobile.showPageLoadingMsg();
var i = limit;
//送信データを準備
var postData = {};
$('#form1').find(':input').each(function(){
postData[$(this).attr('name')] = $(this).val();
});
postData["mode"] = "json";
postData["pageno"] = pageNo;

$.ajax({
type: "POST",
data: postData,
url: "<!--{$smarty.const.ROOT_URLPATH}-->products/list.php",
cache: false,
dataType: "json",
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(textStatus);
$.mobile.hidePageLoadingMsg();
},
success: function(result){
var productStatus = result.productStatus;
for (var product_id in result) {
if (isNaN(product_id)) continue;
var product = result[product_id];
var productHtml = "";
var maxCnt = $(".list_area").length - 1;
var productEl = $(".list_area").get(maxCnt);
productEl = $(productEl).clone(true).insertAfter(productEl);
maxCnt++;

//商品写真をセット
$($(".list_area .listphoto img").get(maxCnt)).attr({
src: imagePath + product.main_list_image,
alt: product.name
});

// 商品ステータスをセット
var statusAreaEl = $($(".list_area div.statusArea").get(maxCnt));
// 商品ステータスの削除
statusAreaEl.empty();

if (productStatus[product.product_id] != null) {
var statusEl = '<ul class="status_icon">';
var statusCnt = productStatus[product.product_id].length;
for (var k = 0; k < statusCnt; k++) {
var status = productStatus[product.product_id][k];
var statusImgEl = '<li>' + status.status_name + '</li>' + "\n";
statusEl += statusImgEl;
}
statusEl += "</ul>";
statusAreaEl.append(statusEl);
}

//商品名をセット
$($(".list_area a.productName").get(maxCnt)).text(product.name);
$($(".list_area a.productName").get(maxCnt)).attr("href", url + product.product_id);

//販売価格をセット
var price = $($(".list_area span.price").get(maxCnt));
//販売価格をクリア
price.empty();
var priceVale = "";
//販売価格が範囲か判定
if (product.price02_min == product.price02_max) {
priceVale = product.price02_min_tax_format + '円';
} else {
priceVale = product.price02_min_tax_format + '~' + product.price02_max_tax_format + '円';
}
price.append(priceVale);

//コメントをセット
$($(".list_area .listcomment").get(maxCnt)).text(product.main_list_comment);
}
pageNo++;

//すべての商品を表示したか判定
if (parseInt($("#productscount").text()) <= $(".list_area").length) {
$("#btn_more_product").hide();
}
$.mobile.hidePageLoadingMsg();
}
});
}
</script>


http://www.head-t.com/2012/11/2012-11-12_01.html

商品の画像サイズ変更

商品詳細/商品一覧は管理画面から設定できますが、おすすめ商品の画像サイズ はテンプレートを直接変更します。

「data/Smarty/templates/テンプレート名/frontparts/bloc/recommend.tpl」
ほか触ったところ
frontparts/bloc/recommend.tpl
smartphone/products/list.tpl

ここからオリジナル

<!--{*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2013 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.
*}-->

<!--{if count($arrBestProducts) > 0}-->
<div class="block_outer clearfix">
<div id="recommend_area">
<h2><img src="<!--{$TPL_URLPATH}-->img/title/tit_bloc_recommend.jpg" alt="*" class="title_icon" /></h2>
<div class="block_body clearfix">
<!--{foreach from=$arrBestProducts item=arrProduct name="recommend_products"}-->
<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}-->&amp;width=80&amp;height=80" 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">
<!--{$smarty.const.SALE_PRICE_TITLE}-->(税込): <span class="price"><!--{$arrProduct.price02_min_inctax|number_format}--> 円</span>
</p>
<p class="mini comment"><!--{$arrProduct.comment|h|nl2br}--></p>
</div>
</div>
<!--{if $smarty.foreach.recommend_products.iteration % 2 === 0}-->
<div class="clear"></div>
<!--{/if}-->
<!--{/foreach}-->
</div>
</div>
</div>
<!--{/if}-->

 

http://web.makiron.jp/2009/04/eccube-1.html


EC-CUBEで商品を一括登録する際の注意事項覚書き。
レアケースです。

ケース1:
既存登録済みの商品データの価格が全部ずれていいたので、
CSVをダウンロードして、商品データを一括削除。
価格のずれを修正し、一括登録して
修正を行いたい。

もしくは、その他の理由で一括削除する前に、データをCSVでダウンロードし、
削除後、CSVでアップロードしたい。

エラー:
ダウンロードしたCSVの価格部分を修正して、アップロードを行うと、
「指定の規格IDは、登録されていません」のエラーが表示される。

原因と解決策:
Ec-cubeは、商品IDと規格IDを自動で割り振る為、
CSVの商品ID及び、規格IDは空にしておく必要があった。
※規格がある場合、規格名は必要。

一応、既存の規格IDは管理画面から削除を行って、
CSVにて登録した。

これにより、一括登録が可能となった。

EC-CUBE  dataフォルダにアクセス禁止

テーマ:EC-CUBE
dataフォルダ直下に.htaccessを配置
以下内容。

<Files ? ".*">
Order allow,deny
Deny from all
Satisfy all
</Files>

http://www.***.com/data/logs/site.logでログが見れちゃうので。
てか、結構見れるサイトがある・・・

http://ryusendo.no-ip.com/wiki.cgi?page=EC-CUBE+-+XREA%2B

つづいてuser_data以下に配置されたテンプレートファイルに対するアクセス制限をする。

> cd /virtual/hoge/public_html/eccube/html/user_data
> touch .htaccess

.htaccessの中身は

<FilesMatch "\.tpl$">
  Deny from all
</FilesMatch> 

別の拡張子にも対応させたい場合は

<FilesMatch "\.(tpl|log|ini)$">
  Deny from all
</FilesMatch>