WooCommerce Sequential Order Numbers - Version 1.7.0

Version Description

  • 2016.05.24 =
  • Misc - Added support for WooCommerce 2.6
  • Misc - Removed support for WooCommerce 2.3
Download this release

Release Info

Developer SkyVerge
Plugin Icon WooCommerce Sequential Order Numbers
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.1 to 1.7.0

i18n/languages/woocommerce-sequential-order-numbers.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Sequential Order Numbers 1.6.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/skyverge/woocommerce-sequential-order-numbers/issues\n"
8
  "POT-Creation-Date: 2014-09-05 22:27:38+00:00\n"
@@ -13,14 +13,24 @@ msgstr ""
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
- #: woocommerce-sequential-order-numbers.php:458
 
 
 
 
 
 
 
 
 
 
17
  #. Translators: %s - error message(s)
18
  msgid ""
19
  "Error activating and installing <strong>WooCommerce Sequential Order "
20
  "Numbers</strong>: %s"
21
  msgstr ""
22
 
23
- #: woocommerce-sequential-order-numbers.php:459
24
  msgid "&laquo; Go Back"
25
  msgstr ""
26
 
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Sequential Order Numbers 1.7.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://github.com/skyverge/woocommerce-sequential-order-numbers/issues\n"
8
  "POT-Creation-Date: 2014-09-05 22:27:38+00:00\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
+ #: woocommerce-sequential-order-numbers.php:67
17
+ #. translators: Placeholders: %s - plugin name
18
+ msgid "You cannot clone instances of %s."
19
+ msgstr ""
20
+
21
+ #: woocommerce-sequential-order-numbers.php:79
22
+ #. translators: Placeholders: %s - plugin name
23
+ msgid "You cannot unserialize instances of %s."
24
+ msgstr ""
25
+
26
+ #: woocommerce-sequential-order-numbers.php:493
27
  #. Translators: %s - error message(s)
28
  msgid ""
29
  "Error activating and installing <strong>WooCommerce Sequential Order "
30
  "Numbers</strong>: %s"
31
  msgstr ""
32
 
33
+ #: woocommerce-sequential-order-numbers.php:494
34
  msgid "&laquo; Go Back"
35
  msgstr ""
36
 
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WooCommerce Sequential Order Numbers ===
2
  Contributors: SkyVerge, maxrice, tamarazuk, chasewiseman, nekojira
3
  Tags: woocommerce, order number
4
- Requires at least: 4.0
5
- Tested up to: 4.4.2
6
- Requires WooCommerce at least: 2.3
7
- Tested WooCommerce up to: 2.5
8
- Stable tag: 1.6.1
9
 
10
  This plugin extends WooCommerce by setting sequential order numbers for new orders.
11
 
@@ -13,18 +13,21 @@ This plugin extends WooCommerce by setting sequential order numbers for new orde
13
 
14
  This plugin extends WooCommerce by automatically setting sequential order numbers for new orders. If there are existing orders at the time of installation, the sequential order numbers will start with the highest current order number.
15
 
16
- **This plugin requires WooCommerce 2.1 or newer.**
17
 
18
  > No configuration needed! The plugin is so easy to use, there aren't even any settings. Activate it, and orders will automatically become sequential.
19
 
