Booster for WooCommerce - Version 2.3.8

Version Description

  • 26/10/2015 =
  • Dev - Link changed to http://booster.io
  • Fix - Shortcodes - Products - Crowdfunding - [wcj_product_crowdfunding_time_remaining] singular form bug fixed.
  • Dev - PRODUCTS - Product Input Fields - Placeholder for select type added.
  • Dev - PRODUCTS - Product Input Fields - Default value for checkbox type added.
  • Dev - CART & CHECKOUT - Cart - Module description added.
  • Fix - CART & CHECKOUT - Checkout Core Fields - Bug, causing message that some not existing field (e.g. State / County) is required, fixed.
  • Fix - CART & CHECKOUT - Checkout Core Fields - Bug with changing label and/or placeholder for some core checkout fields (e.g. address), fixed.
  • Fix - CART & CHECKOUT - Checkout Custom Fields - Bug, causing PHP notices on order admin save (on orders with some types of custom checkout fields), fixed.
  • Dev - CART & CHECKOUT - Checkout Custom Fields - Placeholder for select type added.
  • Dev - CART & CHECKOUT - Checkout Custom Fields - Default value for checkbox type added.
  • Dev - CART & CHECKOUT - Checkout Custom Fields - Values options for checkbox type added.
  • Dev - EMAILS & MISC. - General - CSS fields changed from textarea to custom_textarea.
  • Fix - SHIPPING & ORDERS - Order Custom Statuses - Custom statuses now counted in admin reports (and "Add Custom Statuses to Admin Reports" option added).
  • Dev - SHIPPING & ORDERS - Order Custom Statuses - Tool link added to module settings.
Download this release

Release Info

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

Code changes from version 2.3.7 to 2.3.8

includes/admin/class-wc-settings-jetpack.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Settings class.
6
  *
7
- * @version 2.2.8
8
  * @since 1.0.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -436,7 +436,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
436
  /**
437
  * Get settings array
438
  *
439
- * @version 2.2.5
440
  * @return array
441
  */
