Booster for WooCommerce - Version 1.2.0

Version Description

  • 17/08/2014 =
  • Feature Upgraded - Orders - Auto-complete all orders option added.
  • Feature Upgraded - Orders - Custom Order Statuses added.
  • Feature Upgraded - Custom Price Labels - Added global remove text from price option.
  • Feature Upgraded - Custom Price Labels - Added compatibility with bookable products.
  • Dev - Links to Jetpack settings added to plugins page and to WooCommerce back end menu.
  • Feature Upgraded - Checkout - Customizable "Place order" ("Order now") button text.
Download this release

Release Info

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

Code changes from version 1.1.7 to 1.2.0

includes/class-wcj-checkout.php CHANGED
@@ -65,13 +65,28 @@ class WCJ_Checkout {
65
  //if ( is_super_admin() )
66
  //global $woocommerce;
67
  // print_r( $woocommerce );
 
 
68
  }
69
 
70
  // Settings hooks
71
  add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
72
  add_filter( 'wcj_settings_checkout', array( $this, 'get_settings' ), 100 );
73
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
 
 
 
74
  }
 
 
 
 
 
 
 
 
 
 
75
 
76
  /**
77
  * add_enabled_option.
@@ -144,6 +159,21 @@ class WCJ_Checkout {
144
  array( 'type' => 'sectionend', 'id' => 'wcj_checkout_options' ),
145
  );
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  $settings[] = array( 'title' => __( 'Checkout Fields Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you customize the checkout fields: change label, placeholder, set required, or remove any field.', 'woocommerce-jetpack' ), 'id' => 'wcj_checkout_fields_options' );
148
 
149
  /*$items = array(
65
  //if ( is_super_admin() )
66
  //global $woocommerce;
67
  // print_r( $woocommerce );
68
+
69
+ add_filter( 'woocommerce_order_button_text', array( $this, 'set_order_button_text' ) );
70
  }
71
 
72
  // Settings hooks
73
  add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
74
  add_filter( 'wcj_settings_checkout', array( $this, 'get_settings' ), 100 );
75
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
76
+
77
+
78
+
79
  }
80
+
81
+ /**
82
+ * set_order_button_text.
83
+ */
84
+ public function set_order_button_text( $current_text ) {
85
+ $new_text = get_option( 'wcj_checkout_place_order_button_text' );
86
+ if ( $new_text != '' )
87
+ return $new_text;
88
+ return $current_text;
89
+ }
90
 
91
  /**
92
  * add_enabled_option.
159
  array( 'type' => 'sectionend', 'id' => 'wcj_checkout_options' ),
160
  );
161
 
162
+ // Place order (Order now) Button
163
+ $settings[] = array( 'title' => __( 'Place order (Order now) Button', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_checkout_place_order_button_options' );
164
+
165
+ $settings[] = array(
166
+ 'title' => __( 'Text', 'woocommerce-jetpack' ),
167
+ 'desc' => __( 'leave blank for WooCommerce default', 'woocommerce-jetpack' ),
168
+ 'desc_tip' => __( 'Button on the checkout page.', 'woocommerce-jetpack' ),
169
+ 'id' => 'wcj_checkout_place_order_button_text',
170
+ 'default' => '',
171
+ 'type' => 'text',
172
+ );
173
+
174
+ $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_checkout_place_order_button_options' );
175
+
176
+ // Checkout fields
177
  $settings[] = array( 'title' => __( 'Checkout Fields Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you customize the checkout fields: change label, placeholder, set required, or remove any field.', 'woocommerce-jetpack' ), 'id' => 'wcj_checkout_fields_options' );
178
 
179
  /*$items = array(
includes/class-wcj-old-slugs.php CHANGED
@@ -25,7 +25,7 @@ class WCJ_Old_Slugs {
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
 
@@ -130,8 +130,8 @@ class WCJ_Old_Slugs {
130
  }
131
  ?>
132
  <div>
133
- <h2>WooCommerce Jetpack - Remove Old Product Slugs</h2>
134
- <p>Tool removes old slugs/permalinks from database.</p>
135
  <?php echo $remove_result_html; ?>
136
  <?php
137
  $num_old_slugs_products = count( $posts_ids['products'] );
25
 
26
  if ( is_admin() ) {
27
 
28
+ add_action( 'admin_menu', array($this, 'add_old_slugs_tool'), 100 ); // Add Remove Old Slugs tool to WooCommerce menu
29
  }
30
  }
31
 
130
  }
131
  ?>
132
  <div>
133
+ <h2><?php _e( 'WooCommerce Jetpack - Remove Old Product Slugs', 'woocommerce-jetpack' ); ?></h2>
134
+ <p><?php _e( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ); ?></p>
135
  <?php echo $remove_result_html; ?>
136
  <?php
137
  $num_old_slugs_products = count( $posts_ids['products'] );
includes/class-wcj-orders.php CHANGED
@@ -4,8 +4,12 @@
4
  *
5
  * The WooCommerce Jetpack Orders class.
6
  *
7
- * @class WCJ_Orders
 
 
 
8
  */
 
