Changeset 2572959
- Timestamp:
- 07/27/2021 10:11:30 AM (4 years ago)
- Location:
- deliveryplus-by-invisible-dragon
- Files:
-
- 4 edited
- 1 copied
-
tags/1.4 (copied) (copied from deliveryplus-by-invisible-dragon/trunk)
-
tags/1.4/class.DeliveryPlus_Filters.php (modified) (1 diff)
-
tags/1.4/class.DeliveryPlus_Shipping_Method.php (modified) (2 diffs)
-
trunk/class.DeliveryPlus_Filters.php (modified) (1 diff)
-
trunk/class.DeliveryPlus_Shipping_Method.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
deliveryplus-by-invisible-dragon/tags/1.4/class.DeliveryPlus_Filters.php
r2402544 r2572959 46 46 $conditions = static::get_conditions(array()); 47 47 foreach($conditions as $key => $val) { 48 add_filter( 'deliveryplus_filter_' . static::$category . '_' . $key, array( static::class, 'do_' . $key ), 10, 3 ); 48 if( method_exists(static::class, 'do_' . $key) ) { 49 add_filter('deliveryplus_filter_' . static::$category . '_' . $key, array(static::class, 'do_' . $key), 10, 3); 50 } 49 51 } 50 52 -
deliveryplus-by-invisible-dragon/tags/1.4/class.DeliveryPlus_Shipping_Method.php
r2465699 r2572959 414 414 if(method_exists($prod, 'get_meta')) { 415 415 $skip = $prod->get_meta('idd_options'); 416 if(is_array($skip) && !in_array($this->instance_id, $skip)) {417 return false;418 }416 if(is_array($skip) && in_array($this->instance_id, $skip)) { 417 continue; 418 } 419 419 } 420 421 return false; 422 420 423 } 421 424 return true; … … 435 438 ); 436 439 437 if(!$this->filter_package($package)) { 438 return; 439 } 440 foreach ( $package['contents'] as $item_id => $values ) { 441 $prod = $values['data']; 442 443 if(method_exists($prod, 'get_meta')) { 444 $skip = $prod->get_meta('idd_options'); 445 if(is_array($skip)) { 446 if (in_array($this->instance_id, $skip)) { 447 unset($package['contents'][$item_id]); 448 } else { 449 return; 450 } 451 } 452 } 453 454 } 440 455 441 456 $filters = json_decode($this->get_option('filter'), true); 442 if(!empty($filters) ) {457 if(!empty($filters) && count($package['contents']) > 0) { 443 458 if(!DeliveryPlus_Filters::filter_package($filters, $package)) { 444 return; // Do not add rate 459 return; 445 460 } 446 461 } -
deliveryplus-by-invisible-dragon/trunk/class.DeliveryPlus_Filters.php
r2402544 r2572959 46 46 $conditions = static::get_conditions(array()); 47 47 foreach($conditions as $key => $val) { 48 add_filter( 'deliveryplus_filter_' . static::$category . '_' . $key, array( static::class, 'do_' . $key ), 10, 3 ); 48 if( method_exists(static::class, 'do_' . $key) ) { 49 add_filter('deliveryplus_filter_' . static::$category . '_' . $key, array(static::class, 'do_' . $key), 10, 3); 50 } 49 51 } 50 52 -
deliveryplus-by-invisible-dragon/trunk/class.DeliveryPlus_Shipping_Method.php
r2465699 r2572959 414 414 if(method_exists($prod, 'get_meta')) { 415 415 $skip = $prod->get_meta('idd_options'); 416 if(is_array($skip) && !in_array($this->instance_id, $skip)) {417 return false;418 }416 if(is_array($skip) && in_array($this->instance_id, $skip)) { 417 continue; 418 } 419 419 } 420 421 return false; 422 420 423 } 421 424 return true; … … 435 438 ); 436 439 437 if(!$this->filter_package($package)) { 438 return; 439 } 440 foreach ( $package['contents'] as $item_id => $values ) { 441 $prod = $values['data']; 442 443 if(method_exists($prod, 'get_meta')) { 444 $skip = $prod->get_meta('idd_options'); 445 if(is_array($skip)) { 446 if (in_array($this->instance_id, $skip)) { 447 unset($package['contents'][$item_id]); 448 } else { 449 return; 450 } 451 } 452 } 453 454 } 440 455 441 456 $filters = json_decode($this->get_option('filter'), true); 442 if(!empty($filters) ) {457 if(!empty($filters) && count($package['contents']) > 0) { 443 458 if(!DeliveryPlus_Filters::filter_package($filters, $package)) { 444 return; // Do not add rate 459 return; 445 460 } 446 461 }
Note: See TracChangeset
for help on using the changeset viewer.