442
  function get_settings( $current_section = '' ) {
@@ -447,7 +447,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
447
  $settings[] = array(
448
  'title' => __( 'Booster for WooCommerce - Dashboard', 'woocommerce-jetpack' ),
449
  'type' => 'title',
450
- 'desc' => __( 'This dashboard lets you enable/disable any Booster\'s module. Each checkbox comes with short module\'s description. Please visit <a href="http://boostwoo.com" target="_blank">BoostWoo.com</a> for detailed info on each feature.', 'woocommerce-jetpack' ),
451
  'id' => 'wcj_options'
452
  );
453
  //$settings = apply_filters( 'wcj_features_status', $settings );
4
  *
5
  * The WooCommerce Jetpack Settings class.
6
  *
7
+ * @version 2.3.8
8
  * @since 1.0.0
9
  * @author Algoritmika Ltd.
10
  */
436
  /**
437
  * Get settings array
438
  *
439
+ * @version 2.3.8
440
  * @return array
441
  */
442
  function get_settings( $current_section = '' ) {
447
  $settings[] = array(
448
  'title' => __( 'Booster for WooCommerce - Dashboard', 'woocommerce-jetpack' ),
449
  'type' => 'title',
450
+ 'desc' => __( 'This dashboard lets you enable/disable any Booster\'s module. Each checkbox comes with short module\'s description. Please visit <a href="http://booster.io" target="_blank">http://booster.io</a> for detailed info on each feature.', 'woocommerce-jetpack' ),
451
  'id' => 'wcj_options'
452
  );
453
  //$settings = apply_filters( 'wcj_features_status', $settings );
includes/class-wcj-cart.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Cart class.
6
  *
7
- * @version 2.2.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -16,20 +16,26 @@ class WCJ_Cart extends WCJ_Module {
16
 
17
  /**
18
  * Constructor.
 
 
19
  */
20
- public function __construct() {
21
 
22
  $this->id = 'cart';
23
  $this->short_desc = __( 'Cart', 'woocommerce-jetpack' );
24
- $this->desc = __( 'Add custom info to WooCommerce cart page. Add empty cart button.', 'woocommerce-jetpack' );
 
 
 
 
25
  parent::__construct();
26
 
27
  if ( $this->is_enabled() ) {
28
 
29
- /*if ( 'yes' === get_option( 'wcj_cart_hide_shipping_and_taxes_estimated_message' ) )
30
- add_filter( 'gettext', array( $this, 'hide_shipping_and_taxes_estimated_message' ), 20, 3 );*/
31
 
32
- //add_action( get_option( 'wcj_cart_custom_info_hook', 'woocommerce_after_cart_totals' ), array( $this, 'add_cart_custom_info' ) );
33
  $total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
34
  for ( $i = 1; $i <= $total_number; $i++) {
35
  add_action( get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ), array( $this, 'add_cart_custom_info' ) );
@@ -52,8 +58,8 @@ class WCJ_Cart extends WCJ_Module {
52
 
53
  /**
54
  * change_labels.
55
- *
56
- public function hide_shipping_and_taxes_estimated_message( $translated_text, $text, $domain ) {
57
 
58
  if ( ! function_exists( 'is_cart' ) || ! is_cart() )
59
  return $translated_text;
@@ -62,25 +68,32 @@ class WCJ_Cart extends WCJ_Module {
62
  return '';
63
 
64
  return $translated_text;
65
- }
66
 
67
  /**
68
  * get_settings.
 
 
69
  */
70
  function get_settings() {
71
 
72
  $settings = array();
73
 
74
- /*array(
75
  'title' => __( 'Hide "Note: Shipping and taxes are estimated..." message on Cart page', 'woocommerce-jetpack' ),
76
  'desc' => __( 'Hide', 'woocommerce-jetpack' ),
77
  'id' => 'wcj_cart_hide_shipping_and_taxes_estimated_message',
78
  'default' => 'no',
79
  'type' => 'checkbox',
80
- ),*/
81
 
82
  // Cart Custom Info Options
83
- $settings[] = array( 'title' => __( 'Cart Custom Info Blocks', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_cart_custom_info_options' );
 
 
 
 
 
84
 
85
  $settings[] = array(
86
  'title' => __( 'Total Blocks', 'woocommerce-jetpack' ),
@@ -89,10 +102,13 @@ class WCJ_Cart extends WCJ_Module {
89
  'type' => 'custom_number',
90
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
91
  'custom_attributes'
92
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
93
  );
94
 
95
- $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_cart_custom_info_options' );
 
 
 
96
 
97
  $total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
98
 
@@ -100,7 +116,11 @@ class WCJ_Cart extends WCJ_Module {
100
 
101
  $settings = array_merge( $settings, array(
102
 
103
- array( 'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i, 'type' => 'title', 'desc' => '', 'id' => 'wcj_cart_custom_info_options_' . $i, ),
 
 
 
 
104
 
105
  array(
106
  'title' => __( 'Content', 'woocommerce-jetpack' ),
@@ -140,6 +160,7 @@ class WCJ_Cart extends WCJ_Module {
140
  'woocommerce_after_shipping_calculator' => __( 'After shipping calculator', 'woocommerce-jetpack' ),
141
 
142
  'woocommerce_cart_is_empty' => __( 'If cart is empty', 'woocommerce-jetpack' ),
 
143
  ),
144
  'css' => 'width:250px;',
145
  ),
@@ -152,11 +173,15 @@ class WCJ_Cart extends WCJ_Module {
152
  'css' => 'width:250px;',
153
  ),
154
 
155
- array( 'type' => 'sectionend', 'id' => 'wcj_cart_custom_info_options_' . $i, ),
 
 
 
 
156
  ) );
157
  }
158
 
159
- return $this->add_enable_module_setting( $settings );
160
  }
161
  }
162
 
4
  *
5
  * The WooCommerce Jetpack Cart class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
16
 
17
  /**
18
  * Constructor.
19
+ *
20
+ * @version 2.3.8
21
  */
22
+ function __construct() {
23
 
24
  $this->id = 'cart';
25
  $this->short_desc = __( 'Cart', 'woocommerce-jetpack' );
26
+ $this->desc = __( 'Add custom info to WooCommerce cart page.', 'woocommerce-jetpack' );
27
+ $this->full_desc =
28
+ __( 'This feature allows you to add a final checkpoint for your customers before they proceed to payment.', 'woocommerce-jetpack' ) . '<br>' .
29
+ __( 'Show custom information at on the cart page using Booster\'s various shortcodes and give your customers a seamless cart experience.', 'woocommerce-jetpack' ) . '<br>' .
30
+ __( 'For example, show them the total weight of their items, any additional fees or taxes, or a confirmation of the address their products are being sent to.', 'woocommerce-jetpack' );
31
  parent::__construct();
32
 
33
  if ( $this->is_enabled() ) {
34
 
35
+ /* if ( 'yes' === get_option( 'wcj_cart_hide_shipping_and_taxes_estimated_message' ) )
36
+ add_filter( 'gettext', array( $this, 'hide_shipping_and_taxes_estimated_message' ), 20, 3 ); */
37
 
38
+ // add_action( get_option( 'wcj_cart_custom_info_hook', 'woocommerce_after_cart_totals' ), array( $this, 'add_cart_custom_info' ) );
39
  $total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
40
  for ( $i = 1; $i <= $total_number; $i++) {
41
  add_action( get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ), array( $this, 'add_cart_custom_info' ) );
58
 
59
  /**
60
  * change_labels.
61
+ */
62
+ /* function hide_shipping_and_taxes_estimated_message( $translated_text, $text, $domain ) {
63
 
64
  if ( ! function_exists( 'is_cart' ) || ! is_cart() )
65
  return $translated_text;
68
  return '';
69
 
70
  return $translated_text;
71
+ } */
72
 
73
  /**
74
  * get_settings.
75
+ *
76
+ * @version 2.3.8
77
  */
78
  function get_settings() {
79
 
80
  $settings = array();
81
 
82
+ /* array(
83
  'title' => __( 'Hide "Note: Shipping and taxes are estimated..." message on Cart page', 'woocommerce-jetpack' ),
84
  'desc' => __( 'Hide', 'woocommerce-jetpack' ),
85
  'id' => 'wcj_cart_hide_shipping_and_taxes_estimated_message',
86
  'default' => 'no',
87
  'type' => 'checkbox',
88
+ ), */
89
 
90
  // Cart Custom Info Options
91
+ $settings[] = array(
92
+ 'title' => __( 'Cart Custom Info Blocks', 'woocommerce-jetpack' ),
93
+ 'type' => 'title',
94
+ 'id' => 'wcj_cart_custom_info_options',
95
+ 'desc' => $this->full_desc,
96
+ );
97
 
98
  $settings[] = array(
99
  'title' => __( 'Total Blocks', 'woocommerce-jetpack' ),
102
  'type' => 'custom_number',
103
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
104
  'custom_attributes'
105
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
106
  );
107
 
108
+ $settings[] = array(
109
+ 'type' => 'sectionend',
110
+ 'id' => 'wcj_cart_custom_info_options',
111
+ );
112
 
113
  $total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
114
 
116
 
117
  $settings = array_merge( $settings, array(
118
 
119
+ array(
120
+ 'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
121
+ 'type' => 'title',
122
+ 'id' => 'wcj_cart_custom_info_options_' . $i,
123
+ ),
124
 
125
  array(
126
  'title' => __( 'Content', 'woocommerce-jetpack' ),
160
  'woocommerce_after_shipping_calculator' => __( 'After shipping calculator', 'woocommerce-jetpack' ),
161
 
162
  'woocommerce_cart_is_empty' => __( 'If cart is empty', 'woocommerce-jetpack' ),
163
+
164
  ),
165
  'css' => 'width:250px;',
166
  ),
173
  'css' => 'width:250px;',
174
  ),
175
 
176
+ array(
177
+ 'type' => 'sectionend',
178
+ 'id' => 'wcj_cart_custom_info_options_' . $i,
179
+ ),
180
+
181
  ) );
182
  }
183
 
184
+ return $this->add_enable_module_setting( $settings/* , $this->full_desc */ );
185
  }
186
  }
187
 
includes/class-wcj-checkout-core-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Checkout Core Fields class.
6
  *
7
- * @version 2.2.7
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -14,49 +14,10 @@ if ( ! class_exists( 'WCJ_Checkout_Core_Fields' ) ) :
14
 
15
  class WCJ_Checkout_Core_Fields extends WCJ_Module {
16
 
17
- /**
18
- * @var array $sub_items
19
- */
20
- public $sub_items = array(
21
- 'enabled' => 'checkbox',
22
- 'required' => 'checkbox',
23
- 'label' => 'text',
24
- 'placeholder' => 'text',
25
- 'class' => 'select',
26
- );
27
-
28
- /**
29
- * @var array $items
30
- */
31
- public $items = array(
32
- 'billing_country' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
33
- 'billing_first_name' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
34
- 'billing_last_name' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
35
- 'billing_company' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'no' ),
36
- 'billing_address_1' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
37
- 'billing_address_2' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'no' ),
38
- 'billing_city' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
39
- 'billing_state' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
40
- 'billing_postcode' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
41
- 'billing_email' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
42
- 'billing_phone' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
43
- 'shipping_country' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
44
- 'shipping_first_name' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
45
- 'shipping_last_name' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
46
- 'shipping_company' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'no' ),
47
- 'shipping_address_1' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
48
- 'shipping_address_2' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'no' ),
49
- 'shipping_city' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
50
- 'shipping_state' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
51
- 'shipping_postcode' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
52
- 'account_password' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'yes' ),
53
- 'order_comments' => array( 'enabled' => 'yes', 'label' => '', 'placeholder' => '', 'required' => 'no' ),
54
- );
55
-
56
  /**
57
  * Constructor.
58
  *
59
- * @version 2.2.7
60
  */
61
  public function __construct() {
62
 
@@ -65,203 +26,269 @@ class WCJ_Checkout_Core_Fields extends WCJ_Module {
65
  $this->desc = __( 'Customize WooCommerce core checkout fields. Disable/enable fields, set required, change labels and/or placeholders.', 'woocommerce-jetpack' );
66
  parent::__construct();
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  if ( $this->is_enabled() ) {
 
69
  add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ) );
70
- add_filter( 'woocommerce_default_address_fields', array( $this, 'fix_required_by_default' ) );
71
  }
72
  }
73
 
74
  /**
75
- * fix_required_by_default.
76
  *
77
- * @since 2.2.4
78
- * @todo There must be a better way!
79
  */
80
- function fix_required_by_default( $address_fields ) {
81
- $fields_required_by_default = array(
82
- 'country',
83
- 'first_name',
84
- 'last_name',
85
- 'address_1',
86
- 'city',
87
- 'state',
88
- 'postcode',
89
- );
90
- foreach ( $fields_required_by_default as $field ) {
91
- $billing_value = get_option( 'wcj_checkout_fields_' . 'billing_' . $field . '_required' );
92
- $shipping_value = get_option( 'wcj_checkout_fields_' . 'shipping_' . $field . '_required' );
93
- if ( 'no' === $billing_value && 'no' === $shipping_value ) {
94
- $address_fields[ $field ]['required'] = false;
95
- }
96
- }
97
- return $address_fields;
98
- }
99
-
100
- /**
101
- * custom_override_checkout_fields.
102
- *
103
- * @version 2.2.7
104
- */
105
- function custom_override_checkout_fields( $checkout_fields ) {
106
-
107
- foreach ( $this->items as $item_key => $default_values ) {
108
 
109
- foreach ( $this->sub_items as $sub_item_key => $sub_item_type ) {
110
 
111
- $item_id = 'wcj_checkout_fields_' . $item_key . '_' . $sub_item_key;
112
- $the_option = get_option( $item_id );
113
 
114
- $field_parts = explode( "_", $item_key, 2 );
 
115
 
116
- if ( $sub_item_key == 'enabled' ) {
 
117
 
118
- if ( $the_option == 'no' )
119
- unset( $checkout_fields[$field_parts[0]][$item_key] ); // e.g. unset( $checkout_fields['billing']['billing_country'] );
120
- }
121
- else if ( isset( $checkout_fields[$field_parts[0]][$item_key] ) ) {
122
-
123
- if ( $the_option != '' ) {
124
 
125
- if ( $sub_item_key == 'required' ) {
 
 
 
126
 
127
- if ( $the_option == 'yes' ) $the_option = true;
128
- else {
129
- $the_option = false;
130
- /* $checkout_fields[$field_parts[0]][$item_key]['validate'] = array();
131
- $checkout_fields[$field_parts[0]][$item_key]['class'] = array( 'woocommerce-validated' );
132
- $checkout_fields[$field_parts[0]][$item_key]['custom_attributes'] = array(); */
133
- }
134
  }
135
 
136
- if ( 'class' === $sub_item_key ) {
137
- if ( 'default' === $the_option ) continue;
138
- else $the_option = array( $the_option );
139
  }
140
 
141
- $checkout_fields[$field_parts[0]][$item_key][$sub_item_key] = $the_option;
 
 
 
142
  }
143
  }
144
  }
145
  }
146
-
147
- return $checkout_fields;
148
  }
149
 
150
  /**
151
- * get_settings.
152
  *
153
- * @version 2.2.7
 
154
  */
155
- function get_settings() {
156
-
157
- //global $woocommerce;
158
-
159
- $settings = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
- array( 'title' => __( 'Checkout Core Fields Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_checkout_core_fields_options' ),
 
 
162
 
163
- //array( 'type' => 'sectionend', 'id' => 'wcj_checkout_core_fields_options' ),
164
- );
 
 
 
 
165
 
166
- // Checkout fields
167
- // $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' );
 
 
168
 
169
- /*$items = array(
170
- 'enabled' => 'checkbox',
171
- ////'type',
172
- 'label' => 'text',
173
- 'placeholder' => 'text',
174
- 'required' => 'checkbox',
175
- //'clear',
176
- );
177
 
178
- $fields = array(
179
- 'billing_country',// => array( 'yes', '', '', 'yes' ),
180
- 'billing_first_name',
181
- 'billing_last_name',
182
- 'billing_company',
183
- 'billing_address_1',
184
- 'billing_address_2',
185
- 'billing_city',
186
- 'billing_state',
187
- 'billing_postcode',
188
- 'billing_email',
189
- 'billing_phone',
190
- 'shipping_country',
191
- 'shipping_first_name',
192
- 'shipping_last_name',
193
- 'shipping_company',
194
- 'shipping_address_1',
195
- 'shipping_address_2',
196
- 'shipping_city',
197
- 'shipping_state',
198
- 'shipping_postcode',
199
- 'account_password',
200
- 'order_comments',
201
- );*/
202
 
203
- //global $woocommerce;
204
- //$checkout_fields = WC()->WC_Checkout->$checkout_fields;//apply_filters( 'woocommerce_checkout_fields' , array() );
205
- /*if ( is_super_admin() ) {
206
 
207
- global $woocommerce;
208
- echo '<pre>[';
209
- print_r( WC_Checkout::instance() );//->checkout()->checkout_fields;
210
- echo ']</pre>';
211
- }*/
 
 
 
212
 
213
- //global $woocommerce;
214
- //echo '<pre>'; print_r( $woocommerce->checkout()->checkout_fields ); echo '</pre>';
215
 
216
- foreach ( $this->items as $field => $default_values) {
 
 
 
217
 
218
- foreach ( $this->sub_items as $item_key => $item_type ) {
 
 
 
219
 
220
- $item_id = 'wcj_checkout_fields_' . $field . '_' . $item_key;
 
 
 
221
 
222
- $default_value = isset( $default_values[ $item_key ] ) ? $default_values[ $item_key ] : '';
 
 
 
 
 
223
 
224
- $item_title = $field;// . ' ' . $item_key;
225
- $item_title = str_replace( "_", " ", $item_title );
226
- $item_title = ucwords( $item_title );
227
 
228
- $item_desc_tip = '';
229
- if ( 'text' == $item_type ) $item_desc_tip = __( 'Leave blank for WooCommerce defaults.', 'woocommerce-jetpack' );
 
 
 
 
230
 
231
- $settings_to_add = array(
232
- // 'title' => $item_title,
233
- // 'desc' => $item_id,//__( 'Enable the Checkout feature', 'woocommerce-jetpack' ),
234
- 'desc' => $item_key,
235
- 'desc_tip' => $item_desc_tip,// . __( 'Default: ', 'woocommerce-jetpack' ) . $default_value,
236
- 'id' => $item_id,
237
- 'default' => $default_value,
238
- 'type' => $item_type,
239
- 'css' => 'min-width:300px;width:50%;',
240
- );
241
 
242
- if ( 'class' === $item_key ) {
243
- $settings_to_add['options'] = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  'default' => __( 'Default', 'woocommerce-jetpack' ),
245
  'form-row-first' => __( 'Align Left', 'woocommerce-jetpack' ),
246
  'form-row-last' => __( 'Align Right', 'woocommerce-jetpack' ),
247
  'form-row-full' => __( 'Full Row', 'woocommerce-jetpack' ),
248
- );
249
- $settings_to_add['default'] = 'default';
250
- }
251
-
252
- if ( 'enabled' == $item_key ) {
253
-
254
- $settings_to_add['title'] = $item_title;
255
- $settings_to_add['checkboxgroup'] = 'start';
256
- }
257
- else if ( 'required' == $item_key ) $settings_to_add['checkboxgroup'] = 'end';
258
 
259
- $settings[] = $settings_to_add;
260
- }
261
  }
262
 
263
- // $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_checkout_fields_options' );
264
- $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_checkout_core_fields_options' );
 
 
265
 
266
  return $this->add_enable_module_setting( $settings );
267
  }
4
  *
5
  * The WooCommerce Jetpack Checkout Core Fields class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
14
 
15
  class WCJ_Checkout_Core_Fields extends WCJ_Module {
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.8
21
  */
22
  public function __construct() {
23
 
26
  $this->desc = __( 'Customize WooCommerce core checkout fields. Disable/enable fields, set required, change labels and/or placeholders.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->woocommerce_core_checkout_fields = array(
30
+ 'billing_country',
31
+ 'billing_first_name',
32
+ 'billing_last_name',
33
+ 'billing_company',
34
+ 'billing_address_1',
35
+ 'billing_address_2',
36
+ 'billing_city',
37
+ 'billing_state',
38
+ 'billing_postcode',
39
+ 'billing_email',
40
+ 'billing_phone',
41
+ 'shipping_country',
42
+ 'shipping_first_name',
43
+ 'shipping_last_name',
44
+ 'shipping_company',
45
+ 'shipping_address_1',
46
+ 'shipping_address_2',
47
+ 'shipping_city',
48
+ 'shipping_state',
49
+ 'shipping_postcode',
50
+ 'account_password',
51
+ 'order_comments',
52
+ );
53
+
54
  if ( $this->is_enabled() ) {
55
+ // $this->convert_old_settings();
56
  add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ) );
57
+ add_filter( 'woocommerce_default_address_fields' , array( $this, 'custom_override_default_address_fields' ) );
58
  }
59
  }
60
 
61
  /**
62
+ * custom_override_default_address_fields.
63
  *
64
+ * @version 2.3.8
65
+ * @since 2.3.8
66
  */
67
+ function custom_override_default_address_fields( $fields ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
+ foreach ( $fields as $field_key => $field_values ) {
70
 
71
+ foreach ( $this->woocommerce_core_checkout_fields as $field ) {
 
72
 
73
+ $field_parts = explode( '_', $field, 2 );
74
+ if ( is_array( $field_parts ) && 2 === count( $field_parts ) ) {
75
 
76
+ $section = $field_parts[0]; // billing or shipping
77
+ $field_name = $field_parts[1];
78
 
79
+ if ( $field_key === $field_name ) {
 
 
 
 
 
80
 
81
+ /* $is_required = get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_required', 'default' );
82
+ if ( 'default' != $is_required ) {
83
+ $fields[ $field_name ]['required'] = ( 'yes' === $is_required ) ? true : false;
84
+ } */
85
 
86
+ $label = get_option( 'wcj_checkout_fields_' . $field . '_' . 'label', '' );
87
+ if ( '' != $label ) {
88
+ $fields[ $field_name ]['label'] = $label;
 
 
 
 
89
  }
90
 
91
+ $placeholder = get_option( 'wcj_checkout_fields_' . $field . '_' . 'placeholder', '' );
92
+ if ( '' != $placeholder ) {
93
+ $fields[ $field_name ]['placeholder'] = $placeholder;
94
  }
95
 
96
+ /* $class = get_option( 'wcj_checkout_fields_' . $field . '_' . 'class', 'default' );
97
+ if ( 'default' != $class ) {
98
+ $fields[ $field_name ]['class'] = $class;
99
+ } */
100
  }
101
  }
102
  }
103
  }
104
+ return $fields;
 
105
  }
