Changeset 3451269
- Timestamp:
- 02/01/2026 08:10:13 AM (2 months ago)
- Location:
- cod24-shipping
- Files:
-
- 33 added
- 1 deleted
- 5 edited
-
tags/5.0.4/readme.txt (deleted)
-
tags/5.0.5 (added)
-
tags/5.0.5/assets (added)
-
tags/5.0.5/assets/css (added)
-
tags/5.0.5/assets/css/cod24-dokan-frontend.css (added)
-
tags/5.0.5/assets/css/cod24-dokan-vendor.css (added)
-
tags/5.0.5/assets/css/cod24-woo-admin.css (added)
-
tags/5.0.5/assets/css/sweetalert2.css (added)
-
tags/5.0.5/assets/index.php (added)
-
tags/5.0.5/assets/js (added)
-
tags/5.0.5/assets/js/city-select.js (added)
-
tags/5.0.5/assets/js/cod24-dokan-settings.js (added)
-
tags/5.0.5/assets/js/cod24-dokan-vendor-order.js (added)
-
tags/5.0.5/assets/js/cod24-shcod-fee.js (added)
-
tags/5.0.5/assets/js/cod24-woo-admin.js (added)
-
tags/5.0.5/assets/js/sweetalert2.js (added)
-
tags/5.0.5/cod24-shipping.php (added)
-
tags/5.0.5/inc (added)
-
tags/5.0.5/inc/api (added)
-
tags/5.0.5/inc/api/class-cod24-api.php (added)
-
tags/5.0.5/inc/api/class-cod24-tipax-api.php (added)
-
tags/5.0.5/inc/class-cod24-dokan.php (added)
-
tags/5.0.5/inc/class-cod24-settings.php (added)
-
tags/5.0.5/inc/class-cod24-shcod.php (added)
-
tags/5.0.5/inc/class-cod24-woo.php (added)
-
tags/5.0.5/inc/index.php (added)
-
tags/5.0.5/inc/shipping (added)
-
tags/5.0.5/inc/shipping/class-cod24-pishtaz.php (added)
-
tags/5.0.5/inc/shipping/class-cod24-special.php (added)
-
tags/5.0.5/inc/shipping/class-cod24-tipax.php (added)
-
tags/5.0.5/index.php (added)
-
tags/5.0.5/readme.txt (added)
-
tags/5.0.5/templates (added)
-
tags/5.0.5/templates/vendor-order-metabox.php (added)
-
trunk/assets/js/cod24-woo-admin.js (modified) (4 diffs)
-
trunk/cod24-shipping.php (modified) (2 diffs)
-
trunk/inc/class-cod24-dokan.php (modified) (2 diffs)
-
trunk/inc/class-cod24-woo.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cod24-shipping/trunk/assets/js/cod24-woo-admin.js
r3399647 r3451269 42 42 <div class="label" style="margin-bottom:10px"><label for="custom_total_weight">`+ cod24_woo_params.options.total_weight + ` (`+ cod24_woo_params.options.wc_weight_unit + `)</label></div> 43 43 <input type="text" class="postbox custom_total_weight" id="custom_total_weight" style="margin-bottom:0px" name="total_weight" /> 44 </div> 45 <div class="cod24-fields calc-service-weight-section" style="margin-bottom:10px;"> 46 <input type="checkbox" class="postbox is_calc_srv_by_weight" id="is_calc_srv_by_weight" style="margin-bottom:0px;height: 17px;" name="is_calc_srv_by_weight" value="yes"/> 47 <div class="label"><label for="is_calc_srv_by_weight">`+ cod24_woo_params.options.calc_service_by_weight + `</label></div> 44 48 </div> 45 49 <div class="cod24-fields"> … … 63 67 const weight_type = document.querySelector('input[name="weight_type"]:checked').value; 64 68 const custom_total_weight = weight_type === 'custom_weight' ? document.getElementById('custom_total_weight').value : null; 69 70 // check is calc srv by weight 71 const is_calc_srv_checkbox = document.querySelector('input[name="is_calc_srv_by_weight"]'); 72 const is_calc_srv_by_weight = is_calc_srv_checkbox && is_calc_srv_checkbox.checked ? 'yes' : 'no'; 73 65 74 const carton_size = document.getElementById('carton_size').value; 66 75 const dimension_length = document.getElementById('dimension_length').value; … … 69 78 const cod24_form_nonce = document.getElementById('cod24_form_nonce').value; 70 79 80 // Validation 71 81 if (weight_type === 'custom_weight' && !custom_total_weight) { 72 Swal.showValidationMessage( cod24_woo_params.field_empty ); 82 Swal.showValidationMessage(cod24_woo_params.field_empty); 83 return false; 73 84 } 74 if (!carton_size) { 75 Swal.showValidationMessage( cod24_woo_params.field_empty ); 85 86 // carton size is not null 87 if (is_calc_srv_by_weight === 'no' && (!carton_size || carton_size === 'none')) { 88 Swal.showValidationMessage(cod24_woo_params.field_empty); 89 return false; 76 90 } 77 91 78 return { weight_type, custom_total_weight, carton_size, cod24_form_nonce, dimension_length, dimension_width, dimension_height }; 92 return { 93 weight_type, 94 custom_total_weight, 95 is_calc_srv_by_weight, 96 carton_size, 97 cod24_form_nonce, 98 dimension_length, 99 dimension_width, 100 dimension_height 101 }; 102 }, 103 showCloseButton: true, 104 confirmButtonText: cod24_woo_params.options.confirm_button_text, 105 cancelButtonText: cod24_woo_params.options.cancel_button_text, 106 showCancelButton: true, 107 didOpen: () => { 108 // event listener for disable carton size 109 const calcCheckbox = document.getElementById('is_calc_srv_by_weight'); 110 const cartonSelect = document.getElementById('carton_size'); 111 const dimensionInputs = [ 112 document.getElementById('dimension_length'), 113 document.getElementById('dimension_width'), 114 document.getElementById('dimension_height') 115 ]; 116 117 // function for change fields 118 const toggleFields = () => { 119 const isChecked = calcCheckbox.checked; 120 cartonSelect.disabled = isChecked; 121 if (isChecked) { 122 cartonSelect.value = '10'; // set default 123 } 124 125 // disable dimension fields 126 dimensionInputs.forEach(input => { 127 if (input) { 128 input.disabled = isChecked; 129 if (isChecked) { 130 input.value = ''; 131 } 132 } 133 }); 134 }; 135 136 toggleFields(); 137 138 // add event listener 139 calcCheckbox.addEventListener('change', toggleFields); 140 141 // Event listener for weight_type 142 document.querySelectorAll('input[name="weight_type"]').forEach((elem) => { 143 elem.addEventListener('change', function () { 144 const custom_weight_section = document.querySelector('.custom-weight-section'); 145 if (this.value === 'total_weight') { 146 custom_weight_section.style.display = 'none'; 147 } else { 148 custom_weight_section.style.display = 'flex'; 149 } 150 }); 151 }); 152 153 // set visibility 154 document.querySelector('.custom-weight-section').style.display = 'none'; 79 155 }, 80 156 showCloseButton: true, … … 94 170 weight_type: result.value.weight_type, 95 171 custom_total_weight: result.value.custom_total_weight, 172 is_calc_srv_by_weight: result.value.is_calc_srv_by_weight, 96 173 carton_size: result.value.carton_size, 97 174 dimension_length: result.value.dimension_length, -
cod24-shipping/trunk/cod24-shipping.php
r3426465 r3451269 3 3 Plugin Name: COD24 Shipping For Woocommerce 4 4 Description: This plugin is adding COD24 shipping methods to woocommerce. 5 Version: 5.0. 45 Version: 5.0.5 6 6 Author: COD24 7 7 Author URI: https://cod24.ir … … 26 26 public function __construct() 27 27 { 28 define('COD24_PLUGIN_VERSION', '5.0. 4');28 define('COD24_PLUGIN_VERSION', '5.0.5'); 29 29 define('COD24_PLUGIN_DIR', plugin_dir_path(__FILE__)); 30 30 define('COD24_PLUGIN_URL', plugin_dir_url(__FILE__)); -
cod24-shipping/trunk/inc/class-cod24-dokan.php
r3426465 r3451269 6 6 * Package: COD24 Shipping 7 7 * Author: COD24 8 * Last Modified Time: 2025/1 0/26 (Complete Rewrite)8 * Last Modified Time: 2025/12/29 00:35:41 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 65 65 public static function enqueue_vendor_assets() { 66 66 // Check if we're on Dokan vendor dashboard 67 if ( ! dokan_is_seller_dashboard() ) {67 if ( function_exists('dokan_is_seller_dashboard') && ! dokan_is_seller_dashboard() ) { 68 68 return; 69 69 } -
cod24-shipping/trunk/inc/class-cod24-woo.php
r3426042 r3451269 6 6 * Package: COD24 Shipping 7 7 * Author: COD24 8 * Last Modified Time: 2025/ 09/23 22:38:168 * Last Modified Time: 2025/12/28 22:30:13 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 129 129 ), 130 130 'total_weight' => esc_attr__('Total weight of order', 'cod24-shipping'), 131 'calc_service_by_weight' => esc_attr__('Calculate service cost by weight', 'cod24-shipping'), 131 132 'wc_weight_unit' => esc_attr( get_option('woocommerce_weight_unit') ), 132 133 'carton_size' => array( … … 683 684 } 684 685 685 // check content parcel686 if( isset( $_POST['content_parcel'] ) && !empty( $_POST['content_parcel'] ) )687 {688 $cod24_info['content_parcel'] = sanitize_textarea_field( $_POST['content_parcel'] );689 }686 // check content parcel 687 if( isset( $_POST['content_parcel'] ) && !empty( $_POST['content_parcel'] ) ) 688 { 689 $cod24_info['content_parcel'] = sanitize_textarea_field( $_POST['content_parcel'] ); 690 } 690 691 } 691 692 elseif( $old_cod24_info['shipping_type'] == 'tipax' && isset( $_POST['tipax_custom_total_weight'] ) && !empty( $_POST['tipax_custom_total_weight'] ) ) … … 1589 1590 if( ! $process_only_orders && $valid_weight ) 1590 1591 { 1591 // check carton size 1592 if( isset( $_POST['carton_size'] ) && !empty( $_POST['carton_size'] ) && $_POST['carton_size'] != 'none' ) 1593 { 1594 $carton_sizes = COD24_Tipax_API::get_carton_sizes(); 1595 $user_key_carton_size = sanitize_text_field( $_POST['carton_size'] ); 1596 if( in_array( $user_key_carton_size, array_keys( $carton_sizes ) ) ) 1597 { 1598 // do nothing 1599 $user_carton_size = array_search( $user_key_carton_size, array_keys( $carton_sizes ) ) + 1; 1600 $result = array( 'status' => true ); 1601 $valid_carton_size = 1; 1602 } 1603 else 1604 { 1605 $result = array( 'status' => false, 'msg' => __('The carton size value is invalid', 'cod24-shipping') ); 1606 $valid_carton_size = 0; 1607 } 1608 } 1609 else 1610 { 1611 $result = array( 'status' => false, 'msg' => __('Please fill in the carton size field', 'cod24-shipping') ); 1612 $valid_carton_size = 0; 1613 } 1592 // check is_calc_srv_by_weight 1593 if( isset( $_POST['is_calc_srv_by_weight'] ) && $_POST['is_calc_srv_by_weight'] == 'yes' ) 1594 { 1595 $is_calc_srv_by_weight = 'yes'; 1596 $user_carton_size = 0; // Set carton size to 0 when calculating by weight 1597 $valid_carton_size = 1; 1598 } 1599 else 1600 { 1601 $is_calc_srv_by_weight = 'no'; 1602 // check carton size 1603 if( isset( $_POST['carton_size'] ) && !empty( $_POST['carton_size'] ) && $_POST['carton_size'] != 'none' ) 1604 { 1605 $carton_sizes = COD24_Tipax_API::get_carton_sizes(); 1606 $user_key_carton_size = sanitize_text_field( $_POST['carton_size'] ); 1607 if( in_array( $user_key_carton_size, array_keys( $carton_sizes ) ) ) 1608 { 1609 // do nothing 1610 $user_carton_size = array_search( $user_key_carton_size, array_keys( $carton_sizes ) ) + 1; 1611 $result = array( 'status' => true ); 1612 $valid_carton_size = 1; 1613 } 1614 else 1615 { 1616 $result = array( 'status' => false, 'msg' => __('The carton size value is invalid', 'cod24-shipping') ); 1617 $valid_carton_size = 0; 1618 } 1619 } 1620 else 1621 { 1622 $result = array( 'status' => false, 'msg' => __('Please fill in the carton size field', 'cod24-shipping') ); 1623 $valid_carton_size = 0; 1624 } 1625 } 1614 1626 } 1615 1627 } 1616 1617 1628 1618 1629 if( $valid_weight && $valid_carton_size ) … … 1681 1692 $cod24_info['distribution_type'] = 20; 1682 1693 } 1694 1695 $cod24_info['is_calc_srv_by_weight'] = $is_calc_srv_by_weight; 1683 1696 1684 1697 $order->update_meta_data( '_cod24_info', $cod24_info ); -
cod24-shipping/trunk/readme.txt
r3426465 r3451269 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 5.0. 46 Stable tag: 5.0.5 7 7 License: GPL-2.0+ 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 45 45 == Changelog == 46 47 = 5.0.5 = 48 * Added Calc service by weight field in bulk action 46 49 47 50 = 5.0.4 =
Note: See TracChangeset
for help on using the changeset viewer.