2013年3月14日木曜日
2012年1月28日土曜日
CS-Cart SSLから抜けるとトップページに戻ってしまう
CS-Cartの仕様なのかこちらのRewriteRuleの設定を間違っているのか不明だけど「SSL使用ページにアクセスした後はHTTPS接続を維持」にチェックが入っていないと、カートページでカートに入っている商品をクリックしてしまうと商品詳細ページではなくトップページに飛ばされる。
https://〜/index.php?dispatch=checkout.cart
↓
カートに入っているサムネイル、商品名のリンクをクリックすると
https://〜/index.php?dispatch=products.view&product_id=1
↓
http://〜/index.php
できれば
https://〜/index.php?dispatch=checkout.cart
↓
カートに入っているサムネイル、商品名のリンクをクリックすると
https://〜/index.php?dispatch=products.view&product_id=1
↓
http://〜/index.php?dispatch=products.view&product_id=1
となって欲しい・・・
https://〜/index.php?dispatch=checkout.cart
↓
カートに入っているサムネイル、商品名のリンクをクリックすると
https://〜/index.php?dispatch=products.view&product_id=1
↓
http://〜/index.php
できれば
https://〜/index.php?dispatch=checkout.cart
↓
カートに入っているサムネイル、商品名のリンクをクリックすると
https://〜/index.php?dispatch=products.view&product_id=1
↓
http://〜/index.php?dispatch=products.view&product_id=1
となって欲しい・・・
2012年1月27日金曜日
CS-CartをFastCGIで運用するときに
個人的なメモ
mod_fastcgiのバージョンが2.4.6の時、
Apache2+FastCGI(mod_fastcgi)+PHP-FPMの環境で納品書(PDF)をダウンロードすると
FastCGI: comm with server "/var/www/fcgi-bin/php-fpm" aborted: error parsing headers: duplicate header 'Content-Type', referer: ...
とInternal Serverエラーが出る
mod_fastcgiのバグ?らしいのでSnapshot版の http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0811090952.tar.gz と入れ替える。
mod_fastcgi-SNAP-0910052141.tar.gzの方が新しいようだけど未検証。
mod_fastcgiのバージョンが2.4.6の時、
Apache2+FastCGI(mod_fastcgi)+PHP-FPMの環境で納品書(PDF)をダウンロードすると
FastCGI: comm with server "/var/www/fcgi-bin/php-fpm" aborted: error parsing headers: duplicate header 'Content-Type', referer: ...
とInternal Serverエラーが出る
mod_fastcgiのバグ?らしいのでSnapshot版の http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0811090952.tar.gz と入れ替える。
mod_fastcgi-SNAP-0910052141.tar.gzの方が新しいようだけど未検証。
2012年1月25日水曜日
CS-Cart パンくずリストをリッチスニペット化
skins/basic/customer/common_templates/breadcrumbs.tplを修正
http://support.google.com/webmasters/bin/answer.py?hl=ja&answer=185417&topic=1088474&ctx=topic を参考に
http://www.google.co.jp/webmasters/tools/richsnippets で確かめる
修正例
{* $Id$ *}
{if $breadcrumbs && $breadcrumbs|@sizeof > 1}
<div class="breadcrumbs">
{strip}
{foreach from=$breadcrumbs item="bc" name="bcn" key="key"}
{if $key != "0"}
<img src="{$images_dir}/icons/breadcrumbs_arrow.gif" class="bc-arrow" border="0" alt=">" />
{/if}
{if $bc.link}
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="{$bc.link|fn_url}"{if $additional_class} class="{$additional_class}"{/if} itemprop="url"><span itemprop="title">{$bc.title|unescape|strip_tags|escape:"html"}</span></a>
</span>
{else}
{$bc.title|unescape|strip_tags|escape:"html"}
{/if}
{/foreach}
{/strip}
</div>
{/if}
http://support.google.com/webmasters/bin/answer.py?hl=ja&answer=185417&topic=1088474&ctx=topic を参考に
http://www.google.co.jp/webmasters/tools/richsnippets で確かめる
修正例
{* $Id$ *}
{if $breadcrumbs && $breadcrumbs|@sizeof > 1}
<div class="breadcrumbs">
{strip}
{foreach from=$breadcrumbs item="bc" name="bcn" key="key"}
{if $key != "0"}
<img src="{$images_dir}/icons/breadcrumbs_arrow.gif" class="bc-arrow" border="0" alt=">" />
{/if}
{if $bc.link}
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="{$bc.link|fn_url}"{if $additional_class} class="{$additional_class}"{/if} itemprop="url"><span itemprop="title">{$bc.title|unescape|strip_tags|escape:"html"}</span></a>
</span>
{else}
{$bc.title|unescape|strip_tags|escape:"html"}
{/if}
{/foreach}
{/strip}
</div>
{/if}
2012年1月20日金曜日
CS-Cart PayPal Express Checkoutボタンを日本語にする
PayPal Express Checkoutを有効にするとカートページにExpress Checkoutボタン現れる。
そのままだと英語圏向けのボタン表示なので日本語向けボタンに変更する。
ボタンはハードコーディングされているので payments/paypal_express.php の134行目付近
そのままだと英語圏向けのボタン表示なので日本語向けボタンに変更する。
ボタンはハードコーディングされているので payments/paypal_express.php の134行目付近
if (!empty($_payment_id) && !empty($_SESSION['cart']['products'])) {
$lang = array(
'EN' => 'en_US',
'JP' => 'ja_JP',
);
$lang_code = isset($lang[CART_LANGUAGE]) ? $lang[CART_LANGUAGE] : 'en_US';
$checkout_buttons[] = '
<html>
<body>
<br/>
<form name="pp_express" action="'. Registry::get('config.current_location') . '/payments/paypal_express.php" method="post">
<input name="_payment_id" value="'.$_payment_id.'" type="hidden" />
<input src="https://www.paypal.com/' . $lang_code . '/i/btn/btn_xpressCheckout.gif" type="image" />
<input name="mode" value="express" type="hidden" />
</form>
</body>
</html>';
CS-Cart 購入画面のコメント欄を削除する
skins/basic/customer/addons/my_changes/hooks/checkout/notes.override.tpl
{* $Id: customer_notes.tpl 9403 2010-05-07 13:11:06Z klerik $ *}
<!-- //-->
2012年1月11日水曜日
CS-Cart 携帯電話対応アドオンでPHP Noticeエラー
携帯電話対応アドオンを有効後、端末でアクセスするとDIR_SKINS定数を再定義するようでNoticeエラーが発生する
PHP Notice: Constant DIR_SKINS already defined in /var/www/html/config.php on line 41
if (!defined(DIR_SKINS))という感じでとりあえず回避
PHP Notice: Constant DIR_SKINS already defined in /var/www/html/config.php on line 41
if (!defined(DIR_SKINS))という感じでとりあえず回避
2012年1月10日火曜日
CS-Cartのタイトルを変更する
skins/basic/customer/index.tpl
商品ページは、商品名 | サイト名となる。
<title>
{if $page_title}
{$page_title|escape:"html"}
{else}
{assign var='breadcrumbs_reverse' value=$breadcrumbs|array_reverse}
{assign var='breadcrumbs_reverse_count' value=$breadcrumbs_reverse|count}
{foreach from=$breadcrumbs_reverse item=i name="bkt"}
{if $_REQUEST.dispatch == 'products.view'}
{if $smarty.foreach.bkt.first}{$i.title|unescape|strip_tags|escape:"html"}{/if}
{else}
{if !$smarty.foreach.bkt.last}{$i.title$i.title|unescape|strip_tags|escape:"html"}{if $breadcrumbs_reverse_count -1 > $smarty.foreach.bkt.iteration} :: {/if}{/if}
{/if}
{/foreach}
{if !$skip_page_title}{if $breadcrumbs_reverse|count > 1} | {/if}{$location_data.page_title}{/if}
{/if}
</title>
これでカテゴリページは、小カテゴリ :: 大カテゴリ | サイト名商品ページは、商品名 | サイト名となる。
2012年1月8日日曜日
CS-Cart HTMLエディタ「CKEditor」の出力フォーマットを変更する
CKEditorの出力ソースをカスタマイズする方法
CKEditorはデフォルトだとソースを勝手にインデントしたり改行を入れるので、それを制御する。
/js/editors/ckeditor.editor.js の CKEDITOR.replace(elm.attr('id'), {}); の次あたり(26行目付近)に
editor.dataProcessor.writer.setRules で指定タグで改行させないを指定する。
http://cksource.com/forums/viewtopic.php?t=14493
CKEditorはデフォルトだとソースを勝手にインデントしたり改行を入れるので、それを制御する。
/js/editors/ckeditor.editor.js の CKEDITOR.replace(elm.attr('id'), {}); の次あたり(26行目付近)に
CKEDITOR.on('instanceReady', function(ev) {
ev.editor.dataProcessor.writer.indentationChars = '';
var tags = ['div', 'h1','h2','h3','h4','h5','h6', 'p', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'table', 'tbody', 'tr', 'th', 'td', 'pre', 'address'];
for (var key in tags) {
ev.editor.dataProcessor.writer.setRules(tags[key], {
breakAfterOpen : false
});
}
});
editor.dataProcessor.writer.indentationChars でインデント文字を指定する。タブの場合は\t、スペースの場合は' '、インデントさせない場合は空白。
editor.dataProcessor.writer.setRules で指定タグで改行させないを指定する。
http://cksource.com/forums/viewtopic.php?t=14493
2011年11月21日月曜日
EC-CUBE 2.11、Google Chromeでfaceboxがズレるのを直す
EC-CUBE 2.11の商品画像を拡大するとGoogle Chrome(Mac)だとfaceboxが右にズレてしまう。
facebox.cssの#facebox .popupにmin-width:を追加して拡大画像の幅を指定してやると直る。
拡大画像の横幅が500pxであれば、
#facebox .popup{
position:relative;
border:3px solid rgba(0,0,0,0);
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 0 18px rgba(0,0,0,0.4);
-moz-box-shadow:0 0 18px rgba(0,0,0,0.4);
box-shadow:0 0 18px rgba(0,0,0,0.4);
min-width: 500px;
}
2011年3月21日月曜日
モニタリングツールの minit をインストールして nginx、MySQL、PHP-FPMを監視する
EPEL レポジトリを追加している場合は
# yum install monit
EPEL レポジトリの追加は下記。
# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/epel-release-1-1.ius.el5.noarch.rpm
# rpm -ivh epel-release-1-1.ius.el5.noarch.rpm
monit の設定ファイル
# vi /etc/monit.conf
set daemon 60
set logfile syslog facility log_daemon
set alert mailaddress
# アラートメールはGmail経由で送信
set mailserver smtp.gmail.com port 587
username "gmail_address" password "gmail_password"
using tlsv1
with timeout 30 seconds
# Include all files from /etc/monit.d/
include /etc/monit.d/*
MySQL 設定ファイル
# vi /etc/monit.d/mysqld
check process mysql with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed port 3306 protocol mysql
then restart
group mysql
nginx 設定ファイル
# vi /etc/monit.d/nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
group nginx
# chkconfig monit on
# /etc/init.d/monit start
monit の設定ファイル
# vi /etc/monit.conf
set daemon 60
set logfile syslog facility log_daemon
set alert mailaddress
# アラートメールはGmail経由で送信
set mailserver smtp.gmail.com port 587
username "gmail_address" password "gmail_password"
using tlsv1
with timeout 30 seconds
# Include all files from /etc/monit.d/
include /etc/monit.d/*
MySQL 設定ファイル
# vi /etc/monit.d/mysqld
check process mysql with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed port 3306 protocol mysql
then restart
group mysql
nginx 設定ファイル
# vi /etc/monit.d/nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
group nginx
PHP-FPM 設定ファイル
# vi /etc/monit.d/php-fpm
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
group nginx
start program "/etc/init.d/php-fpm start"
stop program "/etc/init.d/php-fpm stop"
if failed host 127.0.0.1 port 9000
then restart
if 5 restarts within 5 cycles
then timeout
# chkconfig monit on
# /etc/init.d/monit start
2011年3月18日金曜日
CS-Cart ウォーターマーク アドオン
商品画像にウォータマークをつけることができるアドオン
New addon "Watermarks" is available for testing - CS-Cart Community Forums
ウォータマークにテキスト、画像を指定することができます。
New addon "Watermarks" is available for testing - CS-Cart Community Forums
ウォータマークにテキスト、画像を指定することができます。
2011年3月11日金曜日
CS-Cart で商品画像にウォーターマークを入れる
既に uservoice で image watermark があるのでそのうち対応してくれそうだけど、
phpThumb を使えば簡単にできるのでご紹介。
phpThumbを設定、ウォーターマーク画像を用意する。
拡大画像にウォーターマークを入れたいなら .htaccess に
RewriteRule ^(.*)images/detailed/(.*) $1phpThumb/phpThumb.php?q=100&src=../images/detailed/$2&&fltr[]=wmi|images/watermark_LRG.png|C|100 [L]
初回のみキャッシュ作成のため、読み込みに時間がかかるというのと
GD2よりも ImageMagick を使った方が画像が若干綺麗。
phpThumb を使えば簡単にできるのでご紹介。
phpThumbを設定、ウォーターマーク画像を用意する。
拡大画像にウォーターマークを入れたいなら .htaccess に
RewriteRule ^(.*)images/detailed/(.*) $1phpThumb/phpThumb.php?q=100&src=../images/detailed/$2&&fltr[]=wmi|images/watermark_LRG.png|C|100 [L]
初回のみキャッシュ作成のため、読み込みに時間がかかるというのと
GD2よりも ImageMagick を使った方が画像が若干綺麗。
2011年3月1日火曜日
CS-Cart on nginx
nginx.conf
location / {
root /var/www/html;
index index.php;
if (-f $request_filename) {
break;
}
try_files $uri $uri/ /index.php?sef_rewrite=1;
}
nginx は RewriteRule の QSAフラグ と違って何もしなくてもそのまま引数を渡せるみたい。
location / {
root /var/www/html;
index index.php;
if (-f $request_filename) {
break;
}
try_files $uri $uri/ /index.php?sef_rewrite=1;
}
nginx は RewriteRule の QSAフラグ と違って何もしなくてもそのまま引数を渡せるみたい。
CS-Cart で Warning: The secure connection check has failed. Check HTTPS settings in config.php file and make sure that SSL certificate is installed on your server. エラーが出たときの対処法
Secure connection fails より
nginx上のCS-Cart で
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == '1')) {
define('HTTPS', true);
の後に
} elseif ($_SERVER['SERVER_PORT']=='443') {
define('HTTPS', true);
を追加する
nginx上のCS-Cart で
Warning: The secure connection check has failed. Check HTTPS settings in config.php file and make sure that SSL certificate is installed on your server.というエラーが出たときは、prepare.php の
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == '1')) {
define('HTTPS', true);
の後に
} elseif ($_SERVER['SERVER_PORT']=='443') {
define('HTTPS', true);
を追加する
さくらのVPSにnginx+PHP 5.3.3+MySQL+PHP-FPM+APCをyumを使ってインストール
CentOS 5.5 + PHP 5.3.3 + PHP-FPM + APC + nginx (yum RPMs)を参考に
EPEL、IUS-Communityレポジトリを追加
# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/epel-release-1-1.ius.el5.noarch.rpm
# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/ius-release-1.0-6.ius.el5.noarch.rpm
# rpm -ivh epel-release-1-1.ius.el5.noarch.rpm ius-release-1.0-6.ius.el5.noarch.rpm
IUS-Communityレポジトリのバーションが5なので5.5に変更
# vi /etc/yum.repos.d/ius.repo
mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el5&arch=$basearch をコメントアウトして、
baseurl=http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/$basearch を追加
MySQLのインストール
5.1系
# yum install mysql51.x86_64 mysql51-devel.x86_64 mysql51-server.x86_64
5.5系
# yum install mysql55.x86_64 mysql55-devel.x86_64 mysql55-server.x86_64
PHP 5.3とPHP-FPMとAPCのインストール
# yum install php53u.x86_64 php53u-devel.x86_64 php53u-gd.x86_64 php53u-mbstring.x86_64 php53u-mcrypt.x86_64 php53u-mysql.x86_64 php53u-pdo.x86_64 php53u-pecl-imagick.x86_64 php53u-fpm.x86_64 php53u-pecl-apc.x86_64
その他のエクステンションは yum search php53u で
nginxのインストール
インストールされるバージョンは 0.8.53、0.7系をインストールしたい時は nginx07.x86_64 を指定
# yum install nginx.x86_64
nginxの設定ファイルを編集
# vi /etc/nginx/nginx.conf
#location ~ \.php$ { ブロックのコメントアウトを解除
さらに
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; を
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; に変更
自動起動の設定
# chkconfig mysqld on
# chkconfig php-fpm on
# chkconfig nginx on
MySQL、PHP-FPM、nginxを起動
# service mysqld start
# service php-fpm start
# service nginx start
EPEL、IUS-Communityレポジトリを追加
# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/epel-release-1-1.ius.el5.noarch.rpm
# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/ius-release-1.0-6.ius.el5.noarch.rpm
# rpm -ivh epel-release-1-1.ius.el5.noarch.rpm ius-release-1.0-6.ius.el5.noarch.rpm
IUS-Communityレポジトリのバーションが5なので5.5に変更
# vi /etc/yum.repos.d/ius.repo
mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el5&arch=$basearch をコメントアウトして、
baseurl=http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/$basearch を追加
MySQLのインストール
5.1系
# yum install mysql51.x86_64 mysql51-devel.x86_64 mysql51-server.x86_64
5.5系
# yum install mysql55.x86_64 mysql55-devel.x86_64 mysql55-server.x86_64
PHP 5.3とPHP-FPMとAPCのインストール
# yum install php53u.x86_64 php53u-devel.x86_64 php53u-gd.x86_64 php53u-mbstring.x86_64 php53u-mcrypt.x86_64 php53u-mysql.x86_64 php53u-pdo.x86_64 php53u-pecl-imagick.x86_64 php53u-fpm.x86_64 php53u-pecl-apc.x86_64
その他のエクステンションは yum search php53u で
nginxのインストール
インストールされるバージョンは 0.8.53、0.7系をインストールしたい時は nginx07.x86_64 を指定
# yum install nginx.x86_64
nginxの設定ファイルを編集
# vi /etc/nginx/nginx.conf
#location ~ \.php$ { ブロックのコメントアウトを解除
さらに
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; を
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; に変更
自動起動の設定
# chkconfig mysqld on
# chkconfig php-fpm on
# chkconfig nginx on
MySQL、PHP-FPM、nginxを起動
# service mysqld start
# service php-fpm start
# service nginx start
登録:
投稿 (Atom)