9
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
 
11
  if ( ! class_exists( 'WCJ_Orders' ) ) :
@@ -24,21 +28,45 @@ class WCJ_Orders {
24
 
25
  add_action( 'woocommerce_new_order', array( $this, 'add_order_number_meta' ), 100 );
26
  add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), 100, 2 );
27
- }
28
- add_action( 'admin_menu', array( $this, 'add_renumerate_orders_tool' ), 100 );
29
-
30
- if ( get_option( 'wcj_order_minimum_amount' ) > 0 ) {
31
 
 
32
  add_action( 'woocommerce_checkout_process', array( $this, 'order_minimum_amount' ) );
33
  add_action( 'woocommerce_before_cart', array( $this, 'order_minimum_amount' ) );
34
  }
 
 
 
 
 
 
 
 
35
  }
 
 
 
36
 
37
  // Settings hooks
38
  add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
39
  add_filter( 'wcj_settings_orders', array( $this, 'get_settings' ), 100 );
40
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  /**
44
  * order_minimum_amount.
@@ -48,20 +76,16 @@ class WCJ_Orders {
48
  $minimum = get_option( 'wcj_order_minimum_amount' );
49
  if ( WC()->cart->total < $minimum ) {
50
 
51
- if( is_cart() ) {
52
-
53
  if ( 'yes' === get_option( 'wcj_order_minimum_amount_cart_notice_enabled' ) ) {
54
-
55
  wc_print_notice(
56
  sprintf( apply_filters( 'wcj_get_option_filter', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option( 'wcj_order_minimum_amount_cart_notice_message' ) ),
57
  woocommerce_price( $minimum ),
58
  woocommerce_price( WC()->cart->total )
59
  ), 'notice'
60
  );
61
- }
62
-
63
  } else {
64
-
65
  wc_add_notice(
66
  sprintf( apply_filters( 'wcj_get_option_filter', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option( 'wcj_order_minimum_amount_error_message' ) ),
67
  woocommerce_price( $minimum ),
@@ -72,6 +96,131 @@ class WCJ_Orders {
72
  }
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Add Renumerate Orders tool to WooCommerce menu (menu link).
77
  */
@@ -86,10 +235,9 @@ class WCJ_Orders {
86
  public function create_renumerate_orders_tool() {
87
 
88
  $result_message = '';
89
- if ( isset( $_POST['renumerate_orders'] ) ) {
90
-
91
  $this->renumerate_orders();
92
- $result_message = '<div class="updated"><p><strong>Orders successfully renumerated!</p></div>';
93
  }
94
  ?><?php echo $result_message; ?>
95
  <div>
@@ -97,9 +245,8 @@ class WCJ_Orders {
97
  <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>
98
  <form method="post" action="">
99
  <input type="submit" name="renumerate_orders" value="Renumerate orders">
100
- </form>
101
- </div>
102
- <?php
103
  }
104
 
105
  /**
@@ -190,8 +337,8 @@ class WCJ_Orders {
190
  ),
191
 
192
  array( 'type' => 'sectionend', 'id' => 'wcj_orders_options' ),
193
-
194
- array( 'title' => __( 'Order Numbers Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable sequential order numbering, set custom number prefix and width.', 'woocommerce-jetpack' ), 'id' => 'wcj_order_numbers_options' ),
195
 
196
  array(
197
  'title' => __( 'Order Numbers', 'woocommerce-jetpack' ),
@@ -257,7 +404,7 @@ class WCJ_Orders {
257
 
258
  array(
259
  'title' => __( 'Add notice to cart page also', 'woocommerce-jetpack' ),
260
- 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
261
  'id' => 'wcj_order_minimum_amount_cart_notice_enabled',
262
  'default' => 'no',
263
  'type' => 'checkbox',
@@ -275,20 +422,89 @@ class WCJ_Orders {
275
  'css' => 'width:50%;min-width:300px;',
276
  ),
277
 
278
- array( 'type' => 'sectionend', 'id' => 'wcj_order_minimum_amount_options' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  return $settings;
283
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
 
285
  /**
286
  * Add settings section to WooCommerce > Settings > Jetpack.
287
  */
288
- function settings_section( $sections ) {
289
-
290
- $sections['orders'] = 'Orders';
291
-
292
  return $sections;
293
  }
294
  }
4
  *
5
  * The WooCommerce Jetpack Orders class.
6
  *
7
+ * @class WCJ_Orders
8
+ * @version 1.0.0
9
+ * @category Class
10
+ * @author Algoritmika Ltd.
11
  */
12
+
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
  if ( ! class_exists( 'WCJ_Orders' ) ) :
28
 
29
  add_action( 'woocommerce_new_order', array( $this, 'add_order_number_meta' ), 100 );
30
  add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), 100, 2 );
