Plugin Directory

Changeset 3095681


Ignore:
Timestamp:
05/31/2024 01:25:38 PM (22 months ago)
Author:
shindhl
Message:

Release 2.1.4

  • Fixed fallback shipping method not using alternative text
  • Fixed fallback shipping method not applying the correct cost
  • Fixed fallback shipping method not using tax included input cost calculation
Location:
dhlpwc
Files:
8 edited
1 copied

Legend:

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

    r3095647 r3095681  
    11# DHL eCommerce (Benelux) for WooCommerce
     2 
     3v2.1.4
     4## Changes
     5- Fixed fallback shipping method not using alternative text
     6- Fixed fallback shipping method not applying the correct cost
     7- Fixed fallback shipping method not using tax included input cost calculation
    28 
    39v2.1.3
  • dhlpwc/tags/2.1.4/dhlpwoocommerce.php

    r3095647 r3095681  
    55 * Description:          This is the official DHL eCommerce (Benelux) for WooCommerce plugin.
    66 * Author:               DHL eCommerce
    7  * Version:              2.1.3
     7 * Version:              2.1.4
    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.3');
     54        $this->define('DHLPWC_PLUGIN_VERSION', '2.1.4');
    5555        $this->define('DHLPWC_PLUGIN_FILE', __FILE__);
    5656        $this->define('DHLPWC_PLUGIN_BASENAME', plugin_basename(__FILE__));
  • dhlpwc/tags/2.1.4/includes/model/woocommerce/settings/class-dhlpwc-model-woocommerce-settings-shipping-method.php

    r3095647 r3095681  
    10341034        }
    10351035
    1036         $domain = $this->get_option(self::PRESET_TRANSLATION_DOMAIN);
    1037 
    10381036        $service = DHLPWC_Model_Service_Shipping_Preset::instance();
    10391037        $presets = $service->get_presets();
     
    11331131            }
    11341132
    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);
    1139                 } else {
    1140                     $title = $alternate_text;
    1141                 }
    1142             } else {
    1143                 $title = __($preset->title, 'dhlpwc');
    1144             }
    1145 
     1133            $title = $this->get_preset_title($preset);
    11461134            $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;
    1152                 }
    1153             }
     1135            $cost = $this->get_tax_adjusted_cost($cost);
    11541136
    11551137            // Pass sort position meta data if available
     
    11711153
    11721154        if (!$added_rate && $fallbackPreset !== false) {
     1155            $title = $this->get_preset_title($fallbackPreset);
     1156            $cost = $this->calculate_cost($package, $fallbackPreset->setting_id);
     1157            $cost = $this->get_tax_adjusted_cost($cost);
     1158
    11731159            $meta_data = array();
    11741160            if ($sort_position = $this->get_option('sort_position_' . $fallbackPreset->setting_id)) {
     
    11791165                $this->add_rate(array(
    11801166                    'id'        => 'dhlpwc-' . $fallbackPreset->frontend_id,
    1181                     'label'     => __($fallbackPreset->title, 'dhlpwc'),
    1182                     'cost'      => $this->calculate_cost($package, $preset->setting_id),
     1167                    'label'     => $title,
     1168                    'cost'      => $cost,
    11831169                    'meta_data' => $meta_data,
    11841170                ));
    11851171            }
    11861172        }
     1173    }
     1174
     1175    protected function get_preset_title($preset)
     1176    {
     1177        $alternate_text = $this->get_option('alternative_option_text_' . $preset->setting_id);
     1178        $domain = $this->get_option(self::PRESET_TRANSLATION_DOMAIN);
     1179
     1180        if (!empty($alternate_text)) {
     1181            if (!empty($domain)) {
     1182                return __($alternate_text, $domain);
     1183            } else {
     1184                return $alternate_text;
     1185            }
     1186        }
     1187        return __($preset->title, 'dhlpwc');
     1188    }
     1189
     1190    protected function get_tax_adjusted_cost($cost)
     1191    {
     1192        // Apply negative tax if tax assistance is turned on (so WooCommerce can apply tax on it properly)
     1193        if ($this->get_option(self::ENABLE_TAX_ASSISTANCE) !== 'yes') {
     1194            return $cost;
     1195        }
     1196
     1197        $taxes = WC_Tax::calc_inclusive_tax($cost, WC_Tax::get_shipping_tax_rates());
     1198        foreach($taxes as $tax) {
     1199            $cost -= $tax;
     1200        }
     1201
     1202        return $cost;
    11871203    }
    11881204
  • dhlpwc/tags/2.1.4/readme.txt

    r3095647 r3095681  
    55Requires PHP:         5.6
    66Tested up to:         6.5.2
    7 Stable tag:           2.1.3
     7Stable tag:           2.1.4
    88WC requires at least: 3.0.0
    99WC tested up to:      8.6.1
     
    5656
    5757== Changelog ==
     58 
     59= 2.1.4 =
     60- Fixed fallback shipping method not using alternative text
     61- Fixed fallback shipping method not applying the correct cost
     62- Fixed fallback shipping method not using tax included input cost calculation
    5863 
    5964= 2.1.3 =
  • dhlpwc/trunk/README.md

    r3095647 r3095681  
    11# DHL eCommerce (Benelux) for WooCommerce
     2 
     3v2.1.4
     4## Changes
     5- Fixed fallback shipping method not using alternative text
     6- Fixed fallback shipping method not applying the correct cost
     7- Fixed fallback shipping method not using tax included input cost calculation
    28 
    39v2.1.3
  • dhlpwc/trunk/dhlpwoocommerce.php

    r3095647 r3095681  
    55 * Description:          This is the official DHL eCommerce (Benelux) for WooCommerce plugin.
    66 * Author:               DHL eCommerce
    7  * Version:              2.1.3
     7 * Version:              2.1.4
    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.3');
     54        $this->define('DHLPWC_PLUGIN_VERSION', '2.1.4');
    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

    r3095647 r3095681  
    10341034        }
    10351035
    1036         $domain = $this->get_option(self::PRESET_TRANSLATION_DOMAIN);
    1037 
    10381036        $service = DHLPWC_Model_Service_Shipping_Preset::instance();
    10391037        $presets = $service->get_presets();
     
    11331131            }
    11341132
    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);
    1139                 } else {
    1140                     $title = $alternate_text;
    1141                 }
    1142             } else {
    1143                 $title = __($preset->title, 'dhlpwc');
    1144             }
    1145 
     1133            $title = $this->get_preset_title($preset);
    11461134            $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;
    1152                 }
    1153             }
     1135            $cost = $this->get_tax_adjusted_cost($cost);
    11541136
    11551137            // Pass sort position meta data if available
     
    11711153
    11721154        if (!$added_rate && $fallbackPreset !== false) {
     1155            $title = $this->get_preset_title($fallbackPreset);
     1156            $cost = $this->calculate_cost($package, $fallbackPreset->setting_id);
     1157            $cost = $this->get_tax_adjusted_cost($cost);
     1158
    11731159            $meta_data = array();
    11741160            if ($sort_position = $this->get_option('sort_position_' . $fallbackPreset->setting_id)) {
     
    11791165                $this->add_rate(array(
    11801166                    'id'        => 'dhlpwc-' . $fallbackPreset->frontend_id,
    1181                     'label'     => __($fallbackPreset->title, 'dhlpwc'),
    1182                     'cost'      => $this->calculate_cost($package, $preset->setting_id),
     1167                    'label'     => $title,
     1168                    'cost'      => $cost,
    11831169                    'meta_data' => $meta_data,
    11841170                ));
    11851171            }
    11861172        }
     1173    }
     1174
     1175    protected function get_preset_title($preset)
     1176    {
     1177        $alternate_text = $this->get_option('alternative_option_text_' . $preset->setting_id);
     1178        $domain = $this->get_option(self::PRESET_TRANSLATION_DOMAIN);
     1179
     1180        if (!empty($alternate_text)) {
     1181            if (!empty($domain)) {
     1182                return __($alternate_text, $domain);
     1183            } else {
     1184                return $alternate_text;
     1185            }
     1186        }
     1187        return __($preset->title, 'dhlpwc');
     1188    }
     1189
     1190    protected function get_tax_adjusted_cost($cost)
     1191    {
     1192        // Apply negative tax if tax assistance is turned on (so WooCommerce can apply tax on it properly)
     1193        if ($this->get_option(self::ENABLE_TAX_ASSISTANCE) !== 'yes') {
     1194            return $cost;
     1195        }
     1196
     1197        $taxes = WC_Tax::calc_inclusive_tax($cost, WC_Tax::get_shipping_tax_rates());
     1198        foreach($taxes as $tax) {
     1199            $cost -= $tax;
     1200        }
     1201
     1202        return $cost;
    11871203    }
    11881204
  • dhlpwc/trunk/readme.txt

    r3095647 r3095681  
    55Requires PHP:         5.6
    66Tested up to:         6.5.2
    7 Stable tag:           2.1.3
     7Stable tag:           2.1.4
    88WC requires at least: 3.0.0
    99WC tested up to:      8.6.1
     
    5656
    5757== Changelog ==
     58 
     59= 2.1.4 =
     60- Fixed fallback shipping method not using alternative text
     61- Fixed fallback shipping method not applying the correct cost
     62- Fixed fallback shipping method not using tax included input cost calculation
    5863 
    5964= 2.1.3 =
Note: See TracChangeset for help on using the changeset viewer.