welcartで会員ランクを増やす方法
welcartは標準で会員ランクが
・通常会員
・有料会員
・VIP会員
・不良会員
の4つを用意されていますが、これじゃ使い勝手悪いなぁ。
と思いましたので追加してみました。
今回実験に使ったのは
wordpressバージョン 6.8.1
welcart Version 2.11.16
※あくまで個人でやってみただけなのでプラグインがアップデートされると消える可能性があります。
その際にどのような不具合がでるかわかりません。
ご自分のサイトに反映させる場合はあくまで自己責任でお願いします。
①ランクを増やす
/wp-content/plugins/usc-e-shop/includes/initial.php
103行目あたり
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/** * Option - usces_customer_status * key(slug) => 会員ランク */ function usces_customer_status_init() { $customer_status = array( '0' => __( 'notmal member', 'usces' ), '1' => __( 'good member', 'usces' ), '2' => __( 'VIP member', 'usces' ), '99' => __( 'bad member', 'usces' ), ); update_option( 'usces_customer_status', $customer_status ); } |
この部分を
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/** * Option - usces_customer_status * key(slug) => 会員ランク */ function usces_customer_status_init() { $customer_status = array( '0' => __( 'provisional', 'usces' ), '1' => __( 'Platinum', 'usces' ), '2' => __( 'Gold', 'usces' ), '3' => __( 'Silver', 'usces' ), '4' => __( 'Bronze', 'usces' ), '5' => __( 'Grey', 'usces' ), '99' => __( 'bad member', 'usces' ), ); update_option( 'usces_customer_status', $customer_status ); } |
へ変更
この段階で「Welcart Management 会員データ編集」の
画面では会員ランクのところが
Platinum・Gold・Silver・Bronze・Grey・不良会員
という表示になると思います。
あとは日本語変換をする必要があるので
WordPressのプラグインの言語ファイル(.poファイル)
/wp-content/plugins/usc-e-shop/languages/usces-ja.po
に以下を記述
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#: includes/initial.php:21 msgid "notmal member" msgstr "通常会員" #: includes/initial.php:22 msgid "good member" msgstr "優良会員" #: includes/initial.php:23 msgid "VIP member" msgstr "VIP会員" #: includes/initial.php:24 msgid "bad member" msgstr "不良会員" |
の下に追加していったあと
.poファイルから【usces-ja.mo】に変換する
私のオススメはオンラインツール
Convert .po to .mo
https://po2mo.net/
で変換してアップロード。これで表示が変わるはずです。
.moファイルの変換はほかにも
Poeditを使用する方法
WordPressプラグインを使用する方法
msgfmtコマンドを使用する方法
があるけどインストールとか面倒なので。