31
+
32
+ add_action( 'admin_menu', array( $this, 'add_renumerate_orders_tool' ), 100 );
33
+ }
 
34
 
35
+ if ( get_option( 'wcj_order_minimum_amount' ) > 0 ) {
36
  add_action( 'woocommerce_checkout_process', array( $this, 'order_minimum_amount' ) );
37
  add_action( 'woocommerce_before_cart', array( $this, 'order_minimum_amount' ) );
38
  }
39
+
40
+ if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled' ) ) {
41
+ add_action( 'admin_menu', array( $this, 'add_custom_statuses_tool' ), 100 );
42
+ add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
43
+ }
44
+
45
+ if ( 'yes' === get_option( 'wcj_order_auto_complete_enabled' ) )
46
+ add_action( 'woocommerce_thankyou', array( $this, 'auto_complete_order' ) );
47
  }
48
+
49
+ // woocommerce_admin_field_text_and_button / add_text_and_button_settings_fields
50
+ //add_action( 'woocommerce_admin_field_text_and_button', array( $this, 'add_text_and_button_settings_fields' ) );
51
 
52
  // Settings hooks
53
  add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
54
  add_filter( 'wcj_settings_orders', array( $this, 'get_settings' ), 100 );
55
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
56
  }
57
+
58
+ /**
59
+ * Auto Complete all WooCommerce orders.
60
+ */
61
+ public function auto_complete_order( $order_id ) {
62
+
63
+ global $woocommerce;
64
+
65
+ if ( !$order_id )
66
+ return;
67
+ $order = new WC_Order( $order_id );
68
+ $order->update_status( 'completed' );
69
+ }
70
 
