wordPressにショッピングカートYAKを設定する
Posted: 6月 26th, 2009 | Author: admin | Filed under: plugin, wordPress | Tags: cart | No Comments »人気のブログ、wordPressにショッピングカート設置する。
目的
- 3件から10件の単品販売に近い
- 代金引換での支払い
- 一ページにすべて、表示されるイメージ
本格的な販売なら、zencart、ec-cubeを設置だが、blog内にちょっとした、製品を販売したい場合は、もっとシンプルなものがいい。pluginで検索してみるといかが人気のようだ
プラグイン
YAK
http://wordpress.org/extend/plugins/yak-for-wordpress/
- 日本語対応、実績もあるらしい
- 使いやすそうだが、代引きの機能がない
- 商品値段の少数点がなぜか表示される
eShop
http://wordpress.org/extend/plugins/eshop/
- 今回、未テスト
WP e-Commerce
http://wordpress.org/extend/plugins/wp-e-commerce/
- なぜか最新バージョンをインストールしようとするとFatal errorが発生。Google checkout関連みたいだが、とりあえず、今回は保留
ざくっと検討の結果、今回はYAKを選択
設定方法
- インストール
- category "products"を作る
- "default"を"products"カテゴリーの下につくる
- チェックアウト用のページをつくる。たとえばCheckout
- 上記のページに、下記を明記
[yak_checkout] -
銀行支払いの場合はDepositぺージを製作 -
設定>YAK>Basic
デフォルトカントリーをJapanにするProduct category nameを"products"にする
-
ツール>Productsのページで値段、そして在庫数を設定する
-
設定>Yakで、支払方法、送料など全体にかかわる設定をする
オプションの設定
商品属性
YAK Product Detailsで商品属性(Tシャツでいえばサイズとか)が設定できる
- さきに指定したい子カテゴリをつくっておく
例)[size L]とか[size M]とか- 使用したい、属性を子カテゴリーとして指定する
- YAK Product Detailsのtypeで選択する
- post内には以下のように記述するとその属性に従った値段が表示される
[yak_price size L][yak_price 5size M]
カスタマイズ
以下の点がが必要と思われる
日本語化バージョン
一部日本語化されているが、やはり書き換える必要がある。その場合は、poeditを使用して、yak-ja.poをカスタマイズする。
*一部ファイルがpoeditに対応していない場合があるので、注意
住所の順番を日本の習慣にあわせる
住所の順番が日本の習慣としてはおかしいので、以下のファイルのhtmlを変更する
yak-view-address.php
*こちらはhtmlを変更
yak-model.php
*yak-model.php内では住所データを出力用文字列に変換している。それは以下の順番を希望に変更
function get_members() {
$arr = array();$arr['email'] = $this->email;
$arr['recipient'] = $this->recipient;
$arr['phone'] = $this->phone;
$arr['postcode'] = $this->postcode;
$arr['state'] = $this->state;
$arr['city'] = $this->city;
$arr['region'] = $this->region;
$arr['addr1'] = $this->addr1;
$arr['addr2'] = $this->addr2;
$arr['suburb'] = $this->suburb;
$arr['country'] = $this->country;
return $arr;
}
少数点
なぜか、オプションで小数点表示をしない、にしても小数点表示されるので、以下を修正
yak-for-wordpress.phpファイルのyak_format_moneyを書き換える。
$money = number_format($money,$dec_places, $dec_point, $thousands_sep);
を以下に変更する
$money = number_format($money, ”, $dec_point, $thousands_sep);
special instructions(注文時の連絡事項等)
こちらも、なぜかか、注文メールにデーターがはいってこないので以下の変更をする。
1)yak-payments.php内以下の部分を変更
function send_confirmation_email($order_id) {
global $wpdb, $order_table, $order_detail_table;↓
function send_confirmation_email($order_id) {
global $wpdb, $order_table, $order_detail_table,$order_meta_table;
2)yak-payments.php内以下の部分を変更
$results = $wpdb->get_results("select * from $order_detail_table where id = $order_id");
↓
$results = $wpdb->get_results("select * from $order_detail_table where id = $order_id");
$meta = $wpdb->get_var("select value from $order_meta_table where order_id = $order_id");3)yak-payments.php内以下の部分を変更
$mail = str_replace($name, $name2, $mail);
↓
$mail = str_replace($name, $name2, $mail);
$mail = str_replace(‘[mail_address]‘, $email, $mail);$mail = str_replace(‘[special_instructions]‘, $meta, $mail);
この変更によって、[mail_address]と[special_instructions]を適当に追加して、注文確認メールに含めることができる
今回テストでインストールしたページ
参考

Leave a Reply