OSDN Git Service

Eコマース機能更新。
authornaoki hirata <naoki@magic3.org>
Sat, 9 Dec 2017 00:19:33 +0000 (09:19 +0900)
committernaoki hirata <naoki@magic3.org>
Sat, 9 Dec 2017 00:19:33 +0000 (09:19 +0900)
include/wp/contentApi.php
include/wp/plugins/woocommerce/includes/wc-core-functions.php

index c06a62e..3354b34 100644 (file)
@@ -153,6 +153,7 @@ class ContentApi extends BaseApi
                        case M3_VIEW_TYPE_PRODUCT:      // 製品
                                // ##### woocommerce.phpが呼ばれる前にWooCommerceで使用するオプション値は取得しておく #####
                                global $m3WpOptions;            // 初期値取得用
+                               global $gCommerceApi;           // EコマースAPI
                                
                                // ##### 商品価格の扱い #####
                                // 商品価格と税は分けて計算する。商品価格を表示するときは税を含んで表示する。
@@ -193,6 +194,10 @@ class ContentApi extends BaseApi
                                        }
                                });
                                
+                               // EコマースAPIオブジェクト作成
+                               require_once($this->gEnv->getWordpressRootPath() . '/commerceApi.php'); // EコマースAPI
+                               $gCommerceApi = new CommerceApi();
+                               
                                $this->useCommerce = true;                      // EC機能を使用
                                break;
                        case M3_VIEW_TYPE_BBS:  // BBS
index 9b5b607..1d3fd23 100644 (file)
@@ -737,16 +737,16 @@ function wc_print_js() {
 function wc_setcookie( $name, $value, $expire = 0, $secure = false ) {
                global $gRequestManager;
 
-               // ##### $name\82Ì\83N\83b\83L\81[\96¼\82Í\90æ\93ª\82É\81uwoocommerce_\81v\82ª\95t\89Á\82³\82ê\82Ä\82¢\82é #####
+               // ##### $nameのクッキー名は先頭に「woocommerce_」が付加されている #####
                if (intval($expire) == 0){
-                       $expire = 0;                    // \83u\83\89\83E\83U\95Â\82\82é\82Ü\82Å\90\91
-               } else if ($expire < time()){// \8c»\8dÝ\8e\9e\82æ\82è\82à\91O\82Ì\8fê\8d\87\82Í\83N\83b\83L\81[\82ð\8dí\8f\9c
+                       $expire = 0;                    // ブラウザ閉じるまで生存
+               } else if ($expire < time()){// 現在時よりも前の場合はクッキーを削除
                        $gRequestManager->removeCookieValue($name);
                        return;
                } else {
-                       $expire = $expire / (60 * 60 * 24);             // \93ú\82É\82¿\8a·\8eZ
+                       $expire = $expire / (60 * 60 * 24);             // 日にち換算
                }
-               // \83N\83b\83L\81[\82ð\8dì\90¬
+               // クッキーを作成
                $gRequestManager->setCookieValue($name, $value, $expire);
                
 /*     if ( ! headers_sent() ) {
@@ -1372,7 +1372,11 @@ function wc_postcode_location_matcher( $postcode, $objects, $object_id_key, $obj
  * @return int
  */
 function wc_get_shipping_method_count( $include_legacy = false ) {
-       return 0;
+       global $gCommerceApi;
+       
+       // 配送方法の総数を取得
+       $count = $gCommerceApi->getDeliveryMethodCount();
+       return $count;
 /*     global $wpdb;
 
        $transient_name = 'wc_shipping_method_count_' . ( $include_legacy ? 1 : 0 ) . '_' . WC_Cache_Helper::get_transient_version( 'shipping' );