71
  /**
72
  * order_minimum_amount.
76
  $minimum = get_option( 'wcj_order_minimum_amount' );
77
  if ( WC()->cart->total < $minimum ) {
78
 
79
+ if( is_cart() ) {
 
80
  if ( 'yes' === get_option( 'wcj_order_minimum_amount_cart_notice_enabled' ) ) {
 
81
  wc_print_notice(
82
  sprintf( apply_filters( 'wcj_get_option_filter', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option( 'wcj_order_minimum_amount_cart_notice_message' ) ),
83
  woocommerce_price( $minimum ),
84
  woocommerce_price( WC()->cart->total )
85
  ), 'notice'
86
  );
87
+ }
 
88
  } else {
 
89
  wc_add_notice(
90
  sprintf( apply_filters( 'wcj_get_option_filter', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option( 'wcj_order_minimum_amount_error_message' ) ),
91
  woocommerce_price( $minimum ),
96
  }
97
  }
98
 
99
+ /**
100
+ * add_custom_statuses_tool to WooCommerce menu (menu link).
101
+ */
102
+ public function add_custom_statuses_tool() {
103
+
104
+ add_submenu_page( 'woocommerce', 'Jetpack - Custom Statuses', 'Custom Statuses', 'manage_options', 'woocommerce-jetpack-custom-statuses', array( $this, 'create_custom_statuses_tool' ) );
105
+ }
106
+
107
+ /**
108
+ * add_custom_statuses_tool to WooCommerce menu (the content).
109
+ */
110
+
111
+
112
+ // TODO: content, color
113
+ public function hook_statuses_icons_css() {
114
+ $output = '<style>';
115
+
116
+
117
+ $default_statuses = array(
118
+ 'pending',
119
+ 'failed',
120
+ 'on-hold',
121
+ 'processing',
122
+ 'completed',
123
+ 'refunded',
124
+ 'cancelled',
125
+ );
126
+ $statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
127
+ foreach( $statuses as $status )
128
+ if ( ! in_array( $status->slug, $default_statuses ) ) {
129
+ $output .= 'mark.' . $status->slug . '::after { content: "\e011"; color: #999; }';
130
+ $output .= 'mark.' . $status->slug . ':after {font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center}';
131
+ }
132
+
133
+
134
+ //$output .= '.close { .ir;&:before { .icon("\e013"); }}';
135
+ //$output .= '.close:before { .iconbefore("\e02d"); }';
136
+ $output .= '.close:after { content: "\e011"; }';
137
+
138
+ $output .= '</style>';
139
+ echo $output;
140
+ }
141
+
142
+ public function create_custom_statuses_tool() {
143
+
144
+ $result_message = '';
145
+ if ( isset( $_POST['add_custom_status'] ) && isset( $_POST['new_status'] ) ) {
146
+ //$this->renumerate_orders();
147
+ if ( $_POST['new_status'] != '' ) {
148
+
149
+ $result = wp_insert_term( $_POST['new_status'], 'shop_order_status' );//, array( 'color' => '#999', ) );
150
+ if ( $result > 0 ) $result_message = '<div class="updated"><p>' . __( 'New status have been successfully added!', 'woocommerce-jetpack' ) . '</p></div>';
151
+ else $result_message = '<div class="error"><p>' . __( 'Status was not added.', 'woocommerce-jetpack' ) . '</p></div>';
152
+ //$result_message = '<div class="updated"><p><strong>' . $_POST['new_status'] . ':' . $_POST['add_custom_status'] . '</strong></p></div>';
153
+
154
+ }
155
+ else $result_message = '<div class="error"><p>' . __( 'Status name is empty. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
156
+ }
157
+
158
+ if ( isset( $_GET['delete'] ) && ( $_GET['delete'] > 0 ) ) {
159
+ if ( true === wp_delete_term( $_GET['delete'], 'shop_order_status' ) )
160
+ $result_message = '<div class="updated"><p>' . __( 'Status have been successfully deleted.', 'woocommerce-jetpack' ) . '</p></div>';
161
+ else
162
+ $result_message = '<div class="error"><p>' . __( 'Delete failed.', 'woocommerce-jetpack' ) . '</p></div>';
163
+ }
164
+
165
+ /*
166
+ stdClass Object
167
+ (
168
+ [term_id] => 6
169
+ [name] => pending
170
+ [slug] => pending
171
+ [term_group] => 0
172
+ [term_taxonomy_id] => 6
173
+ [taxonomy] => shop_order_status
174
+ [description] =>
175
+ [parent] => 0
176
+ [count] => 0
177
+ )
178
+ */
179
+
180
+ $default_statuses = array(
181
+ 'pending',
182
+ 'failed',
183
+ 'on-hold',
184
+ 'processing',
185
+ 'completed',
186
+ 'refunded',
187
+ 'cancelled',
188
+ );
189
+
190
+ ?><div>
191
+ <h2><?php echo __( 'WooCommerce Jetpack - Custom Statuses', 'woocommerce-jetpack' ); ?></h2>
192
+ <p><?php echo __( 'The tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ); ?></p>
193
+ <?php echo $result_message; ?>
194
+ <h3><?php echo __( 'Statuses', 'woocommerce-jetpack' ); ?></h3>
195
+ <table class="wc_status_table widefat"><?php
196
+ echo '<tr>';
197
+ echo '<th>' . __( 'Term ID', 'woocommerce-jetpack' ) . '</th>';
198
+ echo '<th>' . __( 'Name', 'woocommerce-jetpack' ) . '</th>';
199
+ echo '<th>' . __( 'Slug', 'woocommerce-jetpack' ) . '</th>';
200
+ echo '<th>' . __( 'Count', 'woocommerce-jetpack' ) . '</th>';
201
+ echo '<th>' . __( 'Delete', 'woocommerce-jetpack' ) . '</th>';
202
+ echo '</tr>';
203
+ $statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
204
+ foreach( $statuses as $status ) {
205
+ echo '<tr>';
206
+ echo '<td>' . $status->term_id . '</td>';
207
+ echo '<td>' . $status->name . '</td>';
208
+ echo '<td>' . $status->slug . '</td>';
209
+ echo '<td>' . $status->count . '</td>';
210
+ if ( in_array( $status->slug, $default_statuses ) )
211
+ echo '<td></td>';
212
+ else
213
+ echo '<td>' . '<a href="' . add_query_arg( 'delete', $status->term_id ) . '">' . __( 'Delete', 'woocommerce-jetpack' ) . '</a>' . '</td>';
214
+ echo '</tr>';
215
+ }
216
+ ?></table>
217
+ <p><form method="post" action="<?php echo remove_query_arg( 'delete' ); ?>">
218
+ <input type="text" name="new_status">
219
+ <input type="submit" name="add_custom_status" value="Add new custom status">
220
+ </form></p>
221
+ </div><?php
222
+ }
223
+
224
  /**
225
  * Add Renumerate Orders tool to WooCommerce menu (menu link).
226
  */
235
  public function create_renumerate_orders_tool() {
236
 
237
  $result_message = '';
238
+ if ( isset( $_POST['renumerate_orders'] ) ) {
 
239
  $this->renumerate_orders();
240
+ $result_message = '<div class="updated"><p><strong>Orders successfully renumerated!</strong></p></div>';
241
  }
242
  ?><?php echo $result_message; ?>
243
  <div>
245
  <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>
246
  <form method="post" action="">
247
  <input type="submit" name="renumerate_orders" value="Renumerate orders">
248
+ </form>
249
+ </div><?php
 
250
  }
251
 
252
  /**
337
  ),
338
 
339
  array( 'type' => 'sectionend', 'id' => 'wcj_orders_options' ),
340
+
341
+ array( 'title' => __( 'Order Numbers', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable sequential order numbering, set custom number prefix and width.', 'woocommerce-jetpack' ), 'id' => 'wcj_order_numbers_options' ),
342
 
343
  array(
344
  'title' => __( 'Order Numbers', 'woocommerce-jetpack' ),
404
 
405
  array(
406
  'title' => __( 'Add notice to cart page also', 'woocommerce-jetpack' ),
407
+ 'desc' => __( 'Add', 'woocommerce-jetpack' ),
408
  'id' => 'wcj_order_minimum_amount_cart_notice_enabled',
409
  'default' => 'no',
410
  'type' => 'checkbox',
422
  'css' => 'width:50%;min-width:300px;',
423
  ),
424
 
425
+ array( 'type' => 'sectionend', 'id' => 'wcj_order_minimum_amount_options' ),
426
+
427
+ array( 'title' => __( 'Orders Auto-Complete', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable orders auto-complete function.', 'woocommerce-jetpack' ), 'id' => 'wcj_order_auto_complete_options' ),
428
+
429
+ array(
430
+ 'title' => __( 'Auto-complete all WooCommerce orders', 'woocommerce-jetpack' ),
431
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
432
+ 'desc_tip' => __( 'E.g. if you sell digital products then you are not shipping anything and you may want auto-complete all your orders.', 'woocommerce-jetpack' ),
433
+ 'id' => 'wcj_order_auto_complete_enabled',
434
+ 'default' => 'no',
435
+ 'type' => 'checkbox',
436
+ ),
437
+
438
+ array( 'type' => 'sectionend', 'id' => 'wcj_order_auto_complete_options' ),
439
+
440
+ array( 'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable custom statuses tool.', 'woocommerce-jetpack' ), 'id' => 'wcj_orders_custom_statuses_options' ),
441
+
442
+ array(
443
+ 'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ),
444
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
445
+ //'desc_tip' => __( 'E.g. if you sell digital products then you are not shipping anything and you may want auto-complete all your orders.', 'woocommerce-jetpack' ),
446
+ 'id' => 'wcj_orders_custom_statuses_enabled',
447
+ 'default' => 'yes',
448
+ 'type' => 'checkbox',
449
+ ),
450
+
451
+ array( 'type' => 'sectionend', 'id' => 'wcj_orders_custom_statuses_options' ),
452
 
453
  );
454
+
455
+ /*
456
+ $settings[] = array(
457
+ 'title' => __( 'Add new custom status', 'woocommerce-jetpack' ),
458
+ //'desc' => __( 'Enable Custom Statuses', 'woocommerce-jetpack' ),
459
+ //'desc_tip' => __( 'Sequential order numbering, custom order number prefix and number width. Minimum order amount.', 'woocommerce-jetpack' ),
460
+ 'id' => 'wcj_orders_custom_statuses_add',
461
+ 'default' => '',
462
+ 'type' => 'text_and_button',
463
+
464
+ 'button_value' => 'Add',
465
+ /*'form_name' => '',
466
+ 'form_action' => '',
467
+ 'form_method' => 'post',*//*
468
+ );
469
+ */
470
 
471
  return $settings;
472
  }
473
+
474
+ /**
475
+ * add_text_and_button_settings_fields.
476
+ *
477
+ function add_text_and_button_settings_fields( $value ) {
478
+ ?><tr valign="top">
479
+ <th scope="row" class="titledesc">
480
+ <label for="<?php echo esc_attr( $value['id'] ) . '_text'; ?>"><?php echo esc_html( $value['title'] ); ?></label>
481
+ <?php /*echo $tip;*//* ?>
482
+ </th>
483
+ <td class="forminp forminp-text">
484
+ <form
485
+ name="<?php echo esc_attr( $value['id'] ) . '_form'; ?>"
486
+ action=""
487
+ method="get">
488
+ <input
489
+ name="<?php echo esc_attr( $value['id'] ) . '_text'; ?>"
490
+ id="<?php echo esc_attr( $value['id'] ) . '_text'; ?>"
491
+ type="text"
492
+ style="<?php echo esc_attr( $value['css'] ); ?>"
493
+ <?php /*value="<?php echo esc_attr( $option_value ); ?>"*//* ?>
494
+ class="<?php echo esc_attr( $value['class'] ); ?>"
495
+ <?php /*echo implode( ' ', $custom_attributes );*//* ?>
496
+ /> <?php /*echo $description;*//* ?>
497
+ <input type="submit" value="<?php echo esc_attr( $value['button_value'] ); ?>">
498
+ </form>
499
+ </td>
500
+ </tr><?php
501
+ }
502
 
503
  /**
504
  * Add settings section to WooCommerce > Settings > Jetpack.
505
  */
506
+ function settings_section( $sections ) {
507
+ $sections['orders'] = 'Orders';
 
 
508
  return $sections;
509
  }
510
  }
