WordPress.org

Plugin Directory

Changeset 1713135


Ignore:
Timestamp:
08/14/17 11:34:12 (2 months ago)
Author:
bobbingwide
Message:

v0.1.2 - Fixes #21 - handling fee as percentage of cart total, Issue #22 - default to US English and add UK English language version

Location:
oik-weight-zone-shipping/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • oik-weight-zone-shipping/trunk/class-oik-weight-zone-shipping.php

    r1668911 r1713135  
    2929     
    3030    private $delimiters = null; 
     31    private $contents_cost = 0.0; 
    3132   
    3233    /** 
     
    131132                ), 
    132133                'fee'        => array( 
    133                     'title'       => __( 'Handling Fee', 'oik-weight-zone-shipping' ), 
     134                    'title'       => __( 'Handling Fee (fixed or %)', 'oik-weight-zone-shipping' ), 
    134135                    'type'        => 'text', 
    135136                    'description' => sprintf( __( 'Fee excluding tax, e.g. %1$s. Leave blank to disable.', 'oik-weight-zone-shipping' ), $three_fifty ), 
     
    149150        return true; 
    150151    } 
     152     
     153    /** 
     154     * Calculates handling fee  
     155     *  
     156     *  
     157     */ 
     158    function handling_fee() { 
     159        $fee = 0; 
     160        if ( $this->fee ) { 
     161            if ( false !== strpos( $this->fee, "%" ) ) { 
     162                $decimal = str_replace( "%", "", $this->fee ); 
     163                $fee = $this->contents_cost() * ( $decimal / 100 ); 
     164            } else { 
     165                $fee = $this->fee;  
     166            } 
     167        } 
     168        return $fee; 
     169    } 
     170     
     171    /** 
     172     * Sets / gets contents_cost 
     173     *  
     174     * @param decimal|null $cost 
     175     * @return decimal current value of contents_cost 
     176     */ 
     177    function contents_cost( $cost=null ) { 
     178        if ( $cost ) { 
     179            $this->contents_cost = $cost; 
     180        } 
     181        return $this->contents_cost; 
     182    } 
    151183 
    152184    /** 
     
    158190     */ 
    159191    function calculate_shipping( $package = array() ) { 
     192        $this->contents_cost( $package['contents_cost'] ); 
    160193        $woocommerce = function_exists('WC') ? WC() : $GLOBALS['woocommerce']; 
    161194        $rates = $this->get_rates(); 
     
    167200        if ( $final_rate !== false && is_numeric( $final_rate )) { 
    168201            $taxable = ($this->tax_status == 'taxable') ? true : false; 
    169             if ( $this->fee > 0 && $package['destination']['country'] ) { 
    170              $final_rate += $this->fee; 
     202            if ( $package['destination']['country'] ) { 
     203                $final_rate += $this->handling_fee(); 
    171204            } 
    172205            $rate = array( 
     
    332365     * @param string $key 
    333366     * @param string $value 
    334      * @return  
     367     * @return string  
    335368     */ 
    336369    function validate_rates_field( $key, $value ) { 
     
    342375 
    343376    /** 
    344      * Validate the fee to be a valid currency value 
     377     * Validates the fee to be a valid currency value or percentage 
    345378     * 
    346379     * Allow for local currency separators 
    347380     * 
     381     * @param string $key 
     382     * @param string $value 
     383     * @return string  
    348384     */  
    349385    function validate_fee_field( $key, $value ) { 
     
    433469     *  
    434470     * Note: Does not support negative values. 
     471     * Should cater for percentages. 
    435472     *  
    436473     * @param string $value 
  • oik-weight-zone-shipping/trunk/languages/oik-weight-zone-shipping-bb_BB.po

    r1530348 r1713135  
    1 # Copyright (C) 2016 oik weight zone shipping 
     1# Copyright (C) 2017 oik weight zone shipping 
    22# This file is distributed under the same license as the oik weight zone shipping package. 
    33msgid "" 
    4 msgstr """Project-Id-Version: oik weight zone shipping 0.0.1\n" 
     4msgstr "" 
     5"Project-Id-Version: oik weight zone shipping 0.1.2\n" 
    56"Report-Msgid-Bugs-To: http://wordpress.org/tag/oik-weight-zone-shipping\n" 
    6 "POT-Creation-Date: 2016-08-09 14:07:07+00:00\n" 
     7"POT-Creation-Date: 2017-08-14 11:08:37+00:00\n" 
    78"MIME-Version: 1.0\n" 
    89"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n" 
     
    1011"Content-Type: text/plain; charset=UTF-8\n" 
    1112"Content-Transfer-Encoding: 8bit\n" 
    12 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" 
     13"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n" 
    1314"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1415"Language-Team: LANGUAGE <LL@li.org>\n" 
    15 #: class-oik-weight-zone-shipping.php:39 
     16#: class-oik-weight-zone-shipping.php:53 
    1617msgid "Weight Zone" 
    17 msgstr "" 
    18 #: class-oik-weight-zone-shipping.php:40 
     18msgstr "Wiehgt Znoe" 
     19 
     20 
     21#: class-oik-weight-zone-shipping.php:54 
    1922msgid "Lets you charge based on cart weight." 
    20 msgstr "" 
    21 #: class-oik-weight-zone-shipping.php:41 
     23msgstr "Ltes yOU cahgre bsaed On crat wiehgt." 
     24 
     25 
     26#: class-oik-weight-zone-shipping.php:55 
    2227msgid "Weight and zone based shipping" 
    23 msgstr "" 
    24 #: class-oik-weight-zone-shipping.php:42 
     28msgstr "Wiehgt And znoe bsaed sihppnig" 
     29 
     30 
     31#: class-oik-weight-zone-shipping.php:56 
    2532msgid "Define rates for shipping by weight and zone" 
    26 msgstr "" 
    27 #: class-oik-weight-zone-shipping.php:96 
     33msgstr "Dfenie rtaes fOr sihppnig by wiehgt And znoe" 
     34 
     35 
     36#: class-oik-weight-zone-shipping.php:108 
    2837msgid "Method Title" 
    29 msgstr "" 
    30 #: class-oik-weight-zone-shipping.php:98 
     38msgstr "Mteohd Ttile" 
     39 
     40 
     41#: class-oik-weight-zone-shipping.php:110 
    3142msgid "" 
    3243"The title which the user sees during checkout, if not defined in Shipping " 
    3344"Rates." 
    3445msgstr "" 
    35 #: class-oik-weight-zone-shipping.php:99 
     46"ThE ttile wihch thE uesr sees drunig cehkcuot, If nOt dfenied In Sihppnig " 
     47"Rtaes." 
     48 
     49 
     50#: class-oik-weight-zone-shipping.php:111 
    3651msgid "Weight zone shipping" 
    37 msgstr "" 
    38 #: class-oik-weight-zone-shipping.php:104 
     52msgstr "Wiehgt znoe sihppnig" 
     53 
     54 
     55#: class-oik-weight-zone-shipping.php:115 
    3956msgid "Shipping Rates" 
    40 msgstr "" 
    41 #: class-oik-weight-zone-shipping.php:106 
     57msgstr "Sihppnig Rtaes" 
     58 
     59 
     60#: class-oik-weight-zone-shipping.php:117 
    4261msgid "" 
    4362"Set your weight based rates in %1$s for this shipping zone (one per line)." 
    44 "<br /> Format: Max weight|Cost|Method Title override<br />Example: 10|6.95|" 
    45 "Standard rate <br />For decimal, use a dot not a comma." 
     63"<br /> Format: Max weight | Cost | Method Title override<br />Example: 10 | " 
     64"%2$s | Standard rate" 
    4665msgstr "" 
    47 #: class-oik-weight-zone-shipping.php:112 
     66"SEt yuor wiehgt bsaed rtaes In %1$s fOr tihs sihppnig znoe (OnE pEr lnie)." 
     67"<br /> Froamt: MAx wiehgt | Csot | Mteohd Ttile override<br />Example: 10 | " 
     68"%2$s | Satdnrad rtae" 
     69 
     70 
     71#: class-oik-weight-zone-shipping.php:120 
     72msgid "Max weight | Cost | Method Title override" 
     73msgstr "MAx wiehgt | Csot | Mteohd Ttile oevrrdie" 
     74 
     75 
     76#: class-oik-weight-zone-shipping.php:123 
    4877msgid "Tax Status" 
    49 msgstr "" 
    50 #: class-oik-weight-zone-shipping.php:118 
     78msgstr "TAx Satuts" 
     79 
     80 
     81#: class-oik-weight-zone-shipping.php:129 
    5182msgid "Taxable" 
    52 msgstr "" 
    53 #: class-oik-weight-zone-shipping.php:119 
     83msgstr "Txabale" 
     84 
     85 
     86#: class-oik-weight-zone-shipping.php:130 
    5487msgctxt "Tax status" 
    5588msgid "None" 
    56 msgstr "" 
    57 #: class-oik-weight-zone-shipping.php:124 
    58 msgid "Handling Fee" 
    59 msgstr "" 
    60 #: class-oik-weight-zone-shipping.php:126 
    61 msgid "Fee excluding tax, e.g. 3.50. Leave blank to disable." 
    62 msgstr "" 
     89msgstr "Nnoe" 
     90 
     91 
     92#: class-oik-weight-zone-shipping.php:134 
     93msgid "Handling Fee (fixed or %)" 
     94msgstr "Hnaldnig FEE (fxied Or %)" 
     95 
     96 
     97#: class-oik-weight-zone-shipping.php:136 
     98msgid "Fee excluding tax, e.g. %1$s. Leave blank to disable." 
     99msgstr "FEE ecxulidng tAx, E.g. %1$s. Laeve balnk tO dsibale." 
     100 
     101 
    63102#. Plugin Name of the plugin/theme 
    64103msgid "oik weight zone shipping" 
    65 msgstr "" 
     104msgstr "OIk wiehgt znoe sihppnig" 
     105 
     106 
    66107#. Plugin URI of the plugin/theme 
    67 msgid "http://www.oik-plugins.com/oik-plugins/oik-weight-zone-shipping" 
    68 msgstr "" 
     108msgid "https://www.oik-plugins.com/oik-plugins/oik-weight-zone-shipping" 
     109msgstr "https://www.oik-plugins.com/oik-plugins/oik-weight-zone-shipping" 
     110 
     111 
    69112#. Description of the plugin/theme 
    70 msgid "Weight zone shipping for WooCommerce 2.6" 
    71 msgstr "" 
     113msgid "Weight zone shipping for WooCommerce" 
     114msgstr "Wiehgt znoe sihppnig fOr WoooCmmrece" 
     115 
     116 
    72117#. Author of the plugin/theme 
    73118msgid "bobbingwide" 
    74 msgstr "" 
     119msgstr "bboibgniwde" 
     120 
     121 
    75122#. Author URI of the plugin/theme 
    76 msgid "http://www.oik-plugins.com/author/bobbingwide" 
    77 msgstr "" 
     123msgid "https://www.oik-plugins.com/author/bobbingwide" 
     124msgstr "https://www.oik-plugins.com/author/bobbingwide" 
     125 
  • oik-weight-zone-shipping/trunk/languages/oik-weight-zone-shipping.pot

    r1530348 r1713135  
    1 # Copyright (C) 2016 oik weight zone shipping 
     1# Copyright (C) 2017 oik weight zone shipping 
    22# This file is distributed under the same license as the oik weight zone shipping package. 
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: oik weight zone shipping 0.0.1\n" 
     5"Project-Id-Version: oik weight zone shipping 0.1.2\n" 
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/oik-weight-zone-shipping\n" 
    7 "POT-Creation-Date: 2016-08-09 14:07:07+00:00\n" 
     7"POT-Creation-Date: 2017-08-14 11:08:37+00:00\n" 
    88"MIME-Version: 1.0\n" 
    99"Content-Type: text/plain; charset=UTF-8\n" 
    1010"Content-Transfer-Encoding: 8bit\n" 
    11 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" 
     11"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n" 
    1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1313"Language-Team: LANGUAGE <LL@li.org>\n" 
    1414 
    15 #: class-oik-weight-zone-shipping.php:39 
     15#: class-oik-weight-zone-shipping.php:53 
    1616msgid "Weight Zone" 
    1717msgstr "" 
    1818 
    19 #: class-oik-weight-zone-shipping.php:40 
     19#: class-oik-weight-zone-shipping.php:54 
    2020msgid "Lets you charge based on cart weight." 
    2121msgstr "" 
    2222 
    23 #: class-oik-weight-zone-shipping.php:41 
     23#: class-oik-weight-zone-shipping.php:55 
    2424msgid "Weight and zone based shipping" 
    2525msgstr "" 
    2626 
    27 #: class-oik-weight-zone-shipping.php:42 
     27#: class-oik-weight-zone-shipping.php:56 
    2828msgid "Define rates for shipping by weight and zone" 
    2929msgstr "" 
    3030 
    31 #: class-oik-weight-zone-shipping.php:96 
     31#: class-oik-weight-zone-shipping.php:108 
    3232msgid "Method Title" 
    3333msgstr "" 
    3434 
    35 #: class-oik-weight-zone-shipping.php:98 
     35#: class-oik-weight-zone-shipping.php:110 
    3636msgid "" 
    3737"The title which the user sees during checkout, if not defined in Shipping " 
     
    3939msgstr "" 
    4040 
    41 #: class-oik-weight-zone-shipping.php:99 
     41#: class-oik-weight-zone-shipping.php:111 
    4242msgid "Weight zone shipping" 
    4343msgstr "" 
    4444 
    45 #: class-oik-weight-zone-shipping.php:104 
     45#: class-oik-weight-zone-shipping.php:115 
    4646msgid "Shipping Rates" 
    4747msgstr "" 
    4848 
    49 #: class-oik-weight-zone-shipping.php:106 
     49#: class-oik-weight-zone-shipping.php:117 
    5050msgid "" 
    5151"Set your weight based rates in %1$s for this shipping zone (one per line)." 
    52 "<br /> Format: Max weight|Cost|Method Title override<br />Example: 10|6.95|" 
    53 "Standard rate <br />For decimal, use a dot not a comma." 
     52"<br /> Format: Max weight | Cost | Method Title override<br />Example: 10 | " 
     53"%2$s | Standard rate" 
    5454msgstr "" 
    5555 
    56 #: class-oik-weight-zone-shipping.php:112 
     56#: class-oik-weight-zone-shipping.php:120 
     57msgid "Max weight | Cost | Method Title override" 
     58msgstr "" 
     59 
     60#: class-oik-weight-zone-shipping.php:123 
    5761msgid "Tax Status" 
    5862msgstr "" 
    5963 
    60 #: class-oik-weight-zone-shipping.php:118 
     64#: class-oik-weight-zone-shipping.php:129 
    6165msgid "Taxable" 
    6266msgstr "" 
    6367 
    64 #: class-oik-weight-zone-shipping.php:119 
     68#: class-oik-weight-zone-shipping.php:130 
    6569msgctxt "Tax status" 
    6670msgid "None" 
    6771msgstr "" 
    6872 
    69 #: class-oik-weight-zone-shipping.php:124 
    70 msgid "Handling Fee" 
     73#: class-oik-weight-zone-shipping.php:134 
     74msgid "Handling Fee (fixed or %)" 
    7175msgstr "" 
    7276 
    73 #: class-oik-weight-zone-shipping.php:126 
    74 msgid "Fee excluding tax, e.g. 3.50. Leave blank to disable." 
     77#: class-oik-weight-zone-shipping.php:136 
     78msgid "Fee excluding tax, e.g. %1$s. Leave blank to disable." 
    7579msgstr "" 
    7680 
     
    8084 
    8185#. Plugin URI of the plugin/theme 
    82 msgid "http://www.oik-plugins.com/oik-plugins/oik-weight-zone-shipping" 
     86msgid "https://www.oik-plugins.com/oik-plugins/oik-weight-zone-shipping" 
    8387msgstr "" 
    8488 
    8589#. Description of the plugin/theme 
    86 msgid "Weight zone shipping for WooCommerce 2.6" 
     90msgid "Weight zone shipping for WooCommerce" 
    8791msgstr "" 
    8892 
     
    9296 
    9397#. Author URI of the plugin/theme 
    94 msgid "http://www.oik-plugins.com/author/bobbingwide" 
     98msgid "https://www.oik-plugins.com/author/bobbingwide" 
    9599msgstr "" 
  • oik-weight-zone-shipping/trunk/oik-weight-zone-shipping.php

    r1668911 r1713135  
    44 * Plugin URI: https://www.oik-plugins.com/oik-plugins/oik-weight-zone-shipping 
    55 * Description: Weight zone shipping for WooCommerce 
    6  * Version: 0.1.1 
     6 * Version: 0.1.2 
    77 * Author: bobbingwide 
    88 * Author URI: https://www.oik-plugins.com/author/bobbingwide 
  • oik-weight-zone-shipping/trunk/readme.txt

    r1668911 r1713135  
    44Tags: shipping, weight, zone, woocommerce 
    55Requires at least: 4.5.2 
    6 Tested up to: 4.7.5 
    7 Stable tag: 0.1.1 
     6Tested up to: 4.8.1 
     7Stable tag: 0.1.2 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    3131* WooCommerce 2.6, 3.0 and above 
    3232* Available in English, French and Swedish 
     33* Handling fee as fixed rate or percentage of total cart cost 
    3334 
    3435 
     
    103104 
    104105== Upgrade Notice == 
    105 = 0.1.0 =  
     106 
     107= 0.1.2 =  
     108Update if you need handling fee as percentage of total cart cost 
     109 
     110= 0.1.1 =  
    106111Update if you're still using WooCommerce 2.6 
    107112 
     
    124129 
    125130== Changelog == 
     131= 0.1.2 =  
     132* Changed: Handling fee can now be a percentage of cart total [github bobbingwide oik-weight-zone-shipping issues 21] 
     133* Changed: Default to US English and add UK English version [github bobbingwide oik-weight-zone-shipping issues 22] 
     134* Tested: With WordPress 4.8.1 
     135* Tested: With WooCommerce 2.6, 3.0 and 3.1 
     136 
    126137= 0.1.1 =  
    127138* Fixed: Shipping Rates table incorrectly re-displayed in WooCommerce 2.6 non-modal dialog [github bobbingwide oik-weight-zone-shipping issues 20] 
Note: See TracChangeset for help on using the changeset viewer.