Plugin Directory

Changeset 3462312


Ignore:
Timestamp:
02/16/2026 08:53:02 AM (6 weeks ago)
Author:
enituretechnology
Message:

3.3.12 - 2026-02-16

  • Update: Introduced bulk delete functionality for warehouse and dropship locations to simplify location management.
  • Update: Added parent product checks to properly handle empty variant scenarios and prevent invalid processing.

Ticket 23708293437

Location:
ltl-freight-quotes-rl-edition
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ltl-freight-quotes-rl-edition/tags/3.3.12/logs/en-json-tree-view/en-jtv-style.css

    r2981057 r3462312  
    9797.en_jtv li.en_folder > div.en_key > span::before {
    9898  content: "\2212";
    99   opacity: 0.33;
    100   color: #111;
    101   background-color: #e0eaef;
     99  opacity: 1;
     100  color: #fff;
     101  background-color: black !important;
    102102  text-align: center;
    103103  display: inline-block;
     
    112112.en_jtv li.en_folder.en_folded > div.en_key > span::before {
    113113  content: "+";
     114  font-weight: bolder;
     115    background-color: black !important;
     116    color: #fff !important;
    114117}
    115118
  • ltl-freight-quotes-rl-edition/tags/3.3.12/ltl-freight-quotes-rnl-edition.php

    r3442253 r3462312  
    44 * Plugin URI:     https://eniture.com/products/
    55 * Description:    Dynamically retrieves your negotiated shipping rates from R+L Freight and displays the results in the WooCommerce shopping cart.
    6  * Version:        3.3.11
     6 * Version:        3.3.12
    77 * Author:         Eniture Technology
    88 * Author URI:     http://eniture.com/
  • ltl-freight-quotes-rl-edition/tags/3.3.12/readme.txt

    r3442253 r3462312  
    44Requires at least: 6.4
    55Tested up to: 6.9
    6 Stable tag: 3.3.11
     6Stable tag: 3.3.12
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    152152== Changelog ==
    153153
     154= 3.3.12 - 2026-02-16 =
     155* Update: Introduced **bulk delete functionality** for warehouse and dropship locations to simplify location management.
     156* Update: Added parent product checks to properly handle empty variant scenarios and prevent invalid processing.
     157
    154158= 3.3.11 - 2026-01-19 =
    155159* Update: Added a **caching mechanism** to efficiently handle multiple identical quote requests and reduce redundant API calls.
  • ltl-freight-quotes-rl-edition/tags/3.3.12/rnl-group-package.php

    r3391680 r3462312  
    149149            $locationId = 0;
    150150            (isset($values['variation_id']) && $values['variation_id'] > 0) ? $post_id = $values['variation_id'] : $post_id = $_product->get_id();
    151             $locations_list = $this->rnl_get_locations_list($post_id);
     151            $locations_list = $this->rnl_get_locations_list($post_id, $values);
    152152            $origin_address = $rnl_res_inst->rnl_multi_warehouse($locations_list, $rnl_zipcode);
    153153            $locationId = (isset($origin_address['id'])) ? $origin_address['id'] : $origin_address['locationId'];
     
    175175            if ($nested_material == "yes") {
    176176                $post_id = (isset($values['variation_id']) && $values['variation_id'] > 0) ? $values['variation_id'] : $_product->get_id();
    177                 $nestedPercentage = get_post_meta($post_id, '_nestedPercentage', true);
    178                 $nestedDimension = get_post_meta($post_id, '_nestedDimension', true);
    179                 $nestedItems = get_post_meta($post_id, '_maxNestedItems', true);
    180                 $StakingProperty = get_post_meta($post_id, '_nestedStakingProperty', true);
     177                $nestedPercentage = $this->get_property_value('_nestedPercentage', $values, $_product);
     178                $nestedDimension = $this->get_property_value('_nestedDimension', $values, $_product);
     179                $nestedItems = $this->get_property_value('_maxNestedItems', $values, $_product);
     180                $StakingProperty = $this->get_property_value('_nestedStakingProperty', $values, $_product);
    181181            }
    182182
     
    325325        }
    326326
    327         // Micro Warehouse
    328         $eniureLicenceKey = get_option('wc_settings_rnl_plugin_licence_key');
    329         $rnl_package = apply_filters('en_micro_warehouse', $rnl_package, $this->products, $this->dropship_location_array, $this->destination_Address_rnl, $this->origin, $smallPluginExist, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'rnl');
     327        if (!empty($this->dropship_location_array)) {
     328            // Micro Warehouse
     329            $eniureLicenceKey = get_option('wc_settings_rnl_plugin_licence_key');
     330            $rnl_package = apply_filters('en_micro_warehouse', $rnl_package, $this->products, $this->dropship_location_array, $this->destination_Address_rnl, $this->origin, $smallPluginExist, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'rnl');
     331        }
     332       
    330333        do_action("eniture_debug_mood", "Product Detail (rnl)", $rnl_package);
    331334        return $rnl_package;
     
    375378    {
    376379        $post_id = (isset($values['variation_id']) && $values['variation_id'] > 0) ? $values['variation_id'] : $_product->get_id();
    377         return get_post_meta($post_id, '_nestedMaterials', true);
     380        $en_nested_material = get_post_meta($post_id, '_nestedMaterials', true);
     381
     382        // check property in parent
     383        if (isset($values['variation_id']) && $values['variation_id'] > 0 && empty($en_nested_material)) {
     384            $post_id = isset($values['product_id']) ? $values['product_id'] : $_product->get_parent_id();
     385            $en_nested_material = get_post_meta($post_id, '_nestedMaterials', true);
     386        }
     387
     388        return $en_nested_material;
    378389    }
    379390
     
    399410     * @global $wpdb
    400411     */
    401     function rnl_get_locations_list($post_id)
     412    function rnl_get_locations_list($post_id, $values)
    402413    {
    403414        global $wpdb;
     
    405416        (isset($values['variation_id']) && $values['variation_id'] > 0) ? $post_id = $values['variation_id'] : $post_id;
    406417        $enable_dropship = get_post_meta($post_id, '_enable_dropship', true);
     418
     419        // Check dropship location in parent product also
     420        if (isset($values['variation_id']) && $values['variation_id'] > 0 && empty($enable_dropship)) {
     421            $post_id = isset($values['product_id']) ? $values['product_id'] : $post_id;
     422            $enable_dropship = get_post_meta($post_id, '_enable_dropship', true);
     423            $post_id = empty($enable_dropship) ? $values['variation_id'] : $post_id;
     424        }
     425
    407426        if ($enable_dropship == 'yes') {
    408427            $get_loc = get_post_meta($post_id, '_dropship_location', true);
     
    515534            $variation_class = get_post_meta($variation_id, '_ltl_freight_variation', true);
    516535
    517             if ($variation_class == 0) {
     536            if (empty($variation_class) || $variation_class == 0) {
    518537                $variation_class = get_post_meta($product_id, '_ltl_freight', true);
    519538                $freightClass_ltl_gross = $variation_class;
     
    524543                    $freightClass_ltl_gross = get_post_meta($_product->get_id(), '_ltl_freight', true);
    525544                }
     545            }
     546
     547            if (empty($hazardous_material)) {
     548                $hazardous_material = get_post_meta($product_id, '_hazardousmaterials', true);
    526549            }
    527550        } else {
     
    764787        return '';
    765788    }
     789
     790    function get_property_value($property_key, $values, $_product)
     791    {
     792        $post_id = (isset($values['variation_id']) && $values['variation_id'] > 0) ? $values['variation_id'] : $_product->get_id();
     793        $property_enabled = get_post_meta($post_id, $property_key, true);
     794
     795        // check property in parent
     796        if (isset($values['variation_id']) && $values['variation_id'] > 0 && empty($property_enabled)) {
     797            $post_id = isset($values['product_id']) ? $values['product_id'] : $_product->get_parent_id();
     798            $property_enabled = get_post_meta($post_id, $property_key, true);
     799        }
     800
     801        return $property_enabled;
     802    }
    766803}
  • ltl-freight-quotes-rl-edition/tags/3.3.12/rnl-shipping-class.php

    r3442253 r3462312  
    220220                           
    221221                            // Add backup rates in the shipping rates
    222                             if ((empty($response) && get_option('rnl_ltl_backup_rates_carrier_returns_error') == 'yes') || (!empty($response) && isset($response->backupRate) && get_option('rnl_ltl_backup_rates_carrier_fails_to_return_response') == 'yes')) {
     222                            $backup_rates_error = !empty($response) && isset($response->backupRate);
     223                            if ((empty($response) && get_option('rnl_ltl_backup_rates_carrier_returns_error') == 'yes') || ($backup_rates_error && get_option('rnl_ltl_backup_rates_carrier_fails_to_return_response') == 'yes')) {
    223224                                $this->rnl_backup_rates();
    224                                 $this->compile_and_add_ins_loc_del_rates();
    225 
    226                                 return [];
    227                             }
    228 
    229                             if (empty($response)) {
     225                            }
     226
     227                            if (empty($response) || $backup_rates_error) {
    230228                                $this->compile_and_add_ins_loc_del_rates();
    231229                                return [];
  • ltl-freight-quotes-rl-edition/tags/3.3.12/update-plan.php

    r3373534 r3462312  
    6363            $plan_type = isset($response['plan_type']) ? $response['plan_type'] : '';
    6464
    65             if ($response['pakg_price'] == '0') {
     65            if (isset($response['pakg_price']) && $response['pakg_price'] == '0') {
    6666                $plan = '0';
    6767            }
     
    113113        $plan_type = isset($response['plan_type']) ? $response['plan_type'] : '';
    114114
    115         if ($response['pakg_price'] == '0') {
     115        if (isset($response['pakg_price']) && $response['pakg_price'] == '0') {
    116116            $plan = '0';
    117117        }
  • ltl-freight-quotes-rl-edition/tags/3.3.12/warehouse-dropship/wild-delivery.php

    r3391680 r3462312  
    2222                ));
    2323
    24             wp_enqueue_script('rl_ltl_en_woo_wd_script', plugin_dir_url(__FILE__) . '/wild/assets/js/warehouse_section.js', array(), '1.0.9');
     24            wp_enqueue_script('rl_ltl_en_woo_wd_script', plugin_dir_url(__FILE__) . '/wild/assets/js/warehouse_section.js', array(), '1.1.0');
    2525            wp_localize_script('rl_ltl_en_woo_wd_script', 'rl_ltl_wd_script', array(
    2626                    'pluginsUrl' => plugins_url(),
     
    2828            ));
    2929
    30             wp_register_style('rl_ltl_warehouse_section', plugin_dir_url(__FILE__) . '/wild/assets/css/warehouse_section.css', false, '1.0.6');
     30            wp_register_style('rl_ltl_warehouse_section', plugin_dir_url(__FILE__) . '/wild/assets/css/warehouse_section.css', false, '1.0.7');
    3131            wp_enqueue_style('rl_ltl_warehouse_section');
    3232        }
     
    5858            $multi_warehouse = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_warehouse');
    5959
    60             if(is_array($multi_warehouse) && count($warehous_list) > 0)
    61             {
     60            if (is_array($multi_warehouse) && count($warehous_list) > 0) {
    6261                $add_space = "<br><br>";
    6362                $multi_warehouse_disabled = "wild_disabled_me"; 
     
    7069        <div class="add_btn_warehouse rnl_ltl_wrapper">
    7170
    72             <a href="#en_wd_add_warehouse_btn" onclick="en_wd_add_warehouse_btn()" title="Add Warehouse" class="en_wd_add_warehouse_btn <?php echo $multi_warehouse_disabled; ?>" name="avc">Add</a>
    73 
    74             <div class="wild_warehouse pakage_notify heading_right">
    75                 <?php echo $multi_warehouse_package_required; ?>
    76             </div>
    77 
    78         <br><?php echo $add_space; ?>
     71            <div style="display: flex; gap: 3px; align-items: center;">
     72                <a href="#en_wd_add_warehouse_btn" onclick="en_wd_add_warehouse_btn()" title="Add Warehouse" class="en_wd_add_warehouse_btn <?php echo $multi_warehouse_disabled; ?>" name="avc">Add</a>
     73                <a href="#" name="en_rnl_bulk_delete_warehouse" class="en_rnl_bulk_delete_warehouse en_wd_add_warehouse_btn" title="Delete Warehouses" onclick="return en_rnl_delete_bulk_locations(event, 'en_rnl_delete_warehouse_item', 'warehouse');">Delete</a>
     74
     75                <div class="wild_warehouse pakage_notify heading_right">
     76                    <?php echo $multi_warehouse_package_required; ?>
     77                </div>
     78            </div>
    7979
    8080        <div class="warehouse_text">
     
    9090            <p><strong>Success! Warehouse updated successfully.</strong></p>
    9191        </div>
     92        <div id="message" class="updated inline rnl_bulk_warehouse_deleted">
     93                <p><strong>Success!</strong> Selected warehouses deleted successfully.</p>
     94        </div>
     95        <div id="message" class="rnl_bulk_warehouse_delete_error">
     96            <p><strong>Error!</strong> Please select at least one warehouse to delete.</p>
     97        </div>
     98
    9299        <table class="en_wd_warehouse_list" id="append_warehouse">
    93100            <thead>
    94101                <tr>
     102                    <th class="en_wd_warehouse_list_heading en_rnl_bulk_delete_col">
     103                        <!-- Bulk delete -->
     104                        <input type="checkbox" name="en_rnl_bulk_delete_warehouses" id="en_rnl_bulk_delete_warehouses" onclick="return en_rnl_select_bulk_locations('en_rnl_delete_warehouse_item', this);" />
     105                    </th>
    95106                    <th class="en_wd_warehouse_list_heading">
    96107                        City
     
    117128                        ?>
    118129                        <tr class="<?php echo (strlen($tr_disabled_me) > 0 && $count != 0) ? $tr_disabled_me : ""; ?>" id="row_<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>" data-id="<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>">
     130                            <td class="en_wd_warehouse_list_data en_rnl_bulk_delete_col">
     131                                <input type="checkbox" class="en_rnl_delete_warehouse_item" value="<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>" onclick="return en_rnl_toggle_select_all_locations('en_rnl_delete_warehouse_item', 'en_rnl_bulk_delete_warehouses');">
     132                            </td>
    119133                            <td class="en_wd_warehouse_list_data">
    120134                                <?php echo ( isset($list->city) ) ? esc_attr($list->city) : ''; ?>
     
    179193            $multi_dropship = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_dropship');
    180194
    181             if(is_array($multi_dropship) && count($dropship_list) > 0)
    182             {
     195            if (is_array($multi_dropship) && count($dropship_list) > 0) {
    183196                $add_space = "<br><br>";
    184197                $multi_dropship_disabled = "wild_disabled_me"; 
     
    189202
    190203        <div class="add_btn_dropship rnl_ltl_wrapper">
    191             <a href="#add_dropship_btn" onclick="hide_drop_val()" title="Add Drop Ship" class="en_wd_add_dropship_btn hide_drop_val <?php echo $multi_dropship_disabled; ?>">Add</a>
    192 
    193             <div class="wild_warehouse pakage_notify heading_right">
    194                 <?php echo $multi_dropship_package_required; ?>
     204            <div style="display: flex; gap: 3px; align-items: center;">
     205                <a href="#add_dropship_btn" onclick="hide_drop_val()" title="Add Drop Ship" class="en_wd_add_dropship_btn hide_drop_val <?php echo $multi_dropship_disabled; ?>">Add</a>
     206                <a href="#" name="en_rnl_bulk_delete_dropship" class="en_rnl_bulk_delete_dropship en_wd_add_dropship_btn" title="Delete Drop Ships" onclick="en_rnl_delete_bulk_locations(event, 'en_rnl_delete_dropship_item', 'dropship');">Delete</a>
     207   
     208                <div class="wild_warehouse pakage_notify heading_right">
     209                    <?php echo $multi_dropship_package_required; ?>
     210                </div>
    195211            </div>
    196212           
    197         <br><?php echo $add_space; ?>
    198213        <div class="warehouse_text">
    199214            <p>Locations that inventory specific items that are drop shipped to the destination. Use the product's settings page to identify it as a drop shipped item and its associated drop ship location. Orders that include drop shipped items will display a single figure for the shipping rate estimate that is equal to the sum of the cheapest option of each shipment required to fulfill the order.</p>
     
    208223            <p><strong>Success! Drop ship deleted successfully.</strong></p>
    209224        </div>
     225        <div id="message" class="updated inline rnl_bulk_dropship_deleted">
     226            <p><strong>Success!</strong> Selected drop ships deleted successfully.</p>
     227        </div>
     228        <div id="message" class="rnl_bulk_dropship_delete_error">
     229            <p><strong>Error!</strong> Please select at least one drop ship to delete.</p>
     230        </div>
     231
    210232        <table class="en_wd_dropship_list" id="append_dropship">
    211233            <thead>
    212234                <tr>
     235                    <th class="en_wd_dropship_list_heading en_rnl_bulk_delete_col">
     236                        <!-- Bulk delete -->
     237                        <input type="checkbox" name="en_rnl_bulk_delete_dropships" id="en_rnl_bulk_delete_dropships" onclick="return en_rnl_select_bulk_locations('en_rnl_delete_dropship_item', this);" />
     238                    </th>
    213239                    <th class="en_wd_dropship_list_heading">
    214240                        Nickname
     
    238264                        ?>
    239265                        <tr class="<?php echo (strlen($tr_disabled_me) > 0 && $count != 0) ? $tr_disabled_me : ""; ?>" id="row_<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>">
     266                            <td class="en_wd_dropship_list_data en_rnl_bulk_delete_col">
     267                                <input type="checkbox" class="en_rnl_delete_dropship_item" value="<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>" onclick="return en_rnl_toggle_select_all_locations('en_rnl_delete_dropship_item', 'en_rnl_bulk_delete_dropships');">
     268                            </td>
    240269                            <td class="en_wd_dropship_list_data">
    241270                                <?php echo ( isset($list->nickname) ) ? esc_attr($list->nickname) : ''; ?>
  • ltl-freight-quotes-rl-edition/tags/3.3.12/warehouse-dropship/wild/assets/css/warehouse_section.css

    r3373534 r3462312  
    207207}
    208208
    209 .warehouse_deleted {
     209.warehouse_deleted,
     210.rnl_bulk_warehouse_deleted,
     211.rnl_bulk_warehouse_delete_error {
    210212    margin-top: 20px !important;
    211213    display: none;
     
    249251.wrng_credential,
    250252.wrng_instore,
    251 .wrng_local {
     253.wrng_local,
     254.rnl_bulk_warehouse_delete_error,
     255.rnl_bulk_dropship_delete_error {
    252256    background: #f1f1f1 none repeat scroll 0 0;
    253257    border-left: 4px solid #dc3232;
     
    344348}
    345349
    346 .dropship_deleted {
     350.dropship_deleted,
     351.rnl_bulk_dropship_deleted, .rnl_bulk_dropship_delete_error {
    347352    display: none;
    348353}
     
    624629    opacity: 0.5;
    625630}
     631
     632.en_rnl_bulk_delete_col {
     633    width: 38px;
     634    text-align: center;
     635}
     636
     637.rnl_bulk_warehouse_delete_error,
     638.rnl_bulk_dropship_delete_error {
     639    width: auto !important;
     640    background-color: #fff !important;
     641}
  • ltl-freight-quotes-rl-edition/tags/3.3.12/warehouse-dropship/wild/assets/js/warehouse_section.js

    r3391680 r3462312  
    725725    }
    726726}
     727
     728if (typeof en_rnl_select_bulk_locations != 'function') {
     729    function en_rnl_select_bulk_locations(location_class, e) {
     730        const checked = jQuery(e).is(':checked');
     731        jQuery(`.${location_class}`).prop('checked', checked);
     732    }
     733}
     734
     735if (typeof en_rnl_toggle_select_all_locations != 'function') {
     736    function en_rnl_toggle_select_all_locations(location_class, select_all_locations) {
     737        const allChecked = jQuery(`.${location_class}:checked`).length === jQuery(`.${location_class}`).length;
     738        jQuery(`#${select_all_locations}`).prop('checked', allChecked);
     739    }
     740}
     741
     742if (typeof en_rnl_delete_bulk_locations != 'function') {
     743    function en_rnl_delete_bulk_locations(e, location_class, location_type) {
     744        e.preventDefault();
     745        const location_ids = jQuery(`.${location_class}:checked`).map(function () {
     746            return this.value;
     747        }).get();
     748
     749        // Show error message if no locations are selected
     750        if (location_ids.length === 0) {
     751            const loc_error_class = `rnl_bulk_${location_type}_delete_error`;
     752            jQuery(`.${loc_error_class}`).show('slow').delay(3000).hide('slow');
     753            return;
     754        }
     755
     756        const postForm = {
     757            'action': 'rl_ltl_en_wd_bulk_delete_locations',
     758            'location_ids': location_ids,
     759            'location_type': location_type,
     760            'wp_nonce': rl_ltl_wd_script.nonce
     761        }
     762        const delete_locs_btn = `.en_rnl_bulk_delete_${location_type}`,
     763        loc_success_class = `.rnl_bulk_${location_type}_deleted`,
     764        loc_error_class = `.rnl_bulk_${location_type}_delete_error`;
     765       
     766        jQuery.ajax({
     767            type: 'POST',
     768            url: ajaxurl,
     769            data: postForm,
     770            dataType: 'json',
     771            beforeSend: function () {
     772                jQuery(delete_locs_btn).addClass('spinner_disable');
     773            },
     774            success: function (data) {
     775                if (data.error && data.message) {
     776                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     777                    jQuery(loc_error_class).show('slow').delay(3000).hide('slow');
     778                } else {
     779                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     780                    const loc_conatainer = location_type == 'warehouse' ? jQuery('.add_btn_warehouse') : jQuery('.add_btn_dropship');
     781                    jQuery(loc_conatainer).html(data.html);
     782                    jQuery(loc_success_class).show('slow').delay(3000).hide('slow');
     783                    jQuery('.warehouse_updated, .warehouse_created, .warehouse_deleted, .dropship_deleted, .dropship_updated, .dropship_created').css('display', 'none');
     784                }
     785            },
     786            error: function (error) {
     787                jQuery(delete_locs_btn).removeClass('spinner_disable');
     788                console.log(error);
     789            }
     790        });
     791    }
     792}
  • ltl-freight-quotes-rl-edition/tags/3.3.12/warehouse-dropship/wild/includes/wild-delivery-save.php

    r3373534 r3462312  
    4444            add_action('wp_ajax_nopriv_rl_ltl_en_wd_delete_dropship', array($this, 'delete_dropship_ajax'));
    4545            add_action('wp_ajax_rl_ltl_en_wd_delete_dropship', array($this, 'delete_dropship_ajax'));
     46
     47            add_action('wp_ajax_nopriv_rl_ltl_en_wd_bulk_delete_locations', array($this, 'delete_bulk_locations_ajax'));
     48            add_action('wp_ajax_rl_ltl_en_wd_bulk_delete_locations', array($this, 'delete_bulk_locations_ajax'));
    4649        }
    4750
     
    437440        }
    438441
     442        function delete_bulk_locations_ajax()
     443        {
     444            if (!(current_user_can('manage_options') || current_user_can('manage_woocommerce')) || !wp_verify_nonce($_POST['wp_nonce'], 'rl_ltl_en_woo_wd_nonce')) {
     445                echo wp_json_encode(array('error' => true, 'message' => 'Unauthorized Access'));
     446                exit;
     447            }
     448
     449            $location_ids = isset($_POST['location_ids']) ? $_POST['location_ids'] : array();
     450            $loc_type = isset($_POST['location_type']) ? $_POST['location_type'] : '';
     451            if (empty($location_ids)) {
     452                echo wp_json_encode(['error' => true, 'message' => "Please select at least one {$loc_type} to delete."]);
     453                exit;
     454            }
     455
     456            global $wpdb;
     457            foreach ($location_ids as $location_id) {
     458                if ($loc_type == 'dropship') {
     459                    $get_dropship_id = '';
     460                    $dropship_id = intval($location_id);
     461                    $get_dropship_array = array($dropship_id);
     462                    $ser = maybe_serialize($get_dropship_id);
     463                    $get_dropship_val = array_map('intval', $get_dropship_array);
     464                    $get_post_id = $wpdb->get_results("SELECT group_concat(post_id) as post_ids_list FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` = '_dropship_location' AND (`meta_value` LIKE '%" . $ser . "%' OR `meta_value` = '" . $dropship_id . "')");
     465                    $post_id = reset($get_post_id)->post_ids_list;
     466
     467                    if (isset($post_id)) {
     468                        $wpdb->query("UPDATE `" . $wpdb->prefix . "postmeta` SET `meta_value` = '' WHERE `meta_key` IN('_enable_dropship','_dropship_location')  AND `post_id` IN ($post_id)");
     469                    }
     470                }
     471
     472                $wpdb->delete($wpdb->prefix . "warehouse", array('id' => intval($location_id), 'location' => $loc_type));
     473            }
     474
     475            $html = $loc_type == 'warehouse' ?  warehouse_template(TRUE) : dropship_template(TRUE);
     476            echo wp_json_encode(['error' => false, 'message' => 'Locations deleted successfully.', 'html' => $html]);
     477            exit;
     478        }
    439479    }
    440480}
  • ltl-freight-quotes-rl-edition/trunk/logs/en-json-tree-view/en-jtv-style.css

    r2981057 r3462312  
    9797.en_jtv li.en_folder > div.en_key > span::before {
    9898  content: "\2212";
    99   opacity: 0.33;
    100   color: #111;
    101   background-color: #e0eaef;
     99  opacity: 1;
     100  color: #fff;
     101  background-color: black !important;
    102102  text-align: center;
    103103  display: inline-block;
     
    112112.en_jtv li.en_folder.en_folded > div.en_key > span::before {
    113113  content: "+";
     114  font-weight: bolder;
     115    background-color: black !important;
     116    color: #fff !important;
    114117}
    115118
  • ltl-freight-quotes-rl-edition/trunk/ltl-freight-quotes-rnl-edition.php

    r3442253 r3462312  
    44 * Plugin URI:     https://eniture.com/products/
    55 * Description:    Dynamically retrieves your negotiated shipping rates from R+L Freight and displays the results in the WooCommerce shopping cart.
    6  * Version:        3.3.11
     6 * Version:        3.3.12
    77 * Author:         Eniture Technology
    88 * Author URI:     http://eniture.com/
  • ltl-freight-quotes-rl-edition/trunk/readme.txt

    r3442253 r3462312  
    44Requires at least: 6.4
    55Tested up to: 6.9
    6 Stable tag: 3.3.11
     6Stable tag: 3.3.12
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    152152== Changelog ==
    153153
     154= 3.3.12 - 2026-02-16 =
     155* Update: Introduced **bulk delete functionality** for warehouse and dropship locations to simplify location management.
     156* Update: Added parent product checks to properly handle empty variant scenarios and prevent invalid processing.
     157
    154158= 3.3.11 - 2026-01-19 =
    155159* Update: Added a **caching mechanism** to efficiently handle multiple identical quote requests and reduce redundant API calls.
  • ltl-freight-quotes-rl-edition/trunk/rnl-group-package.php

    r3391680 r3462312  
    149149            $locationId = 0;
    150150            (isset($values['variation_id']) && $values['variation_id'] > 0) ? $post_id = $values['variation_id'] : $post_id = $_product->get_id();
    151             $locations_list = $this->rnl_get_locations_list($post_id);
     151            $locations_list = $this->rnl_get_locations_list($post_id, $values);
    152152            $origin_address = $rnl_res_inst->rnl_multi_warehouse($locations_list, $rnl_zipcode);
    153153            $locationId = (isset($origin_address['id'])) ? $origin_address['id'] : $origin_address['locationId'];
     
    175175            if ($nested_material == "yes") {
    176176                $post_id = (isset($values['variation_id']) && $values['variation_id'] > 0) ? $values['variation_id'] : $_product->get_id();
    177                 $nestedPercentage = get_post_meta($post_id, '_nestedPercentage', true);
    178                 $nestedDimension = get_post_meta($post_id, '_nestedDimension', true);
    179                 $nestedItems = get_post_meta($post_id, '_maxNestedItems', true);
    180                 $StakingProperty = get_post_meta($post_id, '_nestedStakingProperty', true);
     177                $nestedPercentage = $this->get_property_value('_nestedPercentage', $values, $_product);
     178                $nestedDimension = $this->get_property_value('_nestedDimension', $values, $_product);
     179                $nestedItems = $this->get_property_value('_maxNestedItems', $values, $_product);
     180                $StakingProperty = $this->get_property_value('_nestedStakingProperty', $values, $_product);
    181181            }
    182182
     
    325325        }
    326326
    327         // Micro Warehouse
    328         $eniureLicenceKey = get_option('wc_settings_rnl_plugin_licence_key');
    329         $rnl_package = apply_filters('en_micro_warehouse', $rnl_package, $this->products, $this->dropship_location_array, $this->destination_Address_rnl, $this->origin, $smallPluginExist, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'rnl');
     327        if (!empty($this->dropship_location_array)) {
     328            // Micro Warehouse
     329            $eniureLicenceKey = get_option('wc_settings_rnl_plugin_licence_key');
     330            $rnl_package = apply_filters('en_micro_warehouse', $rnl_package, $this->products, $this->dropship_location_array, $this->destination_Address_rnl, $this->origin, $smallPluginExist, $items, $items_shipment, $this->warehouse_products, $eniureLicenceKey, 'rnl');
     331        }
     332       
    330333        do_action("eniture_debug_mood", "Product Detail (rnl)", $rnl_package);
    331334        return $rnl_package;
     
    375378    {
    376379        $post_id = (isset($values['variation_id']) && $values['variation_id'] > 0) ? $values['variation_id'] : $_product->get_id();
    377         return get_post_meta($post_id, '_nestedMaterials', true);
     380        $en_nested_material = get_post_meta($post_id, '_nestedMaterials', true);
     381
     382        // check property in parent
     383        if (isset($values['variation_id']) && $values['variation_id'] > 0 && empty($en_nested_material)) {
     384            $post_id = isset($values['product_id']) ? $values['product_id'] : $_product->get_parent_id();
     385            $en_nested_material = get_post_meta($post_id, '_nestedMaterials', true);
     386        }
     387
     388        return $en_nested_material;
    378389    }
    379390
     
    399410     * @global $wpdb
    400411     */
    401     function rnl_get_locations_list($post_id)
     412    function rnl_get_locations_list($post_id, $values)
    402413    {
    403414        global $wpdb;
     
    405416        (isset($values['variation_id']) && $values['variation_id'] > 0) ? $post_id = $values['variation_id'] : $post_id;
    406417        $enable_dropship = get_post_meta($post_id, '_enable_dropship', true);
     418
     419        // Check dropship location in parent product also
     420        if (isset($values['variation_id']) && $values['variation_id'] > 0 && empty($enable_dropship)) {
     421            $post_id = isset($values['product_id']) ? $values['product_id'] : $post_id;
     422            $enable_dropship = get_post_meta($post_id, '_enable_dropship', true);
     423            $post_id = empty($enable_dropship) ? $values['variation_id'] : $post_id;
     424        }
     425
    407426        if ($enable_dropship == 'yes') {
    408427            $get_loc = get_post_meta($post_id, '_dropship_location', true);
     
    515534            $variation_class = get_post_meta($variation_id, '_ltl_freight_variation', true);
    516535
    517             if ($variation_class == 0) {
     536            if (empty($variation_class) || $variation_class == 0) {
    518537                $variation_class = get_post_meta($product_id, '_ltl_freight', true);
    519538                $freightClass_ltl_gross = $variation_class;
     
    524543                    $freightClass_ltl_gross = get_post_meta($_product->get_id(), '_ltl_freight', true);
    525544                }
     545            }
     546
     547            if (empty($hazardous_material)) {
     548                $hazardous_material = get_post_meta($product_id, '_hazardousmaterials', true);
    526549            }
    527550        } else {
     
    764787        return '';
    765788    }
     789
     790    function get_property_value($property_key, $values, $_product)
     791    {
     792        $post_id = (isset($values['variation_id']) && $values['variation_id'] > 0) ? $values['variation_id'] : $_product->get_id();
     793        $property_enabled = get_post_meta($post_id, $property_key, true);
     794
     795        // check property in parent
     796        if (isset($values['variation_id']) && $values['variation_id'] > 0 && empty($property_enabled)) {
     797            $post_id = isset($values['product_id']) ? $values['product_id'] : $_product->get_parent_id();
     798            $property_enabled = get_post_meta($post_id, $property_key, true);
     799        }
     800
     801        return $property_enabled;
     802    }
    766803}
  • ltl-freight-quotes-rl-edition/trunk/rnl-shipping-class.php

    r3442253 r3462312  
    220220                           
    221221                            // Add backup rates in the shipping rates
    222                             if ((empty($response) && get_option('rnl_ltl_backup_rates_carrier_returns_error') == 'yes') || (!empty($response) && isset($response->backupRate) && get_option('rnl_ltl_backup_rates_carrier_fails_to_return_response') == 'yes')) {
     222                            $backup_rates_error = !empty($response) && isset($response->backupRate);
     223                            if ((empty($response) && get_option('rnl_ltl_backup_rates_carrier_returns_error') == 'yes') || ($backup_rates_error && get_option('rnl_ltl_backup_rates_carrier_fails_to_return_response') == 'yes')) {
    223224                                $this->rnl_backup_rates();
    224                                 $this->compile_and_add_ins_loc_del_rates();
    225 
    226                                 return [];
    227                             }
    228 
    229                             if (empty($response)) {
     225                            }
     226
     227                            if (empty($response) || $backup_rates_error) {
    230228                                $this->compile_and_add_ins_loc_del_rates();
    231229                                return [];
  • ltl-freight-quotes-rl-edition/trunk/update-plan.php

    r3373534 r3462312  
    6363            $plan_type = isset($response['plan_type']) ? $response['plan_type'] : '';
    6464
    65             if ($response['pakg_price'] == '0') {
     65            if (isset($response['pakg_price']) && $response['pakg_price'] == '0') {
    6666                $plan = '0';
    6767            }
     
    113113        $plan_type = isset($response['plan_type']) ? $response['plan_type'] : '';
    114114
    115         if ($response['pakg_price'] == '0') {
     115        if (isset($response['pakg_price']) && $response['pakg_price'] == '0') {
    116116            $plan = '0';
    117117        }
  • ltl-freight-quotes-rl-edition/trunk/warehouse-dropship/wild-delivery.php

    r3391680 r3462312  
    2222                ));
    2323
    24             wp_enqueue_script('rl_ltl_en_woo_wd_script', plugin_dir_url(__FILE__) . '/wild/assets/js/warehouse_section.js', array(), '1.0.9');
     24            wp_enqueue_script('rl_ltl_en_woo_wd_script', plugin_dir_url(__FILE__) . '/wild/assets/js/warehouse_section.js', array(), '1.1.0');
    2525            wp_localize_script('rl_ltl_en_woo_wd_script', 'rl_ltl_wd_script', array(
    2626                    'pluginsUrl' => plugins_url(),
     
    2828            ));
    2929
    30             wp_register_style('rl_ltl_warehouse_section', plugin_dir_url(__FILE__) . '/wild/assets/css/warehouse_section.css', false, '1.0.6');
     30            wp_register_style('rl_ltl_warehouse_section', plugin_dir_url(__FILE__) . '/wild/assets/css/warehouse_section.css', false, '1.0.7');
    3131            wp_enqueue_style('rl_ltl_warehouse_section');
    3232        }
     
    5858            $multi_warehouse = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_warehouse');
    5959
    60             if(is_array($multi_warehouse) && count($warehous_list) > 0)
    61             {
     60            if (is_array($multi_warehouse) && count($warehous_list) > 0) {
    6261                $add_space = "<br><br>";
    6362                $multi_warehouse_disabled = "wild_disabled_me"; 
     
    7069        <div class="add_btn_warehouse rnl_ltl_wrapper">
    7170
    72             <a href="#en_wd_add_warehouse_btn" onclick="en_wd_add_warehouse_btn()" title="Add Warehouse" class="en_wd_add_warehouse_btn <?php echo $multi_warehouse_disabled; ?>" name="avc">Add</a>
    73 
    74             <div class="wild_warehouse pakage_notify heading_right">
    75                 <?php echo $multi_warehouse_package_required; ?>
    76             </div>
    77 
    78         <br><?php echo $add_space; ?>
     71            <div style="display: flex; gap: 3px; align-items: center;">
     72                <a href="#en_wd_add_warehouse_btn" onclick="en_wd_add_warehouse_btn()" title="Add Warehouse" class="en_wd_add_warehouse_btn <?php echo $multi_warehouse_disabled; ?>" name="avc">Add</a>
     73                <a href="#" name="en_rnl_bulk_delete_warehouse" class="en_rnl_bulk_delete_warehouse en_wd_add_warehouse_btn" title="Delete Warehouses" onclick="return en_rnl_delete_bulk_locations(event, 'en_rnl_delete_warehouse_item', 'warehouse');">Delete</a>
     74
     75                <div class="wild_warehouse pakage_notify heading_right">
     76                    <?php echo $multi_warehouse_package_required; ?>
     77                </div>
     78            </div>
    7979
    8080        <div class="warehouse_text">
     
    9090            <p><strong>Success! Warehouse updated successfully.</strong></p>
    9191        </div>
     92        <div id="message" class="updated inline rnl_bulk_warehouse_deleted">
     93                <p><strong>Success!</strong> Selected warehouses deleted successfully.</p>
     94        </div>
     95        <div id="message" class="rnl_bulk_warehouse_delete_error">
     96            <p><strong>Error!</strong> Please select at least one warehouse to delete.</p>
     97        </div>
     98
    9299        <table class="en_wd_warehouse_list" id="append_warehouse">
    93100            <thead>
    94101                <tr>
     102                    <th class="en_wd_warehouse_list_heading en_rnl_bulk_delete_col">
     103                        <!-- Bulk delete -->
     104                        <input type="checkbox" name="en_rnl_bulk_delete_warehouses" id="en_rnl_bulk_delete_warehouses" onclick="return en_rnl_select_bulk_locations('en_rnl_delete_warehouse_item', this);" />
     105                    </th>
    95106                    <th class="en_wd_warehouse_list_heading">
    96107                        City
     
    117128                        ?>
    118129                        <tr class="<?php echo (strlen($tr_disabled_me) > 0 && $count != 0) ? $tr_disabled_me : ""; ?>" id="row_<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>" data-id="<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>">
     130                            <td class="en_wd_warehouse_list_data en_rnl_bulk_delete_col">
     131                                <input type="checkbox" class="en_rnl_delete_warehouse_item" value="<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>" onclick="return en_rnl_toggle_select_all_locations('en_rnl_delete_warehouse_item', 'en_rnl_bulk_delete_warehouses');">
     132                            </td>
    119133                            <td class="en_wd_warehouse_list_data">
    120134                                <?php echo ( isset($list->city) ) ? esc_attr($list->city) : ''; ?>
     
    179193            $multi_dropship = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_dropship');
    180194
    181             if(is_array($multi_dropship) && count($dropship_list) > 0)
    182             {
     195            if (is_array($multi_dropship) && count($dropship_list) > 0) {
    183196                $add_space = "<br><br>";
    184197                $multi_dropship_disabled = "wild_disabled_me"; 
     
    189202
    190203        <div class="add_btn_dropship rnl_ltl_wrapper">
    191             <a href="#add_dropship_btn" onclick="hide_drop_val()" title="Add Drop Ship" class="en_wd_add_dropship_btn hide_drop_val <?php echo $multi_dropship_disabled; ?>">Add</a>
    192 
    193             <div class="wild_warehouse pakage_notify heading_right">
    194                 <?php echo $multi_dropship_package_required; ?>
     204            <div style="display: flex; gap: 3px; align-items: center;">
     205                <a href="#add_dropship_btn" onclick="hide_drop_val()" title="Add Drop Ship" class="en_wd_add_dropship_btn hide_drop_val <?php echo $multi_dropship_disabled; ?>">Add</a>
     206                <a href="#" name="en_rnl_bulk_delete_dropship" class="en_rnl_bulk_delete_dropship en_wd_add_dropship_btn" title="Delete Drop Ships" onclick="en_rnl_delete_bulk_locations(event, 'en_rnl_delete_dropship_item', 'dropship');">Delete</a>
     207   
     208                <div class="wild_warehouse pakage_notify heading_right">
     209                    <?php echo $multi_dropship_package_required; ?>
     210                </div>
    195211            </div>
    196212           
    197         <br><?php echo $add_space; ?>
    198213        <div class="warehouse_text">
    199214            <p>Locations that inventory specific items that are drop shipped to the destination. Use the product's settings page to identify it as a drop shipped item and its associated drop ship location. Orders that include drop shipped items will display a single figure for the shipping rate estimate that is equal to the sum of the cheapest option of each shipment required to fulfill the order.</p>
     
    208223            <p><strong>Success! Drop ship deleted successfully.</strong></p>
    209224        </div>
     225        <div id="message" class="updated inline rnl_bulk_dropship_deleted">
     226            <p><strong>Success!</strong> Selected drop ships deleted successfully.</p>
     227        </div>
     228        <div id="message" class="rnl_bulk_dropship_delete_error">
     229            <p><strong>Error!</strong> Please select at least one drop ship to delete.</p>
     230        </div>
     231
    210232        <table class="en_wd_dropship_list" id="append_dropship">
    211233            <thead>
    212234                <tr>
     235                    <th class="en_wd_dropship_list_heading en_rnl_bulk_delete_col">
     236                        <!-- Bulk delete -->
     237                        <input type="checkbox" name="en_rnl_bulk_delete_dropships" id="en_rnl_bulk_delete_dropships" onclick="return en_rnl_select_bulk_locations('en_rnl_delete_dropship_item', this);" />
     238                    </th>
    213239                    <th class="en_wd_dropship_list_heading">
    214240                        Nickname
     
    238264                        ?>
    239265                        <tr class="<?php echo (strlen($tr_disabled_me) > 0 && $count != 0) ? $tr_disabled_me : ""; ?>" id="row_<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>">
     266                            <td class="en_wd_dropship_list_data en_rnl_bulk_delete_col">
     267                                <input type="checkbox" class="en_rnl_delete_dropship_item" value="<?php echo ( isset($list->id) ) ? esc_attr($list->id) : ''; ?>" onclick="return en_rnl_toggle_select_all_locations('en_rnl_delete_dropship_item', 'en_rnl_bulk_delete_dropships');">
     268                            </td>
    240269                            <td class="en_wd_dropship_list_data">
    241270                                <?php echo ( isset($list->nickname) ) ? esc_attr($list->nickname) : ''; ?>
  • ltl-freight-quotes-rl-edition/trunk/warehouse-dropship/wild/assets/css/warehouse_section.css

    r3373534 r3462312  
    207207}
    208208
    209 .warehouse_deleted {
     209.warehouse_deleted,
     210.rnl_bulk_warehouse_deleted,
     211.rnl_bulk_warehouse_delete_error {
    210212    margin-top: 20px !important;
    211213    display: none;
     
    249251.wrng_credential,
    250252.wrng_instore,
    251 .wrng_local {
     253.wrng_local,
     254.rnl_bulk_warehouse_delete_error,
     255.rnl_bulk_dropship_delete_error {
    252256    background: #f1f1f1 none repeat scroll 0 0;
    253257    border-left: 4px solid #dc3232;
     
    344348}
    345349
    346 .dropship_deleted {
     350.dropship_deleted,
     351.rnl_bulk_dropship_deleted, .rnl_bulk_dropship_delete_error {
    347352    display: none;
    348353}
     
    624629    opacity: 0.5;
    625630}
     631
     632.en_rnl_bulk_delete_col {
     633    width: 38px;
     634    text-align: center;
     635}
     636
     637.rnl_bulk_warehouse_delete_error,
     638.rnl_bulk_dropship_delete_error {
     639    width: auto !important;
     640    background-color: #fff !important;
     641}
  • ltl-freight-quotes-rl-edition/trunk/warehouse-dropship/wild/assets/js/warehouse_section.js

    r3391680 r3462312  
    725725    }
    726726}
     727
     728if (typeof en_rnl_select_bulk_locations != 'function') {
     729    function en_rnl_select_bulk_locations(location_class, e) {
     730        const checked = jQuery(e).is(':checked');
     731        jQuery(`.${location_class}`).prop('checked', checked);
     732    }
     733}
     734
     735if (typeof en_rnl_toggle_select_all_locations != 'function') {
     736    function en_rnl_toggle_select_all_locations(location_class, select_all_locations) {
     737        const allChecked = jQuery(`.${location_class}:checked`).length === jQuery(`.${location_class}`).length;
     738        jQuery(`#${select_all_locations}`).prop('checked', allChecked);
     739    }
     740}
     741
     742if (typeof en_rnl_delete_bulk_locations != 'function') {
     743    function en_rnl_delete_bulk_locations(e, location_class, location_type) {
     744        e.preventDefault();
     745        const location_ids = jQuery(`.${location_class}:checked`).map(function () {
     746            return this.value;
     747        }).get();
     748
     749        // Show error message if no locations are selected
     750        if (location_ids.length === 0) {
     751            const loc_error_class = `rnl_bulk_${location_type}_delete_error`;
     752            jQuery(`.${loc_error_class}`).show('slow').delay(3000).hide('slow');
     753            return;
     754        }
     755
     756        const postForm = {
     757            'action': 'rl_ltl_en_wd_bulk_delete_locations',
     758            'location_ids': location_ids,
     759            'location_type': location_type,
     760            'wp_nonce': rl_ltl_wd_script.nonce
     761        }
     762        const delete_locs_btn = `.en_rnl_bulk_delete_${location_type}`,
     763        loc_success_class = `.rnl_bulk_${location_type}_deleted`,
     764        loc_error_class = `.rnl_bulk_${location_type}_delete_error`;
     765       
     766        jQuery.ajax({
     767            type: 'POST',
     768            url: ajaxurl,
     769            data: postForm,
     770            dataType: 'json',
     771            beforeSend: function () {
     772                jQuery(delete_locs_btn).addClass('spinner_disable');
     773            },
     774            success: function (data) {
     775                if (data.error && data.message) {
     776                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     777                    jQuery(loc_error_class).show('slow').delay(3000).hide('slow');
     778                } else {
     779                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     780                    const loc_conatainer = location_type == 'warehouse' ? jQuery('.add_btn_warehouse') : jQuery('.add_btn_dropship');
     781                    jQuery(loc_conatainer).html(data.html);
     782                    jQuery(loc_success_class).show('slow').delay(3000).hide('slow');
     783                    jQuery('.warehouse_updated, .warehouse_created, .warehouse_deleted, .dropship_deleted, .dropship_updated, .dropship_created').css('display', 'none');
     784                }
     785            },
     786            error: function (error) {
     787                jQuery(delete_locs_btn).removeClass('spinner_disable');
     788                console.log(error);
     789            }
     790        });
     791    }
     792}
  • ltl-freight-quotes-rl-edition/trunk/warehouse-dropship/wild/includes/wild-delivery-save.php

    r3373534 r3462312  
    4444            add_action('wp_ajax_nopriv_rl_ltl_en_wd_delete_dropship', array($this, 'delete_dropship_ajax'));
    4545            add_action('wp_ajax_rl_ltl_en_wd_delete_dropship', array($this, 'delete_dropship_ajax'));
     46
     47            add_action('wp_ajax_nopriv_rl_ltl_en_wd_bulk_delete_locations', array($this, 'delete_bulk_locations_ajax'));
     48            add_action('wp_ajax_rl_ltl_en_wd_bulk_delete_locations', array($this, 'delete_bulk_locations_ajax'));
    4649        }
    4750
     
    437440        }
    438441
     442        function delete_bulk_locations_ajax()
     443        {
     444            if (!(current_user_can('manage_options') || current_user_can('manage_woocommerce')) || !wp_verify_nonce($_POST['wp_nonce'], 'rl_ltl_en_woo_wd_nonce')) {
     445                echo wp_json_encode(array('error' => true, 'message' => 'Unauthorized Access'));
     446                exit;
     447            }
     448
     449            $location_ids = isset($_POST['location_ids']) ? $_POST['location_ids'] : array();
     450            $loc_type = isset($_POST['location_type']) ? $_POST['location_type'] : '';
     451            if (empty($location_ids)) {
     452                echo wp_json_encode(['error' => true, 'message' => "Please select at least one {$loc_type} to delete."]);
     453                exit;
     454            }
     455
     456            global $wpdb;
     457            foreach ($location_ids as $location_id) {
     458                if ($loc_type == 'dropship') {
     459                    $get_dropship_id = '';
     460                    $dropship_id = intval($location_id);
     461                    $get_dropship_array = array($dropship_id);
     462                    $ser = maybe_serialize($get_dropship_id);
     463                    $get_dropship_val = array_map('intval', $get_dropship_array);
     464                    $get_post_id = $wpdb->get_results("SELECT group_concat(post_id) as post_ids_list FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` = '_dropship_location' AND (`meta_value` LIKE '%" . $ser . "%' OR `meta_value` = '" . $dropship_id . "')");
     465                    $post_id = reset($get_post_id)->post_ids_list;
     466
     467                    if (isset($post_id)) {
     468                        $wpdb->query("UPDATE `" . $wpdb->prefix . "postmeta` SET `meta_value` = '' WHERE `meta_key` IN('_enable_dropship','_dropship_location')  AND `post_id` IN ($post_id)");
     469                    }
     470                }
     471
     472                $wpdb->delete($wpdb->prefix . "warehouse", array('id' => intval($location_id), 'location' => $loc_type));
     473            }
     474
     475            $html = $loc_type == 'warehouse' ?  warehouse_template(TRUE) : dropship_template(TRUE);
     476            echo wp_json_encode(['error' => false, 'message' => 'Locations deleted successfully.', 'html' => $html]);
     477            exit;
     478        }
    439479    }
    440480}
Note: See TracChangeset for help on using the changeset viewer.