includes/class-wcj-price-labels.php CHANGED
@@ -5,6 +5,7 @@
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
  * @class WCJ_Price_Labels
 
8
  * @category Class
9
  * @author Algoritmika Ltd.
10
  */
@@ -54,7 +55,7 @@ class WCJ_Price_Labels {
54
  //add_filter( 'woocommerce_cart_item_price_html', array( $this, 'custom_price' ), 999, 2 ); // depreciated?
55
  //add_filter( 'woocommerce_cart_item_price', array( $this, 'custom_price' ), 999, 2 );
56
 
57
- //add_filter( 'woocommerce_get_price_html', array( $this, 'custom_price' ), 100, 2 );
58
 
59
  //if ( $labels_array[ 'variation_simple' ] == 'off' ) {
60
 
@@ -222,7 +223,7 @@ class WCJ_Price_Labels {
222
  break;
223
  }
224
 
225
- return $price;
226
  }
227
 
228
  /*
@@ -230,6 +231,11 @@ class WCJ_Price_Labels {
230
  */
231
  public function custom_price( $price, $product ) {
232
 
 
 
 
 
 
233
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
234
 
235
  $labels_array = array();
@@ -252,7 +258,12 @@ class WCJ_Price_Labels {
252
  }*/
253
 
254
  //$price .= print_r( $labels_array );
255
- }
 
 
 
 
 
