Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /home/tetch1987/tetch1987.com/public_html/shittakabull/wp-includes/feed-rss2.php on line 8
ECCUBE – ShitTakaBull by tetch1987 https://tetch1987.com/shittakabull WordPress関連やjQueryなどウェブ制作のテクニックデータベース Wed, 28 Feb 2018 09:22:34 +0000 ja hourly 1 https://wordpress.org/?v=7.1.5 ECCUBE 2.12 PostgreからMySQLへ会員情報を移管する手順 https://tetch1987.com/shittakabull/web/eccube-2-12-user-data/ https://tetch1987.com/shittakabull/web/eccube-2-12-user-data/#comments Wed, 15 Mar 2017 12:55:19 +0000 http://tetch1987.com/shittakabull/?p=649 ECCUBE2.12の会員情報を移管する手順になります。ポツポツとECCUBE3の情報やプラグインが出ているなか、仕事でプラグインの関係上ECCUBE2を利用しなくてはならなかったのですが、リニューアルだからと旧サイトのファイルデータはもらえず、移管元となるデータベースと必要最低限の情報のみ渡されました。そして旧サイトのデータベースはPostgreなのに、新サイトのサーバではMySQLだという。特殊なケースになってくると情報も少なく、色々と面倒そうでしたが何とかできそうなのでメモ。とりあえず必要な情報は次の通り。

  1. 旧サイトのデータベースのバックアップデータ(.dumpfile)
  2. 旧サイトの「AUTH MAGIC」(data/config/config.phpに記載)
  3. 旧サイトの「PASSWORD_HASH_ALGOSdata/config/config.phpに記載)

「PostgresからMySQLに変える作業」と「会員情報を移管する作業」の2つの作業の流れになります。会員情報を移管する流れだけを知りたい場合は最初の方は飛ばして大丈夫かと。

【Postgre > MySQL①】phpPgAdminにバックアップデータをインポート

まずは旧サイトのphpPgAdminから吐き出されたdumpfileをPostgreSQLにインポートします。これはあくまでPostgreSQLからMySQLへ移す中間点のために必要な作業なので、新サーバの必要もなくローカルで構築したサーバでも大丈夫だと思いますが、理想はPostgreSQLのバージョンをそろえる方がいいかと思います。今回の場合は新サーバでPostgreが使えない環境だったため他のサーバを利用しました。
この項目は会員情報を移換するだけの方は必要ありません。また、旧サイトも管理下にあって実際に抽出する側の場合は、phpPgAdminからデータをエクスポートする必要があります。

【会員データ移行①】会員情報テーブルをCSV形式でエクスポート

とりあえずphpPgAdminで旧サーバのデータを入れることができたら、次は会員情報のテーブルを抜き出します。顧客データが入っているテーブルは「dtb_customer」です。phpPgAdminの場合は左メニューより「dtb_customer」テーブルを選択し、「エクスポート」からCSV形式でダウンロードします。

【会員データ移行②】会員情報CSVの整形

旧サーバより吐き出されたCSVを整形します。エクセルで開くと文字化けなんかしてしまうことがあるので、Googleスプレッドシートで開きました。無料だしとても便利です。

1)「salt」の値を「NULL」変更

MySQLで見る「NULL」は、Googleスプレッドシートでは「\n」の文字列となって表示されています。
カラム「salt」の値を全て「\n」にしてしまいます。1つの行だけ入れ、角にカーソルを合わせてツタタタターっと伸ばしてしまえば同じ値が入ります。

2)ヘッダー部分(最初の1行)を削除

吐き出されたCSVは最初にカラム名が入っています。「name」とかそういう最初の行です。これを行の削除で消してしまいます。
※Googleスプリットシートでやったからわかりませんが最後に2行空の行が入っていたので消してしまいました。

3)整形したCSVデータを保存

書き出して別名保存しておいた方がいいと思います。あとで利用するかもしれません。

【会員データ移行③】新サイトに同じバージョンでECCUBEをインストール

ここまできたら新サイトにECCUBEをインストールします。バージョンは旧サイトのECCUBEのバージョンとそろえた方がいいと思います。
インストール方法は省略しますが、今回はMySQLにて旧サイトと同じバージョンでECCUBEをインストールしました。

【会員データ移行④】新サイトのphpMyAdminで、旧サイトの整形したCSV(会員テーブル)をインポート

以下はインポートする際に行った設定です。

  • ファイルの文字セット「utf8」
  • インポート済みファイルの書式「LOAD DATAを用いたCSV」
  • フィールド区切り記号「,」
  • フィールド囲み記号「“」
  • ローカルキーワードを使用する「チェック」