20
- If you like this plugin, but are looking for the ability to set the starting number, or to add a custom prefix/suffix to your order numbers (ie, you'd prefer something like WT101UK, WT102UK, etc) please consider our premium WooCommerce Sequential Order Numbers Pro plugin, which is available in the [WooThemes Store](http://www.woothemes.com/products/sequential-order-numbers-pro/).
21
 
22
- = Feedback =
23
- * We are open to your suggestions and feedback - Thank you for using or trying out one of our plugins!
24
- * Drop us a line at [www.skyverge.com](http://www.skyverge.com)
25
 
26
  = Support Details =
27
- We do support our free plugins and extensions, but please understand that support for premium products takes priority. We typically check the forums every few days (with a maximum delay of one week).
 
 
 
 
 
28
 
29
  = More Details =
30
  - See the [product page](http://www.skyverge.com/product/woocommerce-sequential-order-numbers/) for full details.
@@ -32,28 +35,78 @@ We do support our free plugins and extensions, but please understand that suppor
32
  - View more of SkyVerge's [free WooCommerce extensions](http://profiles.wordpress.org/skyverge/)
33
  - View all [SkyVerge WooCommerce extensions](http://www.skyverge.com/shop/)
34
 
 
 
35
  == Installation ==
36
 
37
- 1. Upload the entire 'woocommerce-sequential-order-numbers' folder to the '/wp-content/plugins/' directory or upload the zip via Plugins &gt; Add New
38
- 2. Activate the plugin through the 'Plugins' menu in WordPress
39
- 3. No configuration needed! Order numbers will continue sequentially from the current highest order number, or from 1 if no orders have been placed yet
 
 
 
 
 
 
 
40
 
41
  == Frequently Asked Questions ==
42
 
43
  = Where are the settings? =
44
 
45
- The plugin doesn't require any :). When you activate it, it gets to work right away! Orders will automatically become sequential, starting from the most recent order number.
 
 
 
 
 
 
46
 
47
  = Can I start the order numbers at a particular number? =
48
 
49
  This free version does not have that functionality, but the premium [WooCommerce Sequential Order Numbers Pro](http://www.woothemes.com/products/sequential-order-numbers-pro/) will allow you to choose any starting number that's higher than your most current order number.
50
 
 
 
 
 
51
  = Can I set an order number prefix/suffix? =
52
 
53
  This free version does not have that functionality, but it's included in the premium [WooCommerce Sequential Order Numbers Pro](http://www.woothemes.com/products/sequential-order-numbers-pro/).
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  == Changelog ==
56
 
 
 
 
 
57
  = 1.6.1 - 2016.02.04 =
58
  * Misc - WooCommerce Subscriptions: Use new hook wcs_renewal_order_meta_query instead of deprecated woocommerce_subscriptions_renewal_order_meta_query
59
 
1
  === WooCommerce Sequential Order Numbers ===
2
  Contributors: SkyVerge, maxrice, tamarazuk, chasewiseman, nekojira
3
  Tags: woocommerce, order number
4
+ Requires at least: 4.1
5
+ Tested up to: 4.5.2
6
+ Requires WooCommerce at least: 2.4.13
7
+ Tested WooCommerce up to: 2.6.0
8
+ Stable tag: 1.7.0
9
 
10
  This plugin extends WooCommerce by setting sequential order numbers for new orders.
11
 
13
 
14
  This plugin extends WooCommerce by automatically setting sequential order numbers for new orders. If there are existing orders at the time of installation, the sequential order numbers will start with the highest current order number.
15
 
16
+ **This plugin requires WooCommerce 2.4.13 or newer.**
17
 
18
  > No configuration needed! The plugin is so easy to use, there aren't even any settings. Activate it, and orders will automatically become sequential.
19
 
20
+ If you have no orders in your store, your orders will begin counting from order number 1. If you have existing orders, the count will pick up from your highest order number.
21
 
22
+ If you've placed test orders, you must trash **and** permanently delete them to begin ordering at "1" (trashed orders have to be counted in case they're restored, so they need to be gone completely).
 
 
23
 
24
  = Support Details =
25
+
26
+ We do support our free plugins and extensions, but please understand that support for premium products takes priority. We typically check the forums every few days (usually with a maximum delay of one week).
27
+
28
+ = Sequential Order Numbers Pro =
29
+
30
+ If you like this plugin, but are looking for the ability to set the starting number, or to add a custom prefix/suffix to your order numbers (ie, you'd prefer something like WT101UK, WT102UK, etc) please consider our premium WooCommerce Sequential Order Numbers Pro plugin, which is available in the [WooThemes Store](http://www.woothemes.com/products/sequential-order-numbers-pro/).
31
 
32
  = More Details =
33
  - See the [product page](http://www.skyverge.com/product/woocommerce-sequential-order-numbers/) for full details.
35
  - View more of SkyVerge's [free WooCommerce extensions](http://profiles.wordpress.org/skyverge/)
36
  - View all [SkyVerge WooCommerce extensions](http://www.skyverge.com/shop/)
37
 
38
+ Interested in contributing? You can [find the project on GitHub](https://github.com/skyverge/woocommerce-sequential-order-numbers) and contributions are welcome :)
39
+
40
  == Installation ==
41
 
42
+ You can install the plugin in a few ways:
43
+
44
+ 1. Upload the entire 'woocommerce-sequential-order-numbers' folder to the '/wp-content/plugins/' directory
45
+ 2. Upload the zip file you download via Plugins &gt; Add New
46
+ 3. Go to Plugins &gt; Add New and search for "WooCommerce Sequential Order Numbers", and install the one from SkyVerge.
47
+
48
+ Once you've installed the plugin, to get started please:
49
+
50
+ 1. Activate the plugin through the "Plugins" menu in WordPress.
51
+ 2. No configuration needed! Order numbers will continue sequentially from the current highest order number, or from 1 if no orders have been placed yet.
52
 
53
  == Frequently Asked Questions ==
54
 
55
  = Where are the settings? =
56
 
57
+ The plugin doesn't require any :) When you activate it, it gets to work right away! Orders will automatically become sequential, starting from the most recent order number.
58
+
59
+ = Why doesn't my payment gateway use this number? =
60
+
61
+ For full compatibility with extensions which alter the order number, such as Sequential Order Numbers, WooCommerce extensions should use `$order->get_order_number();` rather than `$order->id` when referencing the order number.
62
+
63
+ If your extension is not displaying the correct order number, you can try contacting the developers of your payment gateway to see if it's possible to make this tiny change. Using the order number instead is both compatible with WooCommerce core and our plugin, as without the order number being changed, it will be equal to the order ID.
64
 
65
  = Can I start the order numbers at a particular number? =
66
 
67
  This free version does not have that functionality, but the premium [WooCommerce Sequential Order Numbers Pro](http://www.woothemes.com/products/sequential-order-numbers-pro/) will allow you to choose any starting number that's higher than your most current order number.
68
 
69
+ = Can I start the order numbers at "1"? =
70
+
71
+ If you want to begin numbering at "1", you must trash, then permanently delete all orders in your store so that there are no order numbers already being counted.
72
+
73
  = Can I set an order number prefix/suffix? =
74
 
75
  This free version does not have that functionality, but it's included in the premium [WooCommerce Sequential Order Numbers Pro](http://www.woothemes.com/products/sequential-order-numbers-pro/).
76
 
77
+ == Other Notes ==
78
+
79
+ If you'd like to make your payment gateway compatible with Sequential Order Numbers, or other plugins that filter the order number, please make one small change. Instead of referencing `$order->id` when storing order data, reference: `$order->get_order_number()`
80
+
81
+ This is compatible with WooCommerce core by default, as the order number is typically equal to the order ID. However, this will also let you be compatible with plugins such as ours, as the order number can be filtered (which is what we do to make it sequential), so using order number is preferred.
82
+
83
+ Some other notes to help developers:
84
+
85
+ = Get an order from order number =
86
+
87
+ If you want to access the order based on the sequential order number, you can do so with a helper method:
88
+
89
+ `
90
+ $order_id = wc_sequential_order_numbers()->find_order_by_order_number( $order_number );
91
+ `
92
+
93
+ This will give you the order's ID (post ID), and you can get the order object from this.
94
+
95
+ = Get the order number =
96
+
97
+ If you have access to the order ID or order object, you can easily get the sequential order number based on WooCommerce core functions.
98
+
99
+ `
100
+ $order = wc_get_order( $order_id );
101
+ $order_number = $order->get_order_number();
102
+ `
103
+
104
  == Changelog ==
105
 
106
+ = 1.7.0 - 2016.05.24 =
107
+ * Misc - Added support for WooCommerce 2.6
108
+ * Misc - Removed support for WooCommerce 2.3
109
+
110
  = 1.6.1 - 2016.02.04 =
111
  * Misc - WooCommerce Subscriptions: Use new hook wcs_renewal_order_meta_query instead of deprecated woocommerce_subscriptions_renewal_order_meta_query
112
 
woocommerce-sequential-order-numbers.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Provides sequential order numbers for WooCommerce orders
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
- * Version: 1.6.1
9
  * Text Domain: woocommerce-sequential-order-numbers
10
  * Domain Path: /i18n/languages/
11
  *
@@ -21,31 +21,27 @@
21
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
22
  */
23
 
24
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25
 
26
  // Check if WooCommerce is active
27
  if ( ! WC_Seq_Order_Number::is_woocommerce_active() ) {
28
  return;
29
  }
30
 
31
- /**
32
- * The WC_Seq_Order_Number global object
33
- * @name $wc_seq_order_number
34
- * @global WC_Seq_Order_Number $GLOBALS['wc_seq_order_number']
35
- */
36
- $GLOBALS['wc_seq_order_number'] = new WC_Seq_Order_Number();
37
-
38
  class WC_Seq_Order_Number {
39
 
40
 
41
  /** version number */
42
- const VERSION = '1.6.1';
 
 
 
43
 
44
  /** version option name */
45
  const VERSION_OPTION_NAME = 'woocommerce_seq_order_number_db_version';
46
 
47
  /** minimum required wc version */
48
- const MINIMUM_WC_VERSION = '2.3';
49
 
50
 
51
  /**
@@ -60,6 +56,30 @@ class WC_Seq_Order_Number {
60
  }
61
 
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  /**
64
  * Initialize the plugin, bailing if any required conditions are not met,
65
  * including minimum WooCommerce version
@@ -203,7 +223,7 @@ class WC_Seq_Order_Number {
203
  *
204
  * @param string $order_number the order id with a leading hash
205
  * @param WC_Order $order the order object
206
- * @return string custom order number, with leading hash for < WC 2.3
207
  */
208
  public function get_order_number( $order_number, $order ) {
209
 
@@ -335,6 +355,21 @@ class WC_Seq_Order_Number {
335
  /** Helper Methods ******************************************************/
336
 
337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  /**
339
  * Checks if WooCommerce is active
340
  *
@@ -368,24 +403,24 @@ class WC_Seq_Order_Number {
368
 
369
 
370
  /**
371
- * Returns true if the installed version of WooCommerce is 2.4 or greater
372
  *
373
  * @since 1.6.0
374
- * @return boolean true if the installed version of WooCommerce is 2.3 or greater
375
  */
376
- public static function is_wc_version_gte_2_4() {
377
- return self::get_wc_version() && version_compare( self::get_wc_version(), '2.4', '>=' );
378
  }
379
 
380
 
381
  /**
382
- * Returns true if the installed version of WooCommerce is 2.5 or greater
383
  *
384
- * @since 1.6.0
385
- * @return boolean true if the installed version of WooCommerce is 2.3 or greater
386
  */
387
- public static function is_wc_version_gte_2_5() {
388
- return self::get_wc_version() && version_compare( self::get_wc_version(), '2.5', '>=' );
389
  }
390
 
391
 
@@ -496,3 +531,23 @@ class WC_Seq_Order_Number {
496
 
497
 
498
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  * Description: Provides sequential order numbers for WooCommerce orders
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
+ * Version: 1.7.0
9
  * Text Domain: woocommerce-sequential-order-numbers
10
  * Domain Path: /i18n/languages/
11
  *
21
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
22
  */
23
 
24
+ defined( 'ABSPATH' ) or exit;
25
 
26
  // Check if WooCommerce is active
27
  if ( ! WC_Seq_Order_Number::is_woocommerce_active() ) {
28
  return;
29
  }
30
 
 
 
 
 
 
 
 
31
  class WC_Seq_Order_Number {
32
 
33
 
34
  /** version number */
35
+ const VERSION = '1.7.0';
36
+
37
+ /** @var \WC_Seq_Order_Number single instance of this plugin */
38
+ protected static $instance;
39
 
40
  /** version option name */
41
  const VERSION_OPTION_NAME = 'woocommerce_seq_order_number_db_version';
42
 
43
  /** minimum required wc version */
44
+ const MINIMUM_WC_VERSION = '2.4.13';
45
 
46
 
47
  /**
56
  }
57
 
58
 
59
+ /**
60
+ * Cloning instances is forbidden due to singleton pattern.
61
+ *
62
+ * @since 1.7.0
63
+ */
64
+ public function __clone() {
65
+
66
+ /* translators: Placeholders: %s - plugin name */
67
+ _doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'You cannot clone instances of %s.', 'woocommerce-sequential-order-numbers' ), 'WooCommerce Sequential Order Numbers' ), '1.7.0' );
68
+ }
69
+
70
+
71
+ /**
72
+ * Unserializing instances is forbidden due to singleton pattern.
73
+ *
74
+ * @since 1.7.0
75
+ */
76
+ public function __wakeup() {
77
+
78
+ /* translators: Placeholders: %s - plugin name */
79
+ _doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'You cannot unserialize instances of %s.', 'woocommerce-sequential-order-numbers' ), 'WooCommerce Sequential Order Numbers' ), '1.7.0' );
80
+ }
81
+
82
+
83
  /**
84
  * Initialize the plugin, bailing if any required conditions are not met,
85
  * including minimum WooCommerce version
223
  *
224
  * @param string $order_number the order id with a leading hash
225
  * @param WC_Order $order the order object
226
+ * @return string custom order number
227
  */
228
  public function get_order_number( $order_number, $order ) {
229
 
355
  /** Helper Methods ******************************************************/
356
 
357
 
358
+ /**
359
+ * Main Sequential Order Numbers Instance, ensures only one instance is/can be loaded
360
+ *
361
+ * @since 1.7.0
362
+ * @see wc_sequential_order_numbers()
363
+ * @return \WC_Seq_Order_Number
364
+ */
365
+ public static function instance() {
366
+ if ( is_null( self::$instance ) ) {
367
+ self::$instance = new self();
368
+ }
369
+ return self::$instance;
370
+ }
371
+
372
+
373
  /**
374
  * Checks if WooCommerce is active
375
  *
403
 
404
 
405
  /**
406
+ * Returns true if the installed version of WooCommerce is 2.5 or greater
407
  *
408
  * @since 1.6.0
409
+ * @return boolean true if the installed version of WooCommerce is 2.5 or greater
410
  */
411
+ public static function is_wc_version_gte_2_5() {
412
+ return self::get_wc_version() && version_compare( self::get_wc_version(), '2.5', '>=' );
413
  }
414
 
415
 
416
  /**
417
+ * Returns true if the installed version of WooCommerce is 2.6 or greater
418
  *
419
+ * @since 1.7.0
420
+ * @return boolean true if the installed version of WooCommerce is 2.6 or greater
421
  */
422
+ public static function is_wc_version_gte_2_6() {
423
+ return self::get_wc_version() && version_compare( self::get_wc_version(), '2.6', '>=' );
424
  }
425
 
426
 
531
 
532
 
533
  }
534
+
535
+
536
+ /**
537
+ * Returns the One True Instance of Sequential Order Numbers
538
+ *
539
+ * @since 1.7.0
540
+ * @return \WC_Seq_Order_Number
541
+ */
542
+ function wc_sequential_order_numbers() {
543
+ return WC_Seq_Order_Number::instance();
544
+ }
545
+
546
+
547
+ /**
548
+ * The WC_Seq_Order_Number global object
549
+ * @deprecated 1.7.0
550
+ * @name $wc_seq_order_number
551
+ * @global WC_Seq_Order_Number $GLOBALS['wc_seq_order_number']
552
+ */
553
+ $GLOBALS['wc_seq_order_number'] = wc_sequential_order_numbers();