256
 
257
  if ( $labels_array[ 'variation_enabled' ] == 'on' ) {
258
 
@@ -262,7 +273,7 @@ class WCJ_Price_Labels {
262
  ( ( $labels_array['variation_single'] == 'off' ) && ( is_single() ) )
263
  )
264
  {
265
- $current_filter_name = current_filter();
266
 
267
  $variable_filters_array = array(
268
  'woocommerce_variable_empty_price_html',
@@ -311,6 +322,24 @@ class WCJ_Price_Labels {
311
  ),
312
 
313
  array( 'type' => 'sectionend', 'id' => 'wcj_price_labels_options' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  );
315
 
316
  return $settings;
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
  * @class WCJ_Price_Labels
8
+ * @version 1.0.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
55
  //add_filter( 'woocommerce_cart_item_price_html', array( $this, 'custom_price' ), 999, 2 ); // depreciated?
56
  //add_filter( 'woocommerce_cart_item_price', array( $this, 'custom_price' ), 999, 2 );
57
 
58
+ add_filter( 'woocommerce_get_price_html', array( $this, 'custom_price' ), 100, 2 );
59
 
60
  //if ( $labels_array[ 'variation_simple' ] == 'off' ) {
61
 
223
  break;
224
  }
225
 
226
+ return str_replace( 'From: ', '', $price );
227
  }
228
 
229
  /*
231
  */
232
  public function custom_price( $price, $product ) {
233
 
234
+ $current_filter_name = current_filter();
235
+
236
+ if ( ( 'woocommerce_get_price_html' === $current_filter_name ) && ( 'booking' !== $product->product_type ) )
237
+ return $price;
238
+
239
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
240
 
241
  $labels_array = array();
258
  }*/
259
 
260
  //$price .= print_r( $labels_array );
261
+ }
262
+
263
+ // Global price labels - Remove text from price
264
+ $text_to_remove = get_option( 'wcj_global_price_labels_remove_text' );
265
+ if ( '' != $text_to_remove )
266
+ $price = str_replace( $text_to_remove, '', $price );
267
 
268
  if ( $labels_array[ 'variation_enabled' ] == 'on' ) {
269
 
273
  ( ( $labels_array['variation_single'] == 'off' ) && ( is_single() ) )
274
  )