【会員データ移行⑤】phpMyAdminで値を変更

ここまでで既に会員データを管理画面から確認できますが、会員データをデータベースに直接インポートした場合、新規会員登録の時にシステムエラーが発生します。理由は何となくですが、ID1として登録ってもう既にID1いるじゃないですか!って感じだと思います。
phpMyAdminで以下を行いました。

  1. 「dtb_customer」テーブルで最後の会員数を確認(※ECCUBE管理画面からの人数と違う場合があります。)
  2. 「dtb_customer_customer_id_sql」に「会員数」を挿入
  3. 「dtb_customer_customer_id_sql」>「操作」で、「AUTO_INCREMENT」の値を「会員数 + 1」にして「実行」

【会員データ移行⑥】config.phpファイルを修正

会員のパスワードは暗号化されてデータベースに挿入されているのですが、新しくECCUBEをインストールした場合はその解読方法も変わってしまうので、このままではせっかく入れ込んだ会員がログインできません。
以下の方法のように、同じキーを入れてあげることでパスワードに対する解釈が旧サイトと同じになりログインできるようになるのですが、今度はインストール時に設定した管理者はログインできなくなるため、1番目の手順は忘れずに必ず行った方がいいと思います。

  1. ECCUBEの管理画面にログイン
  2. 旧サイトのconfig.phpファイル(「data/config/config.php」)にある、「AUTH_MAGIC」と「PASSWORD_HASH_ALGOS」の値をコピー
  3. 新サイトのconfig.phpファイルに、旧サイトの「AUTH_MAGIC」と「PASSWORD_HASH_ALGOS」の値をペースト
  4. 管理画面へ戻り、パスワードを再設定

これで多分大丈夫です。もし不安な場合はログアウトする前に違うブラウザでログインしてみましょう。

まとめ

ECCUBEってややこしいイメージがありましたがやっぱりややこしいと思いました。

]]>
https://tetch1987.com/shittakabull/web/eccube-2-12-user-data/feed/ 1
外部ECCUBEの商品RSSをWordPressのテンプレート内に表示する https://tetch1987.com/shittakabull/web/wordpress-newitem-from-eccube/ https://tetch1987.com/shittakabull/web/wordpress-newitem-from-eccube/#comments Tue, 15 Jul 2014 03:11:32 +0000 http://tetch1987.com/shittakabull/?p=400 会社概要やトップページをWordpress、商品販売ページをECCUBEとして利用している方も多くいると思います。しかし困ってくるのがトップページなどに新着情報(WordPressの投稿)と新着商品(ECCUBEの商品)を同時に掲載したい場合。この方法ではWordpress内でECCUBEの商品RSSを取得して表示します。ECCUBEにWordpressの投稿を表示させるプラグインなどはあるようですが、ページを簡単に作れるWordpressの方をメインに使いたい場合などに便利です。また、外部にECCUBEがある場合にもこの方法は利用できるため、ショップ専用のサーバから取得することもできます。

RSSの取得

以下の参考URLを参考に、ECCUBEの商品RSSを取得するためのPHPコードになります。
参考URL:http://daisukebe.net/php-rss/
SimpleXml関数を利用します。詳しくはまだ知りませんが、XMLデータを簡単にオブジェクト化してくれるもののようです。
「simplexml_load_string」にRSSのURLを入れることによってRSSを配列として取得できます。しかし、ラピッドサイトのVPS-Sプランではうまく動作しなかったため調べてみたところ、以下の参考URLをもとに修正したら表示されました。
参考URL:http://seoaffiliate.org/archives/2544.html

function curl_get_contents( $url, $timeout = 60 ){
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, $url );
    curl_setopt( $ch, CURLOPT_HEADER, false );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
    $result = curl_exec( $ch );
    curl_close( $ch );
    return $result;
}
$result = curl_get_contents('http://sample.com/rss/products.php' , 120);
$rssData = simplexml_load_string($result);

RSSの表示

$rssDataに商品RSSの配列が入っているのでforeachで回して表示させます。リンクやタイトルなども表示できます。print_r($rssData);などで確認してみるといいと思います。$RssMaxを最大値としてループを途中で抜けるようにしています。

<?php 
$RssMax = 10;
$RssCnt = 0;
?>
<?php foreach($rssData->channel->item as $item) : ?>
<div class="Box">
<?php echo $item->description; ?>
</div>
<?php 
$RssCnt++;
if ($RssCnt == $RssMax) {
    break;
}
endforeach; ?>