106
 
107
  /**
108
+ * convert_old_settings.
109
  *
110
+ * @version 2.3.8
111
+ * @since 2.3.8
112
  */
113
+ /* function convert_old_settings() {
114
+ $woocommerce_core_checkout_fields_old = array(
115
+ 'billing_country' => array( 'default_required' => 'yes' ),
116
+ 'billing_first_name' => array( 'default_required' => 'yes' ),
117
+ 'billing_last_name' => array( 'default_required' => 'yes' ),
118
+ 'billing_company' => array( 'default_required' => 'no' ),
119
+ 'billing_address_1' => array( 'default_required' => 'yes' ),
120
+ 'billing_address_2' => array( 'default_required' => 'no' ),
121
+ 'billing_city' => array( 'default_required' => 'yes' ),
122
+ 'billing_state' => array( 'default_required' => 'yes' ),
123
+ 'billing_postcode' => array( 'default_required' => 'yes' ),
124
+ 'billing_email' => array( 'default_required' => 'yes' ),
125
+ 'billing_phone' => array( 'default_required' => 'yes' ),
126
+ 'shipping_country' => array( 'default_required' => 'yes' ),
127
+ 'shipping_first_name' => array( 'default_required' => 'yes' ),
128
+ 'shipping_last_name' => array( 'default_required' => 'yes' ),
129
+ 'shipping_company' => array( 'default_required' => 'no' ),
130
+ 'shipping_address_1' => array( 'default_required' => 'yes' ),
131
+ 'shipping_address_2' => array( 'default_required' => 'no' ),
132
+ 'shipping_city' => array( 'default_required' => 'yes' ),
133
+ 'shipping_state' => array( 'default_required' => 'yes' ),
134
+ 'shipping_postcode' => array( 'default_required' => 'yes' ),
135
+ 'account_password' => array( 'default_required' => 'yes' ),
136
+ 'order_comments' => array( 'default_required' => 'no' ),
137
+ );
138
 
139
+ foreach ( $woocommerce_core_checkout_fields_old as $field => $options ) {
140
+ $is_enabled_old = get_option( 'wcj_checkout_fields_' . $field . '_' . 'enabled', '' );
141
+ $is_required_old = get_option( 'wcj_checkout_fields_' . $field . '_' . 'required', '' );
142
 
143
+ if ( '' != $is_enabled_old && 'yes' != $is_enabled_old ) {
144
+ update_option( 'wcj_checkout_fields_' . $field . '_' . 'is_enabled', $is_enabled_old );
145
+ }
146
+ if ( '' != $is_required_old && $options['default_required'] != $is_required_old ) {
147
+ update_option( 'wcj_checkout_fields_' . $field . '_' . 'is_required', $is_required_old );
148
+ }
149
 
150
+ delete_option( 'wcj_checkout_fields_' . $field . '_' . 'enabled', '' );
151
+ delete_option( 'wcj_checkout_fields_' . $field . '_' . 'required', '' );
152
+ }
153
+ } */
154
 
155
+ /**
156
+ * custom_override_checkout_fields.
157
+ *
158
+ * @version 2.3.8
159
+ */
160
+ function custom_override_checkout_fields( $checkout_fields ) {
 
 
161
 
162
+ foreach ( $this->woocommerce_core_checkout_fields as $field ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
+ $field_parts = explode( '_', $field, 2 );
165
+ $section = ( ! empty( $field_parts ) && is_array( $field_parts ) ) ? $field_parts[0] : ''; // billing or shipping
 
166
 
167
+ $is_enabled = get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_enabled', 'default' );
168
+ if ( 'default' != $is_enabled ) {
169
+ if ( 'no' === $is_enabled ) {
170
+ if ( isset( $checkout_fields[ $section ][ $field ] ) ) {
171
+ unset( $checkout_fields[ $section ][ $field ] ); // e.g. unset( $checkout_fields['billing']['billing_country'] );
172
+ }
173
+ }
174
+ }
175
 
176
+ if ( isset( $checkout_fields[ $section ][ $field ] ) ) {
 
177
 
178
+ $is_required = get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_required', 'default' );
179
+ if ( 'default' != $is_required ) {
180
+ $checkout_fields[ $section ][ $field ]['required'] = ( 'yes' === $is_required ) ? true : false;
181
+ }
182
 
183
+ $label = get_option( 'wcj_checkout_fields_' . $field . '_' . 'label', '' );
184
+ if ( '' != $label ) {
185
+ $checkout_fields[ $section ][ $field ]['label'] = $label;
186
+ }
187
 
188
+ $placeholder = get_option( 'wcj_checkout_fields_' . $field . '_' . 'placeholder', '' );
189
+ if ( '' != $placeholder ) {
190
+ $checkout_fields[ $section ][ $field ]['placeholder'] = $placeholder;
191
+ }
192
 
193
+ $class = get_option( 'wcj_checkout_fields_' . $field . '_' . 'class', 'default' );
194
+ if ( 'default' != $class ) {
195
+ $checkout_fields[ $section ][ $field ]['class'] = $class;
196
+ }
197
+ }
198
+ }
199
 
200
+ return $checkout_fields;
201
+ }
 
202
 
203
+ /**
204
+ * get_settings.
205
+ *
206
+ * @version 2.3.8
207
+ */
208
+ function get_settings() {
209
 
210
+ $settings = array(
211
+ array(
212
+ 'title' => __( 'Checkout Core Fields Options', 'woocommerce-jetpack' ),
213
+ 'type' => 'title',
214
+ 'id' => 'wcj_checkout_core_fields_options',
215
+ ),
216
+ );
 
 
 
217
 
218
+ foreach ( $this->woocommerce_core_checkout_fields as $field ) {
219
+
220
+ $settings = array_merge( $settings, array (
221
+
222
+ array(
223
+ 'title' => ucwords( str_replace( '_', ' ', $field ) ),
224
+ 'desc' => __( 'enabled', 'woocommerce-jetpack' ),
225
+ 'id' => 'wcj_checkout_fields_' . $field . '_' . 'is_enabled',
226
+ 'default' => 'default',
227
+ 'type' => 'select',
228
+ 'options' => array(
229
+ 'default' => __( 'Default', 'woocommerce-jetpack' ),
230
+ 'yes' => __( 'Enabled', 'woocommerce-jetpack' ),
231
+ 'no' => __( 'Disabled', 'woocommerce-jetpack' ),
232
+ ),
233
+ 'css' => 'min-width:300px;width:50%;',
234
+ ),
235
+
236
+ array(
237
+ 'title' => '',
238
+ 'desc' => __( 'required', 'woocommerce-jetpack' ),
239
+ 'id' => 'wcj_checkout_fields_' . $field . '_' . 'is_required',
240
+ 'default' => 'default',
241
+ 'type' => 'select',
242
+ 'options' => array(
243
+ 'default' => __( 'Default', 'woocommerce-jetpack' ),
244
+ 'yes' => __( 'Required', 'woocommerce-jetpack' ),
245
+ 'no' => __( 'Not Required', 'woocommerce-jetpack' ),
246
+ ),
247
+ 'css' => 'min-width:300px;width:50%;',
248
+ ),
249
+
250
+ array(
251
+ 'title' => '',
252
+ 'desc' => __( 'label', 'woocommerce-jetpack' ),
253
+ 'desc_tip' => __( 'Leave blank for WooCommerce defaults.', 'woocommerce-jetpack' ),
254
+ 'id' => 'wcj_checkout_fields_' . $field . '_' . 'label',
255
+ 'default' => '',
256
+ 'type' => 'text',
257
+ 'css' => 'min-width:300px;width:50%;',
258
+ ),
259
+
260
+ array(
261
+ 'title' => '',
262
+ 'desc' => __( 'placeholder', 'woocommerce-jetpack' ),
263
+ 'desc_tip' => __( 'Leave blank for WooCommerce defaults.', 'woocommerce-jetpack' ),
264
+ 'id' => 'wcj_checkout_fields_' . $field . '_' . 'placeholder',
265
+ 'default' => '',
266
+ 'type' => 'text',
267
+ 'css' => 'min-width:300px;width:50%;',
268
+ ),
269
+
270
+ array(
271
+ 'title' => '',
272
+ 'desc' => __( 'class', 'woocommerce-jetpack' ),
273
+ 'id' => 'wcj_checkout_fields_' . $field . '_' . 'class',
274
+ 'default' => 'default',
275
+ 'type' => 'select',
276
+ 'options' => array(
277
  'default' => __( 'Default', 'woocommerce-jetpack' ),
278
  'form-row-first' => __( 'Align Left', 'woocommerce-jetpack' ),
279
  'form-row-last' => __( 'Align Right', 'woocommerce-jetpack' ),
280
  'form-row-full' => __( 'Full Row', 'woocommerce-jetpack' ),
281
+ ),
282
+ 'css' => 'min-width:300px;width:50%;',
283
+ ),
 
 
 
 
 
 
 
284
 
285
+ ) );
 
286
  }
287
 
288
+ $settings[] = array(
289
+ 'type' => 'sectionend',
290
+ 'id' => 'wcj_checkout_core_fields_options',
291
+ );
292
 
293
  return $this->add_enable_module_setting( $settings );
294
  }
includes/class-wcj-checkout-custom-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Checkout Custom Fields class.
6
  *
7
- * @version 2.3.7
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -209,20 +209,30 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
209
  /**
210
  * update_custom_checkout_fields_order_meta.
211
  *
212
- * @version 2.3.7
213
  */
214
  public function update_custom_checkout_fields_order_meta( $order_id ) {
215
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
216
  if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
217
  $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
 
218
  $option_name = $the_section . '_' . 'wcj_checkout_field_' . $i;
219
  $option_name_label = $the_section . '_' . 'wcj_checkout_field_label_' . $i;
220
- if ( ! empty( $_POST[ $option_name ] ) ) {
221
- update_post_meta( $order_id, '_' . $option_name_label, get_option( 'wcj_checkout_custom_field_label_' . $i ) );
222
- update_post_meta( $order_id, '_' . $option_name, wc_clean( $_POST[ $option_name ] ) );
223
- } elseif ( 'checkbox' === get_option( 'wcj_checkout_custom_field_type_' . $i ) ) {
224
  update_post_meta( $order_id, '_' . $option_name_label, get_option( 'wcj_checkout_custom_field_label_' . $i ) );
225
- update_post_meta( $order_id, '_' . $option_name, 0 );
 
 
 
 
 
 
 
 
 
 
226
  }
227
  }
228
  }
@@ -231,7 +241,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
231
  /**
232
  * add_custom_fields_to_order_display.
233
  *
234
- * @version 2.3.7
235
  * @since 2.3.0
236
  */
237
  function add_custom_fields_to_order_display( $order ) {
@@ -240,7 +250,11 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
240
 
241
  if ( false !== strpos( $key, 'wcj_checkout_field_' ) && isset( $values[0] ) ) {
242
 
243
- if ( false !== strpos( $key, '_label_' ) ) {
 
 
 
 
244
  continue;
245
  }
246
 
@@ -248,16 +262,21 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
248
 
249
  $the_label_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_label_', $key );
250
  if ( isset( $post_meta[ $the_label_key ][0] ) ) {
251
- if ( is_array( $post_meta[ $the_label_key ][0] ) ) {
252
- if ( isset( $post_meta[ $the_label_key ][0]['label'] ) ) {
253
- $output .= $post_meta[ $the_label_key ][0]['label'] . ': ';
254
- }
255
- } else {
256
- $output .= $post_meta[ $the_label_key ][0] . ': ';
257
- }
258
  }
259
 
260
- $output .= ( is_array( $values[0] ) && isset( $values[0]['value'] ) ) ? $values[0]['value'] : $values[0];
 
 
 
 
 
 
 
 
261
 
262
  if ( '' != $output ) echo $output . '<br>';
263
  }
@@ -266,6 +285,8 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
266
 
267
  /**
268
  * add_woocommerce_admin_fields.
 
 
269
  */
270
  public function add_woocommerce_admin_fields( $fields, $section ) {
271
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
@@ -274,21 +295,25 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
274
  if ( 'datepicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
275
  $the_type = 'text';
276
  }
 
 
 
277
  $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
278
  if ( $section != $the_section ) continue;
279
  $the_key = 'wcj_checkout_field_' . $i;
280
  $the_key_label = 'wcj_checkout_field_label_' . $i;
281
-
282
  $the_meta = get_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, true );
283
  if ( is_array( $the_meta ) ) {
284
- // Converting from before v2.3.0
285
  if ( isset( $the_meta['value'] ) ) update_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, $the_meta['value'] );
286
  if ( isset( $the_meta['label'] ) ) update_post_meta( get_the_ID(), '_' . $section . '_' . $the_key_label, $the_meta['label'] );
 
287
  }
