Changeset 2981538
- Timestamp:
- 10/20/2023 07:52:09 AM (2 years ago)
- Location:
- ship-depot/trunk
- Files:
-
- 6 edited
-
Ship_Depot_init.php (modified) (2 diffs)
-
assets/js/admin-address.js (modified) (16 diffs)
-
assets/js/admin-order-detail.js (modified) (9 diffs)
-
assets/js/fe-checkout.js (modified) (14 diffs)
-
page/admin/orders/sd-order-detail.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ship-depot/trunk/Ship_Depot_init.php
r2963463 r2981538 5 5 * Plugin URI: https://shipdepot.vn/ 6 6 * Description: Ship Depot support shipping couriers in Vietnam like GHN, GHTK, AhaMove. 7 * Version: 1.1. 17 * Version: 1.1.2 8 8 * Author: ShipDepot.vn 9 9 * Text Domain: ship-depot-translate … … 124 124 add_action('plugins_loaded', 'ship_depot_plugins_loaded'); 125 125 } 126 127 add_action('before_woocommerce_init', function () { 128 if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) { 129 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, false); 130 } 131 }); -
ship-depot/trunk/assets/js/admin-address.js
r2922618 r2981538 29 29 let allProvinces = JSON.parse(sd_admin_address_params.all_provinces); 30 30 parent.find('.__sd_ward').html('<option></option>').attr('disabled', 'disabled'); 31 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';31 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 32 32 allProvinces.forEach(pro => { 33 33 if (pro.Code == province_code) { … … 68 68 let allProvinces = JSON.parse(sd_admin_address_params.all_provinces); 69 69 parent.find('.__sd_ward').html('<option></option>').removeAttr('disabled'); 70 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';70 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 71 71 allProvinces.forEach(pro => { 72 72 if (pro.Code == province_code) { … … 111 111 //Load and update district 112 112 jQuery('[name="shipping_district"]').html('<option></option>') 113 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';113 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 114 114 allProvinces.forEach(pro => { 115 115 if (pro.Code == province_code) { … … 123 123 //Load and update ward 124 124 jQuery('[name="shipping_ward"]').html('<option></option>').removeAttr('disabled'); 125 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';125 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 126 126 allProvinces.forEach(pro => { 127 127 if (pro.Code == province_code) { … … 147 147 //Load and update district 148 148 jQuery('[name="shipping_district"]').html('<option></option>') 149 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';149 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 150 150 allProvinces.forEach(pro => { 151 151 if (pro.Code == province_code) { … … 165 165 //Load and update ward 166 166 jQuery('[name="shipping_ward"]').html('<option></option>').removeAttr('disabled'); 167 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';167 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 168 168 allProvinces.forEach(pro => { 169 169 if (pro.Code == province_code) { … … 198 198 // //Load and update district 199 199 // jQuery('[name="_shipping_district"]').html('<option></option>') 200 // html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';200 // html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 201 201 // allProvinces.forEach(pro => { 202 202 // if (pro.Code == province_code) { … … 216 216 // //Load and update ward 217 217 // jQuery('[name="_shipping_ward"]').html('<option></option>').removeAttr('disabled'); 218 // html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';218 // html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 219 219 // allProvinces.forEach(pro => { 220 220 // if (pro.Code == province_code) { … … 272 272 //Load and update district 273 273 jQuery(':input#_billing_district').html('<option></option>') 274 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';274 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 275 275 allProvinces.some(pro => { 276 276 if (pro.Code == province_code) { … … 285 285 //Load and update ward 286 286 jQuery(':input#_billing_ward').html('<option></option>').removeAttr('disabled'); 287 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';287 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 288 288 allProvinces.some(pro => { 289 289 if (pro.Code == province_code) { … … 349 349 //Load and update district 350 350 jQuery(':input#_shipping_district').html('<option></option>') 351 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';351 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 352 352 allProvinces.some(pro => { 353 353 if (pro.Code == province_code) { … … 362 362 //Load and update ward 363 363 jQuery(':input#_shipping_ward').html('<option></option>').removeAttr('disabled'); 364 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';364 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 365 365 allProvinces.some(pro => { 366 366 if (pro.Code == province_code) { … … 423 423 //Load and update district 424 424 jQuery(':input#_billing_district').html('<option></option>') 425 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';425 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 426 426 allProvinces.some(pro => { 427 427 if (pro.Code == province_code) { … … 436 436 //Load and update ward 437 437 jQuery(':input#_billing_ward').html('<option></option>').removeAttr('disabled'); 438 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';438 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 439 439 allProvinces.some(pro => { 440 440 if (pro.Code == province_code) { … … 482 482 //Load and update district 483 483 jQuery(':input#_shipping_district').html('<option></option>') 484 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';484 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 485 485 allProvinces.some(pro => { 486 486 if (pro.Code == province_code) { … … 495 495 //Load and update ward 496 496 jQuery(':input#_shipping_ward').html('<option></option>').removeAttr('disabled'); 497 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';497 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 498 498 allProvinces.some(pro => { 499 499 if (pro.Code == province_code) { -
ship-depot/trunk/assets/js/admin-order-detail.js
r2963463 r2981538 344 344 }); 345 345 346 jQuery('#receiver_info').find('select').each(function () { 347 if (jQuery(this).hasClass('error-class')) { 348 jQuery(this).removeClass('error-class'); 349 } 350 }); 351 346 352 if (jQuery('#rd_receiver_type_other').is(':checked')) { 347 353 jQuery('#receiver_info').find('input[type=text]').each(function () { 348 if ( jQuery(this).val() == '') {354 if (!jQuery(this).val()) { 349 355 if (!(jQuery(this).hasClass('error-class'))) { 350 356 if (highlightError) { … … 355 361 } 356 362 }); 363 364 jQuery('#receiver_info').find('select').each(function () { 365 if (!jQuery(this).val()) { 366 if (!(jQuery(this).hasClass('error-class'))) { 367 if (highlightError) { 368 jQuery(this).addClass('error-class'); 369 } 370 } 371 hasError = true; 372 } 373 }); 357 374 } else { 358 if ( jQuery('#_shipping_last_name').val() == '' || jQuery('#_shipping_first_name').val() == '' || jQuery('#_shipping_country').val() == '' || jQuery('#_shipping_phone').val() == '' || jQuery('#_shipping_address_1').val() == '' || jQuery('#_shipping_ward').val() == '' || jQuery('#_shipping_district').val() == '' || jQuery('#_shipping_city').val() == '') {375 if (!jQuery('#_shipping_last_name').val() || !jQuery('#_shipping_first_name').val() || !jQuery('#_shipping_country').val() || !jQuery('#_shipping_phone').val() || !jQuery('#_shipping_address_1').val() || !jQuery('#_shipping_ward').val() || !jQuery('#_shipping_district').val() || !jQuery('#_shipping_city').val()) { 359 376 if (highlightError) { 360 377 jQuery('.load_customer_shipping').parents('.order_data_column').children('h3').css('color', 'red'); … … 457 474 list_package_sizes: packageSizes, 458 475 sender_storage: jQuery('#sl_storage').val(), 459 sender_info: jQuery('#sender_info').val(),476 sender_info: jQuery('#sender_info').val(), 460 477 receiver: receiver, 461 478 cod: cod, … … 705 722 let allProvinces = JSON.parse(sd_admin_address_params.all_provinces); 706 723 $('#sl_receiver_ward').html('<option></option>').attr('disabled', 'disabled'); 707 html = '<option >' + sd_admin_address_params.l10n.select_district + '</option>';724 html = '<option value="">' + sd_admin_address_params.l10n.select_district + '</option>'; 708 725 allProvinces.forEach(pro => { 709 726 if (pro.Code == province_code) { … … 714 731 }); 715 732 $('#sl_receiver_district').html(html); 733 checkAndCalFee(); 716 734 }); 717 735 } … … 723 741 let allProvinces = JSON.parse(sd_admin_address_params.all_provinces); 724 742 $('#sl_receiver_ward').html('<option></option>').removeAttr('disabled'); 725 html = '<option >' + sd_admin_address_params.l10n.select_ward + '</option>';743 html = '<option value="">' + sd_admin_address_params.l10n.select_ward + '</option>'; 726 744 allProvinces.forEach(pro => { 727 745 if (pro.Code == province_code) { … … 738 756 }); 739 757 $('#sl_receiver_ward').html(html); 758 checkAndCalFee(); 740 759 }); 741 760 } … … 754 773 755 774 if ($('#_shipping_city').length > 0) { 756 $("#_shipping_city"). blur(function () {775 $("#_shipping_city").change(function () { 757 776 checkAndCalFee(); 758 777 }); … … 760 779 761 780 if ($('#_shipping_district').length > 0) { 762 $("#_shipping_district"). blur(function () {781 $("#_shipping_district").change(function () { 763 782 checkAndCalFee(); 764 783 }); -
ship-depot/trunk/assets/js/fe-checkout.js
r2922618 r2981538 54 54 //Reset ward 55 55 $('#billing_ward').html('<option></option>').removeAttr('disabled'); 56 html = '<option >' + sd_fe_checkout_params.l10n.select_ward + '</option>';56 html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>'; 57 57 allProvinces.forEach(pro => { 58 58 if (pro.Code == province_code) { … … 125 125 //Reset ward 126 126 $('#shipping_ward').html('<option></option>').removeAttr('disabled'); 127 html = '<option >' + sd_fe_checkout_params.l10n.select_ward + '</option>';127 html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>'; 128 128 allProvinces.forEach(pro => { 129 129 if (pro.Code == province_code) { … … 153 153 let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces); 154 154 $('#billing_ward').html('<option></option>').attr('disabled', 'disabled'); 155 html = '<option >' + sd_fe_checkout_params.l10n.select_district + '</option>';155 html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>'; 156 156 allProvinces.forEach(pro => { 157 157 if (pro.Code == province_code) { … … 175 175 let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces); 176 176 $('#shipping_ward').html('<option></option>').attr('disabled', 'disabled'); 177 html = '<option >' + sd_fe_checkout_params.l10n.select_district + '</option>';177 html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>'; 178 178 allProvinces.forEach(pro => { 179 179 if (pro.Code == province_code) { … … 199 199 let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces); 200 200 $('#billing_ward').html('<option></option>').attr('disabled', 'disabled'); 201 html = '<option >' + sd_fe_checkout_params.l10n.select_district + '</option>';201 html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>'; 202 202 allProvinces.forEach(pro => { 203 203 if (pro.Code == province_code) { … … 208 208 }); 209 209 $('#billing_district').html(html); 210 211 if ($('#ship-to-different-address-checkbox').is(':checked') == false212 && !checkNullorEmpty($('#billing_district').val())213 && !checkNullorEmpty($('#billing_ward').val())214 && !checkNullorEmpty($('#billing_address_1').val())) {215 $(document.body).trigger('update_checkout');216 }210 $(document.body).trigger('update_checkout'); 211 // if ($('#ship-to-different-address-checkbox').is(':checked') == false 212 // && !checkNullorEmpty($('#billing_district').val()) 213 // && !checkNullorEmpty($('#billing_ward').val()) 214 // && !checkNullorEmpty($('#billing_address_1').val())) { 215 216 // } 217 217 }); 218 218 } … … 226 226 let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces); 227 227 $('#billing_ward').html('<option></option>').removeAttr('disabled'); 228 html = '<option >' + sd_fe_checkout_params.l10n.select_ward + '</option>';228 html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>'; 229 229 allProvinces.forEach(pro => { 230 230 if (pro.Code == province_code) { … … 239 239 }); 240 240 $('#billing_ward').html(html).val(''); 241 242 if ($('#ship-to-different-address-checkbox').is(':checked') == false243 && !checkNullorEmpty($('#billing_ward').val())244 && !checkNullorEmpty($('#billing_address_1').val())) {245 $(document.body).trigger('update_checkout');246 }241 $(document.body).trigger('update_checkout'); 242 // if ($('#ship-to-different-address-checkbox').is(':checked') == false 243 // && !checkNullorEmpty($('#billing_ward').val()) 244 // && !checkNullorEmpty($('#billing_address_1').val())) { 245 246 // } 247 247 }); 248 248 } … … 251 251 $('#billing_ward').change(function () { 252 252 console.log('billing_ward change'); 253 if ($('#ship-to-different-address-checkbox').is(':checked') == false 254 && !checkNullorEmpty($('#billing_address_1').val())) { 255 $(document.body).trigger('update_checkout'); 256 } 253 $(document.body).trigger('update_checkout'); 254 // if ($('#ship-to-different-address-checkbox').is(':checked') == false 255 // && !checkNullorEmpty($('#billing_address_1').val())) { 256 257 // } 257 258 }); 258 259 } … … 264 265 let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces); 265 266 $('#shipping_ward').html('<option></option>').attr('disabled', 'disabled'); 266 html = '<option >' + sd_fe_checkout_params.l10n.select_district + '</option>';267 html = '<option value="">' + sd_fe_checkout_params.l10n.select_district + '</option>'; 267 268 allProvinces.forEach(pro => { 268 269 if (pro.Code == province_code) { … … 273 274 }); 274 275 $('#shipping_district').html(html); 275 276 if ($('#ship-to-different-address-checkbox').is(':checked') == true277 && !checkNullorEmpty($('#shipping_district').val())278 && !checkNullorEmpty($('#shipping_ward').val())279 && !checkNullorEmpty($('#shipping_address_1').val())) {280 $(document.body).trigger('update_checkout');281 }276 $(document.body).trigger('update_checkout'); 277 // if ($('#ship-to-different-address-checkbox').is(':checked') == true 278 // && !checkNullorEmpty($('#shipping_district').val()) 279 // && !checkNullorEmpty($('#shipping_ward').val()) 280 // && !checkNullorEmpty($('#shipping_address_1').val())) { 281 282 // } 282 283 }); 283 284 } … … 291 292 let allProvinces = JSON.parse(sd_fe_checkout_params.all_provinces); 292 293 $('#shipping_ward').html('<option></option>').removeAttr('disabled'); 293 html = '<option >' + sd_fe_checkout_params.l10n.select_ward + '</option>';294 html = '<option value="">' + sd_fe_checkout_params.l10n.select_ward + '</option>'; 294 295 allProvinces.forEach(pro => { 295 296 if (pro.Code == province_code) { … … 304 305 }); 305 306 $('#shipping_ward').html(html).val(''); 306 if ($('#ship-to-different-address-checkbox').is(':checked') == true 307 && !checkNullorEmpty($('#shipping_ward').val()) 308 && !checkNullorEmpty($('#shipping_address_1').val())) { 309 $(document.body).trigger('update_checkout'); 310 } 307 $(document.body).trigger('update_checkout'); 308 // if ($('#ship-to-different-address-checkbox').is(':checked') == true 309 // && !checkNullorEmpty($('#shipping_ward').val()) 310 // && !checkNullorEmpty($('#shipping_address_1').val())) { 311 312 // } 311 313 }); 312 314 } … … 315 317 $('#shipping_ward').change(function () { 316 318 console.log('shipping_ward change'); 317 if ($('#ship-to-different-address-checkbox').is(':checked') == true 318 && !checkNullorEmpty($('#shipping_address_1').val())) { 319 $(document.body).trigger('update_checkout'); 320 } 319 $(document.body).trigger('update_checkout'); 320 // if ($('#ship-to-different-address-checkbox').is(':checked') == true 321 // && !checkNullorEmpty($('#shipping_address_1').val())) { 322 323 // } 321 324 }); 322 325 } -
ship-depot/trunk/page/admin/orders/sd-order-detail.php
r2963463 r2981538 263 263 if (!$is_edit || $need_call_update) { 264 264 Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] Call API'); 265 $order_created_date = $order->get_date_created(); 266 Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] order_created_date: ' . print_r($order_created_date, true)); 267 Ship_Depot_Logger::wrlog('[sd_submit_data_and_save_to_order_meta_data] order_created_date string: ' . print_r($order_created_date->__toString(), true)); 268 265 269 $data_input = array( 266 270 "order_id" => $order_id, 267 "order_created_date" => Ship_Depot_Helper::ParseObjectToArray($order->get_date_created()), //Order date need parse to array because WC_DateTime object cannot send to API271 "order_created_date" => $order_created_date->__toString(), 268 272 "item_total" => $order->get_subtotal(), 269 273 "order_total" => $order->get_total(), -
ship-depot/trunk/readme.txt
r2963463 r2981538 5 5 Tested up to: 6.3.1 6 6 Requires PHP: 7.4.3 7 Stable tag: 1.1. 17 Stable tag: 1.1.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 65 65 66 66 == Changelog == 67 68 = 1.1.2 = 69 * Sửa 1 số lỗi nhỏ 70 67 71 = 1.1.1 = 68 72 * Thêm chức năng "Gửi hàng tại điểm giao nhận của Giao hàng nhanh"
Note: See TracChangeset
for help on using the changeset viewer.