Plugin Directory

Changeset 3095647


Ignore:
Timestamp:
05/31/2024 12:32:28 PM (22 months ago)
Author:
shindhl
Message:

Release 2.1.3

  • Fixed fallback shipping method not checking on enabled setting
  • Fixed fallback shipping method not applying conditions
Location:
dhlpwc
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • dhlpwc/tags/2.1.3/README.md

    r3093985 r3095647  
    11# DHL eCommerce (Benelux) for WooCommerce
     2 
     3v2.1.3
     4## Changes
     5- Fixed fallback shipping method not checking on enabled setting
     6- Fixed fallback shipping method not applying conditions
    27 
    38v2.1.2
  • dhlpwc/tags/2.1.3/dhlpwoocommerce.php

    r3093985 r3095647  
    55 * Description:          This is the official DHL eCommerce (Benelux) for WooCommerce plugin.
    66 * Author:               DHL eCommerce
    7  * Version:              2.1.2
     7 * Version:              2.1.3
    88 * Requires at least:    4.7.16
    99 * Tested up to:         6.3
     
    5252
    5353        // Set constants
    54         $this->define('DHLPWC_PLUGIN_VERSION', '2.1.2');
     54        $this->define('DHLPWC_PLUGIN_VERSION', '2.1.3');
    5555        $this->define('DHLPWC_PLUGIN_FILE', __FILE__);
    5656        $this->define('DHLPWC_PLUGIN_BASENAME', plugin_basename(__FILE__));
  • dhlpwc/tags/2.1.3/includes/model/woocommerce/settings/class-dhlpwc-model-woocommerce-settings-shipping-method.php

    r3093985 r3095647  
    10911091        foreach ($presets as $data) {
    10921092            $preset = new DHLPWC_Model_Meta_Shipping_Preset($data);
    1093             if ($data['frontend_id'] === 'fallback') {
     1093            if ($this->get_option('enable_option_' . $preset->setting_id) !== 'yes') {
     1094                continue;
     1095            }
     1096
     1097            if ($preset->setting_id === 'fallback') {
    10941098                $fallbackPreset = $preset;
    10951099                continue;
     
    11251129            }
    11261130
    1127             if ($this->get_option('enable_option_' . $preset->setting_id) === 'yes' && $check_allowed_options === true) {
    1128 
    1129                 $alternate_text = $this->get_option('alternative_option_text_' . $preset->setting_id);
    1130                 if (!empty($alternate_text)) {
    1131                     if (!empty($domain)) {
    1132                         $title = __($alternate_text, $domain);
    1133                     } else {
    1134                         $title = $alternate_text;
    1135                     }
     1131            if ($check_allowed_options !== true) {
     1132                continue;
     1133            }
     1134
     1135            $alternate_text = $this->get_option('alternative_option_text_' . $preset->setting_id);
     1136            if (!empty($alternate_text)) {
     1137                if (!empty($domain)) {
     1138                    $title = __($alternate_text, $domain);
    11361139                } else {
    1137                     $title = __($preset->title, 'dhlpwc');
     1140                    $title = $alternate_text;
    11381141                }
    1139 
    1140                 $cost = $this->calculate_cost($package, $preset->setting_id);
    1141                 // Apply negative tax if tax assistance is turned on (so WooCommerce can apply tax on it properly)
    1142                 if ($this->get_option(self::ENABLE_TAX_ASSISTANCE) === 'yes') {
    1143                     $taxes = WC_Tax::calc_inclusive_tax($cost, WC_Tax::get_shipping_tax_rates());
    1144                     foreach($taxes as $tax) {
    1145                         $cost -= $tax;
    1146                     }
     1142            } else {
     1143                $title = __($preset->title, 'dhlpwc');
     1144            }
     1145
     1146            $cost = $this->calculate_cost($package, $preset->setting_id);
     1147            // Apply negative tax if tax assistance is turned on (so WooCommerce can apply tax on it properly)
     1148            if ($this->get_option(self::ENABLE_TAX_ASSISTANCE) === 'yes') {
     1149                $taxes = WC_Tax::calc_inclusive_tax($cost, WC_Tax::get_shipping_tax_rates());
     1150                foreach($taxes as $tax) {
     1151                    $cost -= $tax;
    11471152                }
    1148 
    1149                 // Pass sort position meta data if available
    1150                 $meta_data = array();
    1151                 if ($sort_position = $this->get_option('sort_position_' . $preset->setting_id)) {
    1152                     $meta_data = array('sort_position' => $sort_position);
    1153                 }
    1154 
    1155                 if (!$this->disable_condition($preset->setting_id, $package)) {
    1156                     $added_rate = true;
    1157                     $this->add_rate(array(
    1158                         'id'        => 'dhlpwc-' . $preset->frontend_id,
    1159                         'label'     => $title,
    1160                         'cost'      => $cost,
    1161                         'meta_data' => $meta_data,
    1162                     ));
    1163                 }
    1164             }
    1165         }
    1166 
    1167         if (!$added_rate && $fallbackPreset) {
     1153            }
     1154
     1155            // Pass sort position meta data if available
    11681156            $meta_data = array();
    11691157            if ($sort_position = $this->get_option('sort_position_' . $preset->setting_id)) {
     
    11711159            }
    11721160
    1173             $this->add_rate(array(
    1174                 'id'        => 'dhlpwc-' . $fallbackPreset->frontend_id,
    1175                 'label'     => __($fallbackPreset->title, 'dhlpwc'),
    1176                 'cost'      => $this->calculate_cost($package, $preset->setting_id),
    1177                 'meta_data' => $meta_data,
    1178             ));
     1161            if (!$this->disable_condition($preset->setting_id, $package)) {
     1162                $added_rate = true;
     1163                $this->add_rate(array(
     1164                    'id'        => 'dhlpwc-' . $preset->frontend_id,
     1165                    'label'     => $title,
     1166                    'cost'      => $cost,
     1167                    'meta_data' => $meta_data,
     1168                ));
     1169            }
     1170        }
     1171
     1172        if (!$added_rate && $fallbackPreset !== false) {
     1173            $meta_data = array();
     1174            if ($sort_position = $this->get_option('sort_position_' . $fallbackPreset->setting_id)) {
     1175                $meta_data = array('sort_position' => $sort_position);
     1176            }
     1177
     1178            if (!$this->disable_condition($fallbackPreset->setting_id, $package)) {
     1179                $this->add_rate(array(
     1180                    'id'        => 'dhlpwc-' . $fallbackPreset->frontend_id,
     1181                    'label'     => __($fallbackPreset->title, 'dhlpwc'),
     1182                    'cost'      => $this->calculate_cost($package, $preset->setting_id),
     1183                    'meta_data' => $meta_data,
     1184                ));
     1185            }
    11791186        }
    11801187    }
  • dhlpwc/tags/2.1.3/readme.txt

    r3093985 r3095647  
    55Requires PHP:         5.6
    66Tested up to:         6.5.2
    7 Stable tag:           2.1.2
     7Stable tag:           2.1.3
    88WC requires at least: 3.0.0
    99WC tested up to:      8.6.1
     
    5656
    5757== Changelog ==
     58 
     59= 2.1.3 =
     60- Fixed fallback shipping method not checking on enabled setting
     61- Fixed fallback shipping method not applying conditions
    5862 
    5963= 2.1.2 =
  • dhlpwc/trunk/README.md

    r3093985 r3095647  
    11# DHL eCommerce (Benelux) for WooCommerce
     2 
     3v2.1.3
     4## Changes
     5- Fixed fallback shipping method not checking on enabled setting
     6- Fixed fallback shipping method not applying conditions
    27 
    38v2.1.2
  • dhlpwc/trunk/dhlpwoocommerce.php

    r3093985 r3095647  
    55 * Description:          This is the official DHL eCommerce (Benelux) for WooCommerce plugin.
    66 * Author:               DHL eCommerce
    7  * Version:              2.1.2
     7 * Version:              2.1.3
    88 * Requires at least:    4.7.16
    99 * Tested up to:         6.3
     
    5252
    5353        // Set constants
    54         $this->define('DHLPWC_PLUGIN_VERSION', '2.1.2');
     54        $this->define('DHLPWC_PLUGIN_VERSION', '2.1.3');
    5555        $this->define('DHLPWC_PLUGIN_FILE', __FILE__);
    5656        $this->define('DHLPWC_PLUGIN_BASENAME', plugin_basename(__FILE__));
  • dhlpwc/trunk/includes/model/woocommerce/settings/class-dhlpwc-model-woocommerce-settings-shipping-method.php

    r3093985 r3095647  
    10911091        foreach ($presets as $data) {
    10921092            $preset = new DHLPWC_Model_Meta_Shipping_Preset($data);
    1093             if ($data['frontend_id'] === 'fallback') {
     1093            if ($this->get_option('enable_option_' . $preset->setting_id) !== 'yes') {
     1094                continue;
     1095            }
     1096
     1097            if ($preset->setting_id === 'fallback') {
    10941098                $fallbackPreset = $preset;
    10951099                continue;
     
    11251129            }
    11261130
    1127             if ($this->get_option('enable_option_' . $preset->setting_id) === 'yes' && $check_allowed_options === true) {
    1128 
    1129                 $alternate_text = $this->get_option('alternative_option_text_' . $preset->setting_id);
    1130                 if (!empty($alternate_text)) {
    1131                     if (!empty($domain)) {
    1132                         $title = __($alternate_text, $domain);
    1133                     } else {
    1134                         $title = $alternate_text;
    1135                     }
     1131            if ($check_allowed_options !== true) {
     1132                continue;
     1133            }
     1134
     1135            $alternate_text = $this->get_option('alternative_option_text_' . $preset->setting_id);
     1136            if (!empty($alternate_text)) {
     1137                if (!empty($domain)) {
     1138                    $title = __($alternate_text, $domain);
    11361139                } else {
    1137                     $title = __($preset->title, 'dhlpwc');
     1140                    $title = $alternate_text;
    11381141                }
    1139 
    1140                 $cost = $this->calculate_cost($package, $preset->setting_id);
    1141                 // Apply negative tax if tax assistance is turned on (so WooCommerce can apply tax on it properly)
    1142                 if ($this->get_option(self::ENABLE_TAX_ASSISTANCE) === 'yes') {
    1143                     $taxes = WC_Tax::calc_inclusive_tax($cost, WC_Tax::get_shipping_tax_rates());
    1144                     foreach($taxes as $tax) {
    1145                         $cost -= $tax;
    1146                     }
     1142            } else {
     1143                $title = __($preset->title, 'dhlpwc');
     1144            }
     1145
     1146            $cost = $this->calculate_cost($package, $preset->setting_id);
     1147            // Apply negative tax if tax assistance is turned on (so WooCommerce can apply tax on it properly)
     1148            if ($this->get_option(self::ENABLE_TAX_ASSISTANCE) === 'yes') {
     1149                $taxes = WC_Tax::calc_inclusive_tax($cost, WC_Tax::get_shipping_tax_rates());
     1150                foreach($taxes as $tax) {
     1151                    $cost -= $tax;
    11471152                }
    1148 
    1149                 // Pass sort position meta data if available
    1150                 $meta_data = array();
    1151                 if ($sort_position = $this->get_option('sort_position_' . $preset->setting_id)) {
    1152                     $meta_data = array('sort_position' => $sort_position);
    1153                 }
    1154 
    1155                 if (!$this->disable_condition($preset->setting_id, $package)) {
    1156                     $added_rate = true;
    1157                     $this->add_rate(array(
    1158                         'id'        => 'dhlpwc-' . $preset->frontend_id,
    1159                         'label'     => $title,
    1160                         'cost'      => $cost,
    1161                         'meta_data' => $meta_data,
    1162                     ));
    1163                 }
    1164             }
    1165         }
    1166 
    1167         if (!$added_rate && $fallbackPreset) {
     1153            }
     1154
     1155            // Pass sort position meta data if available
    11681156            $meta_data = array();
    11691157            if ($sort_position = $this->get_option('sort_position_' . $preset->setting_id)) {
     
    11711159            }
    11721160
    1173             $this->add_rate(array(
    1174                 'id'        => 'dhlpwc-' . $fallbackPreset->frontend_id,
    1175                 'label'     => __($fallbackPreset->title, 'dhlpwc'),
    1176                 'cost'      => $this->calculate_cost($package, $preset->setting_id),
    1177                 'meta_data' => $meta_data,
    1178             ));
     1161            if (!$this->disable_condition($preset->setting_id, $package)) {
     1162                $added_rate = true;
     1163                $this->add_rate(array(
     1164                    'id'        => 'dhlpwc-' . $preset->frontend_id,
     1165                    'label'     => $title,
     1166                    'cost'      => $cost,
     1167                    'meta_data' => $meta_data,
     1168                ));
     1169            }
     1170        }
     1171
     1172        if (!$added_rate && $fallbackPreset !== false) {
     1173            $meta_data = array();
     1174            if ($sort_position = $this->get_option('sort_position_' . $fallbackPreset->setting_id)) {
     1175                $meta_data = array('sort_position' => $sort_position);
     1176            }
     1177
     1178            if (!$this->disable_condition($fallbackPreset->setting_id, $package)) {
     1179                $this->add_rate(array(
     1180                    'id'        => 'dhlpwc-' . $fallbackPreset->frontend_id,
     1181                    'label'     => __($fallbackPreset->title, 'dhlpwc'),
     1182                    'cost'      => $this->calculate_cost($package, $preset->setting_id),
     1183                    'meta_data' => $meta_data,
     1184                ));
     1185            }
    11791186        }
    11801187    }
  • dhlpwc/trunk/readme.txt

    r3093985 r3095647  
    55Requires PHP:         5.6
    66Tested up to:         6.5.2
    7 Stable tag:           2.1.2
     7Stable tag:           2.1.3
    88WC requires at least: 3.0.0
    99WC tested up to:      8.6.1
     
    5656
    5757== Changelog ==
     58 
     59= 2.1.3 =
     60- Fixed fallback shipping method not checking on enabled setting
     61- Fixed fallback shipping method not applying conditions
    5862 
    5963= 2.1.2 =
Note: See TracChangeset for help on using the changeset viewer.