275
  {
276
+ //$current_filter_name = current_filter();
277
 
278
  $variable_filters_array = array(
279
  'woocommerce_variable_empty_price_html',
322
  ),
323
 
324
  array( 'type' => 'sectionend', 'id' => 'wcj_price_labels_options' ),
325
+
326
+ array( 'title' => __( 'Global Custom Price Labels', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you set price labels for all products globally.', 'woocommerce-jetpack' ), 'id' => 'wcj_global_price_labels_options' ),
327
+
328
+ array(
329
+ 'title' => __( 'Remove from price', 'woocommerce-jetpack' ),
330
+ //'desc' => __( 'Enable the Custom Price Labels feature', 'woocommerce-jetpack' ),
331
+ 'desc_tip' => __( 'Enter text to remove from all products prices. Leave blank to disable.', 'woocommerce-jetpack' ),
332
+ 'id' => 'wcj_global_price_labels_remove_text',
333
+ 'default' => '',
334
+ 'type' => 'text',
335
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
336
+ 'custom_attributes'
337
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
338
+ 'css' => 'width:30%;min-width:300px;',
339
+ ),
340
+
341
+ array( 'type' => 'sectionend', 'id' => 'wcj_global_price_labels_options' ),
342
+
343
  );
344
 
345
  return $settings;
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,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon
5
  Requires at least: 3.9.1
6
  Tested up to: 3.9.2
7
- Stable tag: 1.1.7
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -16,7 +16,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
16
 
17
  = Features =
18
 
19
- * Payment Gateways - Add and customize simple custom offline payment gateway. Change icons (images) for all default (COD - Cash on Delivery, Cheque, BACS, Mijireh Checkout, PayPal) WooCommerce payment gateways.
20
  * Orders - Sequential order numbering, custom order number prefix and number width. Set minimum order amount.
21
  * Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
22
  * Shipping - Hide shipping when free is available.
@@ -55,8 +55,35 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
55
 
56
  1. Plugin admin area.
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  == Changelog ==
59
 
 
 
 
 
 
 
 
 
60
  = 1.1.7 - 12/08/2014 =
61
  * Dev - Call for Price - "Hide sale tag" code fixed.
62
  * Feature Upgraded - Call for Price - Separate label to show for related products.
@@ -75,8 +102,8 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
75
  * Dev - Product Info - Related products: "columns" option added.
76
 
77
  = 1.1.3 - 09/08/2014 =
78
- * Fix - "Warning: Invalid argument supplied for foreach() in..." bug fixed ("Payment Gateways" feature).
79
- * Feature Upgraded - Call for Price - different labels for single/archive/home.
80
 
81
  = 1.1.2 - 08/08/2014 =
82
  * Dev - PDF Invoices - Icons at orders list changed.
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,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price
5
  Requires at least: 3.9.1
6
  Tested up to: 3.9.2
7
+ Stable tag: 1.2.0
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
16
 
17
  = Features =
18
 
19
+ * Payment Gateways - Add and customize simple custom offline payment gateway. Change icons (images) for all default (COD - Cash on Delivery, Cheque, BACS, Mijireh Checkout, PayPal) WooCommerce payment gateways.
20
  * Orders - Sequential order numbering, custom order number prefix and number width. Set minimum order amount.
21
  * Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
22
  * Shipping - Hide shipping when free is available.
55
 
56
  1. Plugin admin area.
57
 
58
+ == TODO List ==
59
+
60
+ Please note that this list is only preliminary and may be corrected at any time.
61
+
62
+ Please let us know if you want anything added to list by <a href="http://woojetpack.com/submit-idea/">filling the form</a>.
63
+
64
+ If you wish that some task would go up the queue to make it faster, please contact us by <a href="http://woojetpack.com/contact-us/">filling this form</a>. We are listening carefully to our users!
65
+
66
+ 1. Upgrade Feature - Custom Price Labels - Add "global labels".
67
+ 1. Upgrade Feature - Shipping - Add "Custom Shipping Method".
68
+ 1. Upgrade Feature - Product Info - Add "total sales" and "time since last sale" info.
69
+ 1. Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and colour.
70
+ 1. New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
71
+ 1. Upgrade Feature - Custom Price Labels - Add "local remove".
72
+ 1. Upgrade Feature - Orders - Bulk orders (start from global discount for all products; later - discounts for individual products).
73
+ 1. Upgrade Feature - Custom Price Labels - Add different labels for archives, single, homepage, related. Add option to select which price hooks to use. Different labels for variable and variation.
74
+ 1. Dev - Recheck, comment the code.
75
+ 1. Upgrade Feature - Cart - Cart discount.
76
+
77
  == Changelog ==
78
 
79
+ = 1.2.0 - 17/08/2014 =
80
+ * Feature Upgraded - Orders - Auto-complete all orders option added.
81
+ * Feature Upgraded - Orders - Custom Order Statuses added.
82
+ * Feature Upgraded - Custom Price Labels - Added global remove text from price option.
83
+ * Feature Upgraded - Custom Price Labels - Added compatibility with bookable products.
84
+ * Dev - Links to Jetpack settings added to plugins page and to WooCommerce back end menu.
85
+ * Feature Upgraded - Checkout - Customizable "Place order" ("Order now") button text.
86
+
87
  = 1.1.7 - 12/08/2014 =
88
  * Dev - Call for Price - "Hide sale tag" code fixed.
89
  * Feature Upgraded - Call for Price - Separate label to show for related products.
102
  * Dev - Product Info - Related products: "columns" option added.
103
 
104
  = 1.1.3 - 09/08/2014 =
105
+ * Fix - Payment Gateways - "Warning: Invalid argument supplied for foreach() in..." bug fixed.
106
+ * Feature Upgraded - Call for Price - Different labels for single/archive/home.
107
 
108
  = 1.1.2 - 08/08/2014 =
109
  * Dev - PDF Invoices - Icons at orders list changed.
woocommerce-jetpack.php CHANGED
@@ -3,14 +3,13 @@
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.1.7
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
10
  License: GNU General Public License v3.0
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  */
13
-
14
  if ( ! defined( 'ABSPATH' ) ) exit; // exit if accessed directly
15
 
16
  if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // check if WooCommerce is active
@@ -38,13 +37,9 @@ final class WC_Jetpack {
38
  * @see WCJ()
39
  * @return WC_Jetpack - Main instance
40
  */
41
- public static function instance() {
42
-
43
- if ( is_null( self::$_instance ) ) {
44
-
45
  self::$_instance = new self();
46
- }
47
-
48
  return self::$_instance;
49
  }
50
 
@@ -83,12 +78,36 @@ final class WC_Jetpack {
83
 
84
  add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ) );
85
  add_filter( 'get_wc_jetpack_plus_message', array( $this, 'display_get_wcj_plus_message' ), 100, 2 );
 
 
 
86
  }
87
 
88
  // Loaded action
89
  do_action( 'wcj_loaded' );
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  /**
93
  * wcj_get_option.
94
  *
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.2.0
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
10
  License: GNU General Public License v3.0
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  */
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // exit if accessed directly
14
 
15
  if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // check if WooCommerce is active
37
  * @see WCJ()
38
  * @return WC_Jetpack - Main instance
39
  */
40
+ public static function instance() {
41
+ if ( is_null( self::$_instance ) )
 
 
42
  self::$_instance = new self();
 
 
43
  return self::$_instance;
44
  }
45
 
78
 
79
  add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ) );
