Changeset 1984670
- Timestamp:
- 12/03/2018 07:05:09 PM (7 years ago)
- Location:
- e-shops-cart2/trunk
- Files:
-
- 5 edited
-
cart/eshops-cart2-source-create.php (modified) (2 diffs)
-
eshops-cart2.php (modified) (2 diffs)
-
html/eshops-cart2-html.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
shortcodes/eshops-cart2-shortcodes.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
e-shops-cart2/trunk/cart/eshops-cart2-source-create.php
r1792481 r1984670 18 18 //const HTTPS_PATH = 'https://192.168.254.210/cart_step'; 19 19 const HTTPS_PATH = 'https://cart.ec-sites.jp/cart_step'; 20 21 //const SP_HTTPS_PATH = 'http://192.168.254.210/sp_step'; 22 const SP_HTTP_PATH = 'http://cart.ec-sites.jp/sp_step'; 23 //const SP_HTTPS_PATH = 'https://192.168.254.210/sp_step'; 24 const SP_HTTPS_PATH = 'https://cart.ec-sites.jp/sp_step'; 20 25 21 26 //const TK_HTTP_PATH = 'http://192.168.254.210/tk_step'; … … 513 518 * @return string 514 519 */ 515 public function create_tk_action() { 516 return "<form method=\"post\" action=\"" . Kago_Source_Define::TK_HTTP_PATH . "/pc/pk00/\">\n"; 520 public function create_tk_action($kago_url) { 521 return "<form method=\"post\" action=\"" . $kago_url . "\">\n"; 522 } 523 524 /** 525 * Create sp form action. 526 * 527 * @return string 528 */ 529 public function create_sp_action($kago_url) { 530 return "<form method=\"post\" action=\"" . $kago_url . "\">\n"; 517 531 } 518 532 -
e-shops-cart2/trunk/eshops-cart2.php
r1792481 r1984670 432 432 } 433 433 434 /** 435 * Get sp kago url. 436 * 437 * @return mixed|boolean 438 */ 439 public function get_api_sp_kago_url() { 440 $api_key = ''; 441 442 $db_param = get_option( 'ec2_settings' ); 443 if ( $db_param ) { 444 $param = unserialize( $db_param ); 445 446 if ( isset( $param['api_key'] ) && $param['api_key'] ) { 447 $api_key = $param['api_key']; 448 } 449 } 450 451 if ( $api_key ) { 452 $url = self::EC2_API_SERVER . "plugin/get-sp-kago-url/"; 453 $args = array( 454 'timeout' => 5, 455 'body' => array( 456 'apikey' => $api_key, 457 ) 458 ); 459 } else { 460 echo 'api_key is not found.'; 461 exit; 462 } 463 464 $response = wp_remote_post( $url, $args ); 465 466 if ( is_array( $response ) ) { 467 if ( 200 === $response['response']['code'] ) { 468 // Status is OK. 469 if ( isset( $response['body'] ) && $response['body'] ) { 470 $url = json_decode( $response['body'] ); 471 return $url; 472 } 473 } else { 474 // Status is NG. 475 echo 'status is not 200.'; 476 exit; 477 } 478 } else { 479 // Response error. 480 echo Eshops_Cart2_Html::message_errors( $response->get_error_messages() ); 481 } 482 483 return false; 484 } 485 486 /** 487 * Get tk kago url. 488 * 489 * @return mixed|boolean 490 */ 491 public function get_api_tk_kago_url() { 492 $api_key = ''; 493 494 $db_param = get_option( 'ec2_settings' ); 495 if ( $db_param ) { 496 $param = unserialize( $db_param ); 497 498 if ( isset( $param['api_key'] ) && $param['api_key'] ) { 499 $api_key = $param['api_key']; 500 } 501 } 502 503 if ( $api_key ) { 504 $url = self::EC2_API_SERVER . "plugin/get-tk-kago-url/"; 505 $args = array( 506 'timeout' => 5, 507 'body' => array( 508 'apikey' => $api_key, 509 ) 510 ); 511 } else { 512 echo 'api_key is not found.'; 513 exit; 514 } 515 516 $response = wp_remote_post( $url, $args ); 517 518 if ( is_array( $response ) ) { 519 if ( 200 === $response['response']['code'] ) { 520 // Status is OK. 521 if ( isset( $response['body'] ) && $response['body'] ) { 522 $url = json_decode( $response['body'] ); 523 return $url; 524 } 525 } else { 526 // Status is NG. 527 echo 'status is not 200.'; 528 exit; 529 } 530 } else { 531 // Response error. 532 echo Eshops_Cart2_Html::message_errors( $response->get_error_messages() ); 533 } 534 535 return false; 536 } 537 434 538 public function get_api_shop_base( $api_key ) { 435 539 if ( $api_key ) { … … 558 662 $tmpl_html =<<<EOM 559 663 <h3>[ec2_item_name]</h3> 560 [ec2_ tk_start_form][ec2_item_attr]<br>664 [ec2_start_form][ec2_item_attr]<br> 561 665 [ec2_item_attr]<br> 562 666 [ec2_item_attr_sel]<br> 563 667 [ec2_item_attr_text]<br> 564 668 [ec2_item_option]<br> 565 [ec2_item_qty] [ec2_ tk_kago][ec2_end_form]669 [ec2_item_qty] [ec2_kago][ec2_end_form] 566 670 商品コード:[ec2_item_code] 567 671 売価:[ec2_item_price]円 -
e-shops-cart2/trunk/html/eshops-cart2-html.php
r1792481 r1984670 48 48 $html .= '<div class="wrap">' . "\n"; 49 49 $html .= ' <h1>' . esc_html__( '設定', EC2_TEXTDOMAIN ) . '</h1>' . "\n"; 50 $html .= $param['description']->wordpress_description;51 50 $html .= ' <form method="post">' . "\n"; 52 51 $html .= ' ' . wp_nonce_field( 'ec2_settings', 'ec2_csrf', true, false ) . "\n"; … … 219 218 [ec2_item_qty] [ec2_kago][ec2_end_form] 220 219 EOM; 220 221 $recommend_sp_kago = <<<EOM 222 [ec2_sp_start_form][ec2_item_attr]<br> 223 [ec2_item_attr]<br> 224 [ec2_item_attr_sel]<br> 225 [ec2_item_attr_text]<br> 226 [ec2_item_option]<br> 227 [ec2_item_qty] [ec2_kago][ec2_end_form] 228 EOM; 229 221 230 $recommend_tk_kago =<<<EOM 222 231 [ec2_tk_start_form][ec2_item_attr]<br> … … 286 295 $html .= ' </div>' . "\n"; 287 296 $html .= ' <div id="cart2Etab5">' . "\n"; 288 $html .= ' ■カゴに入れるボタンセット :<br />' . "\n";297 $html .= ' ■カゴに入れるボタンセット(通常カゴ用):<br />' . "\n"; 289 298 $html .= ' <textarea id="ec2_kago_all" style="width:500px;" rows="8" readonly="readonly">' . $recommend_kago . '</textarea><br />' . "\n"; 290 299 $html .= ' <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_kago_all" >コピー</button><br />' . "\n"; 291 300 $html .= ' <br />' . "\n"; 292 301 $html .= ' <br />' . "\n"; 293 $html .= ' ■通常カゴに入れるボタン :<input type="text" id="ec2_kago" value="[ec2_kago]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_kago" >コピー</button><br />' . "\n"; 294 $html .= ' ■フォーム開始タグ(通常カゴ用):<input type="text" id="ec2_start_form2" value="[ec2_start_form]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_start_form2" >コピー</button><br />' . "\n"; 295 $html .= ' ■フォーム終了タグ :<input type="text" id="ec2_end_form" value="[ec2_end_form]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_end_form" >コピー</button><br />' . "\n"; 296 $html .= ' ■数量指定フォーム :<input type="text" id="ec2_item_qty" value="[ec2_item_qty]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_qty" >コピー</button><br />' . "\n"; 297 $html .= ' ■単純属性 :<input type="text" id="ec2_item_attr" value="[ec2_item_attr]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_attr" >コピー</button><br />' . "\n"; 298 $html .= ' ■属性別在庫 :<input type="text" id="ec2_item_attr_sel" value="[ec2_item_attr_sel]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_attr_sel" >コピー</button><br />' . "\n"; 299 $html .= ' ■テキスト入力属性 :<input type="text" id="ec2_item_attr_text" value="[ec2_item_attr_text]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_attr_text" >コピー</button><br />' . "\n"; 300 $html .= ' ■オプション :<input type="text" id="ec2_item_option" value="[ec2_item_option]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_option" >コピー</button><br />' . "\n"; 302 $html .= ' ■カゴに入れるボタンセット(スマホカゴ用):<br />' . "\n"; 303 $html .= ' <textarea id="ec2_sp_kago_all" style="width:500px;" rows="8" readonly="readonly">' . $recommend_sp_kago . '</textarea><br />' . "\n"; 304 $html .= ' <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_sp_kago_all" >コピー</button><br />' . "\n"; 305 $html .= ' <br />' . "\n"; 306 $html .= ' <br />' . "\n"; 307 $html .= ' ■通常カゴに入れるボタン :<input type="text" id="ec2_kago" value="[ec2_kago]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_kago" >コピー</button><br />' . "\n"; 308 $html .= ' ■フォーム開始タグ(通常カゴ用) :<input type="text" id="ec2_start_form2" value="[ec2_start_form]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_start_form2" >コピー</button><br />' . "\n"; 309 $html .= ' ■フォーム開始タグ(スマホカゴ用):<input type="text" id="ec2_sp_start_form2" value="[ec2_sp_start_form]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_sp_start_form2" >コピー</button><br />' . "\n"; 310 $html .= ' ■フォーム終了タグ :<input type="text" id="ec2_end_form" value="[ec2_end_form]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_end_form" >コピー</button><br />' . "\n"; 311 $html .= ' ■数量指定フォーム :<input type="text" id="ec2_item_qty" value="[ec2_item_qty]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_qty" >コピー</button><br />' . "\n"; 312 $html .= ' ■単純属性 :<input type="text" id="ec2_item_attr" value="[ec2_item_attr]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_attr" >コピー</button><br />' . "\n"; 313 $html .= ' ■属性別在庫 :<input type="text" id="ec2_item_attr_sel" value="[ec2_item_attr_sel]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_attr_sel" >コピー</button><br />' . "\n"; 314 $html .= ' ■テキスト入力属性 :<input type="text" id="ec2_item_attr_text" value="[ec2_item_attr_text]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_attr_text" >コピー</button><br />' . "\n"; 315 $html .= ' ■オプション :<input type="text" id="ec2_item_option" value="[ec2_item_option]" readonly="readonly"> <button type="button" class="clip_copy_btn button" data-clipboard-target="#ec2_item_option" >コピー</button><br />' . "\n"; 301 316 $html .= ' </div>' . "\n"; 302 317 $html .= ' </div>' . "\n"; -
e-shops-cart2/trunk/readme.txt
r1792490 r1984670 3 3 Tags: store, sales, sell, shop, cart 4 4 Requires at least: 4.4.0 5 Tested up to: 4.9. 16 Stable tag: 1.0. 05 Tested up to: 4.9.8 6 Stable tag: 1.0.1 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 66 66 = 1.0.0 - 2017-12-26 = 67 67 * ベータテスト版公開 68 69 = 1.0.1 - 2018-12-04 = 70 * スマホカゴ対応 -
e-shops-cart2/trunk/shortcodes/eshops-cart2-shortcodes.php
r1792481 r1984670 47 47 */ 48 48 private $kago_url; 49 50 /** 51 * EshopsCart2 Sp kago url. 52 * 53 * @var string 54 */ 55 private $sp_kago_url; 56 57 /** 58 * EshopsCart2 Tk kago url. 59 * 60 * @var string 61 */ 62 private $tk_kago_url; 49 63 50 64 /** … … 127 141 'ec2_item_contact' => 'item_contact', 128 142 'ec2_start_form' => 'start_form', 143 'ec2_sp_start_form' => 'sp_start_form', 129 144 'ec2_tk_start_form' => 'tk_start_form', 130 145 'ec2_end_form' => 'end_form', … … 236 251 237 252 if( $tmpl_option['sale_period_disp_flag'] == 2 || $this->item_data['itemData']['item_sale_flag'] == 0 || ( strtotime( $now ) >= strtotime( $this->item_data['itemData']['item_start_date'] ) && strtotime( $now ) <= strtotime( $this->item_data['itemData']['item_end_date'] ) ) ){ 238 239 if ( ! $this->kago_url ) {240 $kagoUrl = EC2()->get_api_kago_url();241 $this->kago_url = $kagoUrl->kago;242 }243 244 253 $kago_src = new Source_Create( $this->shop_id, $this->item_data ); 245 254 … … 270 279 271 280 if( $tmpl_option['sale_period_disp_flag'] == 2 || $this->item_data['itemData']['item_sale_flag'] == 0 || ( strtotime( $now ) >= strtotime( $this->item_data['itemData']['item_start_date'] ) && strtotime( $now ) <= strtotime( $this->item_data['itemData']['item_end_date'] ) ) ){ 272 273 if ( ! $this->kago_url ) {274 $kagoUrl = EC2()->get_api_kago_url();275 $this->kago_url = $kagoUrl->kago;276 }277 278 281 $kago_src = new Source_Create( $this->shop_id, $this->item_data ); 279 282 … … 993 996 994 997 if ( $this->item_data ) { 995 if ( ! $this->kago_url ) {996 $kagoUrl = EC2()->get_api_kago_url();997 $this->kago_url = $kagoUrl->kago;998 }999 998 if ( ! $this->kago_url ) { 999 $kagoUrl = EC2()->get_api_kago_url(); 1000 $this->kago_url = $kagoUrl->kago; 1001 } 1002 1000 1003 $tmpl_option = unserialize( $this->tmpl_data['tmpl_option'] ); 1001 1004 … … 1012 1015 1013 1016 /** 1017 * Create sp start form. 1018 * @return string 1019 */ 1020 public function sp_start_form(){ 1021 $html = ''; 1022 1023 if ( $this->item_data ) { 1024 if ( ! $this->sp_kago_url ) { 1025 $kagoUrl = EC2()->get_api_sp_kago_url(); 1026 $this->sp_kago_url = $kagoUrl->kago; 1027 } 1028 1029 $tmpl_option = unserialize( $this->tmpl_data['tmpl_option'] ); 1030 1031 $now = date("Y-m-d"); 1032 1033 if( $tmpl_option['sale_period_disp_flag'] == 2 || $this->item_data['itemData']['item_sale_flag'] == 0 || ( strtotime( $now ) >= strtotime( $this->item_data['itemData']['item_start_date'] ) && strtotime( $now ) <= strtotime( $this->item_data['itemData']['item_end_date'] ) ) ){ 1034 $kago_src = new Source_Create( $this->shop_id, $this->item_data ); 1035 $html = $kago_src->create_sp_action( $this->sp_kago_url ); 1036 } 1037 } 1038 1039 return $html; 1040 } 1041 1042 /** 1014 1043 * Create tk start form. 1015 1044 * @return string … … 1019 1048 1020 1049 if ( $this->item_data ) { 1021 if ( ! $this->kago_url ) {1022 $kagoUrl = EC2()->get_api_ kago_url();1023 $this-> kago_url = $kagoUrl->kago;1050 if ( ! $this->tk_kago_url ) { 1051 $kagoUrl = EC2()->get_api_tk_kago_url(); 1052 $this->tk_kago_url = $kagoUrl->kago; 1024 1053 } 1025 1054 … … 1030 1059 if( $tmpl_option['sale_period_disp_flag'] == 2 || $this->item_data['itemData']['item_sale_flag'] == 0 || ( strtotime( $now ) >= strtotime( $this->item_data['itemData']['item_start_date'] ) && strtotime( $now ) <= strtotime( $this->item_data['itemData']['item_end_date'] ) ) ){ 1031 1060 $kago_src = new Source_Create( $this->shop_id, $this->item_data ); 1032 $html = $kago_src->create_tk_action( $this-> kago_url );1061 $html = $kago_src->create_tk_action( $this->tk_kago_url ); 1033 1062 } 1034 1063 }
Note: See TracChangeset
for help on using the changeset viewer.