Changeset 3462312
- Timestamp:
- 02/16/2026 08:53:02 AM (6 weeks ago)
- Location:
- ltl-freight-quotes-rl-edition
- Files:
-
- 20 edited
- 1 copied
-
tags/3.3.12 (copied) (copied from ltl-freight-quotes-rl-edition/trunk)
-
tags/3.3.12/logs/en-json-tree-view/en-jtv-style.css (modified) (2 diffs)
-
tags/3.3.12/ltl-freight-quotes-rnl-edition.php (modified) (1 diff)
-
tags/3.3.12/readme.txt (modified) (2 diffs)
-
tags/3.3.12/rnl-group-package.php (modified) (9 diffs)
-
tags/3.3.12/rnl-shipping-class.php (modified) (1 diff)
-
tags/3.3.12/update-plan.php (modified) (2 diffs)
-
tags/3.3.12/warehouse-dropship/wild-delivery.php (modified) (10 diffs)
-
tags/3.3.12/warehouse-dropship/wild/assets/css/warehouse_section.css (modified) (4 diffs)
-
tags/3.3.12/warehouse-dropship/wild/assets/js/warehouse_section.js (modified) (1 diff)
-
tags/3.3.12/warehouse-dropship/wild/includes/wild-delivery-save.php (modified) (2 diffs)
-
trunk/logs/en-json-tree-view/en-jtv-style.css (modified) (2 diffs)
-
trunk/ltl-freight-quotes-rnl-edition.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/rnl-group-package.php (modified) (9 diffs)
-
trunk/rnl-shipping-class.php (modified) (1 diff)
-
trunk/update-plan.php (modified) (2 diffs)
-
trunk/warehouse-dropship/wild-delivery.php (modified) (10 diffs)
-
trunk/warehouse-dropship/wild/assets/css/warehouse_section.css (modified) (4 diffs)
-
trunk/warehouse-dropship/wild/assets/js/warehouse_section.js (modified) (1 diff)
-
trunk/warehouse-dropship/wild/includes/wild-delivery-save.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ltl-freight-quotes-rl-edition/tags/3.3.12/logs/en-json-tree-view/en-jtv-style.css
r2981057 r3462312 97 97 .en_jtv li.en_folder > div.en_key > span::before { 98 98 content: "\2212"; 99 opacity: 0.33;100 color: # 111;101 background-color: #e0eaef;99 opacity: 1; 100 color: #fff; 101 background-color: black !important; 102 102 text-align: center; 103 103 display: inline-block; … … 112 112 .en_jtv li.en_folder.en_folded > div.en_key > span::before { 113 113 content: "+"; 114 font-weight: bolder; 115 background-color: black !important; 116 color: #fff !important; 114 117 } 115 118 -
ltl-freight-quotes-rl-edition/tags/3.3.12/ltl-freight-quotes-rnl-edition.php
r3442253 r3462312 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from R+L Freight and displays the results in the WooCommerce shopping cart. 6 * Version: 3.3.1 16 * Version: 3.3.12 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ -
ltl-freight-quotes-rl-edition/tags/3.3.12/readme.txt
r3442253 r3462312 4 4 Requires at least: 6.4 5 5 Tested up to: 6.9 6 Stable tag: 3.3.1 16 Stable tag: 3.3.12 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 152 152 == Changelog == 153 153 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 154 158 = 3.3.11 - 2026-01-19 = 155 159 * 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 149 149 $locationId = 0; 150 150 (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); 152 152 $origin_address = $rnl_res_inst->rnl_multi_warehouse($locations_list, $rnl_zipcode); 153 153 $locationId = (isset($origin_address['id'])) ? $origin_address['id'] : $origin_address['locationId']; … … 175 175 if ($nested_material == "yes") { 176 176 $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); 181 181 } 182 182 … … 325 325 } 326 326 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 330 333 do_action("eniture_debug_mood", "Product Detail (rnl)", $rnl_package); 331 334 return $rnl_package; … … 375 378 { 376 379 $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; 378 389 } 379 390 … … 399 410 * @global $wpdb 400 411 */ 401 function rnl_get_locations_list($post_id )412 function rnl_get_locations_list($post_id, $values) 402 413 { 403 414 global $wpdb; … … 405 416 (isset($values['variation_id']) && $values['variation_id'] > 0) ? $post_id = $values['variation_id'] : $post_id; 406 417 $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 407 426 if ($enable_dropship == 'yes') { 408 427 $get_loc = get_post_meta($post_id, '_dropship_location', true); … … 515 534 $variation_class = get_post_meta($variation_id, '_ltl_freight_variation', true); 516 535 517 if ( $variation_class == 0) {536 if (empty($variation_class) || $variation_class == 0) { 518 537 $variation_class = get_post_meta($product_id, '_ltl_freight', true); 519 538 $freightClass_ltl_gross = $variation_class; … … 524 543 $freightClass_ltl_gross = get_post_meta($_product->get_id(), '_ltl_freight', true); 525 544 } 545 } 546 547 if (empty($hazardous_material)) { 548 $hazardous_material = get_post_meta($product_id, '_hazardousmaterials', true); 526 549 } 527 550 } else { … … 764 787 return ''; 765 788 } 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 } 766 803 } -
ltl-freight-quotes-rl-edition/tags/3.3.12/rnl-shipping-class.php
r3442253 r3462312 220 220 221 221 // 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')) { 223 224 $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) { 230 228 $this->compile_and_add_ins_loc_del_rates(); 231 229 return []; -
ltl-freight-quotes-rl-edition/tags/3.3.12/update-plan.php
r3373534 r3462312 63 63 $plan_type = isset($response['plan_type']) ? $response['plan_type'] : ''; 64 64 65 if ( $response['pakg_price'] == '0') {65 if (isset($response['pakg_price']) && $response['pakg_price'] == '0') { 66 66 $plan = '0'; 67 67 } … … 113 113 $plan_type = isset($response['plan_type']) ? $response['plan_type'] : ''; 114 114 115 if ( $response['pakg_price'] == '0') {115 if (isset($response['pakg_price']) && $response['pakg_price'] == '0') { 116 116 $plan = '0'; 117 117 } -
ltl-freight-quotes-rl-edition/tags/3.3.12/warehouse-dropship/wild-delivery.php
r3391680 r3462312 22 22 )); 23 23 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'); 25 25 wp_localize_script('rl_ltl_en_woo_wd_script', 'rl_ltl_wd_script', array( 26 26 'pluginsUrl' => plugins_url(), … … 28 28 )); 29 29 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'); 31 31 wp_enqueue_style('rl_ltl_warehouse_section'); 32 32 } … … 58 58 $multi_warehouse = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_warehouse'); 59 59 60 if(is_array($multi_warehouse) && count($warehous_list) > 0) 61 { 60 if (is_array($multi_warehouse) && count($warehous_list) > 0) { 62 61 $add_space = "<br><br>"; 63 62 $multi_warehouse_disabled = "wild_disabled_me"; … … 70 69 <div class="add_btn_warehouse rnl_ltl_wrapper"> 71 70 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> 79 79 80 80 <div class="warehouse_text"> … … 90 90 <p><strong>Success! Warehouse updated successfully.</strong></p> 91 91 </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 92 99 <table class="en_wd_warehouse_list" id="append_warehouse"> 93 100 <thead> 94 101 <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> 95 106 <th class="en_wd_warehouse_list_heading"> 96 107 City … … 117 128 ?> 118 129 <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> 119 133 <td class="en_wd_warehouse_list_data"> 120 134 <?php echo ( isset($list->city) ) ? esc_attr($list->city) : ''; ?> … … 179 193 $multi_dropship = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_dropship'); 180 194 181 if(is_array($multi_dropship) && count($dropship_list) > 0) 182 { 195 if (is_array($multi_dropship) && count($dropship_list) > 0) { 183 196 $add_space = "<br><br>"; 184 197 $multi_dropship_disabled = "wild_disabled_me"; … … 189 202 190 203 <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> 195 211 </div> 196 212 197 <br><?php echo $add_space; ?>198 213 <div class="warehouse_text"> 199 214 <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> … … 208 223 <p><strong>Success! Drop ship deleted successfully.</strong></p> 209 224 </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 210 232 <table class="en_wd_dropship_list" id="append_dropship"> 211 233 <thead> 212 234 <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> 213 239 <th class="en_wd_dropship_list_heading"> 214 240 Nickname … … 238 264 ?> 239 265 <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> 240 269 <td class="en_wd_dropship_list_data"> 241 270 <?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 207 207 } 208 208 209 .warehouse_deleted { 209 .warehouse_deleted, 210 .rnl_bulk_warehouse_deleted, 211 .rnl_bulk_warehouse_delete_error { 210 212 margin-top: 20px !important; 211 213 display: none; … … 249 251 .wrng_credential, 250 252 .wrng_instore, 251 .wrng_local { 253 .wrng_local, 254 .rnl_bulk_warehouse_delete_error, 255 .rnl_bulk_dropship_delete_error { 252 256 background: #f1f1f1 none repeat scroll 0 0; 253 257 border-left: 4px solid #dc3232; … … 344 348 } 345 349 346 .dropship_deleted { 350 .dropship_deleted, 351 .rnl_bulk_dropship_deleted, .rnl_bulk_dropship_delete_error { 347 352 display: none; 348 353 } … … 624 629 opacity: 0.5; 625 630 } 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 725 725 } 726 726 } 727 728 if (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 735 if (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 742 if (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 44 44 add_action('wp_ajax_nopriv_rl_ltl_en_wd_delete_dropship', array($this, 'delete_dropship_ajax')); 45 45 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')); 46 49 } 47 50 … … 437 440 } 438 441 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 } 439 479 } 440 480 } -
ltl-freight-quotes-rl-edition/trunk/logs/en-json-tree-view/en-jtv-style.css
r2981057 r3462312 97 97 .en_jtv li.en_folder > div.en_key > span::before { 98 98 content: "\2212"; 99 opacity: 0.33;100 color: # 111;101 background-color: #e0eaef;99 opacity: 1; 100 color: #fff; 101 background-color: black !important; 102 102 text-align: center; 103 103 display: inline-block; … … 112 112 .en_jtv li.en_folder.en_folded > div.en_key > span::before { 113 113 content: "+"; 114 font-weight: bolder; 115 background-color: black !important; 116 color: #fff !important; 114 117 } 115 118 -
ltl-freight-quotes-rl-edition/trunk/ltl-freight-quotes-rnl-edition.php
r3442253 r3462312 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from R+L Freight and displays the results in the WooCommerce shopping cart. 6 * Version: 3.3.1 16 * Version: 3.3.12 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ -
ltl-freight-quotes-rl-edition/trunk/readme.txt
r3442253 r3462312 4 4 Requires at least: 6.4 5 5 Tested up to: 6.9 6 Stable tag: 3.3.1 16 Stable tag: 3.3.12 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 152 152 == Changelog == 153 153 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 154 158 = 3.3.11 - 2026-01-19 = 155 159 * 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 149 149 $locationId = 0; 150 150 (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); 152 152 $origin_address = $rnl_res_inst->rnl_multi_warehouse($locations_list, $rnl_zipcode); 153 153 $locationId = (isset($origin_address['id'])) ? $origin_address['id'] : $origin_address['locationId']; … … 175 175 if ($nested_material == "yes") { 176 176 $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); 181 181 } 182 182 … … 325 325 } 326 326 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 330 333 do_action("eniture_debug_mood", "Product Detail (rnl)", $rnl_package); 331 334 return $rnl_package; … … 375 378 { 376 379 $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; 378 389 } 379 390 … … 399 410 * @global $wpdb 400 411 */ 401 function rnl_get_locations_list($post_id )412 function rnl_get_locations_list($post_id, $values) 402 413 { 403 414 global $wpdb; … … 405 416 (isset($values['variation_id']) && $values['variation_id'] > 0) ? $post_id = $values['variation_id'] : $post_id; 406 417 $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 407 426 if ($enable_dropship == 'yes') { 408 427 $get_loc = get_post_meta($post_id, '_dropship_location', true); … … 515 534 $variation_class = get_post_meta($variation_id, '_ltl_freight_variation', true); 516 535 517 if ( $variation_class == 0) {536 if (empty($variation_class) || $variation_class == 0) { 518 537 $variation_class = get_post_meta($product_id, '_ltl_freight', true); 519 538 $freightClass_ltl_gross = $variation_class; … … 524 543 $freightClass_ltl_gross = get_post_meta($_product->get_id(), '_ltl_freight', true); 525 544 } 545 } 546 547 if (empty($hazardous_material)) { 548 $hazardous_material = get_post_meta($product_id, '_hazardousmaterials', true); 526 549 } 527 550 } else { … … 764 787 return ''; 765 788 } 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 } 766 803 } -
ltl-freight-quotes-rl-edition/trunk/rnl-shipping-class.php
r3442253 r3462312 220 220 221 221 // 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')) { 223 224 $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) { 230 228 $this->compile_and_add_ins_loc_del_rates(); 231 229 return []; -
ltl-freight-quotes-rl-edition/trunk/update-plan.php
r3373534 r3462312 63 63 $plan_type = isset($response['plan_type']) ? $response['plan_type'] : ''; 64 64 65 if ( $response['pakg_price'] == '0') {65 if (isset($response['pakg_price']) && $response['pakg_price'] == '0') { 66 66 $plan = '0'; 67 67 } … … 113 113 $plan_type = isset($response['plan_type']) ? $response['plan_type'] : ''; 114 114 115 if ( $response['pakg_price'] == '0') {115 if (isset($response['pakg_price']) && $response['pakg_price'] == '0') { 116 116 $plan = '0'; 117 117 } -
ltl-freight-quotes-rl-edition/trunk/warehouse-dropship/wild-delivery.php
r3391680 r3462312 22 22 )); 23 23 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'); 25 25 wp_localize_script('rl_ltl_en_woo_wd_script', 'rl_ltl_wd_script', array( 26 26 'pluginsUrl' => plugins_url(), … … 28 28 )); 29 29 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'); 31 31 wp_enqueue_style('rl_ltl_warehouse_section'); 32 32 } … … 58 58 $multi_warehouse = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_warehouse'); 59 59 60 if(is_array($multi_warehouse) && count($warehous_list) > 0) 61 { 60 if (is_array($multi_warehouse) && count($warehous_list) > 0) { 62 61 $add_space = "<br><br>"; 63 62 $multi_warehouse_disabled = "wild_disabled_me"; … … 70 69 <div class="add_btn_warehouse rnl_ltl_wrapper"> 71 70 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> 79 79 80 80 <div class="warehouse_text"> … … 90 90 <p><strong>Success! Warehouse updated successfully.</strong></p> 91 91 </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 92 99 <table class="en_wd_warehouse_list" id="append_warehouse"> 93 100 <thead> 94 101 <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> 95 106 <th class="en_wd_warehouse_list_heading"> 96 107 City … … 117 128 ?> 118 129 <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> 119 133 <td class="en_wd_warehouse_list_data"> 120 134 <?php echo ( isset($list->city) ) ? esc_attr($list->city) : ''; ?> … … 179 193 $multi_dropship = apply_filters($plugin_tab . "_quotes_plans_suscription_and_features" , 'multi_dropship'); 180 194 181 if(is_array($multi_dropship) && count($dropship_list) > 0) 182 { 195 if (is_array($multi_dropship) && count($dropship_list) > 0) { 183 196 $add_space = "<br><br>"; 184 197 $multi_dropship_disabled = "wild_disabled_me"; … … 189 202 190 203 <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> 195 211 </div> 196 212 197 <br><?php echo $add_space; ?>198 213 <div class="warehouse_text"> 199 214 <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> … … 208 223 <p><strong>Success! Drop ship deleted successfully.</strong></p> 209 224 </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 210 232 <table class="en_wd_dropship_list" id="append_dropship"> 211 233 <thead> 212 234 <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> 213 239 <th class="en_wd_dropship_list_heading"> 214 240 Nickname … … 238 264 ?> 239 265 <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> 240 269 <td class="en_wd_dropship_list_data"> 241 270 <?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 207 207 } 208 208 209 .warehouse_deleted { 209 .warehouse_deleted, 210 .rnl_bulk_warehouse_deleted, 211 .rnl_bulk_warehouse_delete_error { 210 212 margin-top: 20px !important; 211 213 display: none; … … 249 251 .wrng_credential, 250 252 .wrng_instore, 251 .wrng_local { 253 .wrng_local, 254 .rnl_bulk_warehouse_delete_error, 255 .rnl_bulk_dropship_delete_error { 252 256 background: #f1f1f1 none repeat scroll 0 0; 253 257 border-left: 4px solid #dc3232; … … 344 348 } 345 349 346 .dropship_deleted { 350 .dropship_deleted, 351 .rnl_bulk_dropship_deleted, .rnl_bulk_dropship_delete_error { 347 352 display: none; 348 353 } … … 624 629 opacity: 0.5; 625 630 } 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 725 725 } 726 726 } 727 728 if (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 735 if (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 742 if (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 44 44 add_action('wp_ajax_nopriv_rl_ltl_en_wd_delete_dropship', array($this, 'delete_dropship_ajax')); 45 45 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')); 46 49 } 47 50 … … 437 440 } 438 441 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 } 439 479 } 440 480 }
Note: See TracChangeset
for help on using the changeset viewer.