288
-
289
  $fields[ $the_key ] = array(
290
  'type' => $the_type,
291
- 'label' => get_option( 'wcj_checkout_custom_field_label_' . $i ),//@todo label from post meta?
 
 
292
  'show' => true,
293
  );
294
  }
@@ -322,7 +347,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
322
  /**
323
  * add_custom_checkout_fields.
324
  *
325
- * @version 2.3.0
326
  */
327
  public function add_custom_checkout_fields( $fields ) {
328
 
@@ -374,6 +399,12 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
374
  if ( 'select' === $the_type || 'radio' === $the_type ) {
375
  $select_options_raw = get_option( 'wcj_checkout_custom_field_select_options_' . $i );
376
  $select_options = wcj_get_select_options( $select_options_raw );
 
 
 
 
 
 
377
  $the_field['options'] = $select_options;
378
  if ( ! empty( $select_options ) ) {
379
  reset( $select_options );
@@ -381,6 +412,10 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
381
  }
382
  }
383
 
 
 
 
 
384
  $fields[ $the_section ][ $the_section . '_' . $the_key ] = $the_field;
385
  }
386
  }
@@ -390,7 +425,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
390
  /**
391
  * get_settings.
392
  *
393
- * @version 2.3.0
394
  */
395
  public function get_settings() {
396
 
@@ -463,6 +498,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
463
  'id' => 'wcj_checkout_custom_field_enabled_' . $i,
464
  'default' => 'no',
465
  'type' => 'checkbox',
 
466
  ),
467
  array(
468
  'title' => '',
@@ -473,27 +509,56 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
473
  'options' => array(
474
  'text' => __( 'Text', 'woocommerce-jetpack' ),
475
  'textarea' => __( 'Textarea', 'woocommerce-jetpack' ),
476
- 'number' => __( 'Number', 'woocommerce-jetpack' ),//custom-todo - filter
477
  'checkbox' => __( 'Checkbox', 'woocommerce-jetpack' ),
478
- // 'file' => __( 'File', 'woocommerce-jetpack' ),//todo
479
- 'datepicker' => __( 'Datepicker', 'woocommerce-jetpack' ),//custom (passed as `text`)
480
- 'timepicker' => __( 'Timepicker', 'woocommerce-jetpack' ),//custom (passed as `text`)
481
- 'select' => __( 'Select', 'woocommerce-jetpack' ),//?
482
- 'radio' => __( 'Radio', 'woocommerce-jetpack' ),//?
483
  'password' => __( 'Password', 'woocommerce-jetpack' ),
484
- 'country' => __( 'Country', 'woocommerce-jetpack' ),//
485
- 'state' => __( 'State', 'woocommerce-jetpack' ),//
486
- 'email' => __( 'Email', 'woocommerce-jetpack' ),//
487
- 'tel' => __( 'Phone', 'woocommerce-jetpack' ),//
488
  ),
489
- 'css' => 'width:200px;',
490
  ),
491
  array(
492
  'title' => '',
493
- 'desc' => __( 'options (only if "select" or "radio" type is selected)', 'woocommerce-jetpack' ),
494
  'id' => 'wcj_checkout_custom_field_select_options_' . $i,
495
  'default' => '',
496
  'type' => 'textarea',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  ),
498
  array(
499
  'title' => '',
@@ -501,6 +566,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
501
  'id' => 'wcj_checkout_custom_field_required_' . $i,
502
  'default' => 'no',
503
  'type' => 'checkbox',
 
504
  ),
505
  array(
506
  'title' => '',
@@ -508,7 +574,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
508
  'id' => 'wcj_checkout_custom_field_label_' . $i,
509
  'default' => '',
510
  'type' => 'textarea',
511
- 'css' => 'width:200px;',
512
  ),
513
  /*array(
514
  'title' => '',
@@ -530,7 +596,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
530
  'id' => 'wcj_checkout_custom_field_placeholder_' . $i,
531
  'default' => '',
532
  'type' => 'textarea',
533
- 'css' => 'width:200px;',
534
  ),
535
 
536
  array(
@@ -545,7 +611,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
545
  'order' => __( 'Order Notes', 'woocommerce-jetpack' ),
546
  'account' => __( 'Account', 'woocommerce-jetpack' ),
547
  ),
548
- 'css' => 'width:200px;',
549
  ),
550
 
551
  array(
@@ -559,7 +625,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
559
  'form-row-first' => __( 'First', 'woocommerce-jetpack' ),
560
  'form-row-last' => __( 'Last', 'woocommerce-jetpack' ),
561
  ),
562
- 'css' => 'width:200px;',
563
  ),
564
 
565
  array(
@@ -568,6 +634,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
568
  'id' => 'wcj_checkout_custom_field_clear_' . $i,
569
  'default' => 'yes',
570
  'type' => 'checkbox',
 
571
  ),
572
 
573
  array(
@@ -578,7 +645,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
578
  'default' => '',
579
  'type' => 'multiselect',
580
  'class' => 'chosen_select',
581
- 'css' => 'width: 450px;',
582
  'options' => $product_cats,
583
  ),
584
 
4
  *
5
  * The WooCommerce Jetpack Checkout Custom Fields class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
209
  /**
210
  * update_custom_checkout_fields_order_meta.
211
  *
212
+ * @version 2.3.8
213
  */
214
  public function update_custom_checkout_fields_order_meta( $order_id ) {
215
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
216
  if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
217
  $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
218
+ $the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
219
  $option_name = $the_section . '_' . 'wcj_checkout_field_' . $i;
220
  $option_name_label = $the_section . '_' . 'wcj_checkout_field_label_' . $i;
221
+ $option_name_type = $the_section . '_' . 'wcj_checkout_field_type_' . $i;
222
+ if ( ! empty( $_POST[ $option_name ] ) || 'checkbox' === $the_type ) {
223
+ update_post_meta( $order_id, '_' . $option_name_type, $the_type );
 
224
  update_post_meta( $order_id, '_' . $option_name_label, get_option( 'wcj_checkout_custom_field_label_' . $i ) );
225
+ if ( 'checkbox' === $the_type ) {
226
+ $the_value = ( isset( $_POST[ $option_name ] ) ) ? 1 : 0;
227
+ update_post_meta( $order_id, '_' . $option_name, $the_value );
228
+ $option_name_checkbox_value = $the_section . '_' . 'wcj_checkout_field_checkbox_value_' . $i;
229
+ $checkbox_value = ( 1 == $the_value ) ?
230
+ get_option( 'wcj_checkout_custom_field_checkbox_yes_' . $i ) :
231
+ get_option( 'wcj_checkout_custom_field_checkbox_no_' . $i );
232
+ update_post_meta( $order_id, '_' . $option_name_checkbox_value, $checkbox_value );
233
+ } else {
234
+ update_post_meta( $order_id, '_' . $option_name, wc_clean( $_POST[ $option_name ] ) );
235
+ }
236
  }
237
  }
238
  }
241
  /**
242
  * add_custom_fields_to_order_display.
243
  *
244
+ * @version 2.3.8
245
  * @since 2.3.0
246
  */
247
  function add_custom_fields_to_order_display( $order ) {
250
 
251
  if ( false !== strpos( $key, 'wcj_checkout_field_' ) && isset( $values[0] ) ) {
252
 
253
+ if (
254
+ false !== strpos( $key, '_label_' ) ||
255
+ false !== strpos( $key, '_type_' ) ||
256
+ false !== strpos( $key, '_checkbox_value_' )
257
+ ) {
258
  continue;
259
  }
260
 
262
 
263
  $the_label_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_label_', $key );
264
  if ( isset( $post_meta[ $the_label_key ][0] ) ) {
265
+ $output .= $post_meta[ $the_label_key ][0] . ': ';
266
+ } elseif ( is_array( $values[0] ) && isset( $values[0]['label'] ) ) {
267
+ $output .= $values[0]['label'] . ': ';
268
+ // TODO convert from before version 2.3.0
 
 
 
269
  }
270
 
271
+ $the_value = ( is_array( $values[0] ) && isset( $values[0]['value'] ) ) ? $values[0]['value'] : $values[0];
272
+
273
+ $the_type_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_type_', $key );
274
+ if ( isset( $post_meta[ $the_type_key ][0] ) && 'checkbox' === $post_meta[ $the_type_key ][0] ) {
275
+ $the_checkbox_value_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_checkbox_value_', $key );
276
+ $output .= ( isset( $post_meta[ $the_checkbox_value_key ][0] ) ) ? $post_meta[ $the_checkbox_value_key ][0] : $the_value;
277
+ } else {
278
+ $output .= $the_value;
279
+ }
280
 
281
  if ( '' != $output ) echo $output . '<br>';
282
  }
285
 
286
  /**
287
  * add_woocommerce_admin_fields.
288
+ *
289
+ * @version 2.3.8
290
  */
291
  public function add_woocommerce_admin_fields( $fields, $section ) {
292
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
295
  if ( 'datepicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
296
  $the_type = 'text';
297
  }
298
+ if ( 'checkbox' === $the_type || 'select' === $the_type || 'radio' === $the_type ) {
299
+ $the_type = 'text';
300
+ }
301
  $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
302
  if ( $section != $the_section ) continue;
303
  $the_key = 'wcj_checkout_field_' . $i;
304
  $the_key_label = 'wcj_checkout_field_label_' . $i;
 
305
  $the_meta = get_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, true );
306
  if ( is_array( $the_meta ) ) {
307
+ // Converting from before version 2.3.0
308
  if ( isset( $the_meta['value'] ) ) update_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, $the_meta['value'] );
309
  if ( isset( $the_meta['label'] ) ) update_post_meta( get_the_ID(), '_' . $section . '_' . $the_key_label, $the_meta['label'] );
310
+ // TODO section?
311
  }
 
312
  $fields[ $the_key ] = array(
313
  'type' => $the_type,
314
+ 'label' => ( '' != get_post_meta( get_the_ID(), '_' . $section . '_' . $the_key_label, true ) ) ?
315
+ get_post_meta( get_the_ID(), '_' . $section . '_' . $the_key_label, true ) :
316
+ get_option( 'wcj_checkout_custom_field_label_' . $i ),
317
  'show' => true,
318
  );
319
  }
347
  /**
348
  * add_custom_checkout_fields.
349
  *
350
+ * @version 2.3.8
351
  */
352
  public function add_custom_checkout_fields( $fields ) {
353
 
399
  if ( 'select' === $the_type || 'radio' === $the_type ) {
400
  $select_options_raw = get_option( 'wcj_checkout_custom_field_select_options_' . $i );
401
  $select_options = wcj_get_select_options( $select_options_raw );
402
+ if ( 'select' === $the_type ) {
403
+ $placeholder = get_option( 'wcj_checkout_custom_field_placeholder_' . $i );
404
+ if ( '' != $placeholder ) {
405
+ $select_options = array_merge( array( '' => $placeholder ), $select_options );
406
+ }
407
+ }
408
  $the_field['options'] = $select_options;
409
  if ( ! empty( $select_options ) ) {
410
  reset( $select_options );
412
  }
413
  }
414
 
415
+ if ( 'checkbox' === $the_type ) {
416
+ $the_field['default'] = ( 'yes' === get_option( 'wcj_checkout_custom_field_checkbox_default_' . $i ) ) ? 1 : 0;
417
+ }
418
+
419
  $fields[ $the_section ][ $the_section . '_' . $the_key ] = $the_field;
420
  }
