Plugin Directory

Changeset 3063365


Ignore:
Timestamp:
04/03/2024 07:40:45 AM (2 years ago)
Author:
shipdepot
Message:

Update version 1.2.15

Location:
ship-depot/trunk
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • ship-depot/trunk/Ship_Depot_init.php

    r3043421 r3063365  
    55 * Plugin URI:        https://shipdepot.vn/
    66 * Description:       Ship Depot support shipping couriers in Vietnam like GHN, GHTK, AhaMove.
    7  * Version:           1.2.14
     7 * Version:           1.2.15
    88 * Author:            ShipDepot.vn
    99 * Text Domain:       ship-depot-translate
     
    3535
    3636if (!defined('SHIP_DEPOT_VERSION')) {
    37     define('SHIP_DEPOT_VERSION', '1.2.14');
     37    define('SHIP_DEPOT_VERSION', '1.2.15');
    3838}
    3939
  • ship-depot/trunk/assets/css/fe-checkout.css

    r3014505 r3063365  
    3434}
    3535
     36#sd_reload_shipping {
     37  text-decoration: none;
     38  background-color: #0064ff;
     39  color: #ffffff;
     40  border: none;
     41  padding: 10px 20px;
     42  border-radius: 10px;
     43  cursor: pointer;
     44}
     45
    3646@media screen and (max-width: 599px) {
    3747  /* .courier-fee {
  • ship-depot/trunk/assets/js/fe-checkout.js

    r3014505 r3063365  
    521521            });
    522522        });
     523
     524        $('form[name=checkout]').on('click', '#sd_reload_shipping', function (event)
     525        {
     526            $(document.body).trigger('update_checkout');
     527        });
     528
     529        function CallValidate()
     530        {
     531            if ($('#sd_call_validate').length == 0)
     532            {
     533                $('form[name=checkout]').append('<input type="hidden" id="sd_call_validate" name="sd_call_validate" value="1">');
     534            }
     535            else
     536            {
     537                $('#sd_call_validate').val('1');
     538            }
     539            $('#place_order').click();
     540        }
     541
    523542    }
    524543
  • ship-depot/trunk/helper/class-function-helper.php

    r3015313 r3063365  
    172172        {
    173173            Ship_Depot_Logger::wrlog('[http_post] url: ' . $url);
    174             Ship_Depot_Logger::wrlog('[http_post] body_input: ' . print_r($body_input, true));
     174            // Ship_Depot_Logger::wrlog('[http_post] body_input: ' . print_r($body_input, true));
    175175            Ship_Depot_Logger::wrlog('[http_post] json_body_input: ' . print_r(json_encode($body_input), true));
    176176            Ship_Depot_Logger::wrlog('[http_post] header_input: ' . print_r($header_input, true));
    177             $header = array('Content-Type' => 'application/json');
     177            $header = array();
     178            $header['Expect'] = '';
    178179            foreach ($header_input as $key => $value) {
    179                 $header = array($key => $value);
     180                $header[$key] = $value;
    180181            }
    181182
     
    184185                esc_url($url),
    185186                array(
    186                     'timeout'     => 45,
    187187                    'headers' => $header,
    188188                    'body' => $body_input
     
    195195            Ship_Depot_Logger::wrlog('[http_post] output: ' . print_r($output, true));
    196196            if (is_wp_error($response)) {
    197                 Ship_Depot_Logger::wrlog("[http_post] Reponse WP Error.");
     197                Ship_Depot_Logger::wrlog("[http_post] Reponse WP Error. Message: " . print_r($response, true));
    198198                $result->Code = -1000;
    199199                $result->Msg = $response->get_error_message();
     
    201201            } else if (!$output || $http_code != 200) {
    202202                Ship_Depot_Logger::wrlog("[http_post] HTTP Error or Output error.");
     203                Ship_Depot_Logger::wrlog("[http_post] http_code: " . $http_code);
    203204                $result->Code = -1001;
    204205                $msg = 'HTTP POST error. Error message: Connection Failure.';
     
    463464    }
    464465}
     466
     467// add_action('http_api_debug', function ($response, $context, $class, $parsed_args, $url) {
     468//     Ship_Depot_Logger::wrlog('[http_api_debug_hook] $url: ' . print_r($url, true));
     469//     Ship_Depot_Logger::wrlog('[http_api_debug_hook] $parsed_args: ' . print_r($parsed_args, true), 99999);
     470//     Ship_Depot_Logger::wrlog('[http_api_debug_hook] $response: ' . print_r($response, true), 99999);
     471// }, 10, 5);
  • ship-depot/trunk/helper/class-ship-depot-log.php

    r2922618 r3063365  
    1414         * @version 4.0.0
    1515         */
    16         public static function wrlog($message)
     16        public static function wrlog($message, $limit_length = 500)
    1717        {
    1818            if (!class_exists('WC_Logger')) {
     
    2727            if (empty(self::$logger)) {
    2828                self::$logger = wc_get_logger();
     29            }
     30
     31            if (strlen($message) > $limit_length) {
     32                $message = '---------------- Sub string 0-' . $limit_length . "---------------- \n" .  substr($message, 0, $limit_length) . "\n" . '---------------- End sub string ----------------';
    2933            }
    3034
     
    5054                    mkdir($log_filename, 0777, true);
    5155                }
    52                
     56
    5357                $log_file_data = $log_filename . '/ship-depot-log_' . date('d-M-Y') . '.log';
    5458                // if you don't add `FILE_APPEND`, the file will be erased each time you add a log
  • ship-depot/trunk/includes/Address/frontend/class-custom-checkout-fields.php

    r3043419 r3063365  
    2525
    2626                $fields[$item][$item . '_city'] = array(
    27                     'label'       => esc_html__('Tỉnh/Thành Phố', ''),
     27                    'label'       => esc_html__('Tỉnh/Thành Phố', 'ship-depot-translate'),
    2828                    'required'    => true,
    2929                    'description' => '',
     
    141141
    142142
    143 // add_filter('__experimental_woocommerce_blocks_register_checkout_field', 'custom_register_checkout_field');
    144 
    145 // function custom_register_checkout_field($fields)
    146 // {
    147 //     // Replace 'custom_field' with your desired field name
    148 //     $fields['gov-id'] = array(
    149 //         'label'         => 'Government ID',
    150 //         'optionalLabel' => 'Government ID (optional)',
    151 //         'location'      => 'address',
    152 //         'required'      => true,
    153 //         'attributes'    => array(
    154 //             'autocomplete'     => 'government-id',
    155 //             'aria-describedby' => 'some-element',
    156 //             'aria-label'       => 'custom aria label',
    157 //             'pattern'          => '[A-Z0-9]{5}', // A 5-character string of capital letters and numbers.
    158 //             'title'            => 'Title to show on hover',
    159 //             'data-custom'      => 'custom data',
    160 //         ),
    161 //     );
    162 
    163 //     return $fields;
    164 // }
     143// add_action(
     144//     'woocommerce_blocks_loaded',
     145//     function () {
     146//         __experimental_woocommerce_blocks_register_checkout_field(
     147//             array(
     148//                 'id'            => 'ship-depot/gov-id',
     149//                 'label'         => esc_html__('Phường/Xã', 'ship-depot-translate'),
     150//                 'location'      => 'address',
     151//                 'required'      => true
     152//             ),
     153//         );
     154//     },
     155//     10,
     156//     4
     157// );
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-markup-courier-condition.php

    r2922618 r3063365  
    1010        {
    1111            parent::MapData($object, $this);
    12             Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Courier_Condition] this: ' . print_r($this, true));
     12            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Courier_Condition] this: ' . print_r($this, true));
    1313        }
    1414    }
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-markup-courier-service.php

    r2922618 r3063365  
    1111        {
    1212            parent::MapData($object, $this);
    13             Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Courier_Service] this: ' . print_r($this, true));
     13            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Courier_Service] this: ' . print_r($this, true));
    1414        }
    1515    }
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-markup-option.php

    r2922618 r3063365  
    1111        {
    1212            parent::MapData($object, $this);
    13             Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Option] this: ' . print_r($this, true));
     13            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Option] this: ' . print_r($this, true));
    1414        }
    1515    }
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-markup-order-condition.php

    r2922618 r3063365  
    33
    44if (!class_exists('Ship_Depot_Fee_Markup_Order_Condition')) {
    5 class Ship_Depot_Fee_Markup_Order_Condition extends Ship_Depot_Base_Model
    6 {
    7     public string $ID = "";
    8     public string $Type = "";
    9     public int $FromValue = 0;
    10     public int $ToValue = 0;
    11     public string $FixedValue = "";
    12     function __construct($object = null)
     5    class Ship_Depot_Fee_Markup_Order_Condition extends Ship_Depot_Base_Model
    136    {
    14         parent::MapData($object, $this);
    15         Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Order_Condition] this: ' . print_r($this, true));
     7        public string $ID = "";
     8        public string $Type = "";
     9        public int $FromValue = 0;
     10        public int $ToValue = 0;
     11        public string $FixedValue = "";
     12        function __construct($object = null)
     13        {
     14            parent::MapData($object, $this);
     15            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Order_Condition] this: ' . print_r($this, true));
     16        }
    1617    }
    1718}
    18 }
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-markup-time-condition.php

    r2922618 r3063365  
    1111        {
    1212            parent::MapData($object, $this);
    13             Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Time_Condition] this: ' . print_r($this, true));
     13            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup_Time_Condition] this: ' . print_r($this, true));
    1414        }
    1515    }
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-markup.php

    r2922618 r3063365  
    33
    44if (!class_exists('Ship_Depot_Fee_Markup')) {
    5 class Ship_Depot_Fee_Markup extends Ship_Depot_Base_Model
    6 {
    7     public string $ID = "";
    8     public bool $IsActive = false;
    9     public array $ListOrderConditions = [];
    10     public Ship_Depot_Fee_Markup_Option $Option;
    11     public Ship_Depot_Fee_Markup_Time_Condition $TimeApply;
    12     public Ship_Depot_Fee_Markup_Courier_Condition $CourierApply;
    13     public string $Notes = "";
     5    class Ship_Depot_Fee_Markup extends Ship_Depot_Base_Model
     6    {
     7        public string $ID = "";
     8        public bool $IsActive = false;
     9        public array $ListOrderConditions = [];
     10        public Ship_Depot_Fee_Markup_Option $Option;
     11        public Ship_Depot_Fee_Markup_Time_Condition $TimeApply;
     12        public Ship_Depot_Fee_Markup_Courier_Condition $CourierApply;
     13        public string $Notes = "";
    1414
    15     function __construct($object = null)
    16     {
    17         $this->Option = new Ship_Depot_Fee_Markup_Option();
    18         $this->TimeApply = new Ship_Depot_Fee_Markup_Time_Condition();
    19         $this->CourierApply = new Ship_Depot_Fee_Markup_Courier_Condition();
    20         parent::MapData($object, $this);
    21         Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup] this aft: ' . print_r($this, true));
     15        function __construct($object = null)
     16        {
     17            $this->Option = new Ship_Depot_Fee_Markup_Option();
     18            $this->TimeApply = new Ship_Depot_Fee_Markup_Time_Condition();
     19            $this->CourierApply = new Ship_Depot_Fee_Markup_Courier_Condition();
     20            parent::MapData($object, $this);
     21            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Markup] this aft: ' . print_r($this, true));
     22        }
    2223    }
    2324}
    24 }
  • ship-depot/trunk/includes/Model/FeeSetting/class-fee-settings.php

    r2922618 r3063365  
    1212            $this->ListFeeMarkups = [];
    1313            parent::MapData($object, $this);
    14             Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Setting] this: ' . print_r($this, true));
     14            // Ship_Depot_Logger::wrlog('[Ship_Depot_Fee_Setting] this: ' . print_r($this, true));
    1515        }
    1616    }
  • ship-depot/trunk/includes/Model/ShippingFee/class-courier-response.php

    r2922618 r3063365  
    1717            $this->ListServices = [];
    1818            parent::MapData($object, $this);
    19             Ship_Depot_Logger::wrlog('[Ship_Depot_Courier_Response] this: ' . print_r($this, true));
     19            // Ship_Depot_Logger::wrlog('[Ship_Depot_Courier_Response] this: ' . print_r($this, true));
    2020        }
    2121    }
  • ship-depot/trunk/includes/Model/ShippingFee/class-shipping-fee-info.php

    r2922618 r3063365  
    1717            $this->MarkupOption = new Ship_Depot_Fee_Markup_Option();
    1818            parent::MapData($object, $this);
    19             Ship_Depot_Logger::wrlog('[Ship_Depot_Shipping_Fee_Info] this: ' . print_r($this, true));
     19            // Ship_Depot_Logger::wrlog('[Ship_Depot_Shipping_Fee_Info] this: ' . print_r($this, true));
    2020        }
    2121    }
  • ship-depot/trunk/includes/Model/ShippingFee/class-shipping-fee-response.php

    r2922618 r3063365  
    4747            }
    4848            parent::MapData($object, $this);
    49             Ship_Depot_Logger::wrlog('[Ship_Depot_Shipping_Fee_Response] this: ' . print_r($this, true));
     49            // Ship_Depot_Logger::wrlog('[Ship_Depot_Shipping_Fee_Response] this: ' . print_r($this, true));
    5050        }
    5151    }
  • ship-depot/trunk/includes/Model/class-cod-failed-notice.php

    r2922618 r3063365  
    1111        {
    1212            parent::MapData($object, $this);
    13             Ship_Depot_Logger::wrlog('[Ship_Depot_COD_Failed_Notice] this: ' . print_r($this, true));
     13            // Ship_Depot_Logger::wrlog('[Ship_Depot_COD_Failed_Notice] this: ' . print_r($this, true));
    1414        }
    1515    }
  • ship-depot/trunk/includes/Model/class-cod-failed.php

    r2922618 r3063365  
    1616            $this->ContentShippingLabel = new Ship_Depot_COD_Failed_Notice();
    1717            parent::MapData($object, $this);
    18             Ship_Depot_Logger::wrlog('[Ship_Depot_COD_Failed] this: ' . print_r($this, true));
     18            // Ship_Depot_Logger::wrlog('[Ship_Depot_COD_Failed] this: ' . print_r($this, true));
    1919        }
    2020    }
  • ship-depot/trunk/includes/Model/class-cod.php

    r2922618 r3063365  
    1010        {
    1111            parent::MapData($object, $this);
    12             Ship_Depot_Logger::wrlog('[Ship_Depot_Cod] this: ' . print_r($this, true));
     12            // Ship_Depot_Logger::wrlog('[Ship_Depot_Cod] this: ' . print_r($this, true));
    1313        }
    1414    }
  • ship-depot/trunk/includes/Model/class-coupon.php

    r2992892 r3063365  
    1010        {
    1111            parent::MapData($object, $this);
    12             Ship_Depot_Logger::wrlog('[Ship_Depot_Coupon] this: ' . print_r($this, true));
     12            // Ship_Depot_Logger::wrlog('[Ship_Depot_Coupon] this: ' . print_r($this, true));
    1313        }
    1414    }
  • ship-depot/trunk/includes/Model/class-courier.php

    r2963463 r3063365  
    2828            $this->ListServices = [];
    2929            parent::MapData($object, $this);
    30             Ship_Depot_Logger::wrlog('[Ship_Depot_Courier] this: ' . print_r($this, true));
     30            // Ship_Depot_Logger::wrlog('[Ship_Depot_Courier] this: ' . print_r($this, true));
    3131        }
    3232    }
  • ship-depot/trunk/includes/Model/class-district.php

    r2963463 r3063365  
    1616        {
    1717            parent::MapData($object, $this);
    18             Ship_Depot_Logger::wrlog('[Ship_Depot_District] this: ' . print_r($this, true));
     18            // Ship_Depot_Logger::wrlog('[Ship_Depot_District] this: ' . print_r($this, true));
    1919        }
    2020    }
  • ship-depot/trunk/includes/Model/class-insurance.php

    r2922618 r3063365  
    1010        {
    1111            parent::MapData($object, $this);
    12             Ship_Depot_Logger::wrlog('[Ship_Depot_Insurance] this: ' . print_r($this, true));
     12            // Ship_Depot_Logger::wrlog('[Ship_Depot_Insurance] this: ' . print_r($this, true));
    1313        }
    1414    }
  • ship-depot/trunk/includes/Model/class-item.php

    r2922618 r3063365  
    1717        {
    1818            parent::MapData($object, $this);
    19             Ship_Depot_Logger::wrlog('[Ship_Depot_Item] this: ' . print_r($this, true));
     19            // Ship_Depot_Logger::wrlog('[Ship_Depot_Item] this: ' . print_r($this, true));
    2020        }
    2121    }
  • ship-depot/trunk/includes/Model/class-package.php

    r2922618 r3063365  
    1212        {
    1313            parent::MapData($object, $this);
    14             Ship_Depot_Logger::wrlog('[Ship_Depot_Package] this: ' . print_r($this, true));
     14            // Ship_Depot_Logger::wrlog('[Ship_Depot_Package] this: ' . print_r($this, true));
    1515        }
    1616    }
  • ship-depot/trunk/includes/Model/class-province.php

    r2963463 r3063365  
    1616        {
    1717            parent::MapData($object, $this);
    18             Ship_Depot_Logger::wrlog('[Ship_Depot_Province] this: ' . print_r($this, true));
     18            // Ship_Depot_Logger::wrlog('[Ship_Depot_Province] this: ' . print_r($this, true));
    1919        }
    2020    }
  • ship-depot/trunk/includes/Model/class-receiver.php

    r2922618 r3063365  
    1919            }
    2020            parent::MapData($object, $this);
    21             Ship_Depot_Logger::wrlog('[Ship_Depot_Receiver] this: ' . print_r($this, true));
     21            // Ship_Depot_Logger::wrlog('[Ship_Depot_Receiver] this: ' . print_r($this, true));
    2222        }
    2323    }
  • ship-depot/trunk/includes/Model/class-ship-from-station.php

    r2963463 r3063365  
    1717            $this->Station = new Ship_Depot_Station();
    1818            parent::MapData($object, $this);
    19             Ship_Depot_Logger::wrlog('[Ship_Depot_Ship_From_Station] this: ' . print_r($this, true));
     19            // Ship_Depot_Logger::wrlog('[Ship_Depot_Ship_From_Station] this: ' . print_r($this, true));
    2020        }
    2121    }
  • ship-depot/trunk/includes/Model/class-ship-station.php

    r2963463 r3063365  
    1414        {
    1515            parent::MapData($object, $this);
    16             Ship_Depot_Logger::wrlog('[Ship_Depot_Station] this: ' . print_r($this, true));
     16            // Ship_Depot_Logger::wrlog('[Ship_Depot_Station] this: ' . print_r($this, true));
    1717        }
    1818    }
  • ship-depot/trunk/includes/Model/class-shop-info.php

    r2922618 r3063365  
    2121        {
    2222            parent::MapData($object, $this);
    23             Ship_Depot_Logger::wrlog('[Ship_Depot_Shop_Info] this: ' . print_r($this, true));
     23            // Ship_Depot_Logger::wrlog('[Ship_Depot_Shop_Info] this: ' . print_r($this, true));
    2424        }
    2525    }
  • ship-depot/trunk/includes/Order/class-order-shipping.php

    r3026645 r3063365  
    2525    public static function calculate_shipping_fee($is_cod, $is_insurance, $insurance_amount, $list_packages, $list_items, $receiver, $sender_storage, $sender_info, $items_total_price, $item_regular_price_total, $order_total, $for_courier = '')
    2626    {
    27         Ship_Depot_Logger::wrlog('[Ship_Depot_Order_Shipping][calculate_shipping] receiver: ' . print_r($receiver, true));
     27        // Ship_Depot_Logger::wrlog('[Ship_Depot_Order_Shipping][calculate_shipping] receiver: ' . print_r($receiver, true));
    2828        if (
    2929            is_null($receiver)
     
    6767        $shop_api_key = get_option('sd_api_key');
    6868        $result = Ship_Depot_Helper::http_post($url_API, $dataInput, array('ShopAPIKey' => $shop_api_key));
    69         Ship_Depot_Logger::wrlog('[Ship_Depot_Order_Shipping][calculate_shipping] result: ' . print_r($result, true));
     69        // Ship_Depot_Logger::wrlog('[Ship_Depot_Order_Shipping][calculate_shipping] result: ' . print_r($result, true));
    7070        if ($result->Code >= 0) {
    7171            $list_fees_from_api = [];
     
    445445    Ship_Depot_Logger::wrlog('[sd_handle_woo_order_status_changed] old_status: ' . print_r($old_status, true));
    446446    Ship_Depot_Logger::wrlog('[sd_handle_woo_order_status_changed] new_status: ' . print_r($new_status, true));
    447     Ship_Depot_Logger::wrlog('[sd_handle_woo_order_status_changed] post_type: ' . sanitize_text_field($_POST['post_type']));
    448     Ship_Depot_Logger::wrlog('[sd_handle_woo_order_status_changed] action: ' . sanitize_text_field($_POST['action']));
     447    // Ship_Depot_Logger::wrlog('[sd_handle_woo_order_status_changed] post_type: ' . sanitize_text_field($_POST['post_type']));
     448    // Ship_Depot_Logger::wrlog('[sd_handle_woo_order_status_changed] action: ' . sanitize_text_field($_POST['action']));
    449449
    450450    /*
     
    709709    //list_items
    710710    $list_items = [];
    711     Ship_Depot_Logger::wrlog('[create_ship] order created date: ' . print_r($order->get_date_created(), true));
    712711    $order_items = $order->get_items();
    713712    $item_regular_price_total = 0;
    714713    foreach ($order_items as $item) {
    715714        $item_data = $item->get_data();
    716         Ship_Depot_Logger::wrlog('[create_ship] item_data: ' . print_r($item_data, true));
     715        // Ship_Depot_Logger::wrlog('[create_ship] item_data: ' . print_r($item_data, true));
    717716        $product_id = $item_data['product_id'];
    718717        $product_image = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), 'single-post-thumbnail');
     
    728727        $item_product = new WC_Order_Item_Product($item->get_id());
    729728        $product = $item_product->get_product();
    730         Ship_Depot_Logger::wrlog('[create_ship] product: ' . print_r($product, true));
     729        // Ship_Depot_Logger::wrlog('[create_ship] product: ' . print_r($product, true));
    731730        $it->Length = Ship_Depot_Helper::ConvertToShipDepotDimension($product->get_length());
    732731        $it->Width = Ship_Depot_Helper::ConvertToShipDepotDimension($product->get_width());
     
    766765    }
    767766    $order_created_date = $order->get_date_created();
    768     Ship_Depot_Logger::wrlog('[create_ship] order_created_date: ' . print_r($order_created_date, true));
    769767    Ship_Depot_Logger::wrlog('[create_ship] order_created_date string: ' . print_r($order_created_date->__toString(), true));
    770768    Ship_Depot_Logger::wrlog('[create_ship] ship_from_station: ' . print_r($ship_from_station, true));
     
    799797
    800798    $shop_api_key = get_option('sd_api_key');
    801     Ship_Depot_Logger::wrlog('[create_ship] data_input: ' . print_r($data_input, true));
     799    // Ship_Depot_Logger::wrlog('[create_ship] data_input: ' . print_r($data_input, true));
    802800    $url = SHIP_DEPOT_HOST_API . '/Shipping/CreateShipping';
    803801    $rs = Ship_Depot_Helper::http_post($url, $data_input, array('ShopAPIKey' => $shop_api_key));
    804     Ship_Depot_Logger::wrlog('[create_ship] result call API: ' . print_r($rs, true));
     802    // Ship_Depot_Logger::wrlog('[create_ship] result call API: ' . print_r($rs, true));
    805803    if ($rs->Code > 0) {
    806804        $order_note = __('Vận đơn tạo thành công. Mã vận đơn', 'ship-depot-translate');
  • ship-depot/trunk/includes/class-ship-depot-general.php

    r3043419 r3063365  
    144144        //add_filter('woocommerce_locate_template', array($this, 'log_template'), 10, 3);
    145145        //add_filter('woocommerce_locate_template', array($this, 'woocommerce_locate_template'), 10, 3);
    146 
     146        //Extend time out request
     147        add_filter('http_request_timeout', array($this, 'sd_http_request_timeout_extend'));
    147148    }
    148149
     
    551552        }
    552553    }
     554
     555    public function sd_http_request_timeout_extend($time)
     556    {
     557        return 60;
     558    }
    553559}
  • ship-depot/trunk/page/admin/orders/sd-order-detail.php

    r3026645 r3063365  
    88    //Verify that the nonce is valid.
    99    Ship_Depot_Logger::wrlog('[sd_woocommerce_new_order_action] order_id: ' . print_r($order_id, true));
    10     Ship_Depot_Logger::wrlog('[sd_woocommerce_new_order_action] order: ' . print_r($order, true));
     10    // Ship_Depot_Logger::wrlog('[sd_woocommerce_new_order_action] order: ' . print_r($order, true));
    1111}
    1212
     
    376376                $data_input["shipment_ISN"] = 0;
    377377            }
    378             Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] data_input: ' . print_r($data_input, true));
     378            // Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] data_input: ' . print_r($data_input, true));
    379379            $url = SHIP_DEPOT_HOST_API . '/Shipping/CreateShipping';
    380380            $rs = Ship_Depot_Helper::http_post($url, $data_input, array('ShopAPIKey' => $shop_api_key));
    381             Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] result call API: ' . print_r($rs, true));
     381            // Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] result call API: ' . print_r($rs, true));
    382382            if ($rs->Code > 0) {
    383383                if (!$is_edit) {
     
    658658        Ship_Depot_Logger::wrlog('[calculateTotal_init] order_id: ' . $order_id);
    659659        $order = wc_get_order($order_id);
    660         Ship_Depot_Logger::wrlog('[calculateTotal_init] order: ' . print_r($order, true));
     660        // Ship_Depot_Logger::wrlog('[calculateTotal_init] order: ' . print_r($order, true));
    661661        $oldTotal = $order->get_total();
    662662        $shippings = $order->get_items('shipping');
     
    704704    $order_id = isset($data_input->orderID) ? $data_input->orderID : '';
    705705    $order = wc_get_order($order_id);
    706     Ship_Depot_Logger::wrlog('[calculate_shipping_init] order: ' . print_r($order, true));
     706    // Ship_Depot_Logger::wrlog('[calculate_shipping_init] order: ' . print_r($order, true));
    707707    $order_subtotal = $order->get_subtotal();
    708708    $data_input->item_total = $order_subtotal;
  • ship-depot/trunk/page/frontend/sd-checkout-page.php

    r3043419 r3063365  
    1414    return array();
    1515}
     16
    1617add_filter('woocommerce_cart_needs_shipping_address', 'set_cart_needs_shipping_address_filter');
    1718function set_cart_needs_shipping_address_filter($condition)
     
    4950{
    5051    Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] needs_shipping_address: ' . print_r(WC()->cart->needs_shipping_address(), true));
    51     Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] _POST: ' . print_r($_POST, true));
    52     Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] _GET: ' . print_r($_GET, true));
     52    // Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] _POST: ' . print_r($_POST, true));
     53    // Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] _GET: ' . print_r($_GET, true));
    5354    Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] cart get_total: ' . print_r(WC()->cart->get_total('number'), true));
    5455    $str_courier_setting = get_option('sd_setting_courier');
     
    9192            $item_regular_price_total += floatval($regular_price) * floatval($item['quantity']);
    9293            $it->RegularPrice = $regular_price;
    93             Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] it: ' . print_r($it, true));
     94            // Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] it: ' . print_r($it, true));
    9495            //
    9596            array_push($list_packages_sizes, $package_size);
     
    112113    if (isset($_POST['post_data']) && !Ship_Depot_Helper::check_null_or_empty(sanitize_text_field($_POST['post_data']))) {
    113114        $post_data = sanitize_text_field($_POST['post_data']);
    114         Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] post_data: ' . print_r($post_data, true));
     115        // Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] post_data: ' . print_r($post_data, true));
    115116        $data = array();
    116117        $vars = explode('&', $post_data);
     
    200201                <?php
    201202                // Ship_Depot_Logger::wrlog('[sd_woocommerce_review_order_before_order_total] list_shipping: ' . print_r($list_shipping, true));
     203                ?>
     204                <p style="font-size: 1.5rem; color:#0064ff; margin-bottom: 10px;"><?php _e('Vui lòng chọn đơn vị vận chuyển trước khi bấm đặt hàng.', 'ship-depot-translate') ?></p>
     205                <?php
    202206                if (isset($list_shipping) && $list_shipping != false) {
    203207                    foreach ($list_shipping as $courier_obj) {
     
    288292                    </div>
    289293                <?php
     294                } else {
     295                ?>
     296                    <div style="margin: 10px 0 20px 0; display: flex; flex-wrap: wrap;align-items: center;">
     297                        <p style="color:#0064ff;margin-right: 10px;"><?php _e('Nếu đã điền đủ thông tin thanh toán/vận chuyển mà không thấy danh sách đơn vị vận chuyển thì vui lòng bấm vào đây', 'ship-depot-translate') ?></p>
     298                        <a id="sd_reload_shipping"><?php _e('Tải lại', 'ship-depot-translate') ?></a>
     299                    </div>
     300                <?php
    290301                }
    291 
    292302                ?>
    293303                <input type="hidden" id="SDOrderTotal" value="<?php echo esc_attr($cart_total_without_shipping + GetShippingFeeSession()) ?>" />
     
    301311                        amountEle.html(formatVNCurrency(<?php echo esc_attr($cart_total_without_shipping + GetShippingFeeSession()) ?>));
    302312                    });
     313
     314                    //
     315                    console.log('Validate shipping');
     316                    if (document.querySelectorAll(".radio_shipping_fee[checked=checked]").length > 0) {
     317                        document.getElementById('place_order').disabled = false;
     318                    } else {
     319                        document.getElementById('place_order').disabled = true;
     320                    }
    303321                </script>
    304322            </div>
     
    384402{
    385403    Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] order_id: ' . print_r($order_id, true));
    386     Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] posted_data: ' . print_r($posted_data, true));
     404    // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] posted_data: ' . print_r($posted_data, true));
    387405    Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] _POST: ' . print_r($_POST, true));
    388     Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] order bf: ' . print_r($order, true));
     406    // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] order bf: ' . print_r($order, true));
    389407    $shipping_fee = GetShippingFeeFromPostData($_POST); //GetShippingFeeSession();
    390408    Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] shipping_fee: ' . print_r($shipping_fee, true));
     
    412430    $order->calculate_shipping();
    413431    $order->calculate_totals();
    414     Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] order aft add shipping: ' . print_r($order, true));
     432    // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] order aft add shipping: ' . print_r($order, true));
    415433    //
    416434    //Save ship depot data
     
    423441    $list_packages_sizes = [];
    424442    foreach ($list_items as $item) {
    425         Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] item: ' . print_r($item, true));
     443        // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] item: ' . print_r($item, true));
    426444        $item_product = new WC_Order_Item_Product($item->get_id());
    427         Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] item_product: ' . print_r($item_product, true));
     445        // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] item_product: ' . print_r($item_product, true));
    428446        $product = $item_product->get_product();
    429         Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] product: ' . print_r($product, true));
     447        // Ship_Depot_Logger::wrlog('[sd_action_checkout_order_processed] product: ' . print_r($product, true));
    430448        // $item_product = new WC_Order_Item_Product($item);
    431449        // $product = new WC_Product($item_product->get_product_id());
  • ship-depot/trunk/readme.txt

    r3043419 r3063365  
    55Tested up to: 6.4.3
    66Requires PHP: 7.4.3
    7 Stable tag: 1.2.14
     7Stable tag: 1.2.15
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6565
    6666== Changelog ==
     67
     68= 1.2.15 =
     69* Thêm thông báo 'Chọn đơn vị vận chuyển' ở trang thanh toán.
     70* Thêm nút tải lại để lấy danh sách đơn vị vận chuyển nếu danh sách đơn vị vận chuyển bị trống.
     71
    6772= 1.2.14 =
    6873* Thêm phần hướng dẫn chỉnh về Classic Checkout trong trang Cài Đặt của Ship Depot.
  • ship-depot/trunk/rest-api/class-shipdepot-webhook.php

    r3017671 r3063365  
    8888                ) {
    8989                    $list_storages = $rs->ListStorages;
    90                     Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_storages] list_storages encrypted: ' . print_r($list_storages, true));
     90                    // Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_storages] list_storages encrypted: ' . print_r($list_storages, true));
    9191                    $list_storages_decrypted = Ship_Depot_ProtectData::DecryptData($list_storages);
    9292                    Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_storages] list_storages_decrypted: ' . print_r($list_storages_decrypted, true));
     
    112112                ) {
    113113                    $shop_info = $rs->ShopInfo;
    114                     Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_shop_info] shop_info encrypted: ' . print_r($shop_info, true));
     114                    // Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_shop_info] shop_info encrypted: ' . print_r($shop_info, true));
    115115                    $shop_info_decrypted = Ship_Depot_ProtectData::DecryptData($shop_info);
    116116                    Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_shop_info] shop_info_decrypted: ' . print_r($shop_info_decrypted, true));
     
    137137                ) {
    138138                    $list_cour_settings = $rs->ListCourierSettings;
    139                     Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_courier_settings] list_cour_settings encrypted: ' . print_r($list_cour_settings, true));
     139                    // Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_courier_settings] list_cour_settings encrypted: ' . print_r($list_cour_settings, true));
    140140                    $list_cour_settings_decrypted = Ship_Depot_ProtectData::DecryptData($list_cour_settings);
    141141                    Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_courier_settings] list_cour_settings_decrypted: ' . print_r($list_cour_settings_decrypted, true));
     
    161161                ) {
    162162                    $list_cours = $rs->ListCouriers;
    163                     Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_couriers] shop_info encrypted: ' . print_r($list_cours, true));
     163                    // Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_couriers] shop_info encrypted: ' . print_r($list_cours, true));
    164164                    $list_cour_decrypted = Ship_Depot_ProtectData::DecryptData($list_cours);
    165165                    Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_couriers] shop_info_decrypted: ' . print_r($list_cour_decrypted, true));
     
    173173        {
    174174            $params = wp_parse_args($request->get_params(), '');
    175             Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_provinces] params: ' . print_r($params, true));
     175            // Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_update_provinces] params: ' . print_r($params, true));
    176176            if (!Ship_Depot_Helper::check_null_or_empty($params)) {
    177177                $rs =  (object) $params;
     
    197197        {
    198198            $params = wp_parse_args($request->get_params(), '');
    199             Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_sync_data_from_admin] params: ' . print_r($params, true));
     199            // Ship_Depot_Logger::wrlog('[Ship_Depot_Webhook][sd_sync_data_from_admin] params: ' . print_r($params, true));
    200200            if (!Ship_Depot_Helper::check_null_or_empty($params)) {
    201201                $rs =  (object) $params;
Note: See TracChangeset for help on using the changeset viewer.