Plugin Directory

Changeset 3469958


Ignore:
Timestamp:
02/26/2026 07:25:23 AM (5 weeks ago)
Author:
enituretechnology
Message:

4.5.29 - 2026-02-26

  • Update: Added product-level offset days functionality to allow more granular shipment timing control.
  • Update: Added Quote Information Preference setting to control whether quote information is recorded and displayed in the Additional Order Details widget.
  • Fix: Corrected product tags, categories, and brands array merging to ensure accurate filtering and processing.

Ticket 23708293437, 40343186872, 42170143668

Location:
small-package-quotes-ups-edition
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • small-package-quotes-ups-edition/tags/4.5.29/css/ups-small-style.css

    r3377935 r3469958  
    456456}
    457457
    458 tr.service_ups_small_estimates_title_tr th {
    459     font-size: 1.2em;
    460 }
    461 
    462458.ups_small_cutOffTime_shipDateOffset th {
    463459    font-weight: 400;
     
    552548.woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"],
    553549.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     550.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    554551.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    555552.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
     
    575572.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
    576573.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     574.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    577575.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    578576.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"],
     
    584582.woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip,
    585583.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,
    586585.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip,
    587586.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  
    550550    }
    551551
    552 
    553552    jQuery('.ups_small_quote_section .button-primary, .ups_small_quote_section .is-primary').on('click', function (e) {
    554553        jQuery(".updated").hide();
    555554        jQuery('.error').remove();
     555        jQuery(':checkbox:disabled').prop('disabled', false);
    556556
    557557        if (!en_ups_small_handling_fee_validation()) {
     
    570570        if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays < 1) {
    571571
    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 than 1.</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>');
    573573            jQuery('html, body').animate({
    574574                'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top
     
    577577            return false
    578578        }
    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>');
    582582            jQuery('html, body').animate({
    583583                'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top
     
    591591        if (ups_small_shipmentOffsetDays != "" && !numberOnlyRegex.test(ups_small_shipmentOffsetDays)) {
    592592
    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>');
    594594            jQuery('html, body').animate({
    595595                'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top
     
    608608        });
    609609
    610 
    611610        let ups_small_quotes_markup_right_markup = jQuery('.ups_small_quotes_markup_right_markup');
    612611        jQuery(ups_small_quotes_markup_right_markup).each(function () {
     
    617616            }
    618617        });
    619 
    620618
    621619        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  
    119119                    $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : '';
    120120                    $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                   
    123130                    update_post_meta($postId, $custom_field, $en_updated_product);
    124131                }
    125132            }
     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);
    126145        }
    127146
     
    179198                ],
    180199                [
     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                [
    181217                    'type' => 'checkbox',
    182218                    'id' => '_hazardousmaterials',
     
    298334            }
    299335
     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
    300346            woocommerce_wp_text_input($custom_input_field);
    301347        }
  • small-package-quotes-ups-edition/tags/4.5.29/readme.txt

    r3442520 r3469958  
    44Requires at least: 6.6
    55Tested up to: 6.9
    6 Stable tag: 4.5.28
     6Stable tag: 4.5.29
    77License:           GPL-2.0-or-later
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    142142
    143143== 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.
    144149
    145150= 4.5.28 - 2026-01-19 =
  • small-package-quotes-ups-edition/tags/4.5.29/small-package-quotes-ups-edition.php

    r3442520 r3469958  
    44 * Plugin URI:     https://eniture.com/products/
    55 * Description:    Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart.
    6  * Version:        4.5.28
     6 * Version:        4.5.29
    77 * Author:         Eniture Technology
    88 * Author URI:     http://eniture.com/
     
    186186    {
    187187
    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');
    189189        wp_enqueue_style('eniture_ups_small_style');
    190190    }
     
    223223    {
    224224        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');
    226226        wp_localize_script('eniture_ups_small_script', 'eniture_ups_small_admin_script', array(
    227227            'plugins_url' => plugins_url(),
  • small-package-quotes-ups-edition/tags/4.5.29/template/quote-settings.php

    r3377935 r3469958  
    812812            ),
    813813
     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
    814825            // Package rating method when Standard Box Sizes isn't in use
    815826            'ups_small_packaging_method_label' => array(
     
    830841                'name' => __('Delivery Estimate Options ', 'small-package-quotes-ups-edition'),
    831842                'type' => 'text',
    832                 'desc' => '',
    833843                'id' => 'service_ups_small_estimates_title'
    834844            ),
     
    874884            ),
    875885            'shipmentOffsetDays_ups_small' => array(
    876                 'name' => __('Fulfilment 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' => 'Fulfilment 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',
    880890                'id' => 'ups_small_shipmentOffsetDays',
    881891                'class' => $disable_ups_small_cutOffTime_shipDateOffset,
  • small-package-quotes-ups-edition/tags/4.5.29/ups-small-carrier-service.php

    r3430547 r3469958  
    152152                $shipmentWeekDays = $this->ups_small_shipment_week_days();
    153153                if ($ups_small_delivery_estimates == 'delivery_days' || $ups_small_delivery_estimates == 'delivery_date') {
    154 
    155154                    $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
    157163                    $modifyShipmentDateTime = ($orderCutoffTime != '' || $shipmentOffsetDays != '' || (is_array($shipmentWeekDays) && count($shipmentWeekDays) > 0)) ? 1 : 0;
    158164                    $storeDateTime = gmdate('Y-m-d H:i:s', current_time('timestamp'));
     
    393399
    394400        if (get_option('all_shipment_days_ups_small') == 'yes') {
    395             return $shipment_days_of_week;
     401            return array('1', '2', '3', '4', '5');
    396402        }
    397403        if (get_option('monday_shipment_day_ups_small') == 'yes') {
     
    13371343        $cachable_data['ups_small_pkg_resid_pickup'] = isset($request_data['ups_small_pkg_resid_pickup']) ? $request_data['ups_small_pkg_resid_pickup'] : '';
    13381344        $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'];
    13391348        $cachable_data['hazardousItems'] = isset($request_data['hazardousItems']) ? $request_data['hazardousItems'] : '';
    13401349        $cachable_data['includeInsuranceValue'] = isset($request_data['includeInsuranceValue']) ? $request_data['includeInsuranceValue'] : '';
     
    13461355            $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : '';
    13471356            $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType'];
     1357            $cachable_data['defaultRADWithoutStreetAddress'] = $request_data['defaultRADWithoutStreetAddress'];
    13481358            $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation'];
    13491359        }
  • small-package-quotes-ups-edition/tags/4.5.29/ups-small-group-package.php

    r3442520 r3469958  
    206206
    207207                $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']);
    208209
    209210                $locationId = (isset($origin_address['locationId'])) ? $origin_address['locationId'] : '';
     
    295296                        'ship_item_alone' => $ship_item_alone,
    296297
    297                         'markup' => $product_level_markup
     298                        'markup' => $product_level_markup,
     299                        'fulfillment_offset_days' => $product_level_fulfillment_offset,
    298300                    ];
    299301
     
    378380                        $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'] : [];
    379381                    }
     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                    }
    380389                }
    381390
     
    421430            }
    422431
    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           
    426438            return $ups_small_package;
    427439        }
     
    602614            $post_id = isset($values['product_id']) ? $values['product_id'] : $post_id;
    603615            $enable_dropship = get_post_meta($post_id, '_enable_dropship', true);
     616            $post_id = empty($enable_dropship) ? $values['variation_id'] : $post_id;
    604617        }
    605618
     
    905918            $formatted_values['price'] += floatval($pkg['product_prices']);
    906919            $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            }
    910929        }
    911930
     
    14551474        return $property_enabled;
    14561475    }
     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    }
    14571508}
  • small-package-quotes-ups-edition/tags/4.5.29/ups-small-shipping-class.php

    r3430547 r3469958  
    150150
    151151                $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();
    153153                $get_packg_obj = new Eniture_UPS_Small_Shipping_Get_Package();
    154154                $ups_small_res_inst = new Eniture_UPS_Get_Shipping_Quotes();
     
    312312
    313313                    // 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')) {
    315316                        $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) {
    321321                    // Eniture debug mode
    322322                    do_action("eniture_debug_mood", "UPS Small Quotes not returned", $this->en_not_returned_the_quotes ? 'Yes' : 'No');
     
    346346                $image_urls = apply_filters('en_fdo_image_urls_merge', []);
    347347                $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');
    348350
    349351                do_action("eniture_debug_mood", "Ups Small Eniture Quotes Rates", $en_rates);
     
    370372                        $label_sufex = array_intersect_key($accessorials, array_flip($rate['label_sufex']));
    371373                        $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                        }
    372378
    373379                        // Order widget detail set
     
    388394                        $rate['meta_data']['en_fdo_image_urls'] = wp_json_encode($image_urls);
    389395
     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']);
    390399                    }
    391400
  • small-package-quotes-ups-edition/trunk/css/ups-small-style.css

    r3377935 r3469958  
    456456}
    457457
    458 tr.service_ups_small_estimates_title_tr th {
    459     font-size: 1.2em;
    460 }
    461 
    462458.ups_small_cutOffTime_shipDateOffset th {
    463459    font-weight: 400;
     
    552548.woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"],
    553549.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     550.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    554551.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    555552.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
     
    575572.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
    576573.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     574.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    577575.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    578576.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"],
     
    584582.woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip,
    585583.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,
    586585.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip,
    587586.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  
    550550    }
    551551
    552 
    553552    jQuery('.ups_small_quote_section .button-primary, .ups_small_quote_section .is-primary').on('click', function (e) {
    554553        jQuery(".updated").hide();
    555554        jQuery('.error').remove();
     555        jQuery(':checkbox:disabled').prop('disabled', false);
    556556
    557557        if (!en_ups_small_handling_fee_validation()) {
     
    570570        if (ups_small_shipmentOffsetDays != "" && ups_small_shipmentOffsetDays < 1) {
    571571
    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 than 1.</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>');
    573573            jQuery('html, body').animate({
    574574                'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top
     
    577577            return false
    578578        }
    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>');
    582582            jQuery('html, body').animate({
    583583                'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top
     
    591591        if (ups_small_shipmentOffsetDays != "" && !numberOnlyRegex.test(ups_small_shipmentOffsetDays)) {
    592592
    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>');
    594594            jQuery('html, body').animate({
    595595                'scrollTop': jQuery('.ups_small_orderCutoffTime_error').position().top
     
    608608        });
    609609
    610 
    611610        let ups_small_quotes_markup_right_markup = jQuery('.ups_small_quotes_markup_right_markup');
    612611        jQuery(ups_small_quotes_markup_right_markup).each(function () {
     
    617616            }
    618617        });
    619 
    620618
    621619        var num_of_checkboxes = jQuery('.ups_small_quotes_services:checked').length;
  • small-package-quotes-ups-edition/trunk/product/en-product-detail.php

    r3377935 r3469958  
    119119                    $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : '';
    120120                    $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                   
    123130                    update_post_meta($postId, $custom_field, $en_updated_product);
    124131                }
    125132            }
     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);
    126145        }
    127146
     
    179198                ],
    180199                [
     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                [
    181217                    'type' => 'checkbox',
    182218                    'id' => '_hazardousmaterials',
     
    298334            }
    299335
     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
    300346            woocommerce_wp_text_input($custom_input_field);
    301347        }
  • small-package-quotes-ups-edition/trunk/readme.txt

    r3442520 r3469958  
    44Requires at least: 6.6
    55Tested up to: 6.9
    6 Stable tag: 4.5.28
     6Stable tag: 4.5.29
    77License:           GPL-2.0-or-later
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    142142
    143143== 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.
    144149
    145150= 4.5.28 - 2026-01-19 =
  • small-package-quotes-ups-edition/trunk/small-package-quotes-ups-edition.php

    r3442520 r3469958  
    44 * Plugin URI:     https://eniture.com/products/
    55 * Description:    Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart.
    6  * Version:        4.5.28
     6 * Version:        4.5.29
    77 * Author:         Eniture Technology
    88 * Author URI:     http://eniture.com/
     
    186186    {
    187187
    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');
    189189        wp_enqueue_style('eniture_ups_small_style');
    190190    }
     
    223223    {
    224224        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');
    226226        wp_localize_script('eniture_ups_small_script', 'eniture_ups_small_admin_script', array(
    227227            'plugins_url' => plugins_url(),
  • small-package-quotes-ups-edition/trunk/template/quote-settings.php

    r3377935 r3469958  
    812812            ),
    813813
     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
    814825            // Package rating method when Standard Box Sizes isn't in use
    815826            'ups_small_packaging_method_label' => array(
     
    830841                'name' => __('Delivery Estimate Options ', 'small-package-quotes-ups-edition'),
    831842                'type' => 'text',
    832                 'desc' => '',
    833843                'id' => 'service_ups_small_estimates_title'
    834844            ),
     
    874884            ),
    875885            'shipmentOffsetDays_ups_small' => array(
    876                 'name' => __('Fulfilment 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' => 'Fulfilment 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',
    880890                'id' => 'ups_small_shipmentOffsetDays',
    881891                'class' => $disable_ups_small_cutOffTime_shipDateOffset,
  • small-package-quotes-ups-edition/trunk/ups-small-carrier-service.php

    r3430547 r3469958  
    152152                $shipmentWeekDays = $this->ups_small_shipment_week_days();
    153153                if ($ups_small_delivery_estimates == 'delivery_days' || $ups_small_delivery_estimates == 'delivery_date') {
    154 
    155154                    $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
    157163                    $modifyShipmentDateTime = ($orderCutoffTime != '' || $shipmentOffsetDays != '' || (is_array($shipmentWeekDays) && count($shipmentWeekDays) > 0)) ? 1 : 0;
    158164                    $storeDateTime = gmdate('Y-m-d H:i:s', current_time('timestamp'));
     
    393399
    394400        if (get_option('all_shipment_days_ups_small') == 'yes') {
    395             return $shipment_days_of_week;
     401            return array('1', '2', '3', '4', '5');
    396402        }
    397403        if (get_option('monday_shipment_day_ups_small') == 'yes') {
     
    13371343        $cachable_data['ups_small_pkg_resid_pickup'] = isset($request_data['ups_small_pkg_resid_pickup']) ? $request_data['ups_small_pkg_resid_pickup'] : '';
    13381344        $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'];
    13391348        $cachable_data['hazardousItems'] = isset($request_data['hazardousItems']) ? $request_data['hazardousItems'] : '';
    13401349        $cachable_data['includeInsuranceValue'] = isset($request_data['includeInsuranceValue']) ? $request_data['includeInsuranceValue'] : '';
     
    13461355            $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : '';
    13471356            $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType'];
     1357            $cachable_data['defaultRADWithoutStreetAddress'] = $request_data['defaultRADWithoutStreetAddress'];
    13481358            $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation'];
    13491359        }
  • small-package-quotes-ups-edition/trunk/ups-small-group-package.php

    r3442520 r3469958  
    206206
    207207                $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']);
    208209
    209210                $locationId = (isset($origin_address['locationId'])) ? $origin_address['locationId'] : '';
     
    295296                        'ship_item_alone' => $ship_item_alone,
    296297
    297                         'markup' => $product_level_markup
     298                        'markup' => $product_level_markup,
     299                        'fulfillment_offset_days' => $product_level_fulfillment_offset,
    298300                    ];
    299301
     
    378380                        $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'] : [];
    379381                    }
     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                    }
    380389                }
    381390
     
    421430            }
    422431
    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           
    426438            return $ups_small_package;
    427439        }
     
    602614            $post_id = isset($values['product_id']) ? $values['product_id'] : $post_id;
    603615            $enable_dropship = get_post_meta($post_id, '_enable_dropship', true);
     616            $post_id = empty($enable_dropship) ? $values['variation_id'] : $post_id;
    604617        }
    605618
     
    905918            $formatted_values['price'] += floatval($pkg['product_prices']);
    906919            $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            }
    910929        }
    911930
     
    14551474        return $property_enabled;
    14561475    }
     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    }
    14571508}
  • small-package-quotes-ups-edition/trunk/ups-small-shipping-class.php

    r3430547 r3469958  
    150150
    151151                $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();
    153153                $get_packg_obj = new Eniture_UPS_Small_Shipping_Get_Package();
    154154                $ups_small_res_inst = new Eniture_UPS_Get_Shipping_Quotes();
     
    312312
    313313                    // 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')) {
    315316                        $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) {
    321321                    // Eniture debug mode
    322322                    do_action("eniture_debug_mood", "UPS Small Quotes not returned", $this->en_not_returned_the_quotes ? 'Yes' : 'No');
     
    346346                $image_urls = apply_filters('en_fdo_image_urls_merge', []);
    347347                $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');
    348350
    349351                do_action("eniture_debug_mood", "Ups Small Eniture Quotes Rates", $en_rates);
     
    370372                        $label_sufex = array_intersect_key($accessorials, array_flip($rate['label_sufex']));
    371373                        $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                        }
    372378
    373379                        // Order widget detail set
     
    388394                        $rate['meta_data']['en_fdo_image_urls'] = wp_json_encode($image_urls);
    389395
     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']);
    390399                    }
    391400
Note: See TracChangeset for help on using the changeset viewer.