Changeset 875432
- Timestamp:
- 03/14/2014 01:49:37 PM (12 years ago)
- Location:
- woocommerce-prices/trunk
- Files:
-
- 1 added
- 4 edited
-
accounting.min.js (added)
-
languages/woocommerce-prices.pot (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
script.js (modified) (7 diffs)
-
woocommerce-prices.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-prices/trunk/languages/woocommerce-prices.pot
r795157 r875432 2 2 msgstr "" 3 3 "Project-Id-Version: WooCommerce Prices\n" 4 "POT-Creation-Date: 201 3-10-29 17:00+1000\n"5 "PO-Revision-Date: 201 3-10-29 17:03+1000\n"4 "POT-Creation-Date: 2014-03-15 00:44+1000\n" 5 "PO-Revision-Date: 2014-03-15 00:44+1000\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 11 11 "X-Generator: Poedit 1.5.5\n" 12 12 "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n" 13 "X-Poedit-Basepath: .\n" 14 "X-Poedit-SearchPath-0: ..\n" 13 15 14 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:1516 #: ../template.php:15 15 17 msgid "WooCommerce Prices" 16 18 msgstr "" 17 19 18 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:2920 #: ../template.php:29 19 21 msgid "Action" 20 22 msgstr "" 21 23 22 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3124 #: ../template.php:31 23 25 msgid "Regular Price" 24 26 msgstr "" 25 27 26 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3228 #: ../template.php:32 27 29 msgid "New Regular Price" 28 30 msgstr "" 29 31 30 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3332 #: ../template.php:33 31 33 msgid "Increase Regular Price" 32 34 msgstr "" 33 35 34 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3436 #: ../template.php:34 35 37 msgid "Decrease Regular Price" 36 38 msgstr "" 37 39 38 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3640 #: ../template.php:36 39 41 msgid "Sale Price" 40 42 msgstr "" 41 43 42 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3744 #: ../template.php:37 43 45 msgid "New Sale Price" 44 46 msgstr "" 45 47 46 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3848 #: ../template.php:38 47 49 msgid "New Sale Discount" 48 50 msgstr "" 49 51 50 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:3952 #: ../template.php:39 51 53 msgid "Increase Sale Price" 52 54 msgstr "" 53 55 54 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:4056 #: ../template.php:40 55 57 msgid "Decrease Sale Price" 56 58 msgstr "" 57 59 58 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:42 59 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:63 60 #: ../template.php:42 ../template.php:63 60 61 msgid "Sale From" 61 62 msgstr "" 62 63 63 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:4364 #: ../template.php:43 64 65 msgid "New Sale From" 65 66 msgstr "" 66 67 67 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:4468 #: ../template.php:44 68 69 msgid "Increase Sale From" 69 70 msgstr "" 70 71 71 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:4572 #: ../template.php:45 72 73 msgid "Decrease Sale From" 73 74 msgstr "" 74 75 75 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:47 76 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:67 76 #: ../template.php:47 ../template.php:67 77 77 msgid "Sale To" 78 78 msgstr "" 79 79 80 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:4880 #: ../template.php:48 81 81 msgid "New Sale To" 82 82 msgstr "" 83 83 84 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:4984 #: ../template.php:49 85 85 msgid "Increase Sale To" 86 86 msgstr "" 87 87 88 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:5088 #: ../template.php:50 89 89 msgid "Decrease Sale To" 90 90 msgstr "" 91 91 92 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:5592 #: ../template.php:55 93 93 msgid "Value" 94 94 msgstr "" 95 95 96 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:5696 #: ../template.php:56 97 97 msgid "Enter amount or percentage" 98 98 msgstr "" 99 99 100 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:59100 #: ../template.php:59 101 101 msgid "Days" 102 102 msgstr "" 103 103 104 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:60104 #: ../template.php:60 105 105 msgid "Enter number of days" 106 106 msgstr "" 107 107 108 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:74108 #: ../template.php:74 109 109 msgid "Category" 110 110 msgstr "" 111 111 112 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:87112 #: ../template.php:87 113 113 msgid "OR" 114 114 msgstr "" 115 115 116 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:89116 #: ../template.php:89 117 117 msgid "Taxonomy" 118 118 msgstr "" 119 119 120 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:95120 #: ../template.php:95 121 121 msgid "Term" 122 122 msgstr "" 123 123 124 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:103124 #: ../template.php:103 125 125 msgid "Edit Prices" 126 126 msgstr "" 127 127 128 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:104128 #: ../template.php:104 129 129 msgid "Get Prices" 130 130 msgstr "" 131 131 132 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:105132 #: ../template.php:105 133 133 msgid "Save Prices" 134 134 msgstr "" 135 135 136 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:106136 #: ../template.php:106 137 137 msgid "Saving products" 138 138 msgstr "" 139 139 140 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:107140 #: ../template.php:107 141 141 msgid "Products saved" 142 142 msgstr "" 143 143 144 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/template.php:113144 #: ../template.php:113 145 145 msgid "Loading Products" 146 146 msgstr "" 147 147 148 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/woocommerce-prices.php:94148 #: ../woocommerce-prices.php:94 149 149 msgid "You do not have sufficient permissions to access this page." 150 150 msgstr "" 151 151 152 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/woocommerce-prices.php:172 153 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/woocommerce-prices.php:218 154 #: C:\xampp\htdocs\wordpress52\wp-content\plugins\woocommerce-prices/woocommerce-prices.php:306 152 #: ../woocommerce-prices.php:180 ../woocommerce-prices.php:206 153 #: ../woocommerce-prices.php:298 155 154 msgid "Security check failed" 156 155 msgstr "" 156 157 #: ../woocommerce-prices.php:202 ../woocommerce-prices.php:294 158 msgid "WooCommerce Prices requires WooCommerce" 159 msgstr "" -
woocommerce-prices/trunk/readme.txt
r795175 r875432 4 4 Tags: woocommerce, e-commerce, ecommerce, shop, shopping, store, prices, sales, edit, editor, manage 5 5 Requires at least: 3.3 6 Tested up to: 3. 77 Stable tag: 1.0. 06 Tested up to: 3.8.1 7 Stable tag: 1.0.1 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 83 83 == Changelog == 84 84 85 = 1.0.1 = 86 * Fixed currency format bug 87 85 88 = 1.0.0 = 86 89 * First release -
woocommerce-prices/trunk/script.js
r795157 r875432 204 204 var value = $('#action-value').val(); 205 205 var amount = getAmountValue(value); 206 var percent = getPercentValue(value); 206 var percent = getPercentValue(value); 207 207 var selected = grid.getSelectedRows(); 208 208 var products = grid.getData(); … … 213 213 return; 214 214 } 215 var regular = parseFloat(products[i].regular_price);215 var regular = accounting.unformat(products[i].regular_price, wooPrices.decimalSeparator); 216 216 switch (action) { 217 217 // New regular price … … 243 243 break; 244 244 } 245 products[i].regular_price = Number(regular).toFixed(2);245 products[i].regular_price = accounting.formatMoney(regular, '', 2, '', wooPrices.decimalSeparator); 246 246 }); 247 247 grid.setData(products); … … 266 266 return; 267 267 } 268 var regular = parseFloat(products[i].regular_price);269 var sale = parseFloat(products[i].sale_price);268 var regular = accounting.unformat(products[i].regular_price, wooPrices.decimalSeparator); 269 var sale = accounting.unformat(products[i].sale_price, wooPrices.decimalSeparator); 270 270 var from = products[i].sale_from; 271 271 var to = products[i].sale_to; … … 326 326 sale = 0; 327 327 } 328 products[i].sale_price = Number(sale).toFixed(2);328 products[i].sale_price = accounting.formatMoney(sale, '', 2, '', wooPrices.decimalSeparator); 329 329 products[i].sale_from = from; 330 330 products[i].sale_to = to; … … 434 434 var amount = false; 435 435 if (value.indexOf('%') == -1) { 436 amount = parseFloat(value.replace('%', '')); 436 amount = value.replace('%', ''); 437 amount = accounting.unformat(amount, wooPrices.decimalSeparator); 437 438 } 438 439 return amount; … … 445 446 var percent = false; 446 447 if (value.indexOf('%') > 0) { 447 percent = parseFloat(value.replace('%', '')); 448 percent = value.replace('%', ''); 449 percent = accounting.unformat(percent, wooPrices.decimalSeparator); 448 450 } 449 451 return percent; -
woocommerce-prices/trunk/woocommerce-prices.php
r795157 r875432 4 4 Plugin Name: WooCommerce Prices 5 5 Description: This plugin allows for custom editing of product prices in WooCommerce. Thanks to Anthony for sponsoring this plugin. 6 Version: 1.0. 06 Version: 1.0.1 7 7 Author: sydcode 8 8 Author URI: http://profiles.wordpress.org/sydcode … … 32 32 33 33 protected static $instance = null; 34 const PLUGIN_VERSION = '1.0. 0';34 const PLUGIN_VERSION = '1.0.1'; 35 35 const PLUGIN_SLUG = 'woocommerce_prices'; 36 36 … … 133 133 $url = plugins_url('/smoothness/jquery-ui-1.10.3.custom.min.css', __FILE__); 134 134 wp_enqueue_style('jquery-smoothness', $url, array(), '1.10.3'); 135 // Accounting.JS script 136 $url = plugins_url('accounting.min.js', __FILE__); 137 wp_enqueue_script('accounting-js', $url, array(), '0.3.2'); 138 // Plugin stylesheet and script 135 139 $url = plugins_url('style.css', __FILE__); 136 140 wp_enqueue_style(self::PLUGIN_SLUG, $url, array(), self::PLUGIN_VERSION); … … 141 145 'jquery-ui-datepicker', 142 146 'jquery-slickgrid-core', 143 'jquery-slickgrid-grid' 147 'jquery-slickgrid-grid', 148 'accounting-js' 144 149 ); 145 150 wp_enqueue_script(self::PLUGIN_SLUG, $url, $args, self::PLUGIN_VERSION); 146 $url = plugins_url('', __FILE__); 147 wp_localize_script(self::PLUGIN_SLUG, 'wooPrices', array('pluginURL' => $url)); 151 $data = array( 152 'pluginURL' => plugins_url('', __FILE__), 153 'decimalSeparator' => get_option('woocommerce_price_decimal_sep') 154 ); 155 wp_localize_script(self::PLUGIN_SLUG, 'wooPrices', $data); 148 156 } 149 157 … … 185 193 186 194 /** 187 * Parse value to get amount188 */189 public function parse_value_amount($value) {190 $amount = '';191 if (strpos($value, '%') === false) {192 $value = preg_replace('/^[^0-9\.]/', '', $value);193 $amount = floatval($value);194 }195 return $amount;196 }197 198 /**199 * Parse value to get percentage200 */201 public function parse_value_percent($value) {202 $percent = '';203 if (strpos($value, '%') === true) {204 $value = str_replace('%', '', $value);205 $percent = floatval($value);206 }207 return $percent;208 }209 210 /**211 195 * Get product data for grid 212 196 * … … 214 198 */ 215 199 public function get_products() { 200 // Check that WooCommerce is active 201 if (!function_exists('wc_format_localized_price')) { 202 wp_die(__('WooCommerce Prices requires WooCommerce', 'woocommerce_prices')); 203 } 216 204 // Security check 217 205 if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'wooprices')) { … … 268 256 $regular_price = get_post_meta($post->ID, '_regular_price', true); 269 257 if ('' != $regular_price) { 270 $regular_price = number_format(floatval($regular_price), 2);258 $regular_price = wc_format_localized_price($regular_price); 271 259 } 272 260 $sale_price = get_post_meta($post->ID, '_sale_price', true); 273 261 if ('' != $sale_price) { 274 $sale_price = number_format(floatval($sale_price), 2);262 $sale_price = wc_format_localized_price($sale_price); 275 263 } 276 264 // Get sale dates … … 301 289 * Save grid data to products 302 290 */ 303 public function save_products() { 291 public function save_products() { 292 // Check that WooCommerce is active 293 if (!function_exists('wc_format_decimal')) { 294 wp_die(__('WooCommerce Prices requires WooCommerce', 'woocommerce_prices')); 295 } 304 296 // Security check 305 297 if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'wooprices')) { … … 310 302 foreach ($products as $product) { 311 303 $ID = $product['ID']; 312 $regular_price = $product['regular_price'];313 $sale_price = $product['sale_price'];304 $regular_price = wc_format_decimal($product['regular_price']); 305 $sale_price = wc_format_decimal($product['sale_price']); 314 306 $sale_from = strtotime($product['sale_from']); 315 307 $sale_to = strtotime($product['sale_to']);
Note: See TracChangeset
for help on using the changeset viewer.