80
  add_filter( 'get_wc_jetpack_plus_message', array( $this, 'display_get_wcj_plus_message' ), 100, 2 );
81
+
82
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
83
+ add_action( 'admin_menu', array( $this, 'jetpack_menu' ), 100 );
84
  }
85
 
86
  // Loaded action
87
  do_action( 'wcj_loaded' );
88
  }
89
 
90
+ /**
91
+ * Addons menu item
92
+ */
93
+ public function jetpack_menu() {
94
+ add_submenu_page( 'woocommerce', __( 'WooCommerce Jetpack', 'woocommerce' ), __( 'Jetpack Settings', 'woocommerce' ) , 'manage_woocommerce', 'admin.php?page=wc-settings&tab=jetpack' );
95
+ }
96
+
97
+ /**
98
+ * Show action links on the plugin screen
99
+ *
100
+ * @param mixed $links
101
+ * @return array
102
+ */
103
+ public function action_links( $links ) {
104
+ return array_merge( array(
105
+ '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=jetpack' ) . '">' . __( 'Settings', 'woocommerce' ) . '</a>',
106
+ '<a href="' . esc_url( apply_filters( 'woocommerce_docs_url', 'http://woojetpack.com/', 'woocommerce' ) ) . '">' . __( 'Docs', 'woocommerce' ) . '</a>',
107
+ '<a href="' . esc_url( apply_filters( 'woocommerce_support_url', 'http://woojetpack.com/plus/' ) ) . '">' . __( 'Unlock all', 'woocommerce' ) . '</a>',
108
+ ), $links );
109
+ }
110
+
111
  /**
112
  * wcj_get_option.
113
  *