WooCommerce Checkout Manager - Version 4.8.6

Version Description

  • Fix: woocommerce checkout manager conditional field
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 4.8.6
Comparing to
See all releases

Code changes from version 4.8.5 to 4.8.6

includes/class-wooccm-compatibility.php CHANGED
@@ -293,7 +293,8 @@ class WOOCCM_Field_Compatibility {
293
  }
294
 
295
  if (!empty($field['conditional_parent_key']) && !empty($field['conditional_parent_key'])) {
296
- if ($parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']))) {
 
297
  if (isset($fields[$parent_id]) && !empty($fields[$parent_id]['options'])) {
298
  $id = @max(array_keys(array_column($fields[$parent_id]['options'], 'label'), $field['conditional_parent_value']));
299
  $field['conditional_parent_value'] = (int) $id;
@@ -304,7 +305,7 @@ class WOOCCM_Field_Compatibility {
304
  if ($field['type'] == 'colorpicker' && !empty($field['colorpickerd'])) {
305
  $field['default'] = $field['colorpickerd'];
306
  }
307
-
308
  $field['type'] = $this->get_new_type($field['type']);
309
 
310
  $field['show_role'] = $this->string_to_array($field['show_role']);
@@ -361,7 +362,8 @@ class WOOCCM_Field_Compatibility {
361
 
362
  $field = $this->new_panel_compatibility($field_id, $field, $fields, $prefix);
363
 
364
- if (count($defaults) && $default_id = @max(array_keys(array_column($defaults, 'key'), $field['key']))) {
 
365
 
366
  if (isset($defaults[$default_id])) {
367
 
293
  }
294
 
295
  if (!empty($field['conditional_parent_key']) && !empty($field['conditional_parent_key'])) {
296
+ // if ($parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']))) {
297
+ if ($parent_id = WOOCCM()->$prefix->get_field_id($fields, 'key', $field['conditional_parent_key'])) {
298
  if (isset($fields[$parent_id]) && !empty($fields[$parent_id]['options'])) {
299
  $id = @max(array_keys(array_column($fields[$parent_id]['options'], 'label'), $field['conditional_parent_value']));
300
  $field['conditional_parent_value'] = (int) $id;
305
  if ($field['type'] == 'colorpicker' && !empty($field['colorpickerd'])) {
306
  $field['default'] = $field['colorpickerd'];
307
  }
308
+
309
  $field['type'] = $this->get_new_type($field['type']);
310
 
311
  $field['show_role'] = $this->string_to_array($field['show_role']);
362
 
363
  $field = $this->new_panel_compatibility($field_id, $field, $fields, $prefix);
364
 
365
+ // if (count($defaults) && $default_id = @max(array_keys(array_column($defaults, 'key'), $field['key']))) {
366
+ if (count($defaults) && $default_id = WOOCCM()->$prefix->get_field_id($defaults, 'key', $field['key'])) {
367
 
368
  if (isset($defaults[$default_id])) {
369
 
includes/controller/class-wooccm-field.php CHANGED
@@ -203,7 +203,8 @@ class WOOCCM_Field_Controller {
203
 
204
  if (!empty($field['conditional_parent_key']) && $field['conditional_parent_key'] != $field['key']) {
205
 
206
- $parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']));
 
207
 
208
  if (isset($fields[$parent_id])) {
209
  $field['parent'] = $fields[$parent_id];
@@ -234,7 +235,7 @@ class WOOCCM_Field_Controller {
234
 
235
  if ($fields = WOOCCM()->$section->get_fields()) {
236
 
237
- $parent_id = @max(array_keys(array_column($fields, 'key'), $key));
238
 
239
  if (isset($fields[$parent_id])) {
240
  wp_send_json_success($fields[$parent_id]);
203
 
204
  if (!empty($field['conditional_parent_key']) && $field['conditional_parent_key'] != $field['key']) {
205
 
206
+ // $parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']));
207
+ $parent_id = WOOCCM()->$section->get_field_id($fields, 'key', $field['conditional_parent_key']);
208
 
209
  if (isset($fields[$parent_id])) {
210
  $field['parent'] = $fields[$parent_id];
235
 
236
  if ($fields = WOOCCM()->$section->get_fields()) {
237
 
238
+ $parent_id = WOOCCM()->$section->get_field_id($fields, 'key', $key);
239
 
240
  if (isset($fields[$parent_id])) {
241
  wp_send_json_success($fields[$parent_id]);
includes/model/class-wooccm-field.php CHANGED
@@ -33,7 +33,21 @@ class WOOCCM_Field {
33
  return false;
34
  }
35
 
36
- public function get_id($fields) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  if (count($fields)) {
39
  return max(array_keys($fields)) + 1;
@@ -405,7 +419,7 @@ class WOOCCM_Field {
405
 
406
  $fields = $this->get_fields();
407
 
408
- $field_id = $this->get_id($fields);
409
 
410
  $field_data = $this->sanitize_field_data($field_data);
411
 
33
  return false;
34
  }
35
 
36
+ public function get_field_id($fields, $key = 'key', $value) {
37
+
38
+ if (count($fields)) {
39
+
40
+ foreach ($fields as $id => $field) {
41
+ if ($field[$key] == $value) {
42
+ return $id;
43
+ }
44
+ }
45
+ }
46
+
47
+ return 0;
48
+ }
49
+
50
+ public function get_next_id($fields) {
51
 
52
  if (count($fields)) {
53
  return max(array_keys($fields)) + 1;
419
 
420
  $fields = $this->get_fields();
421
 
422
+ $field_id = $this->get_next_id($fields);
423
 
424
  $field_data = $this->sanitize_field_data($field_data);
425
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 4.6
6
  Tested up to: 5.3.2
7
- Stable tag: 4.8.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
99
 
100
  == Changelog ==
101
 
 
 
 
102
  = 4.8.5 =
103
  * Fix: woocommerce checkout manager modal tab
104
  * New: woocommerce checkout manager field description
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 4.6
6
  Tested up to: 5.3.2
7
+ Stable tag: 4.8.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 4.8.6 =
103
+ * Fix: woocommerce checkout manager conditional field
104
+
105
  = 4.8.5 =
106
  * Fix: woocommerce checkout manager modal tab
107
  * New: woocommerce checkout manager field description
woocommerce-checkout-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
- * Version: 4.8.5
7
  * Author: QuadLayers
8
  * Author URI: https://www.quadlayers.com
9
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
@@ -17,7 +17,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
17
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
18
  }
19
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
20
- define('WOOCCM_PLUGIN_VERSION', '4.8.5');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
+ * Version: 4.8.6
7
  * Author: QuadLayers
8
  * Author URI: https://www.quadlayers.com
9
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
17
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
18
  }
19
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
20
+ define('WOOCCM_PLUGIN_VERSION', '4.8.6');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);