Booster for WooCommerce - Version 1.0.5

Version Description

  • 18/06/2014 =
  • Feature - Order Numbers.
Download this release

Release Info

Developer algoritmika
Plugin Icon 128x128 Booster for WooCommerce
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

includes/class-wcj-add-to-cart.php CHANGED
@@ -180,7 +180,7 @@ class WCJ_Add_to_cart {
180
  */
181
  function settings_section( $sections ) {
182
 
183
- $sections['add_to_cart'] = 'Add to cart';
184
 
185
  return $sections;
186
  }
180
  */
181
  function settings_section( $sections ) {
182
 
183
+ $sections['add_to_cart'] = 'Add to Cart';
184
 
185
  return $sections;
186
  }
includes/class-wcj-old-slugs.php CHANGED
@@ -21,9 +21,11 @@ class WCJ_Old_Slugs {
21
  // HOOKS
22
 
23
  // Main hooks
24
- if ( get_option( 'wcj_old_slugs_enabled' ) == 'yes' ) {
 
25
  if ( is_admin() ) {
26
- add_action('admin_menu', array($this, 'add_old_slugs_tool'), 999);
 
27
  }
28
  }
29
 
21
  // HOOKS
22
 
23
  // Main hooks
24
+ if ( get_option( 'wcj_old_slugs_enabled' ) == 'yes' ) {
25
+
26
  if ( is_admin() ) {
27
+
28
+ add_action( 'admin_menu', array($this, 'add_old_slugs_tool'), 999 ); // Add Remove Old Slugs tool to WooCommerce menu
29
  }
30
  }
31
 
includes/class-wcj-order-numbers.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack Order Numbers
4
+ *
5
+ * The WooCommerce Jetpack Order Numbers class.
6
+ *
7
+ * @class WCJ_Order_Numbers
8
+ */
9
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
+
11
+ if ( ! class_exists( 'WCJ_Order_Numbers' ) ) :
12
+
13
+ class WCJ_Order_Numbers {
14
+
15
+ /**
16
+ * Constructor.
17
+ */
18
+ public function __construct() {
19
+
20
+ // Main hooks
21
+ if ( get_option( 'wcj_order_numbers_enabled' ) == 'yes' ) {
22
+
23
+ add_action( 'woocommerce_new_order', array( $this, 'add_order_number_meta' ), 100 );
24
+ add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), 100, 2 );
25
+ }
26
+ add_action( 'admin_menu', array($this, 'add_renumerate_orders_tool'), 100 );
27
+
28
+ // Settings hooks
29
+ add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
30
+ add_filter( 'wcj_settings_order_numbers', array( $this, 'get_settings' ), 100 );
31
+ add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
32
+ }
33
+
34
+ /**
35
+ * Add Renumerate Orders tool to WooCommerce menu (menu link).
36
+ */
37
+ public function add_renumerate_orders_tool() {
38
+
39
+ add_submenu_page( 'woocommerce', 'Jetpack - Renumerate Orders', 'Renumerate Orders', 'manage_options', 'woocommerce-jetpack--renumerate-orders', array( $this, 'create_renumerate_orders_tool' ) );
40
+ }
41
+
42
+ /**
43
+ * Add Renumerate Orders tool to WooCommerce menu (the content).
44
+ */
45
+ public function create_renumerate_orders_tool() {
46
+
47
+ $result_message = '';
48
+ if ( isset( $_POST['renumerate_orders'] ) ) {
49
+
50
+ $this->renumerate_orders();
51
+ $result_message = '<div class="updated"><p><strong>Orders successfully renumerated!</p></div>';
52
+ }
53
+ ?>
54
+
55
+ <?php echo $result_message; ?>
56
+ <div>
57
+ <h2>WooCommerce Jetpack - Renumerate Orders</h2>
58
+ <p>The tool renumerates all orders. Press the button below to renumerate all existing orders starting from order counter settings in WooCommerce > Settings > Jetpack > Order Numbers.</p>
59
+ <form method="post" action="">
60
+ <input type="submit" name="renumerate_orders" value="Renumerate orders">
61
+ </form>
62
+ </div>
63
+ <?php
64
+ }
65
+
66
+ /**
67
+ * Add/update order_number meta to order.
68
+ */
69
+ public function add_order_number_meta( $order_id ) {
70
+
71
+ $current_order_number = get_option( 'wcj_order_number_counter' );
72
+ update_option( 'wcj_order_number_counter', ( $current_order_number + 1 ) );
73
+ //add_post_meta( $order_id, '_wcj_order_number', $current_order_number );
74
+ update_post_meta( $order_id, '_wcj_order_number', $current_order_number );
75
+ }
76
+
77
+ /**
78
+ * Display order number.
79
+ */
80
+ public function display_order_number( $order_number, $order ) {
81
+
82
+ $order_number_meta = get_post_meta( $order->id, '_wcj_order_number', true );
83
+ if ( $order_number_meta != '' )
84
+ $order_number = '#' . $order_number_meta;
85
+
86
+ return $order_number;
87
+ }
88
+
89
+ /**
90
+ * Renumerate orders function.
91
+ */
92
+ public function renumerate_orders() {
93
+
94
+ $args = array(
95
+ 'post_type' => 'shop_order',
96
+ 'post_status' => 'publish',
97
+ 'posts_per_page' => -1,
98
+ 'orderby' => 'date',
99
+ 'order' => 'ASC',
100
+ );
101
+
102
+ $loop = new WP_Query( $args );
103
+
104
+ while ( $loop->have_posts() ) : $loop->the_post();
105
+
106
+ $order_id = $loop->post->ID;
107
+ $this->add_order_number_meta( $order_id );
108
+
109
+ endwhile;
110
+ }
111
+
112
+ /**
113
+ * Add Enabled option to Jetpack Dashboard.
114
+ */
115
+ public function add_enabled_option( $settings ) {
116
+
117
+ $all_settings = $this->get_settings();
118
+ $settings[] = $all_settings[1];
119
+
120
+ return $settings;
121
+ }
122
+
123
+ /**
124
+ * Add settings arrays to Jetpack Settings.
125
+ */
126
+ function get_settings() {
127
+
128
+ $settings = array(
129
+
130
+ array( 'title' => __( 'Order Numbers Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'Order Numbers.', 'woocommerce-jetpack' ), 'id' => 'wcj_order_numbers_options' ),
131
+
132
+ array(
133
+ 'title' => __( 'Order Numbers', 'woocommerce-jetpack' ),
134
+ 'desc' => __( 'Enable the Order Numbers feature', 'woocommerce-jetpack' ),
135
+ 'desc_tip' => __( 'Sequential order numbering. Custom order number prefix and number width.', 'woocommerce-jetpack' ),
136
+ 'id' => 'wcj_order_numbers_enabled',
137
+ 'default' => 'no',
138
+ 'type' => 'checkbox',
139
+ ),
140
+
141
+ array(
142
+ 'title' => __( 'Next Order Number', 'woocommerce-jetpack' ),
143
+ 'desc' => __( 'Next new order will be given this number.', 'woocommerce-jetpack' ),
144
+ //'desc_tip' => __( 'Order Numbers.', 'woocommerce-jetpack' ),
145
+ 'id' => 'wcj_order_number_counter',
146
+ 'default' => 1,
147
+ 'type' => 'number',
148
+ ),
149
+
150
+ array(
151
+ 'title' => __( 'Order Number Prefix', 'woocommerce-jetpack' ),
152
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
153
+ 'desc_tip' => __( 'Prefix before order number (optional). This will change the prefixes for all existing orders.', 'woocommerce-jetpack' ),
154
+ 'id' => 'wcj_order_number_prefix',
155
+ 'default' => '#',
156
+ 'type' => 'text',
157
+ 'custom_attributes'
158
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
159
+ ),
160
+
161
+ array(
162
+ 'title' => __( 'Order Number Width', 'woocommerce-jetpack' ),
163
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
164
+ 'desc_tip' => __( 'Minimum width of number without prefix (zeros will be added to the left side). This will change the minimum width of order number for all existing orders. E.g. set to 5 to have order number displayed as 00001 instead of 1. Leave zero to disable.', 'woocommerce-jetpack' ),
165
+ 'id' => 'wcj_order_number_min_width',
166
+ 'default' => 0,
167
+ 'type' => 'number',
168
+ 'custom_attributes'
169
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
170
+ ),
171
+
172
+ array( 'type' => 'sectionend', 'id' => 'wcj_order_numbers_options' ),
173
+ );
174
+
175
+ return $settings;
176
+ }
177
+
178
+ /**
179
+ * Add settings section to WooCommerce > Settings > Jetpack.
180
+ */
181
+ function settings_section( $sections ) {
182
+
183
+ $sections['order_numbers'] = 'Order Numbers';
184
+
185
+ return $sections;
186
+ }
187
+ }
188
+
189
+ endif;
190
+
191
+ return new WCJ_Order_Numbers();
includes/class-wcj-price-labels.php CHANGED
@@ -27,7 +27,11 @@ class WCJ_Price_Labels {
27
  // Custom Price Labels - cart item price hooks
28
  //add_filter( 'woocommerce_cart_item_price_html', array( $this, 'custom_price' ), 999, 2 ); // depreciated?
29
  //add_filter( 'woocommerce_cart_item_price', array( $this, 'custom_price' ), 999, 2 );
 
30
  // Custom Price Labels - price hooks
 
 
 
31
  add_filter( 'woocommerce_empty_price_html', array( $this, 'custom_price' ), 100, 2 );
32
  add_filter( 'woocommerce_free_price_html', array( $this, 'custom_price' ), 100, 2 );
33
  add_filter( 'woocommerce_free_sale_price_html', array( $this, 'custom_price' ), 100, 2 );
@@ -40,7 +44,7 @@ class WCJ_Price_Labels {
40
  add_filter( 'woocommerce_variable_free_price_html', array( $this, 'custom_price' ), 100, 2 );
41
  add_filter( 'woocommerce_variable_free_sale_price_html', array( $this, 'custom_price' ), 100, 2 );
42
  add_filter( 'woocommerce_variable_price_html', array( $this, 'custom_price' ), 100, 2 );
43
- add_filter( 'woocommerce_variable_sale_price_html', array( $this, 'custom_price' ), 100, 2 );
44
  // Custom Price Labels - price hooks
45
  add_filter( 'woocommerce_variation_empty_price_html', array( $this, 'custom_price' ), 100, 2 );
46
  add_filter( 'woocommerce_variation_free_price_html', array( $this, 'custom_price' ), 100, 2 );
@@ -74,6 +78,11 @@ class WCJ_Price_Labels {
74
  );
75
  }
76
 
 
 
 
 
 
77
  /**
78
  * add_enabled_option.
79
  */
27
  // Custom Price Labels - cart item price hooks
28
  //add_filter( 'woocommerce_cart_item_price_html', array( $this, 'custom_price' ), 999, 2 ); // depreciated?
29
  //add_filter( 'woocommerce_cart_item_price', array( $this, 'custom_price' ), 999, 2 );
30
+
31
  // Custom Price Labels - price hooks
32
+
33
+ //add_filter( 'woocommerce_get_price_html', array( $this, 'custom_price' ), 100, 2 );
34
+
35
  add_filter( 'woocommerce_empty_price_html', array( $this, 'custom_price' ), 100, 2 );
36
  add_filter( 'woocommerce_free_price_html', array( $this, 'custom_price' ), 100, 2 );
37
  add_filter( 'woocommerce_free_sale_price_html', array( $this, 'custom_price' ), 100, 2 );
44
  add_filter( 'woocommerce_variable_free_price_html', array( $this, 'custom_price' ), 100, 2 );
45
  add_filter( 'woocommerce_variable_free_sale_price_html', array( $this, 'custom_price' ), 100, 2 );
46
  add_filter( 'woocommerce_variable_price_html', array( $this, 'custom_price' ), 100, 2 );
47
+ add_filter( 'woocommerce_variable_sale_price_html', array( $this, 'custom_price' ), 100, 2 );
48
  // Custom Price Labels - price hooks
49
  add_filter( 'woocommerce_variation_empty_price_html', array( $this, 'custom_price' ), 100, 2 );
50
  add_filter( 'woocommerce_variation_free_price_html', array( $this, 'custom_price' ), 100, 2 );
78
  );
79
  }
80
 
81
+ /*public function custom_price1( $price, $product ) {
82
+ echo '[' . $price . ']';
83
+ return $price;
84
+ }*/
85
+
86
  /**
87
  * add_enabled_option.
88
  */
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Jetpack ===
2
  Contributors: algoritmika
3
  Donate link: http://algoritmika.com/donate/
4
- Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs
5
  Requires at least: 3.9.1
6
  Tested up to: 3.9.1
7
- Stable tag: 1.0.4
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -19,13 +19,15 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
19
  * Custom Price Labels - Create any custom price label for any product.
20
  * Call for Price - Create any custom price label, like "Call for price", for all products with empty price.
21
  * Currencies - Add all world currencies, change currency symbol.
 
22
  * More Sorting Options - Add more sorting options or remove sorting (including default) at all.
23
- * Buttons - Change text for add to cart buttons for each product type.
24
  * Old Slugs - Remove old product slugs.
25
 
26
  = Feedback =
27
- * We are open to your suggestions and feedback - Thank you for using or trying out one of our plugins!
28
- * Drop us a line at [www.woojetpack.com/contact-us/](http://woojetpack.com/contact-us/)
 
29
 
30
  = More =
31
  * Visit the [WooCommerce Jetpack plugin page](http://woojetpack.com/)
@@ -48,6 +50,9 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
48
 
49
  == Changelog ==
50
 
 
 
 
51
  = 1.0.4 - 15/06/2014 =
52
  * Fix - Add to cart text - on archives now calling the right function.
53
 
@@ -66,4 +71,4 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
66
  == Upgrade Notice ==
67
 
68
  = 1.0.0 =
69
- This is first release version of the plugin.
1
  === WooCommerce Jetpack ===
2
  Contributors: algoritmika
3
  Donate link: http://algoritmika.com/donate/
4
+ Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering
5
  Requires at least: 3.9.1
6
  Tested up to: 3.9.1
7
+ Stable tag: 1.0.5
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
19
  * Custom Price Labels - Create any custom price label for any product.
20
  * Call for Price - Create any custom price label, like "Call for price", for all products with empty price.
21
  * Currencies - Add all world currencies, change currency symbol.
22
+ * Order Numbers - Sequential order numbering, custom order number prefix and number width.
23
  * More Sorting Options - Add more sorting options or remove sorting (including default) at all.
24
+ * Add to Cart - Change text for add to cart buttons for each product type.
25
  * Old Slugs - Remove old product slugs.
26
 
27
  = Feedback =
28
+ * We are open to your suggestions and feedback - thank you for using or trying out one of our plugins!
29
+ * If you have any ideas how to upgrade the plugin to make it better, or if you have ideas about the features that are missing from our plugin, please [fill the form](http://woojetpack.com/submit-idea/).
30
+ * For support visit the [contact page](http://woojetpack.com/contact-us/).
31
 
32
  = More =
33
  * Visit the [WooCommerce Jetpack plugin page](http://woojetpack.com/)
50
 
51
  == Changelog ==
52
 
53
+ = 1.0.5 - 18/06/2014 =
54
+ * Feature - Order Numbers.
55
+
56
  = 1.0.4 - 15/06/2014 =
57
  * Fix - Add to cart text - on archives now calling the right function.
58
 
71
  == Upgrade Notice ==
72
 
73
  = 1.0.0 =
74
+ This is the first release of the plugin.
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 1.0.4
7
  Author: Algoritmika Ltd.
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
@@ -167,6 +167,7 @@ final class WC_Jetpack {
167
  $settings[] = include_once( 'includes/class-wcj-sorting.php' );
168
  $settings[] = include_once( 'includes/class-wcj-old-slugs.php' );
169
  $settings[] = include_once( 'includes/class-wcj-add-to-cart.php' );
 
170
  //$settings[] = include_once( 'includes/class-wcj-product-info.php' );
171
 
172
  // Add options
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 1.0.5
7
  Author: Algoritmika Ltd.
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
167
  $settings[] = include_once( 'includes/class-wcj-sorting.php' );
168
  $settings[] = include_once( 'includes/class-wcj-old-slugs.php' );
169
  $settings[] = include_once( 'includes/class-wcj-add-to-cart.php' );
170
+ $settings[] = include_once( 'includes/class-wcj-order-numbers.php' );
171
  //$settings[] = include_once( 'includes/class-wcj-product-info.php' );
172
 
173
  // Add options