421
  }
425
  /**
426
  * get_settings.
427
  *
428
+ * @version 2.3.8
429
  */
430
  public function get_settings() {
431
 
498
  'id' => 'wcj_checkout_custom_field_enabled_' . $i,
499
  'default' => 'no',
500
  'type' => 'checkbox',
501
+ 'css' => 'min-width:300px;width:50%;',
502
  ),
503
  array(
504
  'title' => '',
509
  'options' => array(
510
  'text' => __( 'Text', 'woocommerce-jetpack' ),
511
  'textarea' => __( 'Textarea', 'woocommerce-jetpack' ),
512
+ 'number' => __( 'Number', 'woocommerce-jetpack' ),
513
  'checkbox' => __( 'Checkbox', 'woocommerce-jetpack' ),
514
+ // 'file' => __( 'File', 'woocommerce-jetpack' ),
515
+ 'datepicker' => __( 'Datepicker', 'woocommerce-jetpack' ),
516
+ 'timepicker' => __( 'Timepicker', 'woocommerce-jetpack' ),
517
+ 'select' => __( 'Select', 'woocommerce-jetpack' ),
518
+ 'radio' => __( 'Radio', 'woocommerce-jetpack' ),
519
  'password' => __( 'Password', 'woocommerce-jetpack' ),
520
+ 'country' => __( 'Country', 'woocommerce-jetpack' ),
521
+ 'state' => __( 'State', 'woocommerce-jetpack' ),
522
+ 'email' => __( 'Email', 'woocommerce-jetpack' ),
523
+ 'tel' => __( 'Phone', 'woocommerce-jetpack' ),
524
  ),
525
+ 'css' => 'min-width:300px;width:50%;',
526
  ),
527
  array(
528
  'title' => '',
529
+ 'desc' => __( 'options (only if "select" or "radio" type is selected). One option per line', 'woocommerce-jetpack' ),
530
  'id' => 'wcj_checkout_custom_field_select_options_' . $i,
531
  'default' => '',
532
  'type' => 'textarea',
533
+ 'css' => 'min-width:300px;width:50%;',
534
+ ),
535
+ array(
536
+ 'title' => '',
537
+ 'id' => 'wcj_checkout_custom_field_checkbox_yes_' . $i,
538
+ 'desc' => __( 'If checkbox is selected, set value for ON here', 'woocommerce-jetpack' ),
539
+ 'type' => 'text',
540
+ 'default' => __( 'Yes', 'woocommerce-jetpack' ),
541
+ 'css' => 'min-width:300px;width:50%;',
542
+ ),
543
+ array(
544
+ 'title' => '',
545
+ 'id' => 'wcj_checkout_custom_field_checkbox_no_' . $i,
546
+ 'desc' => __( 'If checkbox is selected, set value for OFF here', 'woocommerce-jetpack' ),
547
+ 'type' => 'text',
548
+ 'default' => __( 'No', 'woocommerce-jetpack' ),
549
+ 'css' => 'min-width:300px;width:50%;',
550
+ ),
551
+ array(
552
+ 'title' => '',
553
+ 'id' => 'wcj_checkout_custom_field_checkbox_default_' . $i,
554
+ 'desc' => __( 'If checkbox is selected, set default value here', 'woocommerce-jetpack' ),
555
+ 'type' => 'select',
556
+ 'default' => 'no',
557
+ 'options' => array(
558
+ 'no' => __( 'Not Checked', 'woocommerce-jetpack' ),
559
+ 'yes' => __( 'Checked', 'woocommerce-jetpack' ),
560
+ ),
561
+ 'css' => 'min-width:300px;width:50%;',
562
  ),
563
  array(
564
  'title' => '',
566
  'id' => 'wcj_checkout_custom_field_required_' . $i,
567
  'default' => 'no',
568
  'type' => 'checkbox',
569
+ 'css' => 'min-width:300px;width:50%;',
570
  ),
571
  array(
572
  'title' => '',
574
  'id' => 'wcj_checkout_custom_field_label_' . $i,
575
  'default' => '',
576
  'type' => 'textarea',
577
+ 'css' => 'min-width:300px;width:50%;',
578
  ),
579
  /*array(
580
  'title' => '',
596
  'id' => 'wcj_checkout_custom_field_placeholder_' . $i,
597
  'default' => '',
598
  'type' => 'textarea',
599
+ 'css' => 'min-width:300px;width:50%;',
600
  ),
601
 
602
  array(
611
  'order' => __( 'Order Notes', 'woocommerce-jetpack' ),
612
  'account' => __( 'Account', 'woocommerce-jetpack' ),
613
  ),
614
+ 'css' => 'min-width:300px;width:50%;',
615
  ),
616
 
617
  array(
625
  'form-row-first' => __( 'First', 'woocommerce-jetpack' ),
626
  'form-row-last' => __( 'Last', 'woocommerce-jetpack' ),
627
  ),
628
+ 'css' => 'min-width:300px;width:50%;',
629
  ),
630
 
631
  array(
634
  'id' => 'wcj_checkout_custom_field_clear_' . $i,
635
  'default' => 'yes',
636
  'type' => 'checkbox',
637
+ 'css' => 'min-width:300px;width:50%;',
638
  ),
639
 
640
  array(
645
  'default' => '',
646
  'type' => 'multiselect',
647
  'class' => 'chosen_select',
648
+ 'css' => 'min-width:300px;width:50%;',
649
  'options' => $product_cats,
650
  ),
651
 
includes/class-wcj-general.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
- * @version 2.2.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -57,6 +57,8 @@ class WCJ_General extends WCJ_Module {
57
 
58
  /**
59
  * get_settings.
 
 
60
  */
61
  function get_settings() {
62
 
@@ -93,7 +95,7 @@ class WCJ_General extends WCJ_Module {
93
  'title' => __( 'Custom CSS - Front end (Customers)', 'woocommerce-jetpack' ),
94
  'id' => 'wcj_general_custom_css',
95
  'default' => '',
96
- 'type' => 'textarea',
97
  'css' => 'width:66%;min-width:300px;min-height:300px;',
98
  ),
99
 
@@ -101,7 +103,7 @@ class WCJ_General extends WCJ_Module {
101
  'title' => __( 'Custom CSS - Back end (Admin)', 'woocommerce-jetpack' ),
102
  'id' => 'wcj_general_custom_admin_css',
103
  'default' => '',
104
- 'type' => 'textarea',
105
  'css' => 'width:66%;min-width:300px;min-height:300px;',
106
  ),
107
 
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
57
 
58
  /**
59
  * get_settings.
60
+ *
61
+ * @version 2.3.8
62
  */
63
  function get_settings() {
64
 
95
  'title' => __( 'Custom CSS - Front end (Customers)', 'woocommerce-jetpack' ),
96
  'id' => 'wcj_general_custom_css',
97
  'default' => '',
98
+ 'type' => 'custom_textarea',
99
  'css' => 'width:66%;min-width:300px;min-height:300px;',
100
  ),
101
 
103
  'title' => __( 'Custom CSS - Back end (Admin)', 'woocommerce-jetpack' ),
104
  'id' => 'wcj_general_custom_admin_css',
105
  'default' => '',
106
+ 'type' => 'custom_textarea',
107
  'css' => 'width:66%;min-width:300px;min-height:300px;',
108
  ),
109
 
includes/class-wcj-order-custom-statuses.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Order Custom Statuses class.
6
  *
7
- * @version 2.2.7
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -18,7 +18,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
18
  /**
19
  * Constructor.
20
  *
21
- * @version 2.2.7
22
  */
