Changeset 1795770
- Timestamp:
- 01/02/2018 03:26:01 PM (8 years ago)
- Location:
- minimum-order-amount-for-woocommerce
- Files:
-
- 16 edited
-
assets/screenshot-1.png (modified) (previous)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-dc-moafw-admin.php (modified) (2 diffs)
-
trunk/admin/css/dc-moafw-admin.css (modified) (1 diff)
-
trunk/admin/partials/dc-moafw-admin-display.php (modified) (2 diffs)
-
trunk/dc-moafw.php (modified) (2 diffs)
-
trunk/includes/class-dc-moafw-activator.php (modified) (2 diffs)
-
trunk/includes/class-dc-moafw-deactivator.php (modified) (1 diff)
-
trunk/includes/class-dc-moafw.php (modified) (3 diffs)
-
trunk/languages/dc-moafw-it_IT.mo (modified) (previous)
-
trunk/languages/dc-moafw-it_IT.po (modified) (4 diffs)
-
trunk/languages/dc-moafw-pl_PL.mo (modified) (previous)
-
trunk/languages/dc-moafw-pl_PL.po (modified) (4 diffs)
-
trunk/languages/dc-moafw.pot (modified) (4 diffs)
-
trunk/public/class-dc-moafw-public.php (modified) (7 diffs)
-
trunk/uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
minimum-order-amount-for-woocommerce/trunk/README.txt
r1612768 r1795770 5 5 Tags: woocommerce, order, woocommerce order, minimum order, woocommerce minimum order, shop, cart, woocommerce cart, product, products, minimum order amount, amount, minimum amount 6 6 Requires at least: 3.0.1 7 Tested up to: 4. 7.38 Stable tag: 1. 2.07 Tested up to: 4.9.1 8 Stable tag: 1.3.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 52 52 == Changelog == 53 53 54 = 1.3.0 - 02/01/18 = 55 * New - Added the ability to choose how to display the currency 56 * Fix - Now the options are deleted when the plugin is uninstalled and not when the plugin is deactivate 57 * Fix - The cart total and the minimum order were formatted with two decimal places 58 * Dev - The function for set the minimum order has been restructured 59 * Dev - Update translations 60 54 61 = 1.2.0 - 12/03/17 = 55 62 * New - Added compatibility with WooCommerce Price Based on Country -
minimum-order-amount-for-woocommerce/trunk/admin/class-dc-moafw-admin.php
r1612768 r1795770 121 121 * Creates our settings sections with fields etc. 122 122 * 123 * @since 1. 2.0123 * @since 1.3.0 124 124 */ 125 125 public function settings_api_init(){ … … 128 128 register_setting('dc_moafw_options_group', 'dc_moafw_message'); 129 129 register_setting('dc_moafw_options_group', 'dc_moafw_current_total_text'); 130 register_setting('dc_moafw_options_group', 'dc_moafw_currency_display_type'); 130 131 register_setting('dc_moafw_options_group', 'dc_moafw_message_shop'); 131 132 } -
minimum-order-amount-for-woocommerce/trunk/admin/css/dc-moafw-admin.css
r1507445 r1795770 3 3 * included in this file. 4 4 */ 5 #dc_moafw_currency_display_type { 6 padding-top: 0; 7 padding-bottom: 0; 8 } -
minimum-order-amount-for-woocommerce/trunk/admin/partials/dc-moafw-admin-display.php
r1612768 r1795770 7 7 * 8 8 * @link https://github.com/dcurasi 9 * @since 1. 1.09 * @since 1.3.0 10 10 * 11 11 * @package Dc_Moafw … … 69 69 <tr valign="top"> 70 70 <th scope="row"> 71 <label for="dc_moafw_currency_display_type"><?php _e( 'Currency Display Type', 'dc-moafw' ); ?></label> 72 </th> 73 <td> 74 <select id="dc_moafw_currency_display_type" name="dc_moafw_currency_display_type"> 75 <option value="symbol" <?php echo selected(get_option('dc_moafw_currency_display_type'), "symbol"); ?>><?php _e('Symbol', 'dc-moafw'); ?></option> 76 <option value="text" <?php echo selected(get_option('dc_moafw_currency_display_type'), "text"); ?>><?php _e('Text', 'dc-moafw'); ?></option> 77 </select> 78 <p class="description"><?php _e( 'The way the currency appears in the notification message (i.e. "€" if is "symbol", "EUR" if is "text").', 'dc-moafw' ); ?></p> 79 </td> 80 </tr> 81 <tr valign="top"> 82 <th scope="row"> 71 83 <label for="dc_moafw_message_shop"><?php _e( 'Show message in the shop', 'dc-moafw' ); ?></label> 72 84 </th> -
minimum-order-amount-for-woocommerce/trunk/dc-moafw.php
r1612768 r1795770 10 10 * 11 11 * @link https://github.com/dcurasi 12 * @since 1. 2.012 * @since 1.3.0 13 13 * @package Dc_Moafw 14 14 * … … 17 17 * Plugin URI: https://github.com/dcurasi/dc-moafw 18 18 * Description: Minimum Order Amount for Woocommerce allows you to set easily and fast a minimum amount for the woocommerce orders. 19 * Version: 1. 2.019 * Version: 1.3.0 20 20 * Author: Dario Curasì 21 21 * Author URI: https://github.com/dcurasi -
minimum-order-amount-for-woocommerce/trunk/includes/class-dc-moafw-activator.php
r1612768 r1795770 28 28 * Long Description. 29 29 * 30 * @since 1. 2.030 * @since 1.3.0 31 31 */ 32 32 public static function activate() { … … 35 35 add_option('dc_moafw_message', __('A Minimum of [minimum] is required before checking out.', 'dc-moafw')); 36 36 add_option('dc_moafw_current_total_text', __("Current cart's total: [current]", 'dc-moafw')); 37 add_option('dc_moafw_currency_display_type', "text"); 37 38 add_option('dc_moafw_message_shop', 0); 38 39 } -
minimum-order-amount-for-woocommerce/trunk/includes/class-dc-moafw-deactivator.php
r1612768 r1795770 28 28 * Long Description. 29 29 * 30 * @since 1. 2.030 * @since 1.3.0 31 31 */ 32 32 public static function deactivate() { 33 delete_option('dc_moafw_activate'); 34 delete_option('dc_moafw_minimum'); 35 delete_option('dc_moafw_message'); 36 delete_option('dc_moafw_current_total_text'); 37 delete_option('dc_moafw_message_shop'); 33 38 34 } 39 35 -
minimum-order-amount-for-woocommerce/trunk/includes/class-dc-moafw.php
r1612768 r1795770 70 70 71 71 $this->plugin_name = 'dc-moafw'; 72 $this->version = '1. 2.0';72 $this->version = '1.3.0'; 73 73 74 74 $this->load_dependencies(); … … 145 145 * of the plugin. 146 146 * 147 * @since 1. 2.0147 * @since 1.3.0 148 148 * @access private 149 149 */ … … 152 152 $plugin_admin = new Dc_Moafw_Admin( $this->get_plugin_name(), $this->get_version() ); 153 153 154 //$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );154 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 155 155 //$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); 156 156 $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_menu_page' ); -
minimum-order-amount-for-woocommerce/trunk/languages/dc-moafw-it_IT.po
r1612768 r1795770 2 2 msgstr "" 3 3 "Project-Id-Version: Minimum Order Amount for Woocommerce\n" 4 "POT-Creation-Date: 201 7-03-11 13:30+0100\n"5 "PO-Revision-Date: 201 7-03-11 13:32+0100\n"4 "POT-Creation-Date: 2018-01-02 13:18+0100\n" 5 "PO-Revision-Date: 2018-01-02 13:26+0100\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: Dario Curasì <curasi.d87@gmail.com>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.8.11\n"12 "X-Generator: Poedit 2.0.5\n" 13 13 "X-Poedit-Basepath: ..\n" 14 14 "Plural-Forms: nplurals=2; plural=(n != 1);\n" … … 17 17 "X-Poedit-SearchPath-0: .\n" 18 18 19 #: admin/class-dc-moafw-admin.php:14 119 #: admin/class-dc-moafw-admin.php:142 20 20 msgid "" 21 21 "Minimum Order Amount for Woocommerce is active but does not work. You need " … … 76 76 77 77 #: admin/partials/dc-moafw-admin-display.php:71 78 msgid "Currency Display Type" 79 msgstr "Tipo di visualizzazione della Valuta" 80 81 #: admin/partials/dc-moafw-admin-display.php:75 82 msgid "Symbol" 83 msgstr "Simbolo" 84 85 #: admin/partials/dc-moafw-admin-display.php:76 86 msgid "Text" 87 msgstr "Testo" 88 89 #: admin/partials/dc-moafw-admin-display.php:78 90 msgid "" 91 "The way the currency appears in the notification message (i.e. \"€\" if " 92 "is \"symbol\", \"EUR\" if is \"text\")." 93 msgstr "" 94 "Il modo in cui la valuta viene visualizzata nel messaggio (per es. \"€" 95 "\" se è \"simbolo\", \"EUR\" se è \"testo\")." 96 97 #: admin/partials/dc-moafw-admin-display.php:83 78 98 msgid "Show message in the shop" 79 99 msgstr "Mostra messaggio nello shop" 80 100 81 #: admin/partials/dc-moafw-admin-display.php: 75101 #: admin/partials/dc-moafw-admin-display.php:87 82 102 msgid "Enable" 83 103 msgstr "Abilita" 84 104 85 #: admin/partials/dc-moafw-admin-display.php: 76105 #: admin/partials/dc-moafw-admin-display.php:88 86 106 msgid "" 87 107 "Enable this option to show the notification message also in the shop pages. " -
minimum-order-amount-for-woocommerce/trunk/languages/dc-moafw-pl_PL.po
r1612768 r1795770 2 2 msgstr "" 3 3 "Project-Id-Version: Minimum Order Amount for Woocommerce\n" 4 "POT-Creation-Date: 201 7-03-12 15:25+0100\n"5 "PO-Revision-Date: 201 7-03-12 15:26+0100\n"4 "POT-Creation-Date: 2018-01-02 13:22+0100\n" 5 "PO-Revision-Date: 2018-01-02 13:25+0100\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: Dario Curasì <curasi.d87@gmail.com>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.8.11\n"12 "X-Generator: Poedit 2.0.5\n" 13 13 "X-Poedit-Basepath: ..\n" 14 14 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " … … 18 18 "X-Poedit-SearchPath-0: .\n" 19 19 20 #: admin/class-dc-moafw-admin.php:14 120 #: admin/class-dc-moafw-admin.php:142 21 21 msgid "" 22 22 "Minimum Order Amount for Woocommerce is active but does not work. You need " … … 77 77 78 78 #: admin/partials/dc-moafw-admin-display.php:71 79 msgid "Currency Display Type" 80 msgstr "Typ wyświetlania waluty" 81 82 #: admin/partials/dc-moafw-admin-display.php:75 83 msgid "Symbol" 84 msgstr "Symbol" 85 86 #: admin/partials/dc-moafw-admin-display.php:76 87 msgid "Text" 88 msgstr "Tekst" 89 90 #: admin/partials/dc-moafw-admin-display.php:78 91 msgid "" 92 "The way the currency appears in the notification message (i.e. \"€\" if " 93 "is \"symbol\", \"EUR\" if is \"text\")." 94 msgstr "" 95 "Sposób, w jaki waluta pojawia się w wiadomości powiadomienia (tj. \"€\" " 96 "jeśli jest \"symbol\", \"EUR\", jeśli jest \"tekst\")." 97 98 #: admin/partials/dc-moafw-admin-display.php:83 79 99 msgid "Show message in the shop" 80 100 msgstr "Pokaż wiadomość w sklepie" 81 101 82 #: admin/partials/dc-moafw-admin-display.php: 75102 #: admin/partials/dc-moafw-admin-display.php:87 83 103 msgid "Enable" 84 104 msgstr "Włącz" 85 105 86 #: admin/partials/dc-moafw-admin-display.php: 76106 #: admin/partials/dc-moafw-admin-display.php:88 87 107 msgid "" 88 108 "Enable this option to show the notification message also in the shop pages. " -
minimum-order-amount-for-woocommerce/trunk/languages/dc-moafw.pot
r1612768 r1795770 3 3 msgstr "" 4 4 "Project-Id-Version: Minimum Order Amount for Woocommerce\n" 5 "POT-Creation-Date: 201 7-03-11 13:30+0100\n"5 "POT-Creation-Date: 2018-01-02 13:18+0100\n" 6 6 "PO-Revision-Date: 2017-01-07 19:04+0100\n" 7 7 "Last-Translator: \n" … … 11 11 "Content-Type: text/plain; charset=UTF-8\n" 12 12 "Content-Transfer-Encoding: 8bit\n" 13 "X-Generator: Poedit 1.8.11\n"13 "X-Generator: Poedit 2.0.5\n" 14 14 "X-Poedit-Basepath: ..\n" 15 15 "Plural-Forms: nplurals=2; plural=(n != 1);\n" … … 18 18 "X-Poedit-SearchPath-0: .\n" 19 19 20 #: admin/class-dc-moafw-admin.php:14 120 #: admin/class-dc-moafw-admin.php:142 21 21 msgid "" 22 22 "Minimum Order Amount for Woocommerce is active but does not work. You need " … … 70 70 71 71 #: admin/partials/dc-moafw-admin-display.php:71 72 msgid "Currency Display Type" 73 msgstr "" 74 75 #: admin/partials/dc-moafw-admin-display.php:75 76 msgid "Symbol" 77 msgstr "" 78 79 #: admin/partials/dc-moafw-admin-display.php:76 80 msgid "Text" 81 msgstr "" 82 83 #: admin/partials/dc-moafw-admin-display.php:78 84 msgid "" 85 "The way the currency appears in the notification message (i.e. \"€\" if " 86 "is \"symbol\", \"EUR\" if is \"text\")." 87 msgstr "" 88 89 #: admin/partials/dc-moafw-admin-display.php:83 72 90 msgid "Show message in the shop" 73 91 msgstr "" 74 92 75 #: admin/partials/dc-moafw-admin-display.php: 7593 #: admin/partials/dc-moafw-admin-display.php:87 76 94 msgid "Enable" 77 95 msgstr "" 78 96 79 #: admin/partials/dc-moafw-admin-display.php: 7697 #: admin/partials/dc-moafw-admin-display.php:88 80 98 msgid "" 81 99 "Enable this option to show the notification message also in the shop pages. " -
minimum-order-amount-for-woocommerce/trunk/public/class-dc-moafw-public.php
r1612768 r1795770 104 104 * Set a minimum dollar amount per order 105 105 * 106 * @since 1. 2.0106 * @since 1.3.0 107 107 */ 108 108 public function dc_moafw_set_minimum_order() { 109 109 global $woocommerce; 110 $flag = false; 111 112 if ( in_array( 'polylang/polylang.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && function_exists('pll__') ) { 113 $message = str_replace('[minimum]', '%s %s', pll__(get_option('dc_moafw_message'))); 114 $current_cart_text = str_replace('[current]', '%s %s', pll__(get_option('dc_moafw_current_total_text'))); 115 } 116 else { 117 $message = str_replace('[minimum]', '%s %s', get_option('dc_moafw_message')); 118 $current_cart_text = str_replace('[current]', '%s %s', get_option('dc_moafw_current_total_text')); 119 } 120 121 if ( in_array( 'woocommerce-product-price-based-on-countries/woocommerce-product-price-based-on-countries.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { 122 $wcpbc_values = new WCPBC_Customer(); 123 if ( $wcpbc_values->zone_id ) { 124 $flag = true; 125 } 126 } 110 $wcpbc_values = new WCPBC_Customer(); 111 $wcpbc_currency_active = $this->dc_moafw_wcpbc_currency_is_active($wcpbc_values); 112 113 $message = $this->dc_moafw_get_message(); 114 $current_cart_text = $this->dc_moafw_get_current_cart_text(); 127 115 128 116 // Total we are going to be using for the Math 129 117 // This is before taxes and shipping charges 130 118 $total = round(WC()->cart->subtotal, 2); 131 119 //print_r(WC()->cart->subtotal_ex_tax); 132 120 if( is_cart() || is_checkout() ) { 133 if($ flag) {121 if($wcpbc_currency_active) { 134 122 // Set minimum cart total 135 123 $minimum_cart_total = get_option('dc_moafw_minimum') * $wcpbc_values->exchange_rate; … … 139 127 wc_add_notice( sprintf( '<strong>'.$message.'</strong>' 140 128 .'<br />'.$current_cart_text, 141 $minimum_cart_total,142 $ wcpbc_values->currency,143 $total,144 $ wcpbc_values->currency),129 number_format($minimum_cart_total, 2, ',', '.'), 130 $this->dc_moafw_get_currency_display_type($wcpbc_values), 131 number_format($total, 2, ',', '.'), 132 $this->dc_moafw_get_currency_display_type($wcpbc_values) ), 145 133 'error' ); 146 134 } … … 154 142 wc_add_notice( sprintf( '<strong>'.$message.'</strong>' 155 143 .'<br />'.$current_cart_text, 156 $minimum_cart_total,157 get_option( 'woocommerce_currency'),158 $total,159 get_option( 'woocommerce_currency') ),144 number_format($minimum_cart_total, 2, ',', '.'), 145 $this->dc_moafw_get_currency_display_type($wcpbc_values), 146 number_format($total, 2, ',', '.'), 147 $this->dc_moafw_get_currency_display_type($wcpbc_values) ), 160 148 'error' ); 161 149 } … … 163 151 } 164 152 elseif(get_option( 'dc_moafw_message_shop' ) && $total) { 165 if($ flag) {153 if($wcpbc_currency_active) { 166 154 // Set minimum cart total 167 155 $minimum_cart_total = get_option('dc_moafw_minimum') * $wcpbc_values->exchange_rate; … … 170 158 // Display our error message 171 159 wc_add_notice( sprintf( '<strong>'.$message.'</strong>', 172 $minimum_cart_total,173 $ wcpbc_values->currency),160 number_format($minimum_cart_total, 2, ',', '.'), 161 $this->dc_moafw_get_currency_display_type($wcpbc_values)), 174 162 'error' ); 175 163 } … … 182 170 // Display our error message 183 171 wc_add_notice( sprintf( '<strong>'.$message.'</strong>', 184 $minimum_cart_total,185 get_option( 'woocommerce_currency') ),172 number_format($minimum_cart_total, 2, ',', '.'), 173 $this->dc_moafw_get_currency_display_type($wcpbc_values) ), 186 174 'error' ); 187 175 } … … 190 178 } 191 179 180 /** 181 * Check if woocommerce-product-price-based-on-countries is active and have a currency 182 * 183 * @since 1.3.0 184 */ 185 public function dc_moafw_wcpbc_currency_is_active($wcpbc_values) { 186 if ( in_array( 'woocommerce-product-price-based-on-countries/woocommerce-product-price-based-on-countries.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { 187 if ( $wcpbc_values->zone_id ) { 188 return true; 189 } 190 191 return false; 192 } 193 194 return false; 195 } 196 197 /** 198 * Get a currency display type 199 * 200 * @since 1.3.0 201 */ 202 public function dc_moafw_get_currency_display_type($wcpbc_values) { 203 if(get_option('dc_moafw_currency_display_type') != "symbol") { 204 if($this->dc_moafw_wcpbc_currency_is_active($wcpbc_values)) { 205 return $wcpbc_values->currency; 206 } 207 208 return get_option( 'woocommerce_currency'); 209 } 210 211 return get_woocommerce_currency_symbol(); 212 } 213 214 /** 215 * Get a message 216 * 217 * @since 1.3.0 218 */ 219 public function dc_moafw_get_message() { 220 if ( in_array( 'polylang/polylang.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && function_exists('pll__') ) { 221 return str_replace('[minimum]', '%s %s', pll__(get_option('dc_moafw_message'))); 222 223 } 224 225 return str_replace('[minimum]', '%s %s', get_option('dc_moafw_message')); 226 } 227 228 /** 229 * Get a current cart text 230 * 231 * @since 1.3.0 232 */ 233 public function dc_moafw_get_current_cart_text() { 234 if ( in_array( 'polylang/polylang.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && function_exists('pll__') ) { 235 return str_replace('[current]', '%s %s', pll__(get_option('dc_moafw_current_total_text'))); 236 } 237 return str_replace('[current]', '%s %s', get_option('dc_moafw_current_total_text')); 238 } 239 192 240 } -
minimum-order-amount-for-woocommerce/trunk/uninstall.php
r1507445 r1795770 21 21 * 22 22 * @link https://github.com/dcurasi 23 * @since 1. 0.023 * @since 1.3.0 24 24 * 25 25 * @package Dc_Moafw … … 28 28 // If uninstall not called from WordPress, then exit. 29 29 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 30 delete_option('dc_moafw_activate'); 31 delete_option('dc_moafw_minimum'); 32 delete_option('dc_moafw_message'); 33 delete_option('dc_moafw_current_total_text'); 34 delete_option('dc_moafw_currency_display_type'); 35 delete_option('dc_moafw_message_shop'); 30 36 exit; 31 37 }
Note: See TracChangeset
for help on using the changeset viewer.