Changeset 3469958
- Timestamp:
- 02/26/2026 07:25:23 AM (5 weeks ago)
- Location:
- small-package-quotes-ups-edition
- Files:
-
- 18 edited
- 1 copied
-
tags/4.5.29 (copied) (copied from small-package-quotes-ups-edition/trunk)
-
tags/4.5.29/css/ups-small-style.css (modified) (4 diffs)
-
tags/4.5.29/js/en-ups-small.js (modified) (6 diffs)
-
tags/4.5.29/product/en-product-detail.php (modified) (3 diffs)
-
tags/4.5.29/readme.txt (modified) (2 diffs)
-
tags/4.5.29/small-package-quotes-ups-edition.php (modified) (3 diffs)
-
tags/4.5.29/template/quote-settings.php (modified) (3 diffs)
-
tags/4.5.29/ups-small-carrier-service.php (modified) (4 diffs)
-
tags/4.5.29/ups-small-group-package.php (modified) (7 diffs)
-
tags/4.5.29/ups-small-shipping-class.php (modified) (5 diffs)
-
trunk/css/ups-small-style.css (modified) (4 diffs)
-
trunk/js/en-ups-small.js (modified) (6 diffs)
-
trunk/product/en-product-detail.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/small-package-quotes-ups-edition.php (modified) (3 diffs)
-
trunk/template/quote-settings.php (modified) (3 diffs)
-
trunk/ups-small-carrier-service.php (modified) (4 diffs)
-
trunk/ups-small-group-package.php (modified) (7 diffs)
-
trunk/ups-small-shipping-class.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
small-package-quotes-ups-edition/tags/4.5.29/css/ups-small-style.css
r3377935 r3469958 456 456 } 457 457 458 tr.service_ups_small_estimates_title_tr th {459 font-size: 1.2em;460 }461 462 458 .ups_small_cutOffTime_shipDateOffset th { 463 459 font-weight: 400; … … 552 548 .woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"], 553 549 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 550 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 554 551 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 555 552 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], … … 575 572 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], 576 573 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 574 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 577 575 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 578 576 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"], … … 584 582 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip, 585 583 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_en_product_markup"] span.woocommerce-help-tip, 584 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_eniture_product_level_fulfillment_offset_days"] span.woocommerce-help-tip, 586 585 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip, 587 586 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedDimension"] span.woocommerce-help-tip, -
small-package-quotes-ups-edition/tags/4.5.29/js/en-ups-small.js
r3377935 r3469958 550 550 } 551 551 552 553 552 jQuery('.ups_small_quote_section .button-primary, .ups_small_quote_section .is-primary').on('click', function (e) { 554 553 jQuery(".updated").hide(); 555 554 jQuery('.error').remove(); 555 jQuery(':checkbox:disabled').prop('disabled', false); 556 556 557 557 if (!en_ups_small_handling_fee_validation()) { … … 570 570 if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays < 1) { 571 571 572 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong> Days should not be less than1.</p></div>');572 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong>Fulfillment Offset Days must be greater than or equal to 1.</p></div>'); 573 573 jQuery('html, body').animate({ 574 574 'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top … … 577 577 return false 578 578 } 579 if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays > 8) {580 581 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong> Days should be less than or equal to 8.</p></div>');579 if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays > 20) { 580 581 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong>Fulfillment Offset Days must be less than or equal to 20.</p></div>'); 582 582 jQuery('html, body').animate({ 583 583 'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top … … 591 591 if (ups_small_shipmentOffsetDays != "" && !numberOnlyRegex.test(ups_small_shipmentOffsetDays)) { 592 592 593 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong> Entered Days are not valid.</p></div>');593 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong>Fulfillment Offset Days must be a number.</p></div>'); 594 594 jQuery('html, body').animate({ 595 595 'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top … … 608 608 }); 609 609 610 611 610 let ups_small_quotes_markup_right_markup = jQuery('.ups_small_quotes_markup_right_markup'); 612 611 jQuery(ups_small_quotes_markup_right_markup).each(function () { … … 617 616 } 618 617 }); 619 620 618 621 619 var num_of_checkboxes = jQuery('.ups_small_quotes_services:checked').length; -
small-package-quotes-ups-edition/tags/4.5.29/product/en-product-detail.php
r3377935 r3469958 119 119 $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : ''; 120 120 $en_updated_product = (isset($_POST[$custom_field][$postId])) ? sanitize_text_field(wp_unslash( $_POST[$custom_field][$postId] )) : ''; 121 $en_updated_product = $custom_field == '_dropship_location' ? 122 (maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product)) : esc_attr($en_updated_product); 121 122 if ($custom_field == '_dropship_location') { 123 $en_updated_product = maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product); 124 } elseif ($custom_field == '_eniture_product_level_fulfillment_offset_days') { 125 $en_updated_product = $this->sanitize_fulfillment_offset_days($en_updated_product); 126 } else { 127 $en_updated_product = esc_attr($en_updated_product); 128 } 129 123 130 update_post_meta($postId, $custom_field, $en_updated_product); 124 131 } 125 132 } 133 } 134 135 private function sanitize_fulfillment_offset_days($value) 136 { 137 $value = trim($value); 138 if ($value === '' || $value === null) return ''; 139 140 $value = preg_replace('/[^0-9.-]/', '', $value); 141 if (!is_numeric($value)) return ''; 142 143 $value = intval(floor(floatval($value))); 144 return $value < 0 ? '' : strval($value); 126 145 } 127 146 … … 179 198 ], 180 199 [ 200 'type' => 'input_field', 201 'input_type' => 'number', 202 'id' => '_eniture_product_level_fulfillment_offset_days', 203 'class' => '_eniture_product_level_fulfillment_offset_days short', 204 'label' => __( 'Fulfillment Offset Days', 'woocommerce' ), 205 'placeholder' => 'Fulfillment offset days, e.g. 2', 206 '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.", 207 'custom_attributes' => [ 208 'min' => '1', 209 'max' => '20', 210 'step' => '1', 211 'title' => 'Value must be greater than or equal to 1 and less than or equal to 20', 212 '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' : '')", 213 'oninput' => "this.setCustomValidity('')" 214 ] 215 ], 216 [ 181 217 'type' => 'checkbox', 182 218 'id' => '_hazardousmaterials', … … 298 334 } 299 335 336 // Add input type if specified (e.g., 'number') 337 if (isset($custom_field['input_type'])) { 338 $custom_input_field['type'] = $custom_field['input_type']; 339 } 340 341 // Add custom attributes if specified (e.g., min, max, step) 342 if (isset($custom_field['custom_attributes'])) { 343 $custom_input_field['custom_attributes'] = $custom_field['custom_attributes']; 344 } 345 300 346 woocommerce_wp_text_input($custom_input_field); 301 347 } -
small-package-quotes-ups-edition/tags/4.5.29/readme.txt
r3442520 r3469958 4 4 Requires at least: 6.6 5 5 Tested up to: 6.9 6 Stable tag: 4.5.2 86 Stable tag: 4.5.29 7 7 License: GPL-2.0-or-later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 142 142 143 143 == Changelog == 144 145 = 4.5.29 - 2026-02-26 = 146 * Update: Added **product-level offset days** functionality to allow more granular shipment timing control. 147 * Update: Added **Quote Information Preference setting** to control whether quote information is recorded and displayed in the Additional Order Details widget. 148 * Fix: Corrected product tags, categories, and brands array merging to ensure accurate filtering and processing. 144 149 145 150 = 4.5.28 - 2026-01-19 = -
small-package-quotes-ups-edition/tags/4.5.29/small-package-quotes-ups-edition.php
r3442520 r3469958 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart. 6 * Version: 4.5.2 86 * Version: 4.5.29 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ … … 186 186 { 187 187 188 wp_register_style('eniture_ups_small_style', plugin_dir_url(__FILE__) . '/css/ups-small-style.css', false, '1.2. 0');188 wp_register_style('eniture_ups_small_style', plugin_dir_url(__FILE__) . '/css/ups-small-style.css', false, '1.2.1'); 189 189 wp_enqueue_style('eniture_ups_small_style'); 190 190 } … … 223 223 { 224 224 wp_enqueue_script('jquery'); 225 wp_enqueue_script('eniture_ups_small_script', plugin_dir_url(__FILE__) . 'js/en-ups-small.js', array(), '1.1. 2');225 wp_enqueue_script('eniture_ups_small_script', plugin_dir_url(__FILE__) . 'js/en-ups-small.js', array(), '1.1.3'); 226 226 wp_localize_script('eniture_ups_small_script', 'eniture_ups_small_admin_script', array( 227 227 'plugins_url' => plugins_url(), -
small-package-quotes-ups-edition/tags/4.5.29/template/quote-settings.php
r3377935 r3469958 812 812 ), 813 813 814 'ups_small_quote_information_preference' => array( 815 'name' => __('Quote Information Preference', 'woocommerce-settings-fedex_small_quotes'), 816 'type' => 'radio', 817 'default' => 'yes', 818 'id' => 'ups_small_quote_information_preference', 819 'options' => array( 820 'yes' => __('Record it in the Additional Order Details widget. (Default)', 'woocommerce-settings-fedex_small_quotes'), 821 'no' => __('Don\'t record it in the Additional Order Details widget.', 'woocommerce-settings-fedex_small_quotes'), 822 ), 823 ), 824 814 825 // Package rating method when Standard Box Sizes isn't in use 815 826 'ups_small_packaging_method_label' => array( … … 830 841 'name' => __('Delivery Estimate Options ', 'small-package-quotes-ups-edition'), 831 842 'type' => 'text', 832 'desc' => '',833 843 'id' => 'service_ups_small_estimates_title' 834 844 ), … … 874 884 ), 875 885 'shipmentOffsetDays_ups_small' => array( 876 'name' => __('Fulfil ment Offset Days ', 'small-package-quotes-ups-edition'),877 'type' => 'text', 878 'desc' => 'The number of days the ship date needs to be moved to allow the processing of the order.',879 'placeholder' => 'Fulfil ment Offset Days, e.g. 2',886 'name' => __('Fulfillment Offset Days ', 'small-package-quotes-ups-edition'), 887 'type' => 'text', 888 'desc' => 'The number of days the ship date needs to be moved to allow for the processing of the order.', 889 'placeholder' => 'Fulfillment Offset Days, e.g. 2', 880 890 'id' => 'ups_small_shipmentOffsetDays', 881 891 'class' => $disable_ups_small_cutOffTime_shipDateOffset, -
small-package-quotes-ups-edition/tags/4.5.29/ups-small-carrier-service.php
r3430547 r3469958 152 152 $shipmentWeekDays = $this->ups_small_shipment_week_days(); 153 153 if ($ups_small_delivery_estimates == 'delivery_days' || $ups_small_delivery_estimates == 'delivery_date') { 154 155 154 $orderCutoffTime = get_option('ups_small_orderCutoffTime'); 156 $shipmentOffsetDays = get_option('ups_small_shipmentOffsetDays'); 155 156 // Use product-level fulfillment offset days if available, otherwise use global setting 157 if (isset($package['max_fulfillment_offset_days']) && is_numeric($package['max_fulfillment_offset_days']) && $package['max_fulfillment_offset_days'] > 0) { 158 $shipmentOffsetDays = $package['max_fulfillment_offset_days']; 159 } else { 160 $shipmentOffsetDays = get_option('ups_small_shipmentOffsetDays'); 161 } 162 157 163 $modifyShipmentDateTime = ($orderCutoffTime != '' || $shipmentOffsetDays != '' || (is_array($shipmentWeekDays) && count($shipmentWeekDays) > 0)) ? 1 : 0; 158 164 $storeDateTime = gmdate('Y-m-d H:i:s', current_time('timestamp')); … … 393 399 394 400 if (get_option('all_shipment_days_ups_small') == 'yes') { 395 return $shipment_days_of_week;401 return array('1', '2', '3', '4', '5'); 396 402 } 397 403 if (get_option('monday_shipment_day_ups_small') == 'yes') { … … 1337 1343 $cachable_data['ups_small_pkg_resid_pickup'] = isset($request_data['ups_small_pkg_resid_pickup']) ? $request_data['ups_small_pkg_resid_pickup'] : ''; 1338 1344 $cachable_data['modifyShipmentDateTime'] = $request_data['modifyShipmentDateTime']; 1345 $cachable_data['OrderCutoffTime'] = $request_data['OrderCutoffTime']; 1346 $cachable_data['shipmentOffsetDays'] = $request_data['shipmentOffsetDays']; 1347 $cachable_data['shipmentWeekDays'] = $request_data['shipmentWeekDays']; 1339 1348 $cachable_data['hazardousItems'] = isset($request_data['hazardousItems']) ? $request_data['hazardousItems'] : ''; 1340 1349 $cachable_data['includeInsuranceValue'] = isset($request_data['includeInsuranceValue']) ? $request_data['includeInsuranceValue'] : ''; … … 1346 1355 $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : ''; 1347 1356 $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType']; 1357 $cachable_data['defaultRADWithoutStreetAddress'] = $request_data['defaultRADWithoutStreetAddress']; 1348 1358 $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation']; 1349 1359 } -
small-package-quotes-ups-edition/tags/4.5.29/ups-small-group-package.php
r3442520 r3469958 206 206 207 207 $product_level_markup = $this->ups_small_get_product_level_markup($_product, $values['variation_id'], $product_id, $values['quantity'], $price); 208 $product_level_fulfillment_offset = $this->ups_small_get_product_level_fulfillment_offset_days($_product, $values['variation_id'], $values['product_id']); 208 209 209 210 $locationId = (isset($origin_address['locationId'])) ? $origin_address['locationId'] : ''; … … 295 296 'ship_item_alone' => $ship_item_alone, 296 297 297 'markup' => $product_level_markup 298 'markup' => $product_level_markup, 299 'fulfillment_offset_days' => $product_level_fulfillment_offset, 298 300 ]; 299 301 … … 378 380 $ups_small_package[$locationId]['product_brands'] = isset($ups_small_package[$locationId]['product_brands']) && !empty($ups_small_package[$locationId]['product_brands']) ? $ups_small_package[$locationId]['product_brands'] : []; 379 381 } 382 383 // Track maximum fulfillment offset days 384 if (is_numeric($product_level_fulfillment_offset) && $product_level_fulfillment_offset > 0) { 385 if (!isset($ups_small_package[$locationId]['max_fulfillment_offset_days']) || $product_level_fulfillment_offset > $ups_small_package[$locationId]['max_fulfillment_offset_days']) { 386 $ups_small_package[$locationId]['max_fulfillment_offset_days'] = $product_level_fulfillment_offset; 387 } 388 } 380 389 } 381 390 … … 421 430 } 422 431 423 // Micro Warehouse 424 $eniureLicenceKey = get_option('ups_small_licence_key'); 425 $ups_small_package = apply_filters('en_micro_warehouse', $ups_small_package, $this->products, $this->dropship_location_array, $this->destination_Address_ups_small, $this->origin, 1, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'ups_small'); 432 if (!empty($this->dropship_location_array)) { 433 // Micro Warehouse 434 $eniureLicenceKey = get_option('ups_small_licence_key'); 435 $ups_small_package = apply_filters('en_micro_warehouse', $ups_small_package, $this->products, $this->dropship_location_array, $this->destination_Address_ups_small, $this->origin, 1, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'ups_small'); 436 } 437 426 438 return $ups_small_package; 427 439 } … … 602 614 $post_id = isset($values['product_id']) ? $values['product_id'] : $post_id; 603 615 $enable_dropship = get_post_meta($post_id, '_enable_dropship', true); 616 $post_id = empty($enable_dropship) ? $values['variation_id'] : $post_id; 604 617 } 605 618 … … 905 918 $formatted_values['price'] += floatval($pkg['product_prices']); 906 919 $formatted_values['quantity'] += floatval($pkg['product_quantities']); 907 $formatted_values['tags'] = array_merge($formatted_values['tags'], $pkg['product_tags']); 908 $formatted_values['categories'] = array_merge($formatted_values['categories'], $pkg['product_categories']); 909 $formatted_values['brands'] = array_merge($formatted_values['brands'], $pkg['product_brands']); 920 if (!empty($pkg['product_tags']) && is_array($pkg['product_tags'])) { 921 $formatted_values['tags'] = array_merge($formatted_values['tags'], $pkg['product_tags']); 922 } 923 if (!empty($pkg['product_categories']) && is_array($pkg['product_categories'])) { 924 $formatted_values['categories'] = array_merge($formatted_values['categories'], $pkg['product_categories']); 925 } 926 if (!empty($pkg['product_brands']) && is_array($pkg['product_brands'])) { 927 $formatted_values['brands'] = array_merge($formatted_values['brands'], $pkg['product_brands']); 928 } 910 929 } 911 930 … … 1455 1474 return $property_enabled; 1456 1475 } 1476 1477 function ups_small_get_product_level_fulfillment_offset_days($_product, $variation_id, $product_id) 1478 { 1479 $fulfillment_offset_days = ''; 1480 $field_name = '_eniture_product_level_fulfillment_offset_days'; 1481 1482 if ($_product->get_type() == 'variation' && $variation_id > 0) { 1483 $fulfillment_offset_days = get_post_meta($variation_id, $field_name, true); 1484 1485 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 1486 $parent_id = $_product->get_parent_id(); 1487 if ($parent_id > 0) { 1488 $fulfillment_offset_days = get_post_meta($parent_id, $field_name, true); 1489 } 1490 } 1491 } else { 1492 $fulfillment_offset_days = get_post_meta($_product->get_id(), $field_name, true); 1493 } 1494 1495 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 1496 $fulfillment_offset_days = get_post_meta($product_id, $field_name, true); 1497 } 1498 1499 // Validate and sanitize the value before returning 1500 if (is_numeric($fulfillment_offset_days)) { 1501 $value = intval($fulfillment_offset_days); 1502 return $value; 1503 } 1504 1505 // Return empty string if invalid 1506 return ''; 1507 } 1457 1508 } -
small-package-quotes-ups-edition/tags/4.5.29/ups-small-shipping-class.php
r3430547 r3469958 150 150 151 151 $this->package_plugin = get_option('ups_small_package'); 152 (strlen(WC()->customer->get_shipping_postcode()) > 0) ? $freight_zipcode =WC()->customer->get_shipping_postcode() : WC()->customer->get_billing_postcode();152 $freight_zipcode = strlen(WC()->customer->get_shipping_postcode()) > 0 ? WC()->customer->get_shipping_postcode() : WC()->customer->get_billing_postcode(); 153 153 $get_packg_obj = new Eniture_UPS_Small_Shipping_Get_Package(); 154 154 $ups_small_res_inst = new Eniture_UPS_Get_Shipping_Quotes(); … … 312 312 313 313 // Add backup rates 314 if (($this->en_not_returned_the_quotes && get_option('backup_rates_carrier_returns_error_ups_small') == 'yes') || (is_array($filterd_rates) && isset($filterd_rates['error']) && $filterd_rates['error'] == 'backup_rate' && get_option('backup_rates_carrier_fails_to_return_response_ups_small') == 'yes')) { 314 $backup_rates_error = is_array($filterd_rates) && isset($filterd_rates['error']) && $filterd_rates['error'] == 'backup_rate'; 315 if (($this->en_not_returned_the_quotes && get_option('backup_rates_carrier_returns_error_ups_small') == 'yes') || ($backup_rates_error && get_option('backup_rates_carrier_fails_to_return_response_ups_small') == 'yes')) { 315 316 $this->ups_small_backup_rates(); 316 return []; 317 } 318 } 319 320 if ($this->en_not_returned_the_quotes) { 317 } 318 } 319 320 if ($this->en_not_returned_the_quotes || $backup_rates_error) { 321 321 // Eniture debug mode 322 322 do_action("eniture_debug_mood", "UPS Small Quotes not returned", $this->en_not_returned_the_quotes ? 'Yes' : 'No'); … … 346 346 $image_urls = apply_filters('en_fdo_image_urls_merge', []); 347 347 $en_rates = $this->eniture_rates; 348 $save_order_meta_data = get_option('ups_small_quote_information_preference'); 349 $save_packaging_data = get_option('box_sizing_packaging_solution_preference'); 348 350 349 351 do_action("eniture_debug_mood", "Ups Small Eniture Quotes Rates", $en_rates); … … 370 372 $label_sufex = array_intersect_key($accessorials, array_flip($rate['label_sufex'])); 371 373 $rate['label'] .= (!empty($label_sufex)) ? ' with ' . implode(' and ', $label_sufex) : ''; 374 375 if (isset($rate['meta_data']['en_fdo_meta_data']['rate']['label'])) { 376 $rate['meta_data']['en_fdo_meta_data']['rate']['label'] = $rate['label']; 377 } 372 378 373 379 // Order widget detail set … … 388 394 $rate['meta_data']['en_fdo_image_urls'] = wp_json_encode($image_urls); 389 395 396 // Remove meta data and packaging data if not required 397 if ($save_order_meta_data == 'no') unset($rate['meta_data']['en_fdo_meta_data']); 398 if ($save_packaging_data == 'no') unset($rate['meta_data']['bin_packaging']); 390 399 } 391 400 -
small-package-quotes-ups-edition/trunk/css/ups-small-style.css
r3377935 r3469958 456 456 } 457 457 458 tr.service_ups_small_estimates_title_tr th {459 font-size: 1.2em;460 }461 462 458 .ups_small_cutOffTime_shipDateOffset th { 463 459 font-weight: 400; … … 552 548 .woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"], 553 549 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 550 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 554 551 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 555 552 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], … … 575 572 .woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"], 576 573 .woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"], 574 .woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"], 577 575 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"], 578 576 .woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"], … … 584 582 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip, 585 583 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_en_product_markup"] span.woocommerce-help-tip, 584 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_eniture_product_level_fulfillment_offset_days"] span.woocommerce-help-tip, 586 585 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip, 587 586 .woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedDimension"] span.woocommerce-help-tip, -
small-package-quotes-ups-edition/trunk/js/en-ups-small.js
r3377935 r3469958 550 550 } 551 551 552 553 552 jQuery('.ups_small_quote_section .button-primary, .ups_small_quote_section .is-primary').on('click', function (e) { 554 553 jQuery(".updated").hide(); 555 554 jQuery('.error').remove(); 555 jQuery(':checkbox:disabled').prop('disabled', false); 556 556 557 557 if (!en_ups_small_handling_fee_validation()) { … … 570 570 if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays < 1) { 571 571 572 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong> Days should not be less than1.</p></div>');572 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong>Fulfillment Offset Days must be greater than or equal to 1.</p></div>'); 573 573 jQuery('html, body').animate({ 574 574 'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top … … 577 577 return false 578 578 } 579 if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays > 8) {580 581 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong> Days should be less than or equal to 8.</p></div>');579 if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays > 20) { 580 581 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong>Fulfillment Offset Days must be less than or equal to 20.</p></div>'); 582 582 jQuery('html, body').animate({ 583 583 'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top … … 591 591 if (ups_small_shipmentOffsetDays != "" && !numberOnlyRegex.test(ups_small_shipmentOffsetDays)) { 592 592 593 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong> Entered Days are not valid.</p></div>');593 jQuery("#mainform .ups_small_quote_section").prepend('<div id="message" class="error inline ups_small_orderCutoffTime_error"><p><strong>Error! </strong>Fulfillment Offset Days must be a number.</p></div>'); 594 594 jQuery('html, body').animate({ 595 595 'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top … … 608 608 }); 609 609 610 611 610 let ups_small_quotes_markup_right_markup = jQuery('.ups_small_quotes_markup_right_markup'); 612 611 jQuery(ups_small_quotes_markup_right_markup).each(function () { … … 617 616 } 618 617 }); 619 620 618 621 619 var num_of_checkboxes = jQuery('.ups_small_quotes_services:checked').length; -
small-package-quotes-ups-edition/trunk/product/en-product-detail.php
r3377935 r3469958 119 119 $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : ''; 120 120 $en_updated_product = (isset($_POST[$custom_field][$postId])) ? sanitize_text_field(wp_unslash( $_POST[$custom_field][$postId] )) : ''; 121 $en_updated_product = $custom_field == '_dropship_location' ? 122 (maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product)) : esc_attr($en_updated_product); 121 122 if ($custom_field == '_dropship_location') { 123 $en_updated_product = maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product); 124 } elseif ($custom_field == '_eniture_product_level_fulfillment_offset_days') { 125 $en_updated_product = $this->sanitize_fulfillment_offset_days($en_updated_product); 126 } else { 127 $en_updated_product = esc_attr($en_updated_product); 128 } 129 123 130 update_post_meta($postId, $custom_field, $en_updated_product); 124 131 } 125 132 } 133 } 134 135 private function sanitize_fulfillment_offset_days($value) 136 { 137 $value = trim($value); 138 if ($value === '' || $value === null) return ''; 139 140 $value = preg_replace('/[^0-9.-]/', '', $value); 141 if (!is_numeric($value)) return ''; 142 143 $value = intval(floor(floatval($value))); 144 return $value < 0 ? '' : strval($value); 126 145 } 127 146 … … 179 198 ], 180 199 [ 200 'type' => 'input_field', 201 'input_type' => 'number', 202 'id' => '_eniture_product_level_fulfillment_offset_days', 203 'class' => '_eniture_product_level_fulfillment_offset_days short', 204 'label' => __( 'Fulfillment Offset Days', 'woocommerce' ), 205 'placeholder' => 'Fulfillment offset days, e.g. 2', 206 '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.", 207 'custom_attributes' => [ 208 'min' => '1', 209 'max' => '20', 210 'step' => '1', 211 'title' => 'Value must be greater than or equal to 1 and less than or equal to 20', 212 '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' : '')", 213 'oninput' => "this.setCustomValidity('')" 214 ] 215 ], 216 [ 181 217 'type' => 'checkbox', 182 218 'id' => '_hazardousmaterials', … … 298 334 } 299 335 336 // Add input type if specified (e.g., 'number') 337 if (isset($custom_field['input_type'])) { 338 $custom_input_field['type'] = $custom_field['input_type']; 339 } 340 341 // Add custom attributes if specified (e.g., min, max, step) 342 if (isset($custom_field['custom_attributes'])) { 343 $custom_input_field['custom_attributes'] = $custom_field['custom_attributes']; 344 } 345 300 346 woocommerce_wp_text_input($custom_input_field); 301 347 } -
small-package-quotes-ups-edition/trunk/readme.txt
r3442520 r3469958 4 4 Requires at least: 6.6 5 5 Tested up to: 6.9 6 Stable tag: 4.5.2 86 Stable tag: 4.5.29 7 7 License: GPL-2.0-or-later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 142 142 143 143 == Changelog == 144 145 = 4.5.29 - 2026-02-26 = 146 * Update: Added **product-level offset days** functionality to allow more granular shipment timing control. 147 * Update: Added **Quote Information Preference setting** to control whether quote information is recorded and displayed in the Additional Order Details widget. 148 * Fix: Corrected product tags, categories, and brands array merging to ensure accurate filtering and processing. 144 149 145 150 = 4.5.28 - 2026-01-19 = -
small-package-quotes-ups-edition/trunk/small-package-quotes-ups-edition.php
r3442520 r3469958 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart. 6 * Version: 4.5.2 86 * Version: 4.5.29 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ … … 186 186 { 187 187 188 wp_register_style('eniture_ups_small_style', plugin_dir_url(__FILE__) . '/css/ups-small-style.css', false, '1.2. 0');188 wp_register_style('eniture_ups_small_style', plugin_dir_url(__FILE__) . '/css/ups-small-style.css', false, '1.2.1'); 189 189 wp_enqueue_style('eniture_ups_small_style'); 190 190 } … … 223 223 { 224 224 wp_enqueue_script('jquery'); 225 wp_enqueue_script('eniture_ups_small_script', plugin_dir_url(__FILE__) . 'js/en-ups-small.js', array(), '1.1. 2');225 wp_enqueue_script('eniture_ups_small_script', plugin_dir_url(__FILE__) . 'js/en-ups-small.js', array(), '1.1.3'); 226 226 wp_localize_script('eniture_ups_small_script', 'eniture_ups_small_admin_script', array( 227 227 'plugins_url' => plugins_url(), -
small-package-quotes-ups-edition/trunk/template/quote-settings.php
r3377935 r3469958 812 812 ), 813 813 814 'ups_small_quote_information_preference' => array( 815 'name' => __('Quote Information Preference', 'woocommerce-settings-fedex_small_quotes'), 816 'type' => 'radio', 817 'default' => 'yes', 818 'id' => 'ups_small_quote_information_preference', 819 'options' => array( 820 'yes' => __('Record it in the Additional Order Details widget. (Default)', 'woocommerce-settings-fedex_small_quotes'), 821 'no' => __('Don\'t record it in the Additional Order Details widget.', 'woocommerce-settings-fedex_small_quotes'), 822 ), 823 ), 824 814 825 // Package rating method when Standard Box Sizes isn't in use 815 826 'ups_small_packaging_method_label' => array( … … 830 841 'name' => __('Delivery Estimate Options ', 'small-package-quotes-ups-edition'), 831 842 'type' => 'text', 832 'desc' => '',833 843 'id' => 'service_ups_small_estimates_title' 834 844 ), … … 874 884 ), 875 885 'shipmentOffsetDays_ups_small' => array( 876 'name' => __('Fulfil ment Offset Days ', 'small-package-quotes-ups-edition'),877 'type' => 'text', 878 'desc' => 'The number of days the ship date needs to be moved to allow the processing of the order.',879 'placeholder' => 'Fulfil ment Offset Days, e.g. 2',886 'name' => __('Fulfillment Offset Days ', 'small-package-quotes-ups-edition'), 887 'type' => 'text', 888 'desc' => 'The number of days the ship date needs to be moved to allow for the processing of the order.', 889 'placeholder' => 'Fulfillment Offset Days, e.g. 2', 880 890 'id' => 'ups_small_shipmentOffsetDays', 881 891 'class' => $disable_ups_small_cutOffTime_shipDateOffset, -
small-package-quotes-ups-edition/trunk/ups-small-carrier-service.php
r3430547 r3469958 152 152 $shipmentWeekDays = $this->ups_small_shipment_week_days(); 153 153 if ($ups_small_delivery_estimates == 'delivery_days' || $ups_small_delivery_estimates == 'delivery_date') { 154 155 154 $orderCutoffTime = get_option('ups_small_orderCutoffTime'); 156 $shipmentOffsetDays = get_option('ups_small_shipmentOffsetDays'); 155 156 // Use product-level fulfillment offset days if available, otherwise use global setting 157 if (isset($package['max_fulfillment_offset_days']) && is_numeric($package['max_fulfillment_offset_days']) && $package['max_fulfillment_offset_days'] > 0) { 158 $shipmentOffsetDays = $package['max_fulfillment_offset_days']; 159 } else { 160 $shipmentOffsetDays = get_option('ups_small_shipmentOffsetDays'); 161 } 162 157 163 $modifyShipmentDateTime = ($orderCutoffTime != '' || $shipmentOffsetDays != '' || (is_array($shipmentWeekDays) && count($shipmentWeekDays) > 0)) ? 1 : 0; 158 164 $storeDateTime = gmdate('Y-m-d H:i:s', current_time('timestamp')); … … 393 399 394 400 if (get_option('all_shipment_days_ups_small') == 'yes') { 395 return $shipment_days_of_week;401 return array('1', '2', '3', '4', '5'); 396 402 } 397 403 if (get_option('monday_shipment_day_ups_small') == 'yes') { … … 1337 1343 $cachable_data['ups_small_pkg_resid_pickup'] = isset($request_data['ups_small_pkg_resid_pickup']) ? $request_data['ups_small_pkg_resid_pickup'] : ''; 1338 1344 $cachable_data['modifyShipmentDateTime'] = $request_data['modifyShipmentDateTime']; 1345 $cachable_data['OrderCutoffTime'] = $request_data['OrderCutoffTime']; 1346 $cachable_data['shipmentOffsetDays'] = $request_data['shipmentOffsetDays']; 1347 $cachable_data['shipmentWeekDays'] = $request_data['shipmentWeekDays']; 1339 1348 $cachable_data['hazardousItems'] = isset($request_data['hazardousItems']) ? $request_data['hazardousItems'] : ''; 1340 1349 $cachable_data['includeInsuranceValue'] = isset($request_data['includeInsuranceValue']) ? $request_data['includeInsuranceValue'] : ''; … … 1346 1355 $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : ''; 1347 1356 $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType']; 1357 $cachable_data['defaultRADWithoutStreetAddress'] = $request_data['defaultRADWithoutStreetAddress']; 1348 1358 $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation']; 1349 1359 } -
small-package-quotes-ups-edition/trunk/ups-small-group-package.php
r3442520 r3469958 206 206 207 207 $product_level_markup = $this->ups_small_get_product_level_markup($_product, $values['variation_id'], $product_id, $values['quantity'], $price); 208 $product_level_fulfillment_offset = $this->ups_small_get_product_level_fulfillment_offset_days($_product, $values['variation_id'], $values['product_id']); 208 209 209 210 $locationId = (isset($origin_address['locationId'])) ? $origin_address['locationId'] : ''; … … 295 296 'ship_item_alone' => $ship_item_alone, 296 297 297 'markup' => $product_level_markup 298 'markup' => $product_level_markup, 299 'fulfillment_offset_days' => $product_level_fulfillment_offset, 298 300 ]; 299 301 … … 378 380 $ups_small_package[$locationId]['product_brands'] = isset($ups_small_package[$locationId]['product_brands']) && !empty($ups_small_package[$locationId]['product_brands']) ? $ups_small_package[$locationId]['product_brands'] : []; 379 381 } 382 383 // Track maximum fulfillment offset days 384 if (is_numeric($product_level_fulfillment_offset) && $product_level_fulfillment_offset > 0) { 385 if (!isset($ups_small_package[$locationId]['max_fulfillment_offset_days']) || $product_level_fulfillment_offset > $ups_small_package[$locationId]['max_fulfillment_offset_days']) { 386 $ups_small_package[$locationId]['max_fulfillment_offset_days'] = $product_level_fulfillment_offset; 387 } 388 } 380 389 } 381 390 … … 421 430 } 422 431 423 // Micro Warehouse 424 $eniureLicenceKey = get_option('ups_small_licence_key'); 425 $ups_small_package = apply_filters('en_micro_warehouse', $ups_small_package, $this->products, $this->dropship_location_array, $this->destination_Address_ups_small, $this->origin, 1, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'ups_small'); 432 if (!empty($this->dropship_location_array)) { 433 // Micro Warehouse 434 $eniureLicenceKey = get_option('ups_small_licence_key'); 435 $ups_small_package = apply_filters('en_micro_warehouse', $ups_small_package, $this->products, $this->dropship_location_array, $this->destination_Address_ups_small, $this->origin, 1, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'ups_small'); 436 } 437 426 438 return $ups_small_package; 427 439 } … … 602 614 $post_id = isset($values['product_id']) ? $values['product_id'] : $post_id; 603 615 $enable_dropship = get_post_meta($post_id, '_enable_dropship', true); 616 $post_id = empty($enable_dropship) ? $values['variation_id'] : $post_id; 604 617 } 605 618 … … 905 918 $formatted_values['price'] += floatval($pkg['product_prices']); 906 919 $formatted_values['quantity'] += floatval($pkg['product_quantities']); 907 $formatted_values['tags'] = array_merge($formatted_values['tags'], $pkg['product_tags']); 908 $formatted_values['categories'] = array_merge($formatted_values['categories'], $pkg['product_categories']); 909 $formatted_values['brands'] = array_merge($formatted_values['brands'], $pkg['product_brands']); 920 if (!empty($pkg['product_tags']) && is_array($pkg['product_tags'])) { 921 $formatted_values['tags'] = array_merge($formatted_values['tags'], $pkg['product_tags']); 922 } 923 if (!empty($pkg['product_categories']) && is_array($pkg['product_categories'])) { 924 $formatted_values['categories'] = array_merge($formatted_values['categories'], $pkg['product_categories']); 925 } 926 if (!empty($pkg['product_brands']) && is_array($pkg['product_brands'])) { 927 $formatted_values['brands'] = array_merge($formatted_values['brands'], $pkg['product_brands']); 928 } 910 929 } 911 930 … … 1455 1474 return $property_enabled; 1456 1475 } 1476 1477 function ups_small_get_product_level_fulfillment_offset_days($_product, $variation_id, $product_id) 1478 { 1479 $fulfillment_offset_days = ''; 1480 $field_name = '_eniture_product_level_fulfillment_offset_days'; 1481 1482 if ($_product->get_type() == 'variation' && $variation_id > 0) { 1483 $fulfillment_offset_days = get_post_meta($variation_id, $field_name, true); 1484 1485 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 1486 $parent_id = $_product->get_parent_id(); 1487 if ($parent_id > 0) { 1488 $fulfillment_offset_days = get_post_meta($parent_id, $field_name, true); 1489 } 1490 } 1491 } else { 1492 $fulfillment_offset_days = get_post_meta($_product->get_id(), $field_name, true); 1493 } 1494 1495 if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) { 1496 $fulfillment_offset_days = get_post_meta($product_id, $field_name, true); 1497 } 1498 1499 // Validate and sanitize the value before returning 1500 if (is_numeric($fulfillment_offset_days)) { 1501 $value = intval($fulfillment_offset_days); 1502 return $value; 1503 } 1504 1505 // Return empty string if invalid 1506 return ''; 1507 } 1457 1508 } -
small-package-quotes-ups-edition/trunk/ups-small-shipping-class.php
r3430547 r3469958 150 150 151 151 $this->package_plugin = get_option('ups_small_package'); 152 (strlen(WC()->customer->get_shipping_postcode()) > 0) ? $freight_zipcode =WC()->customer->get_shipping_postcode() : WC()->customer->get_billing_postcode();152 $freight_zipcode = strlen(WC()->customer->get_shipping_postcode()) > 0 ? WC()->customer->get_shipping_postcode() : WC()->customer->get_billing_postcode(); 153 153 $get_packg_obj = new Eniture_UPS_Small_Shipping_Get_Package(); 154 154 $ups_small_res_inst = new Eniture_UPS_Get_Shipping_Quotes(); … … 312 312 313 313 // Add backup rates 314 if (($this->en_not_returned_the_quotes && get_option('backup_rates_carrier_returns_error_ups_small') == 'yes') || (is_array($filterd_rates) && isset($filterd_rates['error']) && $filterd_rates['error'] == 'backup_rate' && get_option('backup_rates_carrier_fails_to_return_response_ups_small') == 'yes')) { 314 $backup_rates_error = is_array($filterd_rates) && isset($filterd_rates['error']) && $filterd_rates['error'] == 'backup_rate'; 315 if (($this->en_not_returned_the_quotes && get_option('backup_rates_carrier_returns_error_ups_small') == 'yes') || ($backup_rates_error && get_option('backup_rates_carrier_fails_to_return_response_ups_small') == 'yes')) { 315 316 $this->ups_small_backup_rates(); 316 return []; 317 } 318 } 319 320 if ($this->en_not_returned_the_quotes) { 317 } 318 } 319 320 if ($this->en_not_returned_the_quotes || $backup_rates_error) { 321 321 // Eniture debug mode 322 322 do_action("eniture_debug_mood", "UPS Small Quotes not returned", $this->en_not_returned_the_quotes ? 'Yes' : 'No'); … … 346 346 $image_urls = apply_filters('en_fdo_image_urls_merge', []); 347 347 $en_rates = $this->eniture_rates; 348 $save_order_meta_data = get_option('ups_small_quote_information_preference'); 349 $save_packaging_data = get_option('box_sizing_packaging_solution_preference'); 348 350 349 351 do_action("eniture_debug_mood", "Ups Small Eniture Quotes Rates", $en_rates); … … 370 372 $label_sufex = array_intersect_key($accessorials, array_flip($rate['label_sufex'])); 371 373 $rate['label'] .= (!empty($label_sufex)) ? ' with ' . implode(' and ', $label_sufex) : ''; 374 375 if (isset($rate['meta_data']['en_fdo_meta_data']['rate']['label'])) { 376 $rate['meta_data']['en_fdo_meta_data']['rate']['label'] = $rate['label']; 377 } 372 378 373 379 // Order widget detail set … … 388 394 $rate['meta_data']['en_fdo_image_urls'] = wp_json_encode($image_urls); 389 395 396 // Remove meta data and packaging data if not required 397 if ($save_order_meta_data == 'no') unset($rate['meta_data']['en_fdo_meta_data']); 398 if ($save_packaging_data == 'no') unset($rate['meta_data']['bin_packaging']); 390 399 } 391 400
Note: See TracChangeset
for help on using the changeset viewer.