23
  public function __construct() {
24
 
@@ -27,7 +27,8 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
27
  $this->desc = __( 'Custom statuses for WooCommerce orders.', 'woocommerce-jetpack' );
28
  parent::__construct();
29
 
30
- // Variables
 
31
  $this->default_statuses = array(
32
  'wc-pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
33
  'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
@@ -48,10 +49,9 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
48
 
49
  add_filter( 'woocommerce_default_order_status', array( $this, 'set_default_order_status' ), 100 );
50
 
51
- // add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
52
- add_filter( 'woocommerce_reports_order_statuses', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
53
-
54
- // add_action( 'wcj_after_module_settings_' . $this->id, array( $this, 'create_custom_statuses_tool' ), PHP_INT_MAX );
55
 
56
  if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_bulk_actions' ) ) {
57
  add_action( 'admin_footer', array( $this, 'bulk_admin_footer' ), 11 );
@@ -64,30 +64,20 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
64
 
65
  /**
66
  * add_custom_order_statuses_to_reports.
 
 
67
  */
68
  public function add_custom_order_statuses_to_reports( $order_statuses ) {
69
-
70
- // if ( is_array( $order_statuses ) && 1 === count( $order_statuses ) && 'refunded' === $order_statuses[0] ) return $order_statuses;
71
- if ( is_array( $order_statuses ) && in_array( 'refunded', $order_statuses ) ) return $order_statuses;
72
-
73
- $custom_order_statuses = get_option( 'wcj_orders_custom_statuses_array' );
74
- if ( ! empty( $custom_order_statuses ) && is_array( $custom_order_statuses ) ) {
75
- foreach ( $custom_order_statuses as $slug => $label ) {
76
- $order_statuses[] = substr( $slug, 3 );
77
  }
78
-
79
  }
80
  return $order_statuses;
81
  }
82
- /* public function add_custom_order_statuses_to_reports( $args ) {
83
- /*if ( ! empty( $args['order_types'] ) && is_array( $args['order_types'] ) && in_array( 'shop_order_refund', $args['order_types'] ) )
84
- return $args;*//*
85
- if ( isset( $args['order_status'] ) && $args['order_status'] === array( 'refunded' ) )
86
- //if ( ! empty( $args['order_status'] ) && is_array( $args['order_status'] ) && 1 === count( $args['order_status'] ) && in_array( 'refunded', $args['order_status'] ) )
87
- return $args;
88
-
89
- ...
90
- } */
91
 
92
  /**
93
  * set_default_order_status.
@@ -127,10 +117,9 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
127
  */
128
  public function add_custom_statuses_tool_info_to_tools_dashboard() {
129
  echo '<tr>';
130
- // if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled') )
131
- $is_enabled = ( $this->is_enabled() )
132
- ? '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>'
133
- : '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
134
  echo '<td>' . __( 'Custom Statuses', 'woocommerce-jetpack' ) . '</td>';
135
  echo '<td>' . $is_enabled . '</td>';
136
  echo '<td>' . __( 'Tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ) . '</td>';
@@ -197,9 +186,10 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
197
 
198
  /**
199
  * create_custom_statuses_tool.
 
 
200
  */
201
  public function create_custom_statuses_tool() {
202
-
203
  $result_message = '';
204
  if ( isset( $_POST['add_custom_status'] ) )
205
  $result_message = $this->add_custom_status( $_POST['new_status'], $_POST['new_status_label'] );
@@ -212,8 +202,9 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
212
  else
213
  $result_message = '<div class="error"><p>' . __( 'Delete failed.', 'woocommerce-jetpack' ) . '</p></div>';
214
  }
 
215
  ?><div>
216
- <h2><?php echo __( 'WooCommerce Jetpack - Custom Statuses', 'woocommerce-jetpack' ); ?></h2>
217
  <p><?php echo __( 'The tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ); ?></p>
218
  <?php echo $result_message; ?>
219
  <h3><?php echo __( 'Statuses', 'woocommerce-jetpack' ); ?></h3>
@@ -221,7 +212,6 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
221
  echo '<tr>';
222
  echo '<th>' . __( 'Slug', 'woocommerce-jetpack' ) . '</th>';
223
  echo '<th>' . __( 'Label', 'woocommerce-jetpack' ) . '</th>';
224
- // echo '<th>' . __( 'Count', 'woocommerce-jetpack' ) . '</th>';
225
  echo '<th>' . __( 'Delete', 'woocommerce-jetpack' ) . '</th>';
226
  echo '</tr>';
227
  $statuses = function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : array();
@@ -240,7 +230,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
240
  </div><?php
241
  ?><div class="metabox-holder" style="width:300px;">
242
  <div class="postbox">
243
- <h3 class="hndle"><span>Add</span></h3>
244
  <div class="inside">
245
  <form method="post" action="<?php echo remove_query_arg( 'delete' ); ?>">
246
  <ul>
@@ -292,7 +282,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
292
  /**
293
  * get_settings.
294
  *
295
- * @version 2.2.7
296
  */
297
  function get_settings() {
298
 
@@ -301,7 +291,6 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
301
  array(
302
  'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ),
303
  'type' => 'title',
304
- // 'desc' => __( 'This section lets you enable custom statuses tool.', 'woocommerce-jetpack' ),
305
  'id' => 'wcj_orders_custom_statuses_options'
306
  ),
307
 
@@ -323,12 +312,22 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
323
  'type' => 'checkbox',
324
  ),
325
 
 
 
 
 
 
 
 
 
326
  array(
327
  'type' => 'sectionend',
328
  'id' => 'wcj_orders_custom_statuses_options'
329
  ),
330
  );
331
 
 
 
332
  return $this->add_enable_module_setting( $settings );
333
  }
334
  }
4
  *
5
  * The WooCommerce Jetpack Order Custom Statuses class.
6
  *
7
+ * @version 2.3.8
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
18
  /**
19
  * Constructor.
20
  *
21
+ * @version 2.3.8
22
  */
23
  public function __construct() {
24
 
27
  $this->desc = __( 'Custom statuses for WooCommerce orders.', 'woocommerce-jetpack' );
28
  parent::__construct();
29
 
30
+ $this->add_tools( array( 'custom_statuses' => __( 'Custom Statuses', 'woocommerce-jetpack' ), ) );
31
+
32
  $this->default_statuses = array(
33
  'wc-pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
34
  'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
49
 
50
  add_filter( 'woocommerce_default_order_status', array( $this, 'set_default_order_status' ), 100 );
51
 
52
+ if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_reports' ) ) {
53
+ add_filter( 'woocommerce_reports_order_statuses', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
54
+ }
 
55
 
56
  if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_bulk_actions' ) ) {
57
  add_action( 'admin_footer', array( $this, 'bulk_admin_footer' ), 11 );
64
 
65
  /**
66
  * add_custom_order_statuses_to_reports.
67
+ *
68
+ * @version 2.3.8
69
  */
70
  public function add_custom_order_statuses_to_reports( $order_statuses ) {
71
+ if ( is_array( $order_statuses ) && in_array( 'completed', $order_statuses ) ) {
72
+ $custom_order_statuses = get_option( 'wcj_orders_custom_statuses_array' );
73
+ if ( ! empty( $custom_order_statuses ) && is_array( $custom_order_statuses ) ) {
74
+ foreach ( $custom_order_statuses as $slug => $label ) {
75
+ $order_statuses[] = substr( $slug, 3 );
76
+ }
 
 
77
  }
 
78
  }
79
  return $order_statuses;
80
  }
 
 
 
 
 
 
 
 
 
81
 
82
  /**
83
  * set_default_order_status.
117
  */
118
  public function add_custom_statuses_tool_info_to_tools_dashboard() {
119
  echo '<tr>';
120
+ $is_enabled = ( $this->is_enabled() ) ?
121
+ '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>' :
122
+ '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
 
123
  echo '<td>' . __( 'Custom Statuses', 'woocommerce-jetpack' ) . '</td>';
124
  echo '<td>' . $is_enabled . '</td>';
125
  echo '<td>' . __( 'Tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ) . '</td>';
186
 
187
  /**
188
  * create_custom_statuses_tool.
189
+ *
190
+ * @version 2.3.8
191
  */
192
  public function create_custom_statuses_tool() {
 
193
  $result_message = '';
194
  if ( isset( $_POST['add_custom_status'] ) )
195
  $result_message = $this->add_custom_status( $_POST['new_status'], $_POST['new_status_label'] );
202
  else
203
  $result_message = '<div class="error"><p>' . __( 'Delete failed.', 'woocommerce-jetpack' ) . '</p></div>';
204
  }
205
+ echo $this->get_back_to_settings_link_html() . '<br>';
206
  ?><div>
207
+ <h2><?php echo __( 'Booster - Custom Statuses', 'woocommerce-jetpack' ); ?></h2>
208
  <p><?php echo __( 'The tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ); ?></p>
209
  <?php echo $result_message; ?>
210
  <h3><?php echo __( 'Statuses', 'woocommerce-jetpack' ); ?></h3>
212
  echo '<tr>';
213
  echo '<th>' . __( 'Slug', 'woocommerce-jetpack' ) . '</th>';
214
  echo '<th>' . __( 'Label', 'woocommerce-jetpack' ) . '</th>';
 
215
  echo '<th>' . __( 'Delete', 'woocommerce-jetpack' ) . '</th>';
216
  echo '</tr>';
217
  $statuses = function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : array();
230
  </div><?php
231
  ?><div class="metabox-holder" style="width:300px;">
232
  <div class="postbox">
233
+ <h3 class="hndle"><span><?php _e( 'Add', 'woocommerce-jetpack' ); ?></span></h3>
234
  <div class="inside">
235
  <form method="post" action="<?php echo remove_query_arg( 'delete' ); ?>">
236
  <ul>
282
  /**
283
  * get_settings.
284
  *
285
+ * @version 2.3.8
286
  */
287
  function get_settings() {
288
 
291
  array(
292
  'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ),
293
  'type' => 'title',
 
294
  'id' => 'wcj_orders_custom_statuses_options'
295
  ),
296
 
312
  'type' => 'checkbox',
313
  ),
314
 
315
+ array(
316
+ 'title' => __( 'Add Custom Statuses to Admin Reports', 'woocommerce-jetpack' ),
317
+ 'desc' => __( 'Add', 'woocommerce-jetpack' ),
318
+ 'id' => 'wcj_orders_custom_statuses_add_to_reports',
319
+ 'default' => 'yes',
320
+ 'type' => 'checkbox',
321
+ ),
322
+
323
  array(
324
  'type' => 'sectionend',
325
  'id' => 'wcj_orders_custom_statuses_options'
326
  ),
327
  );
328
 
329
+ $settings = $this->add_tools_list( $settings );
330
+
331
  return $this->add_enable_module_setting( $settings );
332
  }
333
  }
includes/class-wcj-price-by-country.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Price by Country class.
6
  *
7
- * @version 2.3.4
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -45,7 +45,7 @@ class WCJ_Price_By_Country extends WCJ_Module {
45
  /**
46
  * get_settings.
47
  *
48
- * @version 2.3.0
49
  */
50
  function get_settings() {
51
 
@@ -134,7 +134,7 @@ class WCJ_Price_By_Country extends WCJ_Module {
134
 
135
  $settings[] = array(
136
  'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
137
- 'desc' => __( 'Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://boostwoo.com/features/prices-and-currencies-by-customers-country">BoostWoo.com</a>', 'woocommerce-jetpack' ),
138
  'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i,
139
  'default' => '',
140
  'type' => 'textarea',
4
  *
5
  * The WooCommerce Jetpack Price by Country class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
45
  /**
46
  * get_settings.
47
  *
48
+ * @version 2.3.8
49
  */
50
  function get_settings() {
51
 
134
 
135
  $settings[] = array(
136
  'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
137
+ 'desc' => __( 'Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://booster.io/features/prices-and-currencies-by-customers-country" target="_blank">http://booster.io</a>', 'woocommerce-jetpack' ),
138
  'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i,
139
  'default' => '',
140
  'type' => 'textarea',
includes/classes/class-wcj-module.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Module class.
6
  *
7
- * @version 2.3.0
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -180,13 +180,13 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
180
  /**
181
  * add_tools_list.
182
  *
183
- * @version 2.2.3
184
  * @since 2.2.3
185
  */
186
  function add_tools_list( $settings ) {
187
  return array_merge( $settings, array(
188
  array(
189
- 'title' => $this->short_desc . ' ' . __( 'Tools', 'woocommerce-jetpack' ),
190
  'type' => 'title',
191
  'desc' => '',
192
  'id' => 'wcj_' . $this->id . '_tools_options'
4
  *
5
  * The WooCommerce Jetpack Module class.
6
  *
7
+ * @version 2.3.8
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
180
  /**
181
  * add_tools_list.
182
  *
183
+ * @version 2.3.8
184
  * @since 2.2.3
185
  */
186
  function add_tools_list( $settings ) {
187
  return array_merge( $settings, array(
188
  array(
189
+ 'title' => /* $this->short_desc . ' ' . */__( 'Tools', 'woocommerce-jetpack' ),
190
  'type' => 'title',
191
  'desc' => '',
192
  'id' => 'wcj_' . $this->id . '_tools_options'
includes/input-fields/class-wcj-product-input-fields-abstract.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Product Input Fields abstract class.
6
  *
7
- * @version 2.2.2
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -26,19 +26,23 @@ class WCJ_Product_Input_Fields_Abstract {
26
 
27
  /**
28
  * get_options.
 
 
29
  */
30
  public function get_options() {
31
  $options = array(
 
32
  array(
33
- 'id' => 'wcj_product_input_fields_enabled_' . $this->scope . '_',
34
- 'title' => __( 'Enabled', 'woocommerce-jetpack' ),
35
- 'type' => 'checkbox',
36
- 'default' => 'no',
37
  ),
 
38
  array(
39
- 'id' => 'wcj_product_input_fields_type_' . $this->scope . '_',
40
- 'title' => __( 'Type', 'woocommerce-jetpack' ),
41
- 'type' => 'select',
42
  'default' => 'text',
43
  'options' => array(
44
  'text' => __( 'Text', 'woocommerce-jetpack' ),
@@ -55,76 +59,93 @@ class WCJ_Product_Input_Fields_Abstract {
55
  // 'state' => __( 'State', 'woocommerce-jetpack' ),
56
  'email' => __( 'Email', 'woocommerce-jetpack' ),
57
  'tel' => __( 'Phone', 'woocommerce-jetpack' ),
58
-
59
  ),
60
  ),
61
 
62
  /* array(
63
- 'id' => 'wcj_product_input_fields_type_checkbox_' . $this->scope . '_',
64
- 'title' => __( 'If checkbox is selected, set possible pairs here.', 'woocommerce-jetpack' ),
65
- 'type' => 'select',
66
  'default' => 'yes_no',
67
  'options' => array(
68
- 'yes_no' => __( 'Yes / No', 'woocommerce-jetpack' ),
69
- 'on_off' => __( 'On / Off', 'woocommerce-jetpack' ),
70
- ),
71
  ), */
 
72
  array(
73
- 'id' => 'wcj_product_input_fields_type_checkbox_yes_' . $this->scope . '_',
74
- 'title' => __( 'If checkbox is selected, set value for ON here', 'woocommerce-jetpack' ),
75
- 'short_title' => __( 'Checkbox: ON', 'woocommerce-jetpack' ),
76
- 'type' => 'text',
77
  'default' => __( 'Yes', 'woocommerce-jetpack' ),
78
  ),
 
79
  array(
80
- 'id' => 'wcj_product_input_fields_type_checkbox_no_' . $this->scope . '_',
81
- 'title' => __( 'If checkbox is selected, set value for OFF here', 'woocommerce-jetpack' ),
82
- 'short_title' => __( 'Checkbox: OFF', 'woocommerce-jetpack' ),
83
- 'type' => 'text',
84
  'default' => __( 'No', 'woocommerce-jetpack' ),
85
  ),
86
 
87
- // TODO: http://www.w3schools.com/tags/att_input_accept.asp
88
  array(
89
- 'id' => 'wcj_product_input_fields_type_file_accept_' . $this->scope . '_',
90
- 'title' => __( 'If file is selected, set accepted file types here. E.g.: ".jpg,.jpeg,.png". Leave blank to accept all files', 'woocommerce-jetpack' ),
91
- 'short_title' => __( 'File: Accepted types', 'woocommerce-jetpack' ),
92
- 'type' => 'text',
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  'default' => __( '.jpg,.jpeg,.png', 'woocommerce-jetpack' ),
94
  ),
95
 
96
  array(
97
- 'id' => 'wcj_product_input_fields_type_select_options_' . $this->scope . '_',
98
- 'title' => __( 'If select/radio is selected, set options here. One option per line', 'woocommerce-jetpack' ),
99
- 'short_title' => __( 'Select/Radio: Options', 'woocommerce-jetpack' ),
100
- 'type' => 'textarea',
101
  'default' => '',
102
  ),
103
 
104
  array(
105
- 'id' => 'wcj_product_input_fields_required_' . $this->scope . '_',
106
- 'title' => __( 'Required', 'woocommerce-jetpack' ),
107
- 'type' => 'checkbox',
108
  'default' => 'no',
109
  ),
 
110
  array(
111
- 'id' => 'wcj_product_input_fields_title_' . $this->scope . '_',
112
- 'title' => __( 'Title', 'woocommerce-jetpack' ),
113
- 'type' => 'textarea',
114
  'default' => '',
115
  ),
 
116
  array(
117
- 'id' => 'wcj_product_input_fields_placeholder_' . $this->scope . '_',
118
- 'title' => __( 'Placeholder', 'woocommerce-jetpack' ),
119
- 'type' => 'textarea',
120
  'default' => '',
121
  ),
 
122
  array(
123
- 'id' => 'wcj_product_input_fields_required_message_' . $this->scope . '_',
124
- 'title' => __( 'Message on required', 'woocommerce-jetpack' ),
125
- 'type' => 'textarea',
126
  'default' => '',
127
  ),
 
128
  );
129
  return $options;
130
  }
@@ -334,6 +355,8 @@ class WCJ_Product_Input_Fields_Abstract {
334
 
335
  /**
336
  * add_product_input_fields_to_frontend.
 
 
337
  */
338
  public function add_product_input_fields_to_frontend() {
339
  global $product;
@@ -357,7 +380,6 @@ class WCJ_Product_Input_Fields_Abstract {
357
 
358
  case 'number':
359
  case 'text':
360
- case 'checkbox':
361
  case 'file':
362
  case 'password':
363
  case 'email':
@@ -366,6 +388,15 @@ class WCJ_Product_Input_Fields_Abstract {
366
  echo '<p>' . $title . '<input type="' . $type . '" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
367
  break;
368
 
 
 
 
 
 
 
 
 
 
369
  case 'datepicker':
370
 
371
  echo '<p>' . $title . '<input type="' . $type . '" display="date" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
@@ -385,6 +416,9 @@ class WCJ_Product_Input_Fields_Abstract {
385
 
386
  $select_options_raw = $this->get_value( 'wcj_product_input_fields_type_select_options_' . $this->scope . '_' . $i, $product->id, '' );
387
  $select_options = wcj_get_select_options( $select_options_raw );
 
 
 
388
  $select_options_html = '';
389
  if ( ! empty( $select_options ) ) {
390
  reset( $select_options );
4
  *
5
  * The WooCommerce Jetpack Product Input Fields abstract class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
26
 
27
  /**
28
  * get_options.
29
+ *
30
+ * @version 2.3.8
31
  */
32
  public function get_options() {
33
  $options = array(
34
+
35
  array(
36
+ 'id' => 'wcj_product_input_fields_enabled_' . $this->scope . '_',
37
+ 'title' => __( 'Enabled', 'woocommerce-jetpack' ),
38
+ 'type' => 'checkbox',
39
+ 'default' => 'no',
40
  ),
41
+
42
  array(
43
+ 'id' => 'wcj_product_input_fields_type_' . $this->scope . '_',
44
+ 'title' => __( 'Type', 'woocommerce-jetpack' ),
45
+ 'type' => 'select',
46
  'default' => 'text',
47
  'options' => array(
48
  'text' => __( 'Text', 'woocommerce-jetpack' ),
59
  // 'state' => __( 'State', 'woocommerce-jetpack' ),
60
  'email' => __( 'Email', 'woocommerce-jetpack' ),
61
  'tel' => __( 'Phone', 'woocommerce-jetpack' ),
 
62
  ),
63
  ),
64
 
65
  /* array(
66
+ 'id' => 'wcj_product_input_fields_type_checkbox_' . $this->scope . '_',
67
+ 'title' => __( 'If checkbox is selected, set possible pairs here.', 'woocommerce-jetpack' ),
68
+ 'type' => 'select',
69
  'default' => 'yes_no',
70
  'options' => array(
71
+ 'yes_no' => __( 'Yes / No', 'woocommerce-jetpack' ),
72
+ 'on_off' => __( 'On / Off', 'woocommerce-jetpack' ),
73
+ ),
74
  ), */
75
+
76
  array(
77
+ 'id' => 'wcj_product_input_fields_type_checkbox_yes_' . $this->scope . '_',
78
+ 'title' => __( 'If checkbox is selected, set value for ON here', 'woocommerce-jetpack' ),
79
+ 'short_title' => __( 'Checkbox: ON', 'woocommerce-jetpack' ),
80
+ 'type' => 'text',
81
  'default' => __( 'Yes', 'woocommerce-jetpack' ),
82
  ),
83
+
84
  array(
85
+ 'id' => 'wcj_product_input_fields_type_checkbox_no_' . $this->scope . '_',
86
+ 'title' => __( 'If checkbox is selected, set value for OFF here', 'woocommerce-jetpack' ),
87
+ 'short_title' => __( 'Checkbox: OFF', 'woocommerce-jetpack' ),
88
+ 'type' => 'text',
89
  'default' => __( 'No', 'woocommerce-jetpack' ),
90
  ),
91
 
 
92
  array(
93
+ 'id' => 'wcj_product_input_fields_type_checkbox_default_' . $this->scope . '_',
94
+ 'title' => __( 'If checkbox is selected, set default value here', 'woocommerce-jetpack' ),
95
+ 'short_title' => __( 'Checkbox: Default', 'woocommerce-jetpack' ),
96
+ 'type' => 'select',
97
+ 'default' => 'no',
98
+ 'options' => array(
99
+ 'no' => __( 'Not Checked', 'woocommerce-jetpack' ),
100
+ 'yes' => __( 'Checked', 'woocommerce-jetpack' ),
101
+ ),
102
+ ),
103
+
104
+ // TODO http://www.w3schools.com/tags/att_input_accept.asp
105
+ array(
106
+ 'id' => 'wcj_product_input_fields_type_file_accept_' . $this->scope . '_',
107
+ 'title' => __( 'If file is selected, set accepted file types here. E.g.: ".jpg,.jpeg,.png". Leave blank to accept all files', 'woocommerce-jetpack' ),
108
+ 'short_title' => __( 'File: Accepted types', 'woocommerce-jetpack' ),
109
+ 'type' => 'text',
110
  'default' => __( '.jpg,.jpeg,.png', 'woocommerce-jetpack' ),
111
  ),
112
 
113
  array(
114
+ 'id' => 'wcj_product_input_fields_type_select_options_' . $this->scope . '_',
115
+ 'title' => __( 'If select/radio is selected, set options here. One option per line', 'woocommerce-jetpack' ),
116
+ 'short_title' => __( 'Select/Radio: Options', 'woocommerce-jetpack' ),
117
+ 'type' => 'textarea',
118
  'default' => '',
119
  ),
120
 
121
  array(
122
+ 'id' => 'wcj_product_input_fields_required_' . $this->scope . '_',
123
+ 'title' => __( 'Required', 'woocommerce-jetpack' ),
124
+ 'type' => 'checkbox',
125
  'default' => 'no',
126
  ),
127
+
128
  array(
129
+ 'id' => 'wcj_product_input_fields_title_' . $this->scope . '_',
130
+ 'title' => __( 'Title', 'woocommerce-jetpack' ),
131
+ 'type' => 'textarea',
132
  'default' => '',
133
  ),
134
+
135
  array(
136
+ 'id' => 'wcj_product_input_fields_placeholder_' . $this->scope . '_',
137
+ 'title' => __( 'Placeholder', 'woocommerce-jetpack' ),
138
+ 'type' => 'textarea',
139
  'default' => '',
140
  ),
141
+
142
  array(
143
+ 'id' => 'wcj_product_input_fields_required_message_' . $this->scope . '_',
144
+ 'title' => __( 'Message on required', 'woocommerce-jetpack' ),
145
+ 'type' => 'textarea',
146
  'default' => '',
147
  ),
148
+
149
  );
150
  return $options;
151
  }
355
 
356
  /**
357
  * add_product_input_fields_to_frontend.
358
+ *
359
+ * @version 2.3.8
360
  */
361
  public function add_product_input_fields_to_frontend() {
362
  global $product;
380
 
381
  case 'number':
382
  case 'text':
 
383
  case 'file':
384
  case 'password':
385
  case 'email':
388
  echo '<p>' . $title . '<input type="' . $type . '" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
389
  break;
390
 
391
+ case 'checkbox':
392
+ $checked = checked(
393
+ $this->get_value( 'wcj_product_input_fields_type_checkbox_default_' . $this->scope . '_' . $i, $product->id, 'no' ),
394
+ 'yes',
395
+ false
396
+ );
397
+ echo '<p>' . $title . '<input type="' . $type . '" name="' . $field_name . '"' . $custom_attributes . $checked . '>' . '</p>';
398
+ break;
399
+
400
  case 'datepicker':
401
 
402
  echo '<p>' . $title . '<input type="' . $type . '" display="date" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
416
 
417
  $select_options_raw = $this->get_value( 'wcj_product_input_fields_type_select_options_' . $this->scope . '_' . $i, $product->id, '' );
418
  $select_options = wcj_get_select_options( $select_options_raw );
419
+ if ( '' != $placeholder ) {
420
+ $select_options = array_merge( array( '' => $placeholder ), $select_options );
421
+ }
422
  $select_options_html = '';
423
  if ( ! empty( $select_options ) ) {
424
  reset( $select_options );
includes/shortcodes/class-wcj-products-shortcodes.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Products Shortcodes class.
6
  *
7
- * @version 2.3.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -162,7 +162,7 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
162
  /**
163
  * wcj_product_crowdfunding_time_remaining.
164
  *
165
- * @version 2.3.0
166
  * @since 2.2.6
167
  */
168
  function wcj_product_crowdfunding_time_remaining( $atts ) {
@@ -171,10 +171,10 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
171
  $hours_remaining = floor( $seconds_remaining / ( 60 * 60 ) );
172
  $minutes_remaining = floor( $seconds_remaining / 60 );
173
  if ( $seconds_remaining <= 0 ) return '';
174
- if ( $days_remaining > 0 ) return ( 1 === $days_remaining ) ? $days_remaining . ' day left' : $days_remaining . ' days left';
175
- if ( $hours_remaining > 0 ) return ( 1 === $hours_remaining ) ? $hours_remaining . ' hour left' : $hours_remaining . ' hours left';
176
- if ( $minutes_remaining > 0 ) return ( 1 === $minutes_remaining ) ? $minutes_remaining . ' minute left' : $minutes_remaining . ' minutes left';
177
- return ( 1 === $seconds_remaining ) ? $seconds_remaining . ' second left' : $seconds_remaining . ' seconds left';
178
  /* if ( ( $seconds_remaining = strtotime( $this->wcj_product_crowdfunding_deadline( $atts ) ) - time() ) <= 0 ) return '';
179
  if ( ( $days_remaining = floor( $seconds_remaining / ( 24 * 60 * 60 ) ) ) > 0 ) {
180
  return ( 1 === $days_remaining ) ? $days_remaining . ' day left' : $days_remaining . ' days left';
4
  *
5
  * The WooCommerce Jetpack Products Shortcodes class.
6
  *
7
+ * @version 2.3.8
8
  * @author Algoritmika Ltd.
9
  */
10
 
162
  /**
163
  * wcj_product_crowdfunding_time_remaining.
164
  *
165
+ * @version 2.3.8
166
  * @since 2.2.6
167
  */
168
  function wcj_product_crowdfunding_time_remaining( $atts ) {
171
  $hours_remaining = floor( $seconds_remaining / ( 60 * 60 ) );
172
  $minutes_remaining = floor( $seconds_remaining / 60 );
173
  if ( $seconds_remaining <= 0 ) return '';
174
+ if ( $days_remaining > 0 ) return ( 1 == $days_remaining ) ? $days_remaining . ' day left' : $days_remaining . ' days left';
175
+ if ( $hours_remaining > 0 ) return ( 1 == $hours_remaining ) ? $hours_remaining . ' hour left' : $hours_remaining . ' hours left';
176
+ if ( $minutes_remaining > 0 ) return ( 1 == $minutes_remaining ) ? $minutes_remaining . ' minute left' : $minutes_remaining . ' minutes left';
177
+ return ( 1 == $seconds_remaining ) ? $seconds_remaining . ' second left' : $seconds_remaining . ' seconds left';
178
  /* if ( ( $seconds_remaining = strtotime( $this->wcj_product_crowdfunding_deadline( $atts ) ) - time() ) <= 0 ) return '';
179
  if ( ( $days_remaining = floor( $seconds_remaining / ( 24 * 60 * 60 ) ) ) > 0 ) {
180
  return ( 1 === $days_remaining ) ? $days_remaining . ' day left' : $days_remaining . ' days left';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://algoritmika.com/donate/
4
  Tags: woocommerce,booster for 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,email pdf invoice,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,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
- Stable tag: 2.3.7
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -87,11 +87,11 @@ Booster for WooCommerce is a WordPress plugin that supercharges your site with a
87
 
88
  = Feedback =
89
  * We are open to your suggestions and feedback - thank you for using or trying out one of our plugins!
90
- * 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://boostwoo.com/submit-idea/).
91
- * For support visit the [contact page](http://boostwoo.com/contact-us/).
92
 
93
  = More =
94
- * Visit the [Booster for WooCommerce plugin page](http://boostwoo.com/)
95
 
96
  = Available Translations =
97
  * French - `fr_FR` by Jean-Marc Schreiber.
@@ -108,7 +108,7 @@ Booster for WooCommerce is a WordPress plugin that supercharges your site with a
108
 
109
  = How to unlock those some features settings that are locked? =
110
 
111
- To unlock all Booster for WooCommerce features, please install additional <a href="http://boostwoo.com/plus/">Booster for WooCommerce Plus</a> plugin.
112
 
113
  == Screenshots ==
114
 
@@ -116,6 +116,22 @@ To unlock all Booster for WooCommerce features, please install additional <a hre
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  = 2.3.7 - 17/10/2015 =
120
  * Dev - General Shortcodes - `[wcj_tcpdf_pagebreak]` shortcode added.
121
  * Dev - BUTTON & PRICE LABELS - Custom Price Labels - Global labels - Products/Categories Include/Exclude options added.
@@ -555,7 +571,7 @@ To unlock all Booster for WooCommerce features, please install additional <a hre
555
  %price%, %price_excluding_tax% (suggested by Josh),
556
  %stock_availability% (by https://wordpress.org/support/topic/custom-tabs-1),
557
  %time_since_last_sale%, %weight%, %list_attributes% etc.
558
- For full list of short codes, please visit http://boostwoo.com/features/product-info/
559
  * Feature Upgraded - Product Listings - Option to change default WooCommerce behavior on displaying all products if none categories are dispalyed.
560
  Now it's possible to disable displaying the products. Suggested by Xavier.
561
  * Feature Upgraded - PDF Invoices - Order date and time added. Suggested by https://wordpress.org/support/topic/order-time
4
  Tags: woocommerce,booster for 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,email pdf invoice,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,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
+ Stable tag: 2.3.8
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
87
 
88
  = Feedback =
89
  * We are open to your suggestions and feedback - thank you for using or trying out one of our plugins!
90
+ * 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://booster.io/submit-idea/).
91
+ * For support visit the [contact page](http://booster.io/contact-us/).
92
 
93
  = More =
94
+ * Visit the [Booster for WooCommerce plugin page](http://booster.io/)
95
 
96
  = Available Translations =
97
  * French - `fr_FR` by Jean-Marc Schreiber.
108
 
109
  = How to unlock those some features settings that are locked? =
110
 
111
+ To unlock all Booster for WooCommerce features, please install additional <a href="http://booster.io/plus/">Booster for WooCommerce Plus</a> plugin.
112
 
113
  == Screenshots ==
114
 
116
 
117
  == Changelog ==
118
 
119
+ = 2.3.8 - 26/10/2015 =
120
+ * Dev - Link changed to http://booster.io
121
+ * Fix - Shortcodes - Products - Crowdfunding - `[wcj_product_crowdfunding_time_remaining]` singular form bug fixed.
122
+ * Dev - PRODUCTS - Product Input Fields - *Placeholder* for *select* type added.
123
+ * Dev - PRODUCTS - Product Input Fields - *Default value* for *checkbox* type added.
124
+ * Dev - CART & CHECKOUT - Cart - Module description added.
125
+ * Fix - CART & CHECKOUT - Checkout Core Fields - Bug, causing message that some not existing field (e.g. State / County) is required, fixed.
126
+ * Fix - CART & CHECKOUT - Checkout Core Fields - Bug with changing label and/or placeholder for some core checkout fields (e.g. address), fixed.
127
+ * Fix - CART & CHECKOUT - Checkout Custom Fields - Bug, causing PHP notices on order admin save (on orders with some types of custom checkout fields), fixed.
128
+ * Dev - CART & CHECKOUT - Checkout Custom Fields - *Placeholder* for *select* type added.
129
+ * Dev - CART & CHECKOUT - Checkout Custom Fields - *Default value* for *checkbox* type added.
130
+ * Dev - CART & CHECKOUT - Checkout Custom Fields - *Values options* for *checkbox* type added.
131
+ * Dev - EMAILS & MISC. - General - CSS fields changed from `textarea` to `custom_textarea`.
132
+ * Fix - SHIPPING & ORDERS - Order Custom Statuses - Custom statuses now counted in admin reports (and "Add Custom Statuses to Admin Reports" option added).
133
+ * Dev - SHIPPING & ORDERS - Order Custom Statuses - Tool link added to module settings.
134
+
135
  = 2.3.7 - 17/10/2015 =
136
  * Dev - General Shortcodes - `[wcj_tcpdf_pagebreak]` shortcode added.
137
  * Dev - BUTTON & PRICE LABELS - Custom Price Labels - Global labels - Products/Categories Include/Exclude options added.
571
  %price%, %price_excluding_tax% (suggested by Josh),
572
  %stock_availability% (by https://wordpress.org/support/topic/custom-tabs-1),
573
  %time_since_last_sale%, %weight%, %list_attributes% etc.
574
+ For full list of short codes, please visit http://booster.io/features/product-info/
575
  * Feature Upgraded - Product Listings - Option to change default WooCommerce behavior on displaying all products if none categories are dispalyed.
576
  Now it's possible to disable displaying the products. Suggested by Xavier.
577
  * Feature Upgraded - PDF Invoices - Order date and time added. Suggested by https://wordpress.org/support/topic/order-time
woocommerce-jetpack.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: Booster for WooCommerce
4
- Plugin URI: http://BoostWoo.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 2.3.7
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2015 Algoritmika Ltd.
@@ -21,7 +21,7 @@ if ( ! class_exists( 'WC_Jetpack' ) ) :
21
  * Main WC_Jetpack Class
22
  *
23
  * @class WC_Jetpack
24
- * @version 2.3.3
25
  */
26
 
27
  final class WC_Jetpack {
@@ -230,39 +230,42 @@ final class WC_Jetpack {
230
  /**
231
  * Show action links on the plugin screen
232
  *
233
- * @param mixed $links
234
- * @return array
 
235
  */
236
  public function action_links( $links ) {
237
  return array_merge( array(
238
  '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=jetpack' ) . '">' . __( 'Settings', 'woocommerce' ) . '</a>',
239
- '<a href="' . esc_url( apply_filters( 'woocommerce_docs_url', 'http://BoostWoo.com/', 'woocommerce' ) ) . '">' . __( 'Docs', 'woocommerce' ) . '</a>',
240
- '<a href="' . esc_url( apply_filters( 'woocommerce_support_url', 'http://BoostWoo.com/plus/' ) ) . '">' . __( 'Unlock all', 'woocommerce' ) . '</a>',
241
  ), $links );
242
  }
243
 
244
  /**
245
  * get_wcj_plus_message.
 
 
246
  */
247
  public function get_wcj_plus_message( $value, $message_type ) {
248
 
249
  switch ( $message_type ) {
250
 
251
  case 'global':
252
- return '<div class="updated">
253
- <p class="main"><strong>' . __( 'Install Booster Plus to unlock all features', 'woocommerce-jetpack' ) . '</strong></p>
254
- <span>' . sprintf( __('Some settings fields are locked and you will need %s to modify all locked fields.', 'woocommerce-jetpack'), '<a href="http://BoostWoo.com/plus/">Booster for WooCommerce Plus</a>' ) . '</span>
255
- <p><a href="http://BoostWoo.com/plus/" target="_blank" class="button button-primary">' . __( 'Buy now', 'woocommerce-jetpack' ) . '</a> <a href="http://BoostWoo.com" target="_blank" class="button">'. sprintf( __( 'Visit %s', 'woocommerce-jetpack' ), 'BoostWoo.com' ) . '</a></p>
256
  </div>';
257
 
258
  case 'desc':
259
- return __( 'Get <a href="http://BoostWoo.com/plus/" target="_blank">Booster Plus</a> to change value.', 'woocommerce-jetpack' );
260
 
261
  case 'desc_below':
262
- return __( 'Get <a href="http://BoostWoo.com/plus/" target="_blank">Booster Plus</a> to change values below.', 'woocommerce-jetpack' );
263
 
264
  case 'desc_above':
265
- return __( 'Get <a href="http://BoostWoo.com/plus/" target="_blank">Booster Plus</a> to change values above.', 'woocommerce-jetpack' );
266
 
267
  case 'desc_no_link':
268
  return __( 'Get Booster Plus to change value.', 'woocommerce-jetpack' );
1
  <?php
2
  /*
3
  Plugin Name: Booster for WooCommerce
4
+ Plugin URI: http://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 2.3.8
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2015 Algoritmika Ltd.
21
  * Main WC_Jetpack Class
22
  *
23
  * @class WC_Jetpack
24
+ * @version 2.3.8
25
  */
26
 
27
  final class WC_Jetpack {
230
  /**
231
  * Show action links on the plugin screen
232
  *
233
+ * @version 2.3.8
234
+ * @param mixed $links
235
+ * @return array
236
  */
237
  public function action_links( $links ) {
238
  return array_merge( array(
239
  '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=jetpack' ) . '">' . __( 'Settings', 'woocommerce' ) . '</a>',
240
+ '<a href="' . esc_url( 'http://booster.io/' ) . '">' . __( 'Docs', 'woocommerce' ) . '</a>',
241
+ '<a href="' . esc_url( 'http://booster.io/plus/' ) . '">' . __( 'Unlock all', 'woocommerce' ) . '</a>',
242
  ), $links );
243
  }
244
 
245
  /**
246
  * get_wcj_plus_message.
247
+ *
248
+ * @version 2.3.8
249
  */
250
  public function get_wcj_plus_message( $value, $message_type ) {
251
 
252
  switch ( $message_type ) {
253
 
254
  case 'global':
255
+ return '<div class="updated">
256
+ <p class="main"><strong>' . __( 'Install Booster Plus to unlock all features', 'woocommerce-jetpack' ) . '</strong></p>
257
+ <span>' . sprintf( __('Some settings fields are locked and you will need %s to modify all locked fields.', 'woocommerce-jetpack'), '<a href="http://booster.io/plus/">Booster for WooCommerce Plus</a>' ) . '</span>
258
+ <p><a href="http://booster.io/plus/" target="_blank" class="button button-primary">' . __( 'Buy now', 'woocommerce-jetpack' ) . '</a> <a href="http://booster.io" target="_blank" class="button">'. sprintf( __( 'Visit Booster Site', 'woocommerce-jetpack' ), 'http://booster.io' ) . '</a></p>
259
  </div>';
260
 
261
  case 'desc':
262
+ return __( 'Get <a href="http://booster.io/plus/" target="_blank">Booster Plus</a> to change value.', 'woocommerce-jetpack' );
263
 
264
  case 'desc_below':
265
+ return __( 'Get <a href="http://booster.io/plus/" target="_blank">Booster Plus</a> to change values below.', 'woocommerce-jetpack' );
266
 
267
  case 'desc_above':
268
+ return __( 'Get <a href="http://booster.io/plus/" target="_blank">Booster Plus</a> to change values above.', 'woocommerce-jetpack' );
269
 
270
  case 'desc_no_link':
271
  return __( 'Get Booster Plus to change value.', 'woocommerce-jetpack' );