Changeset 3442520
- Timestamp:
- 01/19/2026 12:18:50 PM (2 months ago)
- Location:
- small-package-quotes-ups-edition
- Files:
-
- 6 edited
- 1 copied
-
tags/4.5.28 (copied) (copied from small-package-quotes-ups-edition/trunk)
-
tags/4.5.28/readme.txt (modified) (2 diffs)
-
tags/4.5.28/small-package-quotes-ups-edition.php (modified) (2 diffs)
-
tags/4.5.28/ups-small-group-package.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/small-package-quotes-ups-edition.php (modified) (2 diffs)
-
trunk/ups-small-group-package.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
small-package-quotes-ups-edition/tags/4.5.28/readme.txt
r3430547 r3442520 3 3 Tags: eniture,UPS,parcel rates, parcel quotes, shipping estimates 4 4 Requires at least: 6.6 5 Tested up to: 6. 86 Stable tag: 4.5.2 75 Tested up to: 6.9 6 Stable tag: 4.5.28 7 7 License: GPL-2.0-or-later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 142 142 143 143 == Changelog == 144 145 = 4.5.28 - 2026-01-19 = 146 * Fix: Improved brand and category filtering by supporting both native WooCommerce and custom brand taxonomies. 144 147 145 148 = 4.5.27 - 2026-01-01 = -
small-package-quotes-ups-edition/tags/4.5.28/small-package-quotes-ups-edition.php
r3430547 r3442520 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart. 6 * Version: 4.5.2 76 * Version: 4.5.28 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ … … 10 10 * License: GPL-2.0-or-later 11 11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 12 * Requires at least: 6.6 13 * Requires PHP: 7.4 12 * Requires Plugins: woocommerce 14 13 */ 15 14 if (!defined('ABSPATH')) { -
small-package-quotes-ups-edition/tags/4.5.28/ups-small-group-package.php
r3430547 r3442520 39 39 $this->is_country_filter_applied = false; 40 40 $this->is_restrict_service_rule_applied = false; 41 } 42 43 /** 44 * Get product terms safely with WP_Error handling and taxonomy fallback 45 */ 46 private function get_product_terms_safely($product_id, $parent_id, $taxonomies) 47 { 48 foreach ($taxonomies as $taxonomy) { 49 if (!taxonomy_exists($taxonomy)) { 50 continue; 51 } 52 53 $terms = get_the_terms($product_id, $taxonomy); 54 if (is_wp_error($terms) || empty($terms)) { 55 $terms = get_the_terms($parent_id, $taxonomy); 56 } 57 58 if (!is_wp_error($terms) && !empty($terms) && is_array($terms)) { 59 return array_map(function($term) { return $term->term_id; }, $terms); 60 } 61 } 62 63 return false; 41 64 } 42 65 … … 308 331 309 332 // Product tags 310 $product_tags = get_the_terms($product_id, 'product_tag'); 311 $product_tags = empty($product_tags) ? get_the_terms($parent_id, 'product_tag') : $product_tags; 312 if (!empty($product_tags)) { 313 $product_tag_names = array_map(function($tag) { return $tag->term_id; }, $product_tags); 314 333 $product_tag_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_tag']); 334 if ($product_tag_names !== false && !empty($product_tag_names)) { 315 335 if (isset($ups_small_package[$locationId]['product_tags'])) { 316 336 $ups_small_package[$locationId]['product_tags'] = array_merge($ups_small_package[$locationId]['product_tags'], $product_tag_names); … … 337 357 338 358 // Product categories 339 $product_categories = get_the_terms($product_id, 'product_cat'); 340 $product_categories = empty($product_categories) ? get_the_terms($parent_id, 'product_cat') : $product_categories; 341 if (!empty($product_categories)) { 342 $product_category_names = array_map(function($category) { return $category->term_id; }, $product_categories); 343 359 $product_category_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_cat']); 360 if ($product_category_names !== false && !empty($product_category_names)) { 344 361 if (isset($ups_small_package[$locationId]['product_categories'])) { 345 362 $ups_small_package[$locationId]['product_categories'] = array_merge($ups_small_package[$locationId]['product_categories'], $product_category_names); … … 348 365 } 349 366 } else { 350 $ups_small_package[$locationId]['product_categories'] = []; 351 } 352 353 // Product brands 354 $product_brands = get_the_terms($product_id, 'product_brand'); 355 $product_brands = empty($product_brands) ? get_the_terms($parent_id, 'product_brand') : $product_brands; 356 if (!empty($product_brands)) { 357 $product_brand_names = array_map(function($brand) { return $brand->term_id; }, $product_brands); 358 367 $ups_small_package[$locationId]['product_categories'] = isset($ups_small_package[$locationId]['product_categories']) && !empty($ups_small_package[$locationId]['product_categories']) ? $ups_small_package[$locationId]['product_categories'] : []; 368 } 369 370 $product_brand_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_brand', 'brand']); 371 if ($product_brand_names !== false && !empty($product_brand_names)) { 359 372 if (isset($ups_small_package[$locationId]['product_brands'])) { 360 373 $ups_small_package[$locationId]['product_brands'] = array_merge($ups_small_package[$locationId]['product_brands'], $product_brand_names); … … 363 376 } 364 377 } else { 365 $ups_small_package[$locationId]['product_brands'] = [];378 $ups_small_package[$locationId]['product_brands'] = isset($ups_small_package[$locationId]['product_brands']) && !empty($ups_small_package[$locationId]['product_brands']) ? $ups_small_package[$locationId]['product_brands'] : []; 366 379 } 367 380 } -
small-package-quotes-ups-edition/trunk/readme.txt
r3430547 r3442520 3 3 Tags: eniture,UPS,parcel rates, parcel quotes, shipping estimates 4 4 Requires at least: 6.6 5 Tested up to: 6. 86 Stable tag: 4.5.2 75 Tested up to: 6.9 6 Stable tag: 4.5.28 7 7 License: GPL-2.0-or-later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 142 142 143 143 == Changelog == 144 145 = 4.5.28 - 2026-01-19 = 146 * Fix: Improved brand and category filtering by supporting both native WooCommerce and custom brand taxonomies. 144 147 145 148 = 4.5.27 - 2026-01-01 = -
small-package-quotes-ups-edition/trunk/small-package-quotes-ups-edition.php
r3430547 r3442520 4 4 * Plugin URI: https://eniture.com/products/ 5 5 * Description: Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart. 6 * Version: 4.5.2 76 * Version: 4.5.28 7 7 * Author: Eniture Technology 8 8 * Author URI: http://eniture.com/ … … 10 10 * License: GPL-2.0-or-later 11 11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 12 * Requires at least: 6.6 13 * Requires PHP: 7.4 12 * Requires Plugins: woocommerce 14 13 */ 15 14 if (!defined('ABSPATH')) { -
small-package-quotes-ups-edition/trunk/ups-small-group-package.php
r3430547 r3442520 39 39 $this->is_country_filter_applied = false; 40 40 $this->is_restrict_service_rule_applied = false; 41 } 42 43 /** 44 * Get product terms safely with WP_Error handling and taxonomy fallback 45 */ 46 private function get_product_terms_safely($product_id, $parent_id, $taxonomies) 47 { 48 foreach ($taxonomies as $taxonomy) { 49 if (!taxonomy_exists($taxonomy)) { 50 continue; 51 } 52 53 $terms = get_the_terms($product_id, $taxonomy); 54 if (is_wp_error($terms) || empty($terms)) { 55 $terms = get_the_terms($parent_id, $taxonomy); 56 } 57 58 if (!is_wp_error($terms) && !empty($terms) && is_array($terms)) { 59 return array_map(function($term) { return $term->term_id; }, $terms); 60 } 61 } 62 63 return false; 41 64 } 42 65 … … 308 331 309 332 // Product tags 310 $product_tags = get_the_terms($product_id, 'product_tag'); 311 $product_tags = empty($product_tags) ? get_the_terms($parent_id, 'product_tag') : $product_tags; 312 if (!empty($product_tags)) { 313 $product_tag_names = array_map(function($tag) { return $tag->term_id; }, $product_tags); 314 333 $product_tag_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_tag']); 334 if ($product_tag_names !== false && !empty($product_tag_names)) { 315 335 if (isset($ups_small_package[$locationId]['product_tags'])) { 316 336 $ups_small_package[$locationId]['product_tags'] = array_merge($ups_small_package[$locationId]['product_tags'], $product_tag_names); … … 337 357 338 358 // Product categories 339 $product_categories = get_the_terms($product_id, 'product_cat'); 340 $product_categories = empty($product_categories) ? get_the_terms($parent_id, 'product_cat') : $product_categories; 341 if (!empty($product_categories)) { 342 $product_category_names = array_map(function($category) { return $category->term_id; }, $product_categories); 343 359 $product_category_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_cat']); 360 if ($product_category_names !== false && !empty($product_category_names)) { 344 361 if (isset($ups_small_package[$locationId]['product_categories'])) { 345 362 $ups_small_package[$locationId]['product_categories'] = array_merge($ups_small_package[$locationId]['product_categories'], $product_category_names); … … 348 365 } 349 366 } else { 350 $ups_small_package[$locationId]['product_categories'] = []; 351 } 352 353 // Product brands 354 $product_brands = get_the_terms($product_id, 'product_brand'); 355 $product_brands = empty($product_brands) ? get_the_terms($parent_id, 'product_brand') : $product_brands; 356 if (!empty($product_brands)) { 357 $product_brand_names = array_map(function($brand) { return $brand->term_id; }, $product_brands); 358 367 $ups_small_package[$locationId]['product_categories'] = isset($ups_small_package[$locationId]['product_categories']) && !empty($ups_small_package[$locationId]['product_categories']) ? $ups_small_package[$locationId]['product_categories'] : []; 368 } 369 370 $product_brand_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_brand', 'brand']); 371 if ($product_brand_names !== false && !empty($product_brand_names)) { 359 372 if (isset($ups_small_package[$locationId]['product_brands'])) { 360 373 $ups_small_package[$locationId]['product_brands'] = array_merge($ups_small_package[$locationId]['product_brands'], $product_brand_names); … … 363 376 } 364 377 } else { 365 $ups_small_package[$locationId]['product_brands'] = [];378 $ups_small_package[$locationId]['product_brands'] = isset($ups_small_package[$locationId]['product_brands']) && !empty($ups_small_package[$locationId]['product_brands']) ? $ups_small_package[$locationId]['product_brands'] : []; 366 379 } 367 380 }
Note: See TracChangeset
for help on using the changeset viewer.