OSDN Git Service

Eコマース機能更新。 v2.21.7
authornaoki hirata <naoki@magic3.org>
Thu, 23 Nov 2017 13:57:45 +0000 (22:57 +0900)
committernaoki hirata <naoki@magic3.org>
Thu, 23 Nov 2017 13:57:45 +0000 (22:57 +0900)
include/wp/plugins/woocommerce/includes/class-wc-ajax.php
include/wp/wp-includes/functions.php
include/wp/wp-includes/load.php

index 83e81b4..c717409 100644 (file)
@@ -365,10 +365,10 @@ class WC_AJAX {
                $product_id        = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) );
                $quantity          = empty( $_POST['quantity'] ) ? 1 : wc_stock_amount( $_POST['quantity'] );
                $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
-               $product_status    = get_post_status( $product_id );
+//             $product_status    = get_post_status( $product_id );
+               $product_status    = get_post_status($product_id, 'product');                   // データタイプを指定
 
                if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity ) && 'publish' === $product_status ) {
-
                        do_action( 'woocommerce_ajax_added_to_cart', $product_id );
 
                        if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) {
index 363ae0e..009336a 100644 (file)
@@ -3160,19 +3160,27 @@ function _wp_json_prepare_data( $data ) {
  * @param int   $status_code The HTTP status code to output.
  */
 function wp_send_json( $response, $status_code = null ) {
+       global $gPageManager;
+                       
+       // システムを中断
+       $gPageManager->abortPage();
+               
        @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
        if ( null !== $status_code ) {
                status_header( $status_code );
        }
        echo wp_json_encode( $response );
 
-       if ( wp_doing_ajax() ) {
+       // システム終了
+       $gPageManager->exitSystem();
+       
+/*     if ( wp_doing_ajax() ) {
                wp_die( '', '', array(
                        'response' => null,
                ) );
        } else {
                die;
-       }
+       }*/
 }
 
 /**
index dd2984c..4354e23 100644 (file)
@@ -1055,6 +1055,7 @@ function wp_is_ini_value_changeable( $setting ) {
  * @return bool True if it's a WordPress Ajax request, false otherwise.
  */
 function wp_doing_ajax() {
+       // AJAX起動かどうかは$_GET['wc-ajax']の値があるかどうかで判断される
        /**
         * Filters whether the current request is a WordPress Ajax request.
         *