Changeset 3494405
- Timestamp:
- 03/30/2026 09:58:31 AM (42 hours ago)
- Location:
- small-package-quotes-usps-edition
- Files:
-
- 34 edited
- 1 copied
-
tags/1.3.13 (copied) (copied from small-package-quotes-usps-edition/trunk)
-
tags/1.3.13/admin/assets/en-usps-admin.css (modified) (5 diffs)
-
tags/1.3.13/admin/assets/en-usps-admin.js (modified) (6 diffs)
-
tags/1.3.13/admin/product/en-product-detail.php (modified) (4 diffs)
-
tags/1.3.13/admin/tab/location/assets/css/en-usps-location.css (modified) (5 diffs)
-
tags/1.3.13/admin/tab/location/assets/js/en-usps-location.js (modified) (4 diffs)
-
tags/1.3.13/admin/tab/location/dropship/en-dropship.php (modified) (3 diffs)
-
tags/1.3.13/admin/tab/location/en-location.php (modified) (3 diffs)
-
tags/1.3.13/admin/tab/location/includes/en-location-ajax.php (modified) (4 diffs)
-
tags/1.3.13/admin/tab/location/warehouse/en-warehouse.php (modified) (1 diff)
-
tags/1.3.13/admin/tab/quote-settings/en-quote-settings.php (modified) (5 diffs)
-
tags/1.3.13/en-install.php (modified) (4 diffs)
-
tags/1.3.13/http/en-curl.php (modified) (2 diffs)
-
tags/1.3.13/readme.txt (modified) (2 diffs)
-
tags/1.3.13/server/api/en-response.php (modified) (1 diff)
-
tags/1.3.13/server/en-shipping-rates.php (modified) (2 diffs)
-
tags/1.3.13/server/package/en-package.php (modified) (5 diffs)
-
tags/1.3.13/small-package-quotes-usps-edition.php (modified) (2 diffs)
-
trunk/admin/assets/en-usps-admin.css (modified) (5 diffs)
-
trunk/admin/assets/en-usps-admin.js (modified) (6 diffs)
-
trunk/admin/product/en-product-detail.php (modified) (4 diffs)
-
trunk/admin/tab/location/assets/css/en-usps-location.css (modified) (5 diffs)
-
trunk/admin/tab/location/assets/js/en-usps-location.js (modified) (4 diffs)
-
trunk/admin/tab/location/dropship/en-dropship.php (modified) (3 diffs)
-
trunk/admin/tab/location/en-location.php (modified) (3 diffs)
-
trunk/admin/tab/location/includes/en-location-ajax.php (modified) (4 diffs)
-
trunk/admin/tab/location/warehouse/en-warehouse.php (modified) (1 diff)
-
trunk/admin/tab/quote-settings/en-quote-settings.php (modified) (5 diffs)
-
trunk/en-install.php (modified) (4 diffs)
-
trunk/http/en-curl.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/server/api/en-response.php (modified) (1 diff)
-
trunk/server/en-shipping-rates.php (modified) (2 diffs)
-
trunk/server/package/en-package.php (modified) (5 diffs)
-
trunk/small-package-quotes-usps-edition.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
small-package-quotes-usps-edition/tags/1.3.13/admin/assets/en-usps-admin.css
r3439225 r3494405 64 64 } 65 65 66 #en_usps_quote_settings .en_usps_shipment_day, 67 #en_usps_quote_settings .en_usps_all_shipment { 66 #en_usps_quote_settings .en_usps_shipment_day { 68 67 display: inline-block; 68 } 69 70 #en_usps_quote_settings tr.en_usps_all_shipment { 71 display: inline-flex; 72 align-items: baseline; 69 73 } 70 74 … … 140 144 .en_quote_settings_sub_options th { 141 145 padding: 0 0 10px 15px; 142 margin-left: 10px !important;143 146 font-weight: 400; 144 147 } … … 377 380 .woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"], 378 381 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 382 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 379 383 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 380 384 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], … … 400 404 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], 401 405 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 406 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 402 407 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 403 408 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"], … … 409 414 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip, 410 415 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_en_product_markup"] span.woocommerce-help-tip, 416 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_eniture_product_level_fulfillment_offset_days"] span.woocommerce-help-tip, 411 417 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip, 412 418 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedDimension"] span.woocommerce-help-tip, -
small-package-quotes-usps-edition/tags/1.3.13/admin/assets/en-usps-admin.js
r3439225 r3494405 6 6 jQuery('#shipping_methods_do_not_sort_by_price').closest('table').attr('id', 'en_usps_quote_settings'); 7 7 jQuery("#order_shipping_line_items .shipping .display_meta").css('display', 'none'); 8 jQuery("#en_usps_fulfilment_offset_days").attr('maxlength', '2'); 8 9 9 10 // Quote Settings Tab … … 30 31 // Delivery estimate options changed 31 32 jQuery("input[name=en_delivery_estimate_options_usps]").on('change load', function () { 32 varen_delivery_estimate_val = jQuery('input[name=en_delivery_estimate_options_usps]:checked').val();33 const en_delivery_estimate_val = jQuery('input[name=en_delivery_estimate_options_usps]:checked').val(); 33 34 if (en_delivery_estimate_val == 'dont_show_estimates') { 34 35 jQuery("#en_usps_cutt_off_time").prop('disabled', true); 35 36 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', true); 37 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', true); 36 38 } else { 37 39 jQuery("#en_usps_cutt_off_time").prop('disabled', false); 38 40 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', false); 39 } 40 }); 41 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', false); 42 } 43 }); 44 45 const en_delivery_estimate_val = jQuery('input[name=en_delivery_estimate_options_usps]:checked').val(); 46 if (en_delivery_estimate_val == 'dont_show_estimates') { 47 jQuery("#en_usps_cutt_off_time").prop('disabled', true); 48 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', true); 49 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', true); 50 } else { 51 jQuery("#en_usps_cutt_off_time").prop('disabled', false); 52 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', false); 53 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', false); 54 } 41 55 42 56 let en_usps_cutt_off_time = jQuery('#en_usps_cutt_off_time').length > 0 && jQuery('#en_usps_cutt_off_time').val().length > 0 ? jQuery('#en_usps_cutt_off_time').val() : ''; … … 111 125 let en_validate_settings = {}; 112 126 let en_data_error = true; 127 jQuery(':checkbox:disabled').prop('disabled', false); 128 113 129 114 130 en_validate_settings['#en_usps_handling_fee'] = { … … 140 156 'en_max_length': false, 141 157 'en_error_msg': 'Air hazardous material fee format should be 100.20 or 10%.', 142 };143 144 en_validate_settings['#en_usps_fulfilment_offset_days'] = {145 'en_data_type': 'isNumeric',146 'en_decimal': false,147 'en_after_decimal': 0,148 'en_add_percentage': false,149 'en_minus_sign': false,150 'en_max_length': 1,151 'en_error_msg': 'Entered Days are not valid.',152 158 }; 153 159 … … 232 238 } 233 239 240 // fulfillment offset days validation 241 if (!en_usps_validate_fullfillment_offset_days()) return false; 234 242 // backup rates validation 235 243 if (!en_usps_small_backup_rates_validations()) return false; … … 728 736 } 729 737 } 738 739 if (typeof en_usps_validate_fullfillment_offset_days !== 'function') { 740 function en_usps_validate_fullfillment_offset_days() { 741 const offset_days = jQuery("#en_usps_fulfilment_offset_days").val(); 742 const number_regex = /^[0-9]+$/; 743 let error_msg = ''; 744 745 if (offset_days != "" && offset_days < 1) error_msg = 'Fulfillment Offset Days must be greater than or equal to 1.'; 746 if (!error_msg && offset_days != "" && offset_days > 20) error_msg = 'Fulfillment Offset Days must be less than or equal to 20.'; 747 if (!error_msg && offset_days != "" && !number_regex.test(offset_days)) error_msg = 'Fulfillment Offset Days must be a number.'; 748 749 if (error_msg) { 750 jQuery('.en_settings_message').remove(); 751 jQuery('.usps_small_plan_notice').after('<div class="notice notice-error en_settings_message"><p><strong>Error! </strong>' + error_msg + '</p></div>'); 752 jQuery('#en_settings_message').delay(200).animate({scrollTop: 0}, 1000); 753 jQuery('html, body').animate({scrollTop: 0}, 'slow'); 754 return false; 755 } 756 757 return true; 758 } 759 } -
small-package-quotes-usps-edition/tags/1.3.13/admin/product/en-product-detail.php
r3287624 r3494405 103 103 $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : ''; 104 104 $en_updated_product = (isset($_POST[$custom_field][$postId])) ? sanitize_text_field(wp_unslash($_POST[$custom_field][$postId])) : ''; 105 $en_updated_product = $custom_field == '_dropship_location' ? 106 (maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product)) : esc_attr($en_updated_product); 105 106 if ($custom_field == '_dropship_location') { 107 $en_updated_product = maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product); 108 } elseif ($custom_field == '_eniture_product_level_fulfillment_offset_days') { 109 $en_updated_product = $this->sanitize_fulfillment_offset_days($en_updated_product); 110 } else { 111 $en_updated_product = esc_attr($en_updated_product); 112 } 113 107 114 update_post_meta($postId, $custom_field, $en_updated_product); 108 115 } 109 116 } 117 } 118 119 private function sanitize_fulfillment_offset_days($value) 120 { 121 $value = trim($value); 122 if ($value === '' || $value === null) return ''; 123 124 $value = preg_replace('/[^0-9.-]/', '', $value); 125 if (!is_numeric($value)) return ''; 126 127 $value = intval(floor(floatval($value))); 128 return $value < 0 ? '' : strval($value); 110 129 } 111 130 … … 196 215 ], 197 216 [ 217 'type' => 'input_field', 218 'input_type' => 'number', 219 'id' => '_eniture_product_level_fulfillment_offset_days', 220 'class' => '_eniture_product_level_fulfillment_offset_days short', 221 'label' => __( 'Fulfillment Offset Days', 'woocommerce' ), 222 'placeholder' => 'Fulfillment offset days, e.g. 2', 223 'description' => "The number of days the ship date needs to be moved to allow for the processing of the order. If set, this will override the global Fulfillment Offset Days setting for this product.", 224 'custom_attributes' => [ 225 'min' => '1', 226 'max' => '20', 227 'step' => '1', 228 'title' => 'Value must be greater than or equal to 1 and less than or equal to 20', 229 'oninvalid' => "this.setCustomValidity(this.validity.rangeUnderflow ? 'Value must be greater than or equal to 1' : this.validity.rangeOverflow ? 'Value must be less than or equal to 20' : '')", 230 'oninput' => "this.setCustomValidity('')" 231 ] 232 ], 233 [ 198 234 'type' => 'checkbox', 199 235 'id' => '_en_insurance_fee', … … 322 358 'label' => $custom_field['label'], 323 359 'class' => $custom_field['class'], 324 'placeholder' => $custom_field['label'],360 'placeholder' => isset($custom_field['placeholder']) ? $custom_field['placeholder'] : $custom_field['label'], 325 361 'value' => get_post_meta($postId, $custom_field['id'], true) 326 362 ]; … … 329 365 $custom_input_field['desc_tip'] = true; 330 366 $custom_input_field['description'] = $custom_field['description']; 367 } 368 369 // Add input type if specified (e.g., 'number') 370 if (isset($custom_field['input_type'])) { 371 $custom_input_field['type'] = $custom_field['input_type']; 372 } 373 374 // Add custom attributes if specified (e.g., min, max, step) 375 if (isset($custom_field['custom_attributes'])) { 376 $custom_input_field['custom_attributes'] = $custom_field['custom_attributes']; 331 377 } 332 378 -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/location/assets/css/en-usps-location.css
r3439225 r3494405 33 33 } 34 34 35 .en_usps_location_btn_container { 36 clear: both; 37 margin: 10px !important; 38 display: flex; 39 justify-content: flex-end; 40 } 41 35 42 .en_usps_location_btn { 36 clear: both; 37 float: right; 38 margin: 10px !important; 43 margin-right: 10px !important; 39 44 } 40 45 … … 124 129 color: #ff0000; 125 130 font-size: 11px; 126 margin: 0 0 0 40.2%; 127 width: 100%; 131 width: 58.7%; 128 132 display: block; 129 } 130 131 .en_location_error_message { 133 float: right; 134 } 135 136 .en_location_error_message, 137 .en_usps_small_warehouse_error_message, .en_usps_small_dropship_error_message { 132 138 background: #f1f1f1 none repeat scroll 0 0; 133 139 border-left: 4px solid #dc3232; … … 139 145 } 140 146 141 .en_location_success_message { 147 .en_location_success_message, 148 .en_usps_wh_location_success_message, .en_usps_ds_location_success_message, 149 .en_usps_small_warehouse_success_message, .en_usps_small_dropship_success_message { 142 150 background: #fff none repeat scroll 0 0; 143 151 border-left: 4px solid #46b450; … … 149 157 } 150 158 159 .en_usps_small_warehouse_success_message, .en_usps_small_dropship_success_message { 160 margin: auto; 161 } 162 151 163 .spinner_disable { 152 164 color: #000000; … … 175 187 .en_location_table td, 176 188 .en_location_table th { 177 color: #555;178 189 padding: 12px 35px; 179 190 border-collapse: collapse; 180 191 text-align: center; 192 } 193 194 .en_location_table td { 195 color: #555; 181 196 } 182 197 -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/location/assets/js/en-usps-location.js
r3347910 r3494405 164 164 } else if (en_is_var_exist('severity', data) && data['severity'] == 'error') { 165 165 jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300); 166 jQuery('.en_location_error_message span').text(data['message']); 167 en_show_errors('.en_location_error_message'); 166 const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds'; 167 jQuery(`.en_usps_${location_type}_location_error_message span`).text(data['message']); 168 en_show_errors(`.en_usps_${location_type}_location_error_message`); 168 169 } 169 170 … … 367 368 function en_usps_location_delete(e, data, en_location_type, en_location_id) { 368 369 e.preventDefault(); 370 371 // If warehouse location then directly delete 372 if (en_location_type) { 373 en_usps_location_confirm_delete(data, en_location_type, en_location_id); 374 return; 375 } 376 369 377 en_popup_confirmation_location_delete_show(); 370 378 … … 408 416 if (data['message'].length > 0) { 409 417 jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300); 410 jQuery('.en_location_success_message span').text(data['message']); 411 en_show_errors('.en_location_success_message'); 418 const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds'; 419 jQuery(`.en_usps_${location_type}_location_success_message span`).text(data['message']); 420 en_show_errors(`.en_usps_${location_type}_location_success_message`); 412 421 } 413 422 } … … 449 458 } 450 459 } 460 461 if (typeof en_usps_small_select_bulk_locations != 'function') { 462 function en_usps_small_select_bulk_locations(location_class, e) { 463 const checked = jQuery(e).is(':checked'); 464 jQuery(`.${location_class}`).prop('checked', checked); 465 } 466 } 467 468 if (typeof en_usps_small_toggle_select_all_locations != 'function') { 469 function en_usps_small_toggle_select_all_locations(location_class, select_all_locations) { 470 const allChecked = jQuery(`.${location_class}:checked`).length === jQuery(`.${location_class}`).length; 471 jQuery(`#${select_all_locations}`).prop('checked', allChecked); 472 } 473 } 474 475 if (typeof en_usps_small_delete_bulk_locations != 'function') { 476 function en_usps_small_delete_bulk_locations(e, location_class, location_type) { 477 e.preventDefault(); 478 const location_ids = jQuery(`.${location_class}:checked`).map(function () { 479 return this.value; 480 }).get(); 481 482 // Show error message if no locations are selected 483 if (location_ids.length === 0) { 484 const loc_error_class = `en_usps_small_${location_type}_error_message`; 485 jQuery(`.${loc_error_class}`).show('slow').delay(3000).hide('slow'); 486 return; 487 } 488 489 const postForm = { 490 'action': 'en_usps_location_bulk_delete', 491 'location_ids': location_ids, 492 'location_type': location_type, 493 'wp_nonce': en_usps_location_script.nonce 494 } 495 const delete_locs_btn = `.en_usps_small_bulk_delete_${location_type}`, 496 loc_success_class = `.en_usps_small_${location_type}_success_message`, 497 loc_error_class = `.en_usps_small_${location_type}_error_message`; 498 499 jQuery.ajax({ 500 type: 'POST', 501 url: ajaxurl, 502 data: postForm, 503 dataType: 'json', 504 beforeSend: function () { 505 jQuery(delete_locs_btn).addClass('spinner_disable'); 506 }, 507 success: function (data) { 508 if (data.error && data.message) { 509 jQuery(delete_locs_btn).removeClass('spinner_disable'); 510 jQuery(loc_error_class).show('slow').delay(3000).hide('slow'); 511 } else { 512 jQuery(delete_locs_btn).removeClass('spinner_disable'); 513 jQuery(data.target_location).replaceWith(data.html); 514 jQuery(loc_success_class).show('slow').delay(3000).hide('slow'); 515 jQuery('.warehouse_updated, .warehouse_created, .warehouse_deleted, .dropship_deleted, .dropship_updated, .dropship_created').css('display', 'none'); 516 } 517 }, 518 error: function (error) { 519 jQuery(delete_locs_btn).removeClass('spinner_disable'); 520 console.log(error); 521 } 522 }); 523 } 524 } -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/location/dropship/en-dropship.php
r3347910 r3494405 45 45 46 46 <h1><?php esc_attr_e('Drop ships', 'small-package-quotes-usps-edition'); ?></h1> 47 <button onclick="en_show_popup_location(false, event)" type="button" 48 class="button-primary"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?></button> 47 <div style="display: flex; gap: 3px; margin-top: 10px;"> 48 <button title="Add Drop Ship" onclick="en_show_popup_location(false, event)" type="button" 49 class="button-primary"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?></button> 50 <button title="Delete Drop Ships" type="button" class="en_usps_small_bulk_delete_dropship en_wd_add_dropship_btn button-primary" title="Delete Drop Ships" onclick="return en_usps_small_delete_bulk_locations(event, 'en_usps_small_delete_dropship_item', 'dropship');"><?php _e('Delete', 'eniture-technology'); ?></button> 51 </div> 49 52 <p><?php esc_attr_e("Locations that inventory specific items that are drop shipped to the destination. Use the product's settings 50 53 page to identify it as a drop shipped item and its associated drop ship location. Orders that include drop … … 52 55 cheapest option of each shipment required to fulfill the order.", 'small-package-quotes-usps-edition'); ?></p> 53 56 57 <!-- Success/Error messages --> 58 <div class="en_usps_ds_location_success_message"><strong>Success! </strong><span></span></div> 59 <div class="en_usps_small_dropship_success_message"><strong>Success!</strong> <span>Selected drop ships deleted successfully.</span></div> 60 <div class="en_usps_small_dropship_error_message"><strong>Error!</strong> Please select at least one drop ship to delete.</div> 61 54 62 <table class="en_location_table en_location_dropship_table"> 55 63 <thead> 56 64 <tr> 65 <th class="en_wd_dropship_list_heading en_usps_small_bulk_delete_col"> 66 <!-- Bulk delete --> 67 <input type="checkbox" name="en_usps_small_bulk_delete_dropships" id="en_usps_small_bulk_delete_dropships" onclick="return en_usps_small_select_bulk_locations('en_usps_small_delete_dropship_item', this);" /> 68 </th> 57 69 <?php echo wp_kses_post(\EnLocation::en_arrange_table_data('th', $en_heading)); ?> 58 70 <th><?php esc_attr_e('Action', 'small-package-quotes-usps-edition'); ?></th> … … 75 87 { 76 88 return array( 77 'div' => array('class' => []), 'button' => array('class' => [], 'onclick' => []), 'strong' => [], 'span' => [], 'table' => array('class' => []), 'thead' => [], 'tr' => array('class' => [], 'id' => []), 'th' => [], 'tbody' => [], 'td' => array('class' => [], 'id' => [], 'data-available_id' => [], 'onclick' => []), 'img' => array('src' => [], 'title' => []), 'a' => array('href' => [], 'onclick' => []), 'p' => [], 'h1' => [], 'br' => [], 89 'div' => array('class' => [], 'style' => []), 'button' => array('class' => [], 'onclick' => [], 'type' => [], 'title' => []), 'strong' => [], 'span' => [], 'table' => array('class' => []), 'thead' => [], 'tr' => array('class' => [], 'id' => []), 'th' => ['input' => ['type' => [], 'name' => [], 'id' => [], 'onclick' => []]], 'tbody' => [], 'td' => array('class' => [], 'id' => [], 'data-available_id' => [], 'onclick' => []), 90 'input' => ['type' => [], 'name' => [], 'id' => [], 'onclick' => [], 'value' => [], 'class' => [], 'checked' => []], 91 'img' => array('src' => [], 'title' => []), 'a' => array('href' => [], 'onclick' => []), 'p' => [], 'h1' => [], 'br' => [], 78 92 'a' => ['href' => [], 'onclick' => [], 'title' => [], 'class' => [], 'id' => [], 'data-action'=> []], 79 93 ); -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/location/en-location.php
r3246136 r3494405 252 252 253 253 echo '<tr class="' . esc_attr($append_class) . '" id="en_location_row_id_' . esc_attr($en_location_id). '">'; 254 255 $loc_type = isset($location['location']) && $location['location'] == 'warehouse' ? 'wh' : 'ds'; 256 $_type = ($loc_type === 'wh') ? 'warehouse' : 'dropship'; 257 echo '<td class="en_wd_' . esc_attr($_type) . '_list_data en_usps_small_bulk_delete_col"> 258 <input 259 type="checkbox" 260 class="en_usps_small_delete_' . esc_attr($_type) . '_item" 261 value="' . esc_attr($en_location_id) . '" 262 onclick="return en_usps_small_toggle_select_all_locations( 263 \'en_usps_small_delete_' . esc_attr($_type) . '_item\', 264 \'en_usps_small_bulk_delete_' . esc_attr($_type) . 's\' 265 );" 266 > 267 </td>'; 268 254 269 echo wp_kses_post(self::en_arrange_table_data('td', $en_sorted_location)); 255 270 … … 284 299 <?php esc_attr_e('Warning!', 'small-package-quotes-usps-edition'); ?> 285 300 </h2> 301 <hr> 286 302 <p class="en_confirmation_message"> 287 <?php esc_attr_e('If you delete this location, then location settings will be disabled against products 288 (if any).', 'small-package-quotes-usps-edition'); ?> 303 Warning! If you delete this location, Drop ship location settings will be disabled against products if any. 289 304 </p> 305 <hr> 290 306 <div class="en_confirmation_buttons"> 291 307 <a href="#" … … 342 358 } 343 359 344 echo '< input type="submit" value="Save" class="en_usps_location_btn button-primary">';360 echo '<div class="en_usps_location_btn_container"><input type="submit" value="Save" class="en_usps_location_btn button-primary"></div>'; 345 361 echo '</form>'; 346 362 echo '</div>'; -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/location/includes/en-location-ajax.php
r3347910 r3494405 20 20 add_action('wp_ajax_en_usps_get_location', [$this, 'en_usps_get_location']); 21 21 add_action('wp_ajax_en_usps_location_delete_row', [$this, 'en_usps_location_delete_row']); 22 add_action('wp_ajax_en_usps_location_bulk_delete', array($this, 'en_usps_bulk_delete_locations_ajax')); 22 23 } 23 24 … … 195 196 196 197 if ($location === 'warehouse') { 197 $location_step = ' Warehouse';198 $location_step = 'New warehouse'; 198 199 $en_location_template_obj = new EnUspsWarehouseTemplate(); 199 200 $en_target_location = '.en_location_warehouse_main_div'; 200 201 $validate = ['zip', 'city', 'state', 'country', 'location']; 201 202 } else { 202 $location_step = ' Dropship';203 $location_step = 'New drop ship'; 203 204 $en_location_template_obj = new EnUspsDropshipTemplate(); 204 205 $en_target_location = '.en_location_dropship_main_div'; … … 218 219 (!empty($en_location_data) && 219 220 reset($en_location_data)['id'] === $location_id))) { 221 $location_step = $location === 'warehouse' ? 'Warehouse' : 'Drop ship'; 220 222 $message = $location_step . ' updated successfully.'; 221 223 $action = 'update'; … … 260 262 } 261 263 264 public function en_usps_bulk_delete_locations_ajax() 265 { 266 if (!(current_user_can('manage_options') || current_user_can('manage_woocommerce')) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wp_nonce'])), 'en_usps_location_nonce')) { 267 echo wp_json_encode(array('error' => true, 'message' => 'Unauthorized Access.')); 268 exit; 269 } 270 271 $location_ids = isset($_POST['location_ids']) ? $_POST['location_ids'] : array(); 272 $loc_type = isset($_POST['location_type']) ? $_POST['location_type'] : ''; 273 if (empty($location_ids)) { 274 echo wp_json_encode(['error' => true, 'message' => "Please select at least one {$loc_type} to delete."]); 275 exit; 276 } 277 278 global $wpdb; 279 foreach ($location_ids as $location_id) { 280 if ($loc_type == 'dropship') { 281 $get_dropship_id = ''; 282 $dropship_id = intval($location_id); 283 $get_dropship_array = array($dropship_id); 284 $ser = maybe_serialize($get_dropship_id); 285 $get_dropship_val = array_map('intval', $get_dropship_array); 286 $get_post_id = $wpdb->get_results("SELECT group_concat(post_id) as post_ids_list FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` = '_dropship_location' AND (`meta_value` LIKE '%" . $ser . "%' OR `meta_value` = '" . $dropship_id . "')"); 287 $post_id = reset($get_post_id)->post_ids_list; 288 289 if (isset($post_id)) { 290 $wpdb->query("UPDATE `" . $wpdb->prefix . "postmeta` SET `meta_value` = '' WHERE `meta_key` IN('_enable_dropship','_dropship_location') AND `post_id` IN ($post_id)"); 291 } 292 } 293 294 $wpdb->delete($wpdb->prefix . "warehouse", array('id' => intval($location_id), 'location' => $loc_type)); 295 } 296 297 if ($loc_type === 'warehouse') { 298 $en_location_template_obj = new EnUspsWarehouseTemplate(); 299 $en_target_location = '.en_location_warehouse_main_div'; 300 } else { 301 $en_location_template_obj = new EnUspsDropshipTemplate(); 302 $en_target_location = '.en_location_dropship_main_div'; 303 } 304 305 $html = $en_location_template_obj::en_load(); 306 307 echo wp_json_encode(['error' => false, 'message' => 'Locations deleted successfully.', 'target_location' => $en_target_location, 'html' => $html]); 308 exit; 309 } 262 310 } 263 311 -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/location/warehouse/en-warehouse.php
r3347910 r3494405 38 38 <div class="en_location_warehouse_main_div"> 39 39 40 <div class="en_location_success_message"> 41 <strong><?php esc_attr_e('Success!', 'small-package-quotes-usps-edition'); ?> </strong><span></span></div> 40 <h1><?php esc_attr_e('Warehouses', 'small-package-quotes-usps-edition'); ?></h1> 41 <div style="display: flex; gap: 3px; margin-top: 10px;"> 42 <button title="Add Warehouse" onclick="en_show_popup_location(true, event)" type="button" 43 class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?> 44 </button> 45 <button title="Delete Warehouses" type="button" class="en_usps_small_bulk_delete_warehouse en_wd_add_warehouse_btn button-primary" title="Delete Warehouses" onclick="return en_usps_small_delete_bulk_locations(event, 'en_usps_small_delete_warehouse_item', 'warehouse');"><?php _e('Delete', 'eniture-technology'); ?> 46 </button> 42 47 43 <h1><?php esc_attr_e('Warehouses', 'small-package-quotes-usps-edition'); ?></h1> 44 <button onclick="en_show_popup_location(true, event)" type="button" 45 class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?> 46 </button> 47 <?php echo wp_kses_post(self::$plan_required); ?> 48 <?php echo wp_kses_post(self::$plan_required); ?> 49 </div> 48 50 49 51 <p><?php esc_attr_e('Warehouses that inventory all products not otherwise identified as drop shipped items. The warehouse with the 50 52 lowest shipping cost to the destination is used for quoting purposes.', 'small-package-quotes-usps-edition'); ?></p> 51 53 54 <div class="en_usps_wh_location_success_message"><strong>Success! </strong><span></span></div> 55 <div class="en_usps_small_warehouse_success_message"><strong>Success! </strong> <span>Selected warehouses deleted successfully.</span></div> 56 <div class="en_usps_small_warehouse_error_message"><strong>Error!</strong> <span>Please select at least one warehouse to delete.</span></div> 57 52 58 <table class="en_location_table en_location_warehouse_table"> 53 59 <thead> 54 60 <tr> 61 <th class="en_wd_warehouse_list_heading en_usps_small_bulk_delete_col"> 62 <!-- Bulk delete --> 63 <input type="checkbox" name="en_usps_small_bulk_delete_warehouses" id="en_usps_small_bulk_delete_warehouses" onclick="return en_usps_small_select_bulk_locations('en_usps_small_delete_warehouse_item', this);" /> 64 </th> 55 65 <?php echo wp_kses_post(\EnLocation::en_arrange_table_data('th', $en_heading)); ?> 56 66 <th><?php esc_attr_e('Action', 'small-package-quotes-usps-edition'); ?></th> -
small-package-quotes-usps-edition/tags/1.3.13/admin/tab/quote-settings/en-quote-settings.php
r3439225 r3494405 154 154 ]; 155 155 156 $services['usps_quote_information_preference'] = [ 157 'name' => __('Quote Information Preference', 'small-package-quotes-usps-edition'), 158 'type' => 'radio', 159 'default' => 'yes', 160 'id' => 'usps_quote_information_preference', 161 'options' => array( 162 'yes' => __('Record it in the Additional Order Details widget. (Default)', 'small-package-quotes-usps-edition'), 163 'no' => __('Don\'t record it in the Additional Order Details widget.', 'small-package-quotes-usps-edition'), 164 ), 165 ]; 166 167 $services = array_merge($services, self::delivery_estimate_option(), self::cutt_off_time()); 156 168 157 169 /** … … 222 234 */ 223 235 static public function delivery_estimate_option() { 224 $option = $message = '';225 if (isset($_REQUEST['tab'])) {226 $feature_option = apply_filters("usps_plans_suscription_and_features", 'delivery_estimate_option');227 if (is_array($feature_option)) {228 $option = 'en_usps_disabled';229 $message = apply_filters("usps_plans_notification_link", $feature_option);230 }231 }232 233 236 return [ 234 237 'delivery_estimate_options' => [ … … 236 239 'type' => 'text', 237 240 'class' => 'hidden', 238 'desc' => $message,239 241 'id' => 'delivery_estimate_options' 240 242 ], … … 242 244 'name' => '', 243 245 'type' => 'radio', 244 'class' => $option,245 246 'default' => "dont_show_estimates", 246 247 'options' => [ … … 326 327 ], 327 328 'en_usps_fulfilment_offset_days' => [ 328 'name' => __('Fulfilment Offset Days', 'small-package-quotes-usps-edition'), 329 'type' => 'text', 330 'class' => $option, 331 'desc' => 'The number of days the ship date needs to be moved to allow the processing of the order.', 329 'name' => __('Fulfillment Offset Days', 'small-package-quotes-usps-edition'), 330 'type' => 'text', 331 'class' => $option, 332 'desc' => 'The number of days the ship date needs to be moved to allow for the processing of the order.', 333 'placeholder' => 'Fulfillment offset days, e.g. 2', 332 334 'id' => 'en_usps_fulfilment_offset_days' 333 335 ], -
small-package-quotes-usps-edition/tags/1.3.13/en-install.php
r3439225 r3494405 42 42 ]); 43 43 44 wp_enqueue_script('EnUspsAdminJs', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.js', [], '1.0. 7');44 wp_enqueue_script('EnUspsAdminJs', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.js', [], '1.0.8'); 45 45 wp_localize_script('EnUspsAdminJs', 'en_usps_admin_script', [ 46 46 'pluginsUrl' => EN_USPS_PLUGIN_URL, … … 62 62 wp_enqueue_style('EnWickedPickerCss'); 63 63 64 wp_enqueue_script('EnUspsLocationScript', EN_USPS_DIR_FILE . '/admin/tab/location/assets/js/en-usps-location.js', [], '1.0. 2');64 wp_enqueue_script('EnUspsLocationScript', EN_USPS_DIR_FILE . '/admin/tab/location/assets/js/en-usps-location.js', [], '1.0.3'); 65 65 wp_localize_script('EnUspsLocationScript', 'en_usps_location_script', array( 66 66 'pluginsUrl' => EN_USPS_PLUGIN_URL, … … 68 68 )); 69 69 70 wp_register_style('EnUspsLocationStyle', EN_USPS_DIR_FILE . '/admin/tab/location/assets/css/en-usps-location.css', false, '1.0. 2');70 wp_register_style('EnUspsLocationStyle', EN_USPS_DIR_FILE . '/admin/tab/location/assets/css/en-usps-location.css', false, '1.0.3'); 71 71 wp_enqueue_style('EnUspsLocationStyle'); 72 72 73 wp_register_style('EnUspsAdminCss', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.css', false, '1.0. 5');73 wp_register_style('EnUspsAdminCss', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.css', false, '1.0.6'); 74 74 wp_enqueue_style('EnUspsAdminCss'); 75 75 … … 247 247 }else{ 248 248 $plan_required = '0'; 249 $feature_status = EN_USPS_NAME . ': Enabled.';249 $feature_status = 'WooCommerce USPS Small Package Quotes: Enabled.'; 250 250 } 251 251 -
small-package-quotes-usps-edition/tags/1.3.13/http/en-curl.php
r3439225 r3494405 123 123 { 124 124 $cachable_keys = [ 125 'serverName', 'licenseKey', 'includeDeclaredValue', 'shipment_type', 'shipment_weight', 'commdityDetails', 'productDetails', 'originAddress', 'product_quantities', 'product_prices', 'receiverZip', 'receiverState', 'receiverCountryCode', 'receiverCity', 'instorPickupLocalDelEnable', 'activeServices', 'rateTier', 'sbsMode' 125 'serverName', 'licenseKey', 'includeDeclaredValue', 'shipment_type', 'shipment_weight', 'commdityDetails', 'productDetails', 'originAddress', 'product_quantities', 'product_prices', 'receiverZip', 'receiverState', 'receiverCountryCode', 'receiverCity', 'instorPickupLocalDelEnable', 'activeServices', 'rateTier', 'sbsMode', 'modifyShipmentDateTime', 'OrderCutoffTime', 'shipmentOffsetDays', 'shipmentWeekDays' 126 126 ]; 127 127 $cachable_data = []; … … 137 137 $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : ''; 138 138 $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType']; 139 $cachable_data['defaultRADWithoutStreetAddress'] = isset($request_data['defaultRADWithoutStreetAddress']) ? $request_data['defaultRADWithoutStreetAddress'] : ''; 139 140 $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation']; 140 141 } 141 142 142 if (isset($request_data[' standardPackaging']) && $request_data['standardPackaging'] == 1) {143 $cachable_data[' standardPackaging'] = $request_data['standardPackaging'];144 $cachable_data[' pallet'] = $request_data['pallet'];143 if (isset($request_data['binPackaging']) && $request_data['binPackaging'] == 1) { 144 $cachable_data['binPackaging'] = $request_data['binPackaging']; 145 $cachable_data['bins'] = $request_data['bins']; 145 146 } 146 147 -
small-package-quotes-usps-edition/tags/1.3.13/readme.txt
r3439225 r3494405 4 4 Requires at least: 6.4 5 5 Tested up to: 6.9 6 Stable tag: 1.3.1 26 Stable tag: 1.3.13 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 132 132 == Changelog == 133 133 134 = 1.3.13 - 2026-03-30 = 135 * Update: Added bulk delete support for warehouse and drop ship locations. 136 * Update: Added product-level offset days functionality. 137 * Update: Added settings to include order metadata and control its visibility on the order details page. 138 134 139 = 1.3.12 - 2026-01-14 = 135 140 * Update: Added data sanitization in the quotes request to ensure cleaner and more reliable API communication. -
small-package-quotes-usps-edition/tags/1.3.13/server/api/en-response.php
r3439225 r3494405 384 384 // Cut Off Time & Ship Date Offset 385 385 $transitDays = self::en_sanitize_rate('transitDays', ''); 386 $calender_date = self::en_sanitize_rate(' calenderDate', '');387 $calender_days_in_transit = self::en_sanitize_rate(' CalenderDaysInTransit', '');386 $calender_date = self::en_sanitize_rate('transitDate', ''); 387 $calender_days_in_transit = self::en_sanitize_rate('totalTransitTimeInDays', ''); 388 388 389 389 if ($delivery_estimate_option == "delivery_date" && strlen($calender_date) > 0) { 390 $label .= ' ( Expected delivery by ' . gmdate('Y-m-d', strtotime($calender_date)) . ')';390 $label .= ' (Expected delivery by ' . gmdate('m-d-Y', strtotime($calender_date)) . ')'; 391 391 } elseif ($delivery_estimate_option == "delivery_days" && strlen($calender_days_in_transit) > 0) { 392 $correct_word = $calender_days_in_transit == 1 ? 'is' : 'are'; 393 $label .= ' ( Estimated number of days until delivery ' . $correct_word . ' ' . $calender_days_in_transit . ' )'; 392 $label .= ' (Intransit days: ' . $calender_days_in_transit . ')'; 394 393 } 395 394 -
small-package-quotes-usps-edition/tags/1.3.13/server/en-shipping-rates.php
r3439225 r3494405 223 223 // Images for FDO 224 224 $image_urls = apply_filters('en_fdo_image_urls_merge', []); 225 $save_order_meta_data = get_option('usps_quote_information_preference'); 226 $save_packaging_data = get_option('box_sizing_packaging_solution_preference'); 225 227 226 228 foreach ($en_rates as $accessorial => $rate) { … … 245 247 // Images for FDO 246 248 $rate['meta_data']['en_fdo_image_urls'] = wp_json_encode($image_urls); 249 250 // Remove meta data and packaging data if not required 251 if ($save_order_meta_data == 'no') unset($rate['meta_data']['en_fdo_meta_data']); 252 if ($save_packaging_data == 'no') unset($rate['meta_data']['bin_packaging']); 247 253 } 248 254 -
small-package-quotes-usps-edition/tags/1.3.13/server/package/en-package.php
r3439225 r3494405 105 105 // Get product level markup value 106 106 $product_level_markup = self::en_get_product_level_markup($product_data, $product['variation_id'], $product['product_id'], $product['quantity']); 107 $product_level_fulfillment_offset = self::en_get_product_level_fulfillment_offset_days($product_data, $product['variation_id'], $product['product_id']); 107 108 108 109 self::$post_id = (isset($product['variation_id']) && $product['variation_id'] > 0) ? … … 147 148 'isInsuranceActive' => $isInsuranceIctive, 148 149 'lineItemSlug' => $product_tag, 149 'markup' => $product_level_markup 150 'markup' => $product_level_markup, 151 'fulfillment_offset_days' => $product_level_fulfillment_offset, 150 152 ]; 151 153 … … 302 304 self::$en_request['product_prices'][$origin_zip_code] = floatval($product_data->get_price() * floatval($product['quantity'])); 303 305 } 306 307 // Track maximum fulfillment offset days 308 if (is_numeric($product_level_fulfillment_offset) && $product_level_fulfillment_offset > 0) { 309 if (!isset(self::$en_request['max_fulfillment_offset_days']) || $product_level_fulfillment_offset > self::$en_request['max_fulfillment_offset_days']) { 310 self::$en_request['max_fulfillment_offset_days'] = $product_level_fulfillment_offset; 311 } 312 } 304 313 } 305 314 } … … 502 511 $en_settings = json_decode(EN_USPS_SET_QUOTE_SETTINGS, true); 503 512 extract($en_settings); 513 514 // Use product-level fulfillment offset days if available, otherwise use global setting 515 if (isset(self::$en_request['max_fulfillment_offset_days']) && is_numeric(self::$en_request['max_fulfillment_offset_days']) && self::$en_request['max_fulfillment_offset_days'] > 0) { 516 $fulfilment_offset_days = self::$en_request['max_fulfillment_offset_days']; 517 } 518 504 519 if (!is_array($feature_option) && ($delivery_estimate_option == 'delivery_days' || $delivery_estimate_option == 'delivery_date')) { 505 520 $settings = [ 506 'modifyShipmentDateTime' => strlen($cutt_off_time) > 0 && strlen($fulfilment_offset_days) > 0 &&!empty($shipment_days) ? true : false,521 'modifyShipmentDateTime' => strlen($cutt_off_time) > 0 || strlen($fulfilment_offset_days) > 0 || !empty($shipment_days) ? true : false, 507 522 'OrderCutoffTime' => $cutt_off_time, 508 523 'shipmentOffsetDays' => $fulfilment_offset_days, … … 870 885 return $is_filter_applied; 871 886 } 887 888 public static function en_get_product_level_fulfillment_offset_days($_product, $variation_id, $product_id) 889 { 890 $fulfillment_offset_days = ''; 891 $field_name = '_eniture_product_level_fulfillment_offset_days'; 892 893 if ($_product->get_type() == 'variation' && $variation_id > 0) { 894 $fulfillment_offset_days = get_post_meta($variation_id, $field_name, true); 895 896 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 897 $parent_id = $_product->get_parent_id(); 898 if ($parent_id > 0) { 899 $fulfillment_offset_days = get_post_meta($parent_id, $field_name, true); 900 } 901 } 902 } else { 903 $fulfillment_offset_days = get_post_meta($_product->get_id(), $field_name, true); 904 } 905 906 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 907 $fulfillment_offset_days = get_post_meta($product_id, $field_name, true); 908 } 909 910 // Validate and sanitize the value before returning 911 if (is_numeric($fulfillment_offset_days)) { 912 $value = intval($fulfillment_offset_days); 913 return $value; 914 } 915 916 // Return empty string if invalid 917 return ''; 918 } 872 919 } 873 920 -
small-package-quotes-usps-edition/tags/1.3.13/small-package-quotes-usps-edition.php
r3439225 r3494405 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from Usps Express and displays the results in the WooCommerce shopping cart. 6 * Version: 1.3.1 26 * Version: 1.3.13 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ … … 25 25 }); 26 26 27 if (empty(\EnUspsGuard\EnUspsGuard::en_check_prerequisites('USPS', '5.6', '4.0', '2.3'))) { 28 require_once 'en-install.php'; 29 } 27 add_action( 'init', function () { 28 if (!is_textdomain_loaded('small-package-quotes-usps-edition')) { 29 load_plugin_textdomain('small-package-quotes-usps-edition', false, dirname(plugin_basename(__FILE__)) . '/languages/'); 30 } 31 32 if (empty(\EnUspsGuard\EnUspsGuard::en_check_prerequisites('USPS', '5.6', '4.0', '2.3'))) { 33 require_once 'en-install.php'; 34 } 35 }); -
small-package-quotes-usps-edition/trunk/admin/assets/en-usps-admin.css
r3439225 r3494405 64 64 } 65 65 66 #en_usps_quote_settings .en_usps_shipment_day, 67 #en_usps_quote_settings .en_usps_all_shipment { 66 #en_usps_quote_settings .en_usps_shipment_day { 68 67 display: inline-block; 68 } 69 70 #en_usps_quote_settings tr.en_usps_all_shipment { 71 display: inline-flex; 72 align-items: baseline; 69 73 } 70 74 … … 140 144 .en_quote_settings_sub_options th { 141 145 padding: 0 0 10px 15px; 142 margin-left: 10px !important;143 146 font-weight: 400; 144 147 } … … 377 380 .woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"], 378 381 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 382 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 379 383 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 380 384 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], … … 400 404 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], 401 405 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 406 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 402 407 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 403 408 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"], … … 409 414 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip, 410 415 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_en_product_markup"] span.woocommerce-help-tip, 416 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_eniture_product_level_fulfillment_offset_days"] span.woocommerce-help-tip, 411 417 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip, 412 418 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedDimension"] span.woocommerce-help-tip, -
small-package-quotes-usps-edition/trunk/admin/assets/en-usps-admin.js
r3439225 r3494405 6 6 jQuery('#shipping_methods_do_not_sort_by_price').closest('table').attr('id', 'en_usps_quote_settings'); 7 7 jQuery("#order_shipping_line_items .shipping .display_meta").css('display', 'none'); 8 jQuery("#en_usps_fulfilment_offset_days").attr('maxlength', '2'); 8 9 9 10 // Quote Settings Tab … … 30 31 // Delivery estimate options changed 31 32 jQuery("input[name=en_delivery_estimate_options_usps]").on('change load', function () { 32 varen_delivery_estimate_val = jQuery('input[name=en_delivery_estimate_options_usps]:checked').val();33 const en_delivery_estimate_val = jQuery('input[name=en_delivery_estimate_options_usps]:checked').val(); 33 34 if (en_delivery_estimate_val == 'dont_show_estimates') { 34 35 jQuery("#en_usps_cutt_off_time").prop('disabled', true); 35 36 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', true); 37 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', true); 36 38 } else { 37 39 jQuery("#en_usps_cutt_off_time").prop('disabled', false); 38 40 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', false); 39 } 40 }); 41 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', false); 42 } 43 }); 44 45 const en_delivery_estimate_val = jQuery('input[name=en_delivery_estimate_options_usps]:checked').val(); 46 if (en_delivery_estimate_val == 'dont_show_estimates') { 47 jQuery("#en_usps_cutt_off_time").prop('disabled', true); 48 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', true); 49 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', true); 50 } else { 51 jQuery("#en_usps_cutt_off_time").prop('disabled', false); 52 jQuery("#en_usps_fulfilment_offset_days").prop('disabled', false); 53 jQuery(".en_usps_all_shipment, .en_usps_shipment_day").prop('disabled', false); 54 } 41 55 42 56 let en_usps_cutt_off_time = jQuery('#en_usps_cutt_off_time').length > 0 && jQuery('#en_usps_cutt_off_time').val().length > 0 ? jQuery('#en_usps_cutt_off_time').val() : ''; … … 111 125 let en_validate_settings = {}; 112 126 let en_data_error = true; 127 jQuery(':checkbox:disabled').prop('disabled', false); 128 113 129 114 130 en_validate_settings['#en_usps_handling_fee'] = { … … 140 156 'en_max_length': false, 141 157 'en_error_msg': 'Air hazardous material fee format should be 100.20 or 10%.', 142 };143 144 en_validate_settings['#en_usps_fulfilment_offset_days'] = {145 'en_data_type': 'isNumeric',146 'en_decimal': false,147 'en_after_decimal': 0,148 'en_add_percentage': false,149 'en_minus_sign': false,150 'en_max_length': 1,151 'en_error_msg': 'Entered Days are not valid.',152 158 }; 153 159 … … 232 238 } 233 239 240 // fulfillment offset days validation 241 if (!en_usps_validate_fullfillment_offset_days()) return false; 234 242 // backup rates validation 235 243 if (!en_usps_small_backup_rates_validations()) return false; … … 728 736 } 729 737 } 738 739 if (typeof en_usps_validate_fullfillment_offset_days !== 'function') { 740 function en_usps_validate_fullfillment_offset_days() { 741 const offset_days = jQuery("#en_usps_fulfilment_offset_days").val(); 742 const number_regex = /^[0-9]+$/; 743 let error_msg = ''; 744 745 if (offset_days != "" && offset_days < 1) error_msg = 'Fulfillment Offset Days must be greater than or equal to 1.'; 746 if (!error_msg && offset_days != "" && offset_days > 20) error_msg = 'Fulfillment Offset Days must be less than or equal to 20.'; 747 if (!error_msg && offset_days != "" && !number_regex.test(offset_days)) error_msg = 'Fulfillment Offset Days must be a number.'; 748 749 if (error_msg) { 750 jQuery('.en_settings_message').remove(); 751 jQuery('.usps_small_plan_notice').after('<div class="notice notice-error en_settings_message"><p><strong>Error! </strong>' + error_msg + '</p></div>'); 752 jQuery('#en_settings_message').delay(200).animate({scrollTop: 0}, 1000); 753 jQuery('html, body').animate({scrollTop: 0}, 'slow'); 754 return false; 755 } 756 757 return true; 758 } 759 } -
small-package-quotes-usps-edition/trunk/admin/product/en-product-detail.php
r3287624 r3494405 103 103 $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : ''; 104 104 $en_updated_product = (isset($_POST[$custom_field][$postId])) ? sanitize_text_field(wp_unslash($_POST[$custom_field][$postId])) : ''; 105 $en_updated_product = $custom_field == '_dropship_location' ? 106 (maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product)) : esc_attr($en_updated_product); 105 106 if ($custom_field == '_dropship_location') { 107 $en_updated_product = maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product); 108 } elseif ($custom_field == '_eniture_product_level_fulfillment_offset_days') { 109 $en_updated_product = $this->sanitize_fulfillment_offset_days($en_updated_product); 110 } else { 111 $en_updated_product = esc_attr($en_updated_product); 112 } 113 107 114 update_post_meta($postId, $custom_field, $en_updated_product); 108 115 } 109 116 } 117 } 118 119 private function sanitize_fulfillment_offset_days($value) 120 { 121 $value = trim($value); 122 if ($value === '' || $value === null) return ''; 123 124 $value = preg_replace('/[^0-9.-]/', '', $value); 125 if (!is_numeric($value)) return ''; 126 127 $value = intval(floor(floatval($value))); 128 return $value < 0 ? '' : strval($value); 110 129 } 111 130 … … 196 215 ], 197 216 [ 217 'type' => 'input_field', 218 'input_type' => 'number', 219 'id' => '_eniture_product_level_fulfillment_offset_days', 220 'class' => '_eniture_product_level_fulfillment_offset_days short', 221 'label' => __( 'Fulfillment Offset Days', 'woocommerce' ), 222 'placeholder' => 'Fulfillment offset days, e.g. 2', 223 'description' => "The number of days the ship date needs to be moved to allow for the processing of the order. If set, this will override the global Fulfillment Offset Days setting for this product.", 224 'custom_attributes' => [ 225 'min' => '1', 226 'max' => '20', 227 'step' => '1', 228 'title' => 'Value must be greater than or equal to 1 and less than or equal to 20', 229 'oninvalid' => "this.setCustomValidity(this.validity.rangeUnderflow ? 'Value must be greater than or equal to 1' : this.validity.rangeOverflow ? 'Value must be less than or equal to 20' : '')", 230 'oninput' => "this.setCustomValidity('')" 231 ] 232 ], 233 [ 198 234 'type' => 'checkbox', 199 235 'id' => '_en_insurance_fee', … … 322 358 'label' => $custom_field['label'], 323 359 'class' => $custom_field['class'], 324 'placeholder' => $custom_field['label'],360 'placeholder' => isset($custom_field['placeholder']) ? $custom_field['placeholder'] : $custom_field['label'], 325 361 'value' => get_post_meta($postId, $custom_field['id'], true) 326 362 ]; … … 329 365 $custom_input_field['desc_tip'] = true; 330 366 $custom_input_field['description'] = $custom_field['description']; 367 } 368 369 // Add input type if specified (e.g., 'number') 370 if (isset($custom_field['input_type'])) { 371 $custom_input_field['type'] = $custom_field['input_type']; 372 } 373 374 // Add custom attributes if specified (e.g., min, max, step) 375 if (isset($custom_field['custom_attributes'])) { 376 $custom_input_field['custom_attributes'] = $custom_field['custom_attributes']; 331 377 } 332 378 -
small-package-quotes-usps-edition/trunk/admin/tab/location/assets/css/en-usps-location.css
r3439225 r3494405 33 33 } 34 34 35 .en_usps_location_btn_container { 36 clear: both; 37 margin: 10px !important; 38 display: flex; 39 justify-content: flex-end; 40 } 41 35 42 .en_usps_location_btn { 36 clear: both; 37 float: right; 38 margin: 10px !important; 43 margin-right: 10px !important; 39 44 } 40 45 … … 124 129 color: #ff0000; 125 130 font-size: 11px; 126 margin: 0 0 0 40.2%; 127 width: 100%; 131 width: 58.7%; 128 132 display: block; 129 } 130 131 .en_location_error_message { 133 float: right; 134 } 135 136 .en_location_error_message, 137 .en_usps_small_warehouse_error_message, .en_usps_small_dropship_error_message { 132 138 background: #f1f1f1 none repeat scroll 0 0; 133 139 border-left: 4px solid #dc3232; … … 139 145 } 140 146 141 .en_location_success_message { 147 .en_location_success_message, 148 .en_usps_wh_location_success_message, .en_usps_ds_location_success_message, 149 .en_usps_small_warehouse_success_message, .en_usps_small_dropship_success_message { 142 150 background: #fff none repeat scroll 0 0; 143 151 border-left: 4px solid #46b450; … … 149 157 } 150 158 159 .en_usps_small_warehouse_success_message, .en_usps_small_dropship_success_message { 160 margin: auto; 161 } 162 151 163 .spinner_disable { 152 164 color: #000000; … … 175 187 .en_location_table td, 176 188 .en_location_table th { 177 color: #555;178 189 padding: 12px 35px; 179 190 border-collapse: collapse; 180 191 text-align: center; 192 } 193 194 .en_location_table td { 195 color: #555; 181 196 } 182 197 -
small-package-quotes-usps-edition/trunk/admin/tab/location/assets/js/en-usps-location.js
r3347910 r3494405 164 164 } else if (en_is_var_exist('severity', data) && data['severity'] == 'error') { 165 165 jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300); 166 jQuery('.en_location_error_message span').text(data['message']); 167 en_show_errors('.en_location_error_message'); 166 const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds'; 167 jQuery(`.en_usps_${location_type}_location_error_message span`).text(data['message']); 168 en_show_errors(`.en_usps_${location_type}_location_error_message`); 168 169 } 169 170 … … 367 368 function en_usps_location_delete(e, data, en_location_type, en_location_id) { 368 369 e.preventDefault(); 370 371 // If warehouse location then directly delete 372 if (en_location_type) { 373 en_usps_location_confirm_delete(data, en_location_type, en_location_id); 374 return; 375 } 376 369 377 en_popup_confirmation_location_delete_show(); 370 378 … … 408 416 if (data['message'].length > 0) { 409 417 jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300); 410 jQuery('.en_location_success_message span').text(data['message']); 411 en_show_errors('.en_location_success_message'); 418 const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds'; 419 jQuery(`.en_usps_${location_type}_location_success_message span`).text(data['message']); 420 en_show_errors(`.en_usps_${location_type}_location_success_message`); 412 421 } 413 422 } … … 449 458 } 450 459 } 460 461 if (typeof en_usps_small_select_bulk_locations != 'function') { 462 function en_usps_small_select_bulk_locations(location_class, e) { 463 const checked = jQuery(e).is(':checked'); 464 jQuery(`.${location_class}`).prop('checked', checked); 465 } 466 } 467 468 if (typeof en_usps_small_toggle_select_all_locations != 'function') { 469 function en_usps_small_toggle_select_all_locations(location_class, select_all_locations) { 470 const allChecked = jQuery(`.${location_class}:checked`).length === jQuery(`.${location_class}`).length; 471 jQuery(`#${select_all_locations}`).prop('checked', allChecked); 472 } 473 } 474 475 if (typeof en_usps_small_delete_bulk_locations != 'function') { 476 function en_usps_small_delete_bulk_locations(e, location_class, location_type) { 477 e.preventDefault(); 478 const location_ids = jQuery(`.${location_class}:checked`).map(function () { 479 return this.value; 480 }).get(); 481 482 // Show error message if no locations are selected 483 if (location_ids.length === 0) { 484 const loc_error_class = `en_usps_small_${location_type}_error_message`; 485 jQuery(`.${loc_error_class}`).show('slow').delay(3000).hide('slow'); 486 return; 487 } 488 489 const postForm = { 490 'action': 'en_usps_location_bulk_delete', 491 'location_ids': location_ids, 492 'location_type': location_type, 493 'wp_nonce': en_usps_location_script.nonce 494 } 495 const delete_locs_btn = `.en_usps_small_bulk_delete_${location_type}`, 496 loc_success_class = `.en_usps_small_${location_type}_success_message`, 497 loc_error_class = `.en_usps_small_${location_type}_error_message`; 498 499 jQuery.ajax({ 500 type: 'POST', 501 url: ajaxurl, 502 data: postForm, 503 dataType: 'json', 504 beforeSend: function () { 505 jQuery(delete_locs_btn).addClass('spinner_disable'); 506 }, 507 success: function (data) { 508 if (data.error && data.message) { 509 jQuery(delete_locs_btn).removeClass('spinner_disable'); 510 jQuery(loc_error_class).show('slow').delay(3000).hide('slow'); 511 } else { 512 jQuery(delete_locs_btn).removeClass('spinner_disable'); 513 jQuery(data.target_location).replaceWith(data.html); 514 jQuery(loc_success_class).show('slow').delay(3000).hide('slow'); 515 jQuery('.warehouse_updated, .warehouse_created, .warehouse_deleted, .dropship_deleted, .dropship_updated, .dropship_created').css('display', 'none'); 516 } 517 }, 518 error: function (error) { 519 jQuery(delete_locs_btn).removeClass('spinner_disable'); 520 console.log(error); 521 } 522 }); 523 } 524 } -
small-package-quotes-usps-edition/trunk/admin/tab/location/dropship/en-dropship.php
r3347910 r3494405 45 45 46 46 <h1><?php esc_attr_e('Drop ships', 'small-package-quotes-usps-edition'); ?></h1> 47 <button onclick="en_show_popup_location(false, event)" type="button" 48 class="button-primary"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?></button> 47 <div style="display: flex; gap: 3px; margin-top: 10px;"> 48 <button title="Add Drop Ship" onclick="en_show_popup_location(false, event)" type="button" 49 class="button-primary"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?></button> 50 <button title="Delete Drop Ships" type="button" class="en_usps_small_bulk_delete_dropship en_wd_add_dropship_btn button-primary" title="Delete Drop Ships" onclick="return en_usps_small_delete_bulk_locations(event, 'en_usps_small_delete_dropship_item', 'dropship');"><?php _e('Delete', 'eniture-technology'); ?></button> 51 </div> 49 52 <p><?php esc_attr_e("Locations that inventory specific items that are drop shipped to the destination. Use the product's settings 50 53 page to identify it as a drop shipped item and its associated drop ship location. Orders that include drop … … 52 55 cheapest option of each shipment required to fulfill the order.", 'small-package-quotes-usps-edition'); ?></p> 53 56 57 <!-- Success/Error messages --> 58 <div class="en_usps_ds_location_success_message"><strong>Success! </strong><span></span></div> 59 <div class="en_usps_small_dropship_success_message"><strong>Success!</strong> <span>Selected drop ships deleted successfully.</span></div> 60 <div class="en_usps_small_dropship_error_message"><strong>Error!</strong> Please select at least one drop ship to delete.</div> 61 54 62 <table class="en_location_table en_location_dropship_table"> 55 63 <thead> 56 64 <tr> 65 <th class="en_wd_dropship_list_heading en_usps_small_bulk_delete_col"> 66 <!-- Bulk delete --> 67 <input type="checkbox" name="en_usps_small_bulk_delete_dropships" id="en_usps_small_bulk_delete_dropships" onclick="return en_usps_small_select_bulk_locations('en_usps_small_delete_dropship_item', this);" /> 68 </th> 57 69 <?php echo wp_kses_post(\EnLocation::en_arrange_table_data('th', $en_heading)); ?> 58 70 <th><?php esc_attr_e('Action', 'small-package-quotes-usps-edition'); ?></th> … … 75 87 { 76 88 return array( 77 'div' => array('class' => []), 'button' => array('class' => [], 'onclick' => []), 'strong' => [], 'span' => [], 'table' => array('class' => []), 'thead' => [], 'tr' => array('class' => [], 'id' => []), 'th' => [], 'tbody' => [], 'td' => array('class' => [], 'id' => [], 'data-available_id' => [], 'onclick' => []), 'img' => array('src' => [], 'title' => []), 'a' => array('href' => [], 'onclick' => []), 'p' => [], 'h1' => [], 'br' => [], 89 'div' => array('class' => [], 'style' => []), 'button' => array('class' => [], 'onclick' => [], 'type' => [], 'title' => []), 'strong' => [], 'span' => [], 'table' => array('class' => []), 'thead' => [], 'tr' => array('class' => [], 'id' => []), 'th' => ['input' => ['type' => [], 'name' => [], 'id' => [], 'onclick' => []]], 'tbody' => [], 'td' => array('class' => [], 'id' => [], 'data-available_id' => [], 'onclick' => []), 90 'input' => ['type' => [], 'name' => [], 'id' => [], 'onclick' => [], 'value' => [], 'class' => [], 'checked' => []], 91 'img' => array('src' => [], 'title' => []), 'a' => array('href' => [], 'onclick' => []), 'p' => [], 'h1' => [], 'br' => [], 78 92 'a' => ['href' => [], 'onclick' => [], 'title' => [], 'class' => [], 'id' => [], 'data-action'=> []], 79 93 ); -
small-package-quotes-usps-edition/trunk/admin/tab/location/en-location.php
r3246136 r3494405 252 252 253 253 echo '<tr class="' . esc_attr($append_class) . '" id="en_location_row_id_' . esc_attr($en_location_id). '">'; 254 255 $loc_type = isset($location['location']) && $location['location'] == 'warehouse' ? 'wh' : 'ds'; 256 $_type = ($loc_type === 'wh') ? 'warehouse' : 'dropship'; 257 echo '<td class="en_wd_' . esc_attr($_type) . '_list_data en_usps_small_bulk_delete_col"> 258 <input 259 type="checkbox" 260 class="en_usps_small_delete_' . esc_attr($_type) . '_item" 261 value="' . esc_attr($en_location_id) . '" 262 onclick="return en_usps_small_toggle_select_all_locations( 263 \'en_usps_small_delete_' . esc_attr($_type) . '_item\', 264 \'en_usps_small_bulk_delete_' . esc_attr($_type) . 's\' 265 );" 266 > 267 </td>'; 268 254 269 echo wp_kses_post(self::en_arrange_table_data('td', $en_sorted_location)); 255 270 … … 284 299 <?php esc_attr_e('Warning!', 'small-package-quotes-usps-edition'); ?> 285 300 </h2> 301 <hr> 286 302 <p class="en_confirmation_message"> 287 <?php esc_attr_e('If you delete this location, then location settings will be disabled against products 288 (if any).', 'small-package-quotes-usps-edition'); ?> 303 Warning! If you delete this location, Drop ship location settings will be disabled against products if any. 289 304 </p> 305 <hr> 290 306 <div class="en_confirmation_buttons"> 291 307 <a href="#" … … 342 358 } 343 359 344 echo '< input type="submit" value="Save" class="en_usps_location_btn button-primary">';360 echo '<div class="en_usps_location_btn_container"><input type="submit" value="Save" class="en_usps_location_btn button-primary"></div>'; 345 361 echo '</form>'; 346 362 echo '</div>'; -
small-package-quotes-usps-edition/trunk/admin/tab/location/includes/en-location-ajax.php
r3347910 r3494405 20 20 add_action('wp_ajax_en_usps_get_location', [$this, 'en_usps_get_location']); 21 21 add_action('wp_ajax_en_usps_location_delete_row', [$this, 'en_usps_location_delete_row']); 22 add_action('wp_ajax_en_usps_location_bulk_delete', array($this, 'en_usps_bulk_delete_locations_ajax')); 22 23 } 23 24 … … 195 196 196 197 if ($location === 'warehouse') { 197 $location_step = ' Warehouse';198 $location_step = 'New warehouse'; 198 199 $en_location_template_obj = new EnUspsWarehouseTemplate(); 199 200 $en_target_location = '.en_location_warehouse_main_div'; 200 201 $validate = ['zip', 'city', 'state', 'country', 'location']; 201 202 } else { 202 $location_step = ' Dropship';203 $location_step = 'New drop ship'; 203 204 $en_location_template_obj = new EnUspsDropshipTemplate(); 204 205 $en_target_location = '.en_location_dropship_main_div'; … … 218 219 (!empty($en_location_data) && 219 220 reset($en_location_data)['id'] === $location_id))) { 221 $location_step = $location === 'warehouse' ? 'Warehouse' : 'Drop ship'; 220 222 $message = $location_step . ' updated successfully.'; 221 223 $action = 'update'; … … 260 262 } 261 263 264 public function en_usps_bulk_delete_locations_ajax() 265 { 266 if (!(current_user_can('manage_options') || current_user_can('manage_woocommerce')) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wp_nonce'])), 'en_usps_location_nonce')) { 267 echo wp_json_encode(array('error' => true, 'message' => 'Unauthorized Access.')); 268 exit; 269 } 270 271 $location_ids = isset($_POST['location_ids']) ? $_POST['location_ids'] : array(); 272 $loc_type = isset($_POST['location_type']) ? $_POST['location_type'] : ''; 273 if (empty($location_ids)) { 274 echo wp_json_encode(['error' => true, 'message' => "Please select at least one {$loc_type} to delete."]); 275 exit; 276 } 277 278 global $wpdb; 279 foreach ($location_ids as $location_id) { 280 if ($loc_type == 'dropship') { 281 $get_dropship_id = ''; 282 $dropship_id = intval($location_id); 283 $get_dropship_array = array($dropship_id); 284 $ser = maybe_serialize($get_dropship_id); 285 $get_dropship_val = array_map('intval', $get_dropship_array); 286 $get_post_id = $wpdb->get_results("SELECT group_concat(post_id) as post_ids_list FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` = '_dropship_location' AND (`meta_value` LIKE '%" . $ser . "%' OR `meta_value` = '" . $dropship_id . "')"); 287 $post_id = reset($get_post_id)->post_ids_list; 288 289 if (isset($post_id)) { 290 $wpdb->query("UPDATE `" . $wpdb->prefix . "postmeta` SET `meta_value` = '' WHERE `meta_key` IN('_enable_dropship','_dropship_location') AND `post_id` IN ($post_id)"); 291 } 292 } 293 294 $wpdb->delete($wpdb->prefix . "warehouse", array('id' => intval($location_id), 'location' => $loc_type)); 295 } 296 297 if ($loc_type === 'warehouse') { 298 $en_location_template_obj = new EnUspsWarehouseTemplate(); 299 $en_target_location = '.en_location_warehouse_main_div'; 300 } else { 301 $en_location_template_obj = new EnUspsDropshipTemplate(); 302 $en_target_location = '.en_location_dropship_main_div'; 303 } 304 305 $html = $en_location_template_obj::en_load(); 306 307 echo wp_json_encode(['error' => false, 'message' => 'Locations deleted successfully.', 'target_location' => $en_target_location, 'html' => $html]); 308 exit; 309 } 262 310 } 263 311 -
small-package-quotes-usps-edition/trunk/admin/tab/location/warehouse/en-warehouse.php
r3347910 r3494405 38 38 <div class="en_location_warehouse_main_div"> 39 39 40 <div class="en_location_success_message"> 41 <strong><?php esc_attr_e('Success!', 'small-package-quotes-usps-edition'); ?> </strong><span></span></div> 40 <h1><?php esc_attr_e('Warehouses', 'small-package-quotes-usps-edition'); ?></h1> 41 <div style="display: flex; gap: 3px; margin-top: 10px;"> 42 <button title="Add Warehouse" onclick="en_show_popup_location(true, event)" type="button" 43 class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?> 44 </button> 45 <button title="Delete Warehouses" type="button" class="en_usps_small_bulk_delete_warehouse en_wd_add_warehouse_btn button-primary" title="Delete Warehouses" onclick="return en_usps_small_delete_bulk_locations(event, 'en_usps_small_delete_warehouse_item', 'warehouse');"><?php _e('Delete', 'eniture-technology'); ?> 46 </button> 42 47 43 <h1><?php esc_attr_e('Warehouses', 'small-package-quotes-usps-edition'); ?></h1> 44 <button onclick="en_show_popup_location(true, event)" type="button" 45 class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php esc_attr_e('Add', 'small-package-quotes-usps-edition'); ?> 46 </button> 47 <?php echo wp_kses_post(self::$plan_required); ?> 48 <?php echo wp_kses_post(self::$plan_required); ?> 49 </div> 48 50 49 51 <p><?php esc_attr_e('Warehouses that inventory all products not otherwise identified as drop shipped items. The warehouse with the 50 52 lowest shipping cost to the destination is used for quoting purposes.', 'small-package-quotes-usps-edition'); ?></p> 51 53 54 <div class="en_usps_wh_location_success_message"><strong>Success! </strong><span></span></div> 55 <div class="en_usps_small_warehouse_success_message"><strong>Success! </strong> <span>Selected warehouses deleted successfully.</span></div> 56 <div class="en_usps_small_warehouse_error_message"><strong>Error!</strong> <span>Please select at least one warehouse to delete.</span></div> 57 52 58 <table class="en_location_table en_location_warehouse_table"> 53 59 <thead> 54 60 <tr> 61 <th class="en_wd_warehouse_list_heading en_usps_small_bulk_delete_col"> 62 <!-- Bulk delete --> 63 <input type="checkbox" name="en_usps_small_bulk_delete_warehouses" id="en_usps_small_bulk_delete_warehouses" onclick="return en_usps_small_select_bulk_locations('en_usps_small_delete_warehouse_item', this);" /> 64 </th> 55 65 <?php echo wp_kses_post(\EnLocation::en_arrange_table_data('th', $en_heading)); ?> 56 66 <th><?php esc_attr_e('Action', 'small-package-quotes-usps-edition'); ?></th> -
small-package-quotes-usps-edition/trunk/admin/tab/quote-settings/en-quote-settings.php
r3439225 r3494405 154 154 ]; 155 155 156 $services['usps_quote_information_preference'] = [ 157 'name' => __('Quote Information Preference', 'small-package-quotes-usps-edition'), 158 'type' => 'radio', 159 'default' => 'yes', 160 'id' => 'usps_quote_information_preference', 161 'options' => array( 162 'yes' => __('Record it in the Additional Order Details widget. (Default)', 'small-package-quotes-usps-edition'), 163 'no' => __('Don\'t record it in the Additional Order Details widget.', 'small-package-quotes-usps-edition'), 164 ), 165 ]; 166 167 $services = array_merge($services, self::delivery_estimate_option(), self::cutt_off_time()); 156 168 157 169 /** … … 222 234 */ 223 235 static public function delivery_estimate_option() { 224 $option = $message = '';225 if (isset($_REQUEST['tab'])) {226 $feature_option = apply_filters("usps_plans_suscription_and_features", 'delivery_estimate_option');227 if (is_array($feature_option)) {228 $option = 'en_usps_disabled';229 $message = apply_filters("usps_plans_notification_link", $feature_option);230 }231 }232 233 236 return [ 234 237 'delivery_estimate_options' => [ … … 236 239 'type' => 'text', 237 240 'class' => 'hidden', 238 'desc' => $message,239 241 'id' => 'delivery_estimate_options' 240 242 ], … … 242 244 'name' => '', 243 245 'type' => 'radio', 244 'class' => $option,245 246 'default' => "dont_show_estimates", 246 247 'options' => [ … … 326 327 ], 327 328 'en_usps_fulfilment_offset_days' => [ 328 'name' => __('Fulfilment Offset Days', 'small-package-quotes-usps-edition'), 329 'type' => 'text', 330 'class' => $option, 331 'desc' => 'The number of days the ship date needs to be moved to allow the processing of the order.', 329 'name' => __('Fulfillment Offset Days', 'small-package-quotes-usps-edition'), 330 'type' => 'text', 331 'class' => $option, 332 'desc' => 'The number of days the ship date needs to be moved to allow for the processing of the order.', 333 'placeholder' => 'Fulfillment offset days, e.g. 2', 332 334 'id' => 'en_usps_fulfilment_offset_days' 333 335 ], -
small-package-quotes-usps-edition/trunk/en-install.php
r3439225 r3494405 42 42 ]); 43 43 44 wp_enqueue_script('EnUspsAdminJs', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.js', [], '1.0. 7');44 wp_enqueue_script('EnUspsAdminJs', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.js', [], '1.0.8'); 45 45 wp_localize_script('EnUspsAdminJs', 'en_usps_admin_script', [ 46 46 'pluginsUrl' => EN_USPS_PLUGIN_URL, … … 62 62 wp_enqueue_style('EnWickedPickerCss'); 63 63 64 wp_enqueue_script('EnUspsLocationScript', EN_USPS_DIR_FILE . '/admin/tab/location/assets/js/en-usps-location.js', [], '1.0. 2');64 wp_enqueue_script('EnUspsLocationScript', EN_USPS_DIR_FILE . '/admin/tab/location/assets/js/en-usps-location.js', [], '1.0.3'); 65 65 wp_localize_script('EnUspsLocationScript', 'en_usps_location_script', array( 66 66 'pluginsUrl' => EN_USPS_PLUGIN_URL, … … 68 68 )); 69 69 70 wp_register_style('EnUspsLocationStyle', EN_USPS_DIR_FILE . '/admin/tab/location/assets/css/en-usps-location.css', false, '1.0. 2');70 wp_register_style('EnUspsLocationStyle', EN_USPS_DIR_FILE . '/admin/tab/location/assets/css/en-usps-location.css', false, '1.0.3'); 71 71 wp_enqueue_style('EnUspsLocationStyle'); 72 72 73 wp_register_style('EnUspsAdminCss', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.css', false, '1.0. 5');73 wp_register_style('EnUspsAdminCss', EN_USPS_DIR_FILE . '/admin/assets/en-usps-admin.css', false, '1.0.6'); 74 74 wp_enqueue_style('EnUspsAdminCss'); 75 75 … … 247 247 }else{ 248 248 $plan_required = '0'; 249 $feature_status = EN_USPS_NAME . ': Enabled.';249 $feature_status = 'WooCommerce USPS Small Package Quotes: Enabled.'; 250 250 } 251 251 -
small-package-quotes-usps-edition/trunk/http/en-curl.php
r3439225 r3494405 123 123 { 124 124 $cachable_keys = [ 125 'serverName', 'licenseKey', 'includeDeclaredValue', 'shipment_type', 'shipment_weight', 'commdityDetails', 'productDetails', 'originAddress', 'product_quantities', 'product_prices', 'receiverZip', 'receiverState', 'receiverCountryCode', 'receiverCity', 'instorPickupLocalDelEnable', 'activeServices', 'rateTier', 'sbsMode' 125 'serverName', 'licenseKey', 'includeDeclaredValue', 'shipment_type', 'shipment_weight', 'commdityDetails', 'productDetails', 'originAddress', 'product_quantities', 'product_prices', 'receiverZip', 'receiverState', 'receiverCountryCode', 'receiverCity', 'instorPickupLocalDelEnable', 'activeServices', 'rateTier', 'sbsMode', 'modifyShipmentDateTime', 'OrderCutoffTime', 'shipmentOffsetDays', 'shipmentWeekDays' 126 126 ]; 127 127 $cachable_data = []; … … 137 137 $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : ''; 138 138 $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType']; 139 $cachable_data['defaultRADWithoutStreetAddress'] = isset($request_data['defaultRADWithoutStreetAddress']) ? $request_data['defaultRADWithoutStreetAddress'] : ''; 139 140 $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation']; 140 141 } 141 142 142 if (isset($request_data[' standardPackaging']) && $request_data['standardPackaging'] == 1) {143 $cachable_data[' standardPackaging'] = $request_data['standardPackaging'];144 $cachable_data[' pallet'] = $request_data['pallet'];143 if (isset($request_data['binPackaging']) && $request_data['binPackaging'] == 1) { 144 $cachable_data['binPackaging'] = $request_data['binPackaging']; 145 $cachable_data['bins'] = $request_data['bins']; 145 146 } 146 147 -
small-package-quotes-usps-edition/trunk/readme.txt
r3439225 r3494405 4 4 Requires at least: 6.4 5 5 Tested up to: 6.9 6 Stable tag: 1.3.1 26 Stable tag: 1.3.13 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 132 132 == Changelog == 133 133 134 = 1.3.13 - 2026-03-30 = 135 * Update: Added bulk delete support for warehouse and drop ship locations. 136 * Update: Added product-level offset days functionality. 137 * Update: Added settings to include order metadata and control its visibility on the order details page. 138 134 139 = 1.3.12 - 2026-01-14 = 135 140 * Update: Added data sanitization in the quotes request to ensure cleaner and more reliable API communication. -
small-package-quotes-usps-edition/trunk/server/api/en-response.php
r3439225 r3494405 384 384 // Cut Off Time & Ship Date Offset 385 385 $transitDays = self::en_sanitize_rate('transitDays', ''); 386 $calender_date = self::en_sanitize_rate(' calenderDate', '');387 $calender_days_in_transit = self::en_sanitize_rate(' CalenderDaysInTransit', '');386 $calender_date = self::en_sanitize_rate('transitDate', ''); 387 $calender_days_in_transit = self::en_sanitize_rate('totalTransitTimeInDays', ''); 388 388 389 389 if ($delivery_estimate_option == "delivery_date" && strlen($calender_date) > 0) { 390 $label .= ' ( Expected delivery by ' . gmdate('Y-m-d', strtotime($calender_date)) . ')';390 $label .= ' (Expected delivery by ' . gmdate('m-d-Y', strtotime($calender_date)) . ')'; 391 391 } elseif ($delivery_estimate_option == "delivery_days" && strlen($calender_days_in_transit) > 0) { 392 $correct_word = $calender_days_in_transit == 1 ? 'is' : 'are'; 393 $label .= ' ( Estimated number of days until delivery ' . $correct_word . ' ' . $calender_days_in_transit . ' )'; 392 $label .= ' (Intransit days: ' . $calender_days_in_transit . ')'; 394 393 } 395 394 -
small-package-quotes-usps-edition/trunk/server/en-shipping-rates.php
r3439225 r3494405 223 223 // Images for FDO 224 224 $image_urls = apply_filters('en_fdo_image_urls_merge', []); 225 $save_order_meta_data = get_option('usps_quote_information_preference'); 226 $save_packaging_data = get_option('box_sizing_packaging_solution_preference'); 225 227 226 228 foreach ($en_rates as $accessorial => $rate) { … … 245 247 // Images for FDO 246 248 $rate['meta_data']['en_fdo_image_urls'] = wp_json_encode($image_urls); 249 250 // Remove meta data and packaging data if not required 251 if ($save_order_meta_data == 'no') unset($rate['meta_data']['en_fdo_meta_data']); 252 if ($save_packaging_data == 'no') unset($rate['meta_data']['bin_packaging']); 247 253 } 248 254 -
small-package-quotes-usps-edition/trunk/server/package/en-package.php
r3439225 r3494405 105 105 // Get product level markup value 106 106 $product_level_markup = self::en_get_product_level_markup($product_data, $product['variation_id'], $product['product_id'], $product['quantity']); 107 $product_level_fulfillment_offset = self::en_get_product_level_fulfillment_offset_days($product_data, $product['variation_id'], $product['product_id']); 107 108 108 109 self::$post_id = (isset($product['variation_id']) && $product['variation_id'] > 0) ? … … 147 148 'isInsuranceActive' => $isInsuranceIctive, 148 149 'lineItemSlug' => $product_tag, 149 'markup' => $product_level_markup 150 'markup' => $product_level_markup, 151 'fulfillment_offset_days' => $product_level_fulfillment_offset, 150 152 ]; 151 153 … … 302 304 self::$en_request['product_prices'][$origin_zip_code] = floatval($product_data->get_price() * floatval($product['quantity'])); 303 305 } 306 307 // Track maximum fulfillment offset days 308 if (is_numeric($product_level_fulfillment_offset) && $product_level_fulfillment_offset > 0) { 309 if (!isset(self::$en_request['max_fulfillment_offset_days']) || $product_level_fulfillment_offset > self::$en_request['max_fulfillment_offset_days']) { 310 self::$en_request['max_fulfillment_offset_days'] = $product_level_fulfillment_offset; 311 } 312 } 304 313 } 305 314 } … … 502 511 $en_settings = json_decode(EN_USPS_SET_QUOTE_SETTINGS, true); 503 512 extract($en_settings); 513 514 // Use product-level fulfillment offset days if available, otherwise use global setting 515 if (isset(self::$en_request['max_fulfillment_offset_days']) && is_numeric(self::$en_request['max_fulfillment_offset_days']) && self::$en_request['max_fulfillment_offset_days'] > 0) { 516 $fulfilment_offset_days = self::$en_request['max_fulfillment_offset_days']; 517 } 518 504 519 if (!is_array($feature_option) && ($delivery_estimate_option == 'delivery_days' || $delivery_estimate_option == 'delivery_date')) { 505 520 $settings = [ 506 'modifyShipmentDateTime' => strlen($cutt_off_time) > 0 && strlen($fulfilment_offset_days) > 0 &&!empty($shipment_days) ? true : false,521 'modifyShipmentDateTime' => strlen($cutt_off_time) > 0 || strlen($fulfilment_offset_days) > 0 || !empty($shipment_days) ? true : false, 507 522 'OrderCutoffTime' => $cutt_off_time, 508 523 'shipmentOffsetDays' => $fulfilment_offset_days, … … 870 885 return $is_filter_applied; 871 886 } 887 888 public static function en_get_product_level_fulfillment_offset_days($_product, $variation_id, $product_id) 889 { 890 $fulfillment_offset_days = ''; 891 $field_name = '_eniture_product_level_fulfillment_offset_days'; 892 893 if ($_product->get_type() == 'variation' && $variation_id > 0) { 894 $fulfillment_offset_days = get_post_meta($variation_id, $field_name, true); 895 896 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 897 $parent_id = $_product->get_parent_id(); 898 if ($parent_id > 0) { 899 $fulfillment_offset_days = get_post_meta($parent_id, $field_name, true); 900 } 901 } 902 } else { 903 $fulfillment_offset_days = get_post_meta($_product->get_id(), $field_name, true); 904 } 905 906 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 907 $fulfillment_offset_days = get_post_meta($product_id, $field_name, true); 908 } 909 910 // Validate and sanitize the value before returning 911 if (is_numeric($fulfillment_offset_days)) { 912 $value = intval($fulfillment_offset_days); 913 return $value; 914 } 915 916 // Return empty string if invalid 917 return ''; 918 } 872 919 } 873 920 -
small-package-quotes-usps-edition/trunk/small-package-quotes-usps-edition.php
r3439225 r3494405 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from Usps Express and displays the results in the WooCommerce shopping cart. 6 * Version: 1.3.1 26 * Version: 1.3.13 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ … … 25 25 }); 26 26 27 if (empty(\EnUspsGuard\EnUspsGuard::en_check_prerequisites('USPS', '5.6', '4.0', '2.3'))) { 28 require_once 'en-install.php'; 29 } 27 add_action( 'init', function () { 28 if (!is_textdomain_loaded('small-package-quotes-usps-edition')) { 29 load_plugin_textdomain('small-package-quotes-usps-edition', false, dirname(plugin_basename(__FILE__)) . '/languages/'); 30 } 31 32 if (empty(\EnUspsGuard\EnUspsGuard::en_check_prerequisites('USPS', '5.6', '4.0', '2.3'))) { 33 require_once 'en-install.php'; 34 } 35 });
Note: See TracChangeset
for help on using the changeset viewer.