Plugin Directory

Changeset 3090663


Ignore:
Timestamp:
05/22/2024 08:04:56 AM (23 months ago)
Author:
shipdepot
Message:

Updare version 1.2.17
Change handle select shipping service logic from php to js

Location:
ship-depot/trunk
Files:
4 edited

Legend:

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

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

    r3090008 r3090663  
    421421        $('form[name=checkout]').on('change', 'input[type=radio][class=radio_shipping_fee]', function ()
    422422        {
    423             $(document.body).trigger('update_checkout');
     423            // $(document.body).trigger('update_checkout');
    424424            // CallValidate();
     425            let spanEle = $('tr[class=order-total]').find('.woocommerce-Price-amount');
     426            if (spanEle.length <= 0) return;
     427            let amountEle = $(spanEle.children()[0]);
     428            let subtotal = parseFloat($('#SDOrderSubTotal').val() ?? '0');
     429            let servFee = 0;
     430            let idSelectedServ = this.value;
     431            if (idSelectedServ != '')
     432            {
     433                let selectedServ = $('#shipping_' + idSelectedServ);
     434                if (selectedServ.length > 0)
     435                {
     436                    let jsonServ = selectedServ.val().replace(new RegExp(`'`, 'g'), `\"`);
     437                    let serv = JSON.parse(jsonServ);
     438                    if (serv.ShopMarkupShippingFee.IsActive)
     439                    {
     440                        servFee = parseFloat(serv.ShopMarkupShippingFee.ShippingFeeTotal) + parseFloat(serv.NoMarkupShippingFee.NoMarkupShippingFeeTotal);
     441                    } else
     442                    {
     443                        servFee = parseFloat(serv.ShipDepotMarkupShippingFee.ShippingFeeTotal) + parseFloat(serv.NoMarkupShippingFee.NoMarkupShippingFeeTotal);
     444                    }
     445                }
     446            }
     447
     448            if (amountEle.length > 0)
     449            {
     450                amountEle.html(formatVNCurrency(subtotal + servFee));
     451            }
     452
     453            //Validate
     454            if ($('#place_order').length > 0)
     455            {
     456                if ($('input[name=shipdepot_shipping_selected]:checked').length > 0)
     457                {
     458                    $('#place_order').removeAttr('disabled');
     459                }
     460                else
     461                {
     462                    $('#place_order').attr('disabled', 'disabled');
     463                }
     464            }
    425465        });
    426466
  • ship-depot/trunk/page/frontend/sd-checkout-page.php

    r3090008 r3090663  
    338338                ?>
    339339                <input type="hidden" id="SDOrderTotal" value="<?php echo esc_attr($cart_total_without_shipping + GetShippingFeeSession()) ?>" />
     340                <input type="hidden" id="SDOrderSubTotal" value="<?php echo esc_attr($cart_total_without_shipping) ?>" />
    340341                <script type="text/javascript">
    341342                    console.log('Set total');
    342343                    jQuery(document).ready(function($) {
    343344                        let spanEle = jQuery('tr[class=order-total]').find('.woocommerce-Price-amount');
     345                        if (spanEle.length <= 0) return;
    344346                        let amountEle = jQuery(spanEle.children()[0]);
     347                        if (amountEle.length <= 0) return;
    345348                        let currencySymbolEle = amountEle.children()[0];
    346349                        // + currencySymbolEle.outerHTML
  • ship-depot/trunk/readme.txt

    r3090008 r3090663  
    55Tested up to: 6.4.3
    66Requires PHP: 7.4.3
    7 Stable tag: 1.2.16
     7Stable tag: 1.2.17
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6565
    6666== Changelog ==
     67= 1.2.17 =
     68* Sửa một số lỗi nhỏ.
     69
     70
    6771= 1.2.16 =
    6872* Thêm đơn vị vận chuyển 'Khách lấy hàng tại shop'.
Note: See TracChangeset for help on using the changeset viewer.