Plugin Directory

Changeset 2572959


Ignore:
Timestamp:
07/27/2021 10:11:30 AM (4 years ago)
Author:
invisibledragonltd
Message:

Update to version 1.4 from GitLab (https://gitlab.com/invisibledragon/id-delivery; https://gitlab.com/invisibledragon/id-delivery/-/jobs/1455048977)

Location:
deliveryplus-by-invisible-dragon
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • deliveryplus-by-invisible-dragon/tags/1.4/class.DeliveryPlus_Filters.php

    r2402544 r2572959  
    4646        $conditions = static::get_conditions(array());
    4747        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            }
    4951        }
    5052
  • deliveryplus-by-invisible-dragon/tags/1.4/class.DeliveryPlus_Shipping_Method.php

    r2465699 r2572959  
    414414            if(method_exists($prod, 'get_meta')) {
    415415                $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                }
    419419            }
     420
     421            return false;
     422
    420423        }
    421424        return true;
     
    435438        );
    436439
    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        }
    440455
    441456        $filters = json_decode($this->get_option('filter'), true);
    442         if(!empty($filters)) {
     457        if(!empty($filters) && count($package['contents']) > 0) {
    443458            if(!DeliveryPlus_Filters::filter_package($filters, $package)) {
    444                 return; // Do not add rate
     459                return;
    445460            }
    446461        }
  • deliveryplus-by-invisible-dragon/trunk/class.DeliveryPlus_Filters.php

    r2402544 r2572959  
    4646        $conditions = static::get_conditions(array());
    4747        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            }
    4951        }
    5052
  • deliveryplus-by-invisible-dragon/trunk/class.DeliveryPlus_Shipping_Method.php

    r2465699 r2572959  
    414414            if(method_exists($prod, 'get_meta')) {
    415415                $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                }
    419419            }
     420
     421            return false;
     422
    420423        }
    421424        return true;
     
    435438        );
    436439
    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        }
    440455
    441456        $filters = json_decode($this->get_option('filter'), true);
    442         if(!empty($filters)) {
     457        if(!empty($filters) && count($package['contents']) > 0) {
    443458            if(!DeliveryPlus_Filters::filter_package($filters, $package)) {
    444                 return; // Do not add rate
     459                return;
    445460            }
    446461        }
Note: See TracChangeset for help on using the changeset viewer.