ラベル Welcart の投稿を表示しています。 すべての投稿を表示
ラベル Welcart の投稿を表示しています。 すべての投稿を表示

2016年4月2日土曜日

Wordpress+Welcart(2) まずプラグインを作るとこから。

WP+WCの2回目。
でもよく考えると、WooCommerceもWCだね^^;

最初にやることは、ここらへんでいきなり質問!ではなくて、まず調べて解析なんですが、
当然のようにJUSTな検索なんかあるわけでもなく、
ここらへんを読むと、結果的に、『自分で解析しましょう!』ってなってます。

ということで、どうするかというと、

これを見ると(※テーマ:Riffles)、まずは"オプションを指定してください"というのを検索してみればよいようなきがするので、やってみます。
そうすると、こんなんが引っかかります。
plugins/usc-e-shop/languages/usces-ja.po(2442): msgstr "オプションを指定してください。"
plugins/usc-e-shop/languages/usces-th.po(2199): msgstr "オプションを指定してください。"
plugins/usc-e-shop/languages/usces.pot(2256): msgstr "オプションを指定してください。"

で、これは言語設定ファイルなので、開いてみると、
msgid "Please appoint an option."
msgstr "オプションを指定してください。"
って感じ。

よって、"Please appoint an option."をGREP。 とりあえずこれだけ発見。
wp-content/plugins/usc-e-shop/templates/single_item.php(45): $html .= "/n";
wp-content/plugins/usc-e-shop/templates/single_item.php(102): $html .= "
" . apply_filters('usces_filter_single_item_options_caption', __('Please appoint an option.', 'usces'), $post) . "
/n"; wp-content/plugins/usc-e-shop/theme/welcart_default/wc_templates/wc_item_single.php(51): wp-content/plugins/usc-e-shop/theme/welcart_default/wc_templates/wc_item_single.php(108): wp-content/themes/riffles_ver1.1/wc_templates/wc_item_single.php(169): wp-content/themes/riffles_ver1.1/wc_templates/wc_item_single.php(288): wp-content/themes/welcart_default/wc_templates/wc_item_single.php(51): wp-content/themes/welcart_default/wc_templates/wc_item_single.php(108): wp-content/themes/welcart_default_kid/wc_templates/wc_item_single.php(51): wp-content/themes/welcart_default_kid/wc_templates/wc_item_single.php(108):
" . apply_filters('usces_filter_single_item_options_caption', __('Please appoint an option.', 'usces'), $post) . "
ということで、single_item.php(45):を調べてみます。ってやってみてハマってしまいました。 まぁCODEをたいして理解しないでやってるのが問題なのですが、これを追っていくと、
if (usces_is_options()) {
  $html .= "\n";
  while (usces_have_options()) {
    $opttr = "";
    $html .= apply_filters('usces_filter_singleitem_option', $opttr, usces_getItemOptName(), NULL) . "\n";
  }
  $html .= "
" . apply_filters('usces_filter_single_item_options_caption', __('Please appoint an option.', 'usces'), $post) . "
" . esc_html(usces_getItemOptName()) . '' . usces_the_itemOption(usces_getItemOptName(),'','return') . "
\n"; }
こんなものを発見するのです。問題はコレ。
apply_filters('usces_filter_singleitem_option'
これをフックすれば何か楽しいことになりそうなきがするじゃないですか、よって、プラグインを書いて検証です。 プラグインは以下。
<?php
/*
Plugin Name: Wlecart keiskes Custom Plugin
Author: keiske
■
*/
/*
st-wc-custom.php
*/
//---------------------------------------
add_filter('usces_filter_singleitem_option','st_usces_filter_singleitem_option');
//---------------------------------------
function st_usces_filter_singleitem_option($opttr="", $name="", $alt=""){
 deBug($opttr);
 return $opttr;
}
//---------------------------------------
function deBug($v,$fl="/web/st-wc-cuatom-php.html"){
 $f = fopen($fl, "a");
 fwrite($f, $v."\n");
 fclose($f);
}
//---------------------------------------
?>
でやっていると、、そもそも、これ、呼ばれて無い!!!(LOG、書かれず。^^;) つづく。

2016年4月1日金曜日

Wordpress+Welcart(1)optionをカスタムする。

WordPressである。
ECである。
WooCommerceとWelcartの2択にした結果、
Welcartを選択。
WooCommerce、サーバの問題はあるけれど、ちょっと遅い。

ということで、WordPress+Welcartをカスタムしてみることにします。
ちなみに理由はあるのですが、WindowsServer(2012)です。


やってみたいのは、これ。


このオプション情報の色選択を画像というか、色のわかる表示をさせたいのです。

今回は、これをするっていうよりも、Welcartへのカスタム方法の第一歩という意味合いが強いです。



WordPressはあんま慣れてないし、、
カスタムするのも初めてだし、
ECも初めてではあるけれど、、
まぁ一応、S/Wが生業なので、どういう手段を取っていくかを書いてみたいと思いますです(o^^o)