新着商品RSSの編集

出力するHTMLのクラスなどを編集したい場合は、テンプレートの「/data/Smarty/templates/default/rss/」内のproducts.tplを編集したらできるかと思います。
また、取得する際の順番や表示件数を変更したい場合は「/data/class/pages/rss/LC_Page_Rss_Products.php」を編集します。

ECCUBE商品RSSの順番を変える

このままではID順になっているので、順番を変える方法になります。ECCUBEのコアな部分かと思うので、サイト移転やアップグレードなどする際は注意や必要です。

以下のファイルを修正します。
/data/class/pages/rss/LC_Page_Rss_Products.php
283行目からを変更します。
参考URL:http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=10873&forum=10
修正前

public function lfGetProductsAllclass(&$objQuery)
    {
        // --- 商品一覧の取得
        $objProduct = new SC_Product_Ex();
        $objQuery->setWhere($objProduct->getProductDispConditions());
        $objQuery->setOrder('product_id');
        $arrProductLsit = $objProduct->lists($objQuery);

修正後

public function lfGetProductsAllclass(&$objQuery)
    {
        // --- 商品一覧の取得
        $objProduct = new SC_Product_Ex();
        $objQuery->setWhere($objProduct->getProductDispConditions());
        $objQuery->setOrder('create_date DESC');//作成日順に変更
        $arrProductLsit = $objProduct->lists($objQuery);

また、「create_date DESC」の部分でソートしています。
更新日順:’update_date DESC’
作成日順:’create_date DESC’

ECCUBE商品RSSの取得件数を変更

このままではすべての商品を取得するので、商品が多くになるにつれ重くなっていきます。また、この方法では商品RSSを変更することになるので、新しいRSSを用意した方がいいかもしれません。
ECCUBEのコアな部分かと思うので、サイト移転やアップグレードなどする際は注意や必要です。
順番の変更と同じく、以下のファイルを修正します。
/data/class/pages/rss/LC_Page_Rss_Products.php
283行目からを変更します。
参考URL:http://aerocompact.blog91.fc2.com/blog-entry-44.html

修正前

public function lfGetProductsAllclass(&$objQuery)
    {
        // --- 商品一覧の取得
        $objProduct = new SC_Product_Ex();
        $objQuery->setWhere($objProduct->getProductDispConditions());
        $objQuery->setOrder('product_id');
        $arrProductLsit = $objProduct->lists($objQuery);

修正後

public function lfGetProductsAllclass(&$objQuery)
    {
        // --- 商品一覧の取得
        $objProduct = new SC_Product_Ex();
        $objQuery->setWhere($objProduct->getProductDispConditions());
        $objQuery->setOrder('product_id');
        $objQuery->setlimit(9);//LIMITを追加
        $arrProductLsit = $objProduct->lists($objQuery);

「setlimit(9)」の括弧内の数字を変えることで取得件数を指定できます。
この場合だと9件取得します。

]]>
https://tetch1987.com/shittakabull/web/wordpress-newitem-from-eccube/feed/ 1
ラピッドサイトVPSにWordPressとECCUBEをインストールする https://tetch1987.com/shittakabull/web/rapidsite-vps-install-wordpress-and-eccube/ https://tetch1987.com/shittakabull/web/rapidsite-vps-install-wordpress-and-eccube/#respond Tue, 23 Jul 2013 03:21:18 +0000 http://tetch1987.com/shittakabull/?p=43 ラピッドサイトにてトップページや会社概要、新着情報をWordPressにし、「shop」フォルダにEC-CUBEを展開する方法。
この場合の注意点としてトップページやWorpdressのページで、商品への直リンクを張ったりは出来るかとは思いますが、ECCUBEの機能を使うのには更に何かする必要があります。ECサイトの新着情報にWordpressを利用したい人向けというよりは、会社のホームページにプラスアルファで販売もしたい人向けです。
また、shopページのタイトルを「ショップ | サイト名」などとしたい場合、店名やmain.tplなどに注意が必要です。。
特に普通と変わらないインストールの部分は省略します。

ファルダ構想

ワードプレスを「wp」フォルダ内に展開し、パーマリンクの変更を行う。EC-CUBEは「shop」内に展開し、「html」フォルダ内のファイルを階層を一つ上げて「shop」直下におく。

  • index.php
  • wp
    • wp-admin
    • wp-content
    • wp-include…etc
  • shop
    • abouts
    • admin
    • cart
    • content
    • data…etc

パスの例

トップ
http://example.com/
直下index.phpが、「wp」フォルダ内のwordpressを読み取ります。
会社概要
http://example.com/about.html
wordpressの設定、パーマリンクの設定とfunctions.phpにする記述により.htmlを尾につけます。
新着情報
http://example.com/news
WordPressのカテゴリー「news」一覧表示になります。語尾「/」はつきません。
新着情報の記事
http://example.com/news/33.html
投稿のシングルページはポストID.htmlで表示にします。
商品販売
http://example.com/shop/
「shop」フォルダ内のEC CUBEを展開させます。

流れ

wordpressのインストールからパスを整えるまでの流れ。

  1. WordPressをインストールする
  2. eccubeを「shop」内にインストールする
  3. eccubeのファイル構成を変え再インストール
  4. Wordpresのパーマリンク変更
  5. eccubeのフォルダ内にWPのリライト設定解除
  6. ControlPanelのリライト設定解除

1.Wordpressをインストールする。

「wp」フォルダ内にWordpressをインストールします。ダウンロード&解凍した「wordpress-xxx」のフォルダ名を「wp」に修正してアップするだけです。
一応ラピッドサイトにおけるWordpressのインストールの主な流れを書きます

データベース作成

http://ドメイン名/mysqladmin/にphpMyAdmin行き、サーバ管理者IDとサーバ管理者パスワードを入力します。
もしサブホストの場合には、http://メインドメイン/mysqladmin/で入ります。

WordPressのダウンロード・アップロード

WordPressのサイトに行き、最新版をダウンロードします。
「wodrepss-xxx.zip」を解凍し、「wp」にフォルダ名を変更してそのまま直下にアップロードします。

ディレクトリのパーミッション変更、インストール

事前に「wp」を「777」に変更することによって、手動で「wp-config.php」を作成せずに済みます。
「localhost」、「管理者ID」、「管理者パスワード」、「データベース名」でインストールできます。

2.EC CUBEをインストールする。

最初に通常通り「shop」フォルダ内にEC CUBEをインストールします。
最新版eccube2.12.xはインストールできませんでした。(2013.02.08現在)
eccube2.11.xは確認済みですので、eccubeのサイトからダウンロードして利用して下さい。

データベース作成

http://ドメイン名/mysqladmin/にphpMyAdmin行き、サーバ管理者IDとサーバ管理者パスワードを入力します。
もしサブホストの場合には、http://メインドメイン/mysqladmin/で入ります。
照合順序を「utf8_unicode_ci」で作成して下さい。

EC CUBEのダウンロード・アップロード

ecucubeのサイトに行き、過去のリリースから「eccube2.11.x.zip」をダウンロードします。
FTPで直下(ドキュメントルート)にアップロードします。

SSH接続、ルートユーザーに変更

アプリケーションソフト「Poderosa」(無料ダウンロード可能)を利用し、接続します。
「新規Telnet/SHH接続」で以下を入力

  1. ホスト:ドメイン
  2. プロトコル:SSh3
  3. アカウント:サーバ管理者ID(サブホストはドメイン管理者ID)
  4. 認証方法:パスワード
  5. パスフレーズ:サーバ管理者パス(サブホストはドメイン管理者パス)

ルートユーザに変えます。(以後SHHの説明で、「# 」は分りやすく浸けたものです。実際に入力するのは「# 」以後です。)

# su

パスワードを求められるので、ルートパスワードを入力。

ドキュメントルートに移動

メインドメインの場合は、

# cd /www/htdocs

サブホストの場合は、

# cd /home/ドメイン管理者ID/www/ドメイン名

解凍と権限の設定

アップロードしたzipファイルを解凍します。

# unzip eccube-xxx.zip

権限を変えます。eccubeの部分は各々の名前に変更して下さい。

# chmod 777 ./eccube/html/install/temp

FFTPで名前を変更

解凍されたファイル「eccube-2-11-x(例)」を「shop」に変更します。

インストールします。

http://ドメイン名/shop/html/install/にアクセスし、インストールします。

  1. DBの種類:MySQL
  2. DBサーバ:localhost
  3. DB名:ECCUBE用に作成したデータベース名
  4. DBユーザ:サーバ管理者ID
  5. DBパスワード:サーバ管理者パス

3.eccubeのファイル構成を変え再インストール

このままでは「ドメイン/shop/html/」にeccubeが展開されるため、SSH接続によりファイルの構成を変えます。
最初から構成を変えてインストールしようとするとなぜか出来ませんでした。

SSHで「shop」に移動

メインドメインの場合は、

# cd /www/htdocs/shop

サブホストの場合は、

# cd /home/ドメイン管理者ID/www/ドメイン名/shop

フォルダの移動

「data」ディレクトリを「html」内に移動します。

# mv data ./html

「html」の中身だけを「shop」直下に移動します。
メインドメインの場合は、

# mv ./html/* /www/htdocs/shop

サブホストの場合は、

# mv ./html/* /home/ドメイン管理者ID/www/ドメイン名/shop

権限を変更します。
メインドメインの場合は、

# chmod 707 ./html/* /www/htdocs/shop

サブホストの場合は、

# chmod 707 ./html/* /home/ドメイン管理者ID/www/ドメイン名/shop

FTPで「shop」フォルダ内の「html」を削除します

define.phpの編集

http://ドメイン名/shop/ 内にあるdefine.phpをダウンロードして修正します。
変更前

define("HTML2DATA_DIR", "/../data/");

変更後

define("HTML2DATA_DIR", "/./data/");

「.htaccess」の作成、アップロード

アプリケーションソフト「TeraPad」を使い、新規作成して下記を記入します。

php_value mbstring.language Japanese
php_value output_handler mb_output_handler
php_flag mbstring.encoding_translation 1
php_flag magic_quotes_gpc 0
php_flag zlib.output_compression Off
#php_flag session.use_cookies 0
#php_flag session.use_trans_sid 1
php_value mbstring.internal_encoding UTF-8
php_value upload_max_filesize 5M

「.htaccess」として保存し、これをhttp://ドメイン名/shop/内にアップロードします。
※Macを利用している場合は、「htaccess」で保存し、アップロードしてからリネーム。

再インストールします。

http://ドメイン名/shop/install/にアクセスしてインストールします。
先ほどと同じ様に進んでいますが、ECサイトの設定の項目で以下を変更します。

  1. HTMLのパス:ドキュメントルート/shop/ に変更
  2. URL(通常):http://ドメイン名/shop/
  3. URL(セキュア):https://ドメイン名/shop/

4.Wordpresのパーマリンク変更

wordpressが「ドメイン/wp/」内に展開しているので、ドメイン直下に持ってくるように設定。

投稿を「ポストID.html」する。

「ダッシュボード」「設定」「パーマリンク設定」から、「カスタム構造」にチェックを入れ、
http://ドメイン名/wp/%category%/%post_id%.htmlを入力

作成できない場合

「TeraPad」で「.htaccess」を作成して、「FFFTP」で「http://ドメイン名/wp/」直下にアップロード
パーミッション(属性・アクセス権限)を「707」に変更。
また設定画面に戻り「変更を保存」をクリックする。

固定ページを「スラッグ.html」する。

利用しているテーマ内の「functions.php」(http://ドメイン名/wp/wp-content/themes/テーマ名/functions.php)に以下を追加。
もしなかったら作成し、「<?php」を先頭につけ、以下を追加してアップロード。

add_action( 'init', 'mytheme_init' );
if ( ! function_exists( 'mytheme_init' ) ) {
	function mytheme_init() {
		global $wp_rewrite;
		$wp_rewrite->page_structure = $wp_rewrite->root . '%pagename%.html';
		flush_rewrite_rules( false );
	}
}

トップページをドメイン直下にする

「ダッシュボード」「設定」「一般アドレス」をhttp://ドメイン名/変更

直下にindex.phpと「.htaccess」が生成されない場合

「TeraPad」で「.htaccess」を作成して、「FFFTP」で「http://ドメイン名/」直下にアップロード
パーミッション(属性・アクセス権限)を「707」に変更。
「http://ドメイン名/wp/index.php」をダウンロードし、以下に変更。

require('./wp/wp-blog-header.php');

「http://ドメイン名/」にアップロードします。

5.eccubeのフォルダ内にWPのリライト設定解除

「http://ドメイン名/shop」に行ってもWordpressのテーマが表示される場合は、リライト設定解除を「http://ドメイン名/shop/.htaccess」に記入。

RewriteEngine Off

6.ControlPanelへログインできるようにする

「http://ドメイン名/ControlPanel」にアクセスしてもWordpressのテーマが表示されてしまうので修正する

  1. 「http://ドメイン名/」に「ControlPanel」のフォルダをアップロード
  2. 「http://ドメイン名/ControlPanel/」に「.htaccess」を作成し下記を記入。

    RewriteEngine Off
]]>
https://tetch1987.com/shittakabull/web/rapidsite-vps-install-wordpress-and-eccube/feed/ 0