WooCommerce Checkout Manager - Version 4.6.4

Version Description

  • Fix: upload files in additional fields
Download this release

Release Info

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

Code changes from version 4.6.3 to 4.6.4

assets/frontend/css/wooccm.css CHANGED
@@ -58,6 +58,7 @@
58
  font-size: 12px;
59
  cursor: pointer;
60
  font-family: code;
 
61
  }
62
  .wooccm-file-list .wooccm-file-file .wooccm-file-list-container {
63
  width: 100%;
58
  font-size: 12px;
59
  cursor: pointer;
60
  font-family: code;
61
+ text-decoration: none!important;
62
  }
63
  .wooccm-file-list .wooccm-file-file .wooccm-file-list-container {
64
  width: 100%;
assets/frontend/css/wooccm.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../less/wooccm.less"],"names":[],"mappings":"AAKI,YALS,KAEX,iBAGG;AACC,YANO,KAEX,iBAIK;EACD,SAAQ,EAAR;EACA,cAAA;;AAEF,YAVS,KAEX,iBAQG;EACC,WAAA;;AAXN,YAAa,KAeX;EACE,aAAA;;AAMF,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAMN;EACE,cAAA;EACA,UAAA;EACA,aAAA;EACA,eAAA;EACA,mBAAA;EACA,sBAAA;;AANF,iBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EAEA,kBAAA;;AAhBJ,iBAQE,kBAWE;EACE,UAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;EACA,eAAA;EACA,iBAAA;;AAnCN,iBAQE,kBA8BE;EACE,WAAA;EACA,gBAAA;;AAxCN,iBAQE,kBAmCE;EACE,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,gBAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;EACA,gBAAA;;AAnDN,iBAQE,kBAmCE,kCAUE;EACE,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,QAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;;AAEA,iBAtDN,kBAmCE,kCAUE,MASG;EACC,MAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EAEA,gBAAA;EACA,YAAA;EACA,WAAA","file":"wooccm.css"}
1
+ {"version":3,"sources":["../../less/wooccm.less"],"names":[],"mappings":"AAKI,YALS,KAEX,iBAGG;AACC,YANO,KAEX,iBAIK;EACD,SAAQ,EAAR;EACA,cAAA;;AAEF,YAVS,KAEX,iBAQG;EACC,WAAA;;AAXN,YAAa,KAeX;EACE,aAAA;;AAMF,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAMN;EACE,cAAA;EACA,UAAA;EACA,aAAA;EACA,eAAA;EACA,mBAAA;EACA,sBAAA;;AANF,iBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EAEA,kBAAA;;AAhBJ,iBAQE,kBAWE;EACE,UAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;EACA,eAAA;EACA,iBAAA;EACA,+BAAA;;AApCN,iBAQE,kBA+BE;EACE,WAAA;EACA,gBAAA;;AAzCN,iBAQE,kBAoCE;EACE,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,gBAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;EACA,gBAAA;;AApDN,iBAQE,kBAoCE,kCAUE;EACE,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,QAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;;AAEA,iBAvDN,kBAoCE,kCAUE,MASG;EACC,MAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EAEA,gBAAA;EACA,YAAA;EACA,WAAA","file":"wooccm.css"}
includes/class-wooccm-upload.php CHANGED
@@ -55,7 +55,7 @@ class WOOCCM_Upload {
55
  return $attachment_ids;
56
  }
57
 
58
- function ajax_delete_attachment() {
59
 
60
  if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
61
 
@@ -112,48 +112,28 @@ class WOOCCM_Upload {
112
  }
113
  }
114
 
115
- public function checkout_billing_attachment_update_ids($order_id = 0) {
116
-
117
- $fields = WOOCCM()->billing->get_fields();
118
-
119
- $this->checkout_attachment_update_ids($order_id, 'billing_', $fields);
120
- }
121
-
122
- public function checkout_shipping_attachment_update_ids($order_id = 0) {
123
-
124
- $fields = WOOCCM()->shipping->get_fields();
125
-
126
- $this->checkout_attachment_update_ids($order_id, 'shipping_', $fields);
127
- }
128
-
129
- public function checkout_additional_attachment_update_ids($order_id = 0) {
130
-
131
- $fields = WOOCCM()->additional->get_fields();
132
-
133
- $this->checkout_attachment_update_ids($order_id, '', $fields);
134
- }
135
-
136
- public function checkout_attachment_update_ids($order_id = 0, $prefix = '', $fields = array()) {
137
 
138
  require_once( ABSPATH . 'wp-admin/includes/image.php' );
139
 
140
- if (count($fields)) {
141
 
142
- foreach ($fields as $id => $field) {
143
 
144
- if ($field['type'] == 'file') {
145
 
146
- $key = sprintf('_%s', $field['key']);
147
 
148
- if ($attachments = get_post_meta($order_id, $key, true)) {
149
 
150
- if ($attachments = (array) explode(',', $attachments)) {
151
 
152
- foreach ($attachments as $image_id) {
153
 
154
- wp_update_post(array('ID' => $image_id, 'post_parent' => $order_id));
155
 
156
- wp_update_attachment_metadata($image_id, wp_generate_attachment_metadata($image_id, get_attached_file($image_id)));
 
157
  }
158
  }
159
  }
@@ -162,18 +142,16 @@ class WOOCCM_Upload {
162
  }
163
  }
164
 
165
- function init() {
166
  add_action('wp_ajax_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
167
  add_action('wp_ajax_nopriv_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
168
 
169
-
170
  // Checkout
171
  // -----------------------------------------------------------------------
172
  add_action('wp_ajax_wooccm_checkout_attachment_upload', array($this, 'ajax_checkout_attachment_upload'));
173
  add_action('wp_ajax_nopriv_wooccm_checkout_attachment_upload', array($this, 'ajax_checkout_attachment_upload'));
174
- add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_billing_attachment_update_ids'));
175
- add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_shipping_attachment_update_ids'));
176
- add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_additional_attachment_update_ids'));
177
  }
178
 
179
  }
55
  return $attachment_ids;
56
  }
57
 
58
+ public function ajax_delete_attachment() {
59
 
60
  if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
61
 
112
  }
113
  }
114
 
115
+ public function update_attachment_ids($order_id = 0) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  require_once( ABSPATH . 'wp-admin/includes/image.php' );
118
 
119
+ if (count($checkout = WC()->checkout->get_checkout_fields())) {
120
 
121
+ foreach ($checkout as $field_type => $fields) {
122
 
123
+ foreach ($fields as $key => $field) {
124
 
125
+ if ($field['type'] == 'file') {
126
 
127
+ if ($attachments = get_post_meta($order_id, sprintf('_%s', $key), true)) {
128
 
129
+ if ($attachments = (array) explode(',', $attachments)) {
130
 
131
+ foreach ($attachments as $image_id) {
132
 
133
+ wp_update_post(array('ID' => $image_id, 'post_parent' => $order_id));
134
 
135
+ wp_update_attachment_metadata($image_id, wp_generate_attachment_metadata($image_id, get_attached_file($image_id)));
136
+ }
137
  }
138
  }
139
  }
142
  }
143
  }
144
 
145
+ public function init() {
146
  add_action('wp_ajax_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
147
  add_action('wp_ajax_nopriv_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
148
 
 
149
  // Checkout
150
  // -----------------------------------------------------------------------
151
  add_action('wp_ajax_wooccm_checkout_attachment_upload', array($this, 'ajax_checkout_attachment_upload'));
152
  add_action('wp_ajax_nopriv_wooccm_checkout_attachment_upload', array($this, 'ajax_checkout_attachment_upload'));
153
+ add_action('woocommerce_checkout_update_order_meta', array($this, 'update_attachment_ids'), 99);
154
+ // }
 
155
  }
156
 
157
  }
includes/view/frontend/class-wooccm-fields-additional.php CHANGED
@@ -53,18 +53,11 @@ class WOOCCM_Fields_Additional {
53
  }
54
  }
55
 
56
- function add_checkout_fields($fields) {
57
-
58
- $fields['additional'] = WOOCCM()->additional->get_fields();
59
-
60
- return $fields;
61
- }
62
-
63
  function add_additional_fields($checkout) {
64
  ?>
65
  <div class="wooccm-additional-fields">
66
  <?php
67
- if ($fields = WC()->checkout->get_checkout_fields('additional')) {
68
 
69
  foreach ($fields as $key => $field) {
70
 
@@ -111,10 +104,8 @@ class WOOCCM_Fields_Additional {
111
  // -----------------------------------------------------------------------
112
  add_filter('default_option_wooccm_additional_position', array($this, 'position'));
113
 
114
-
115
  // Additional fields
116
  // -----------------------------------------------------------------------
117
- add_filter('woocommerce_checkout_fields', array($this, 'add_checkout_fields'));
118
 
119
  switch (get_option('wooccm_additional_position', 'before_order_notes')) {
120
 
53
  }
54
  }
55
 
 
 
 
 
 
 
 
56
  function add_additional_fields($checkout) {
57
  ?>
58
  <div class="wooccm-additional-fields">
59
  <?php
60
+ if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
61
 
62
  foreach ($fields as $key => $field) {
63
 
104
  // -----------------------------------------------------------------------
105
  add_filter('default_option_wooccm_additional_position', array($this, 'position'));
106
 
 
107
  // Additional fields
108
  // -----------------------------------------------------------------------
 
109
 
110
  switch (get_option('wooccm_additional_position', 'before_order_notes')) {
111
 
includes/view/frontend/class-wooccm-fields-register.php CHANGED
@@ -23,6 +23,13 @@ class WOOCCM_Fields_Register {
23
  return WOOCCM()->shipping->get_fields();
24
  }
25
 
 
 
 
 
 
 
 
26
  public function add_keys($fields) {
27
 
28
  $frontend_fields = array();
@@ -37,7 +44,7 @@ class WOOCCM_Fields_Register {
37
  }
38
 
39
  public function init() {
40
-
41
  // Add keys
42
  // -----------------------------------------------------------------------
43
  add_filter('wooccm_additional_fields', array($this, 'add_keys'));
@@ -47,10 +54,14 @@ class WOOCCM_Fields_Register {
47
  // Billing fields
48
  // -----------------------------------------------------------------------
49
  add_filter('woocommerce_billing_fields', array($this, 'add_billing_fields'));
50
-
51
  // Shipping fields
52
  // -----------------------------------------------------------------------
53
  add_filter('woocommerce_shipping_fields', array($this, 'add_shipping_fields'));
 
 
 
 
54
  }
55
 
56
  }
23
  return WOOCCM()->shipping->get_fields();
24
  }
25
 
26
+ public function add_additional_fields($fields) {
27
+
28
+ $fields['additional'] = WOOCCM()->additional->get_fields();
29
+
30
+ return $fields;
31
+ }
32
+
33
  public function add_keys($fields) {
34
 
35
  $frontend_fields = array();
44
  }
45
 
46
  public function init() {
47
+
48
  // Add keys
49
  // -----------------------------------------------------------------------
50
  add_filter('wooccm_additional_fields', array($this, 'add_keys'));
54
  // Billing fields
55
  // -----------------------------------------------------------------------
56
  add_filter('woocommerce_billing_fields', array($this, 'add_billing_fields'));
57
+
58
  // Shipping fields
59
  // -----------------------------------------------------------------------
60
  add_filter('woocommerce_shipping_fields', array($this, 'add_shipping_fields'));
61
+
62
+ // Additional fields
63
+ // -----------------------------------------------------------------------
64
+ add_filter('woocommerce_checkout_fields', array($this, 'add_additional_fields'));
65
  }
66
 
67
  }
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: 3.0
6
  Tested up to: 5.2.4
7
- Stable tag: 4.6.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -137,6 +137,9 @@ Example:
137
 
138
  == Changelog ==
139
 
 
 
 
140
  = 4.6.3 =
141
  * Fix: small CSS issues
142
  * Fix: woocommerce checkout manager upload files in admin panel
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 3.0
6
  Tested up to: 5.2.4
7
+ Stable tag: 4.6.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
137
 
138
  == Changelog ==
139
 
140
+ = 4.6.4 =
141
+ * Fix: upload files in additional fields
142
+
143
  = 4.6.3 =
144
  * Fix: small CSS issues
145
  * Fix: woocommerce checkout manager upload files in admin panel
templates/order/order-custom-fields.php CHANGED
@@ -4,52 +4,27 @@
4
  <table class="woocommerce-table shop_table order_details">
5
  <tbody>
6
 
7
- <?php foreach (WOOCCM()->billing->get_fields() as $field_id => $field) : ?>
8
- <?php if (!in_array($field['name'], WOOCCM()->billing->get_defaults())) : ?>
9
- <?php if ($value = get_post_meta($order_id, sprintf('_%s', $field['key']), true)): ?>
10
- <tr id="tr-<?php echo esc_attr($field['key']); ?>">
11
- <th>
12
- <?php echo esc_html($field['label']); ?>
13
- </th>
14
- <td>
15
- <?php echo esc_html($value); ?>
16
- </td>
17
- </tr>
18
- <?php endif; ?>
19
- <?php endif; ?>
20
- <?php endforeach; ?>
21
-
22
- <?php foreach (WOOCCM()->shipping->get_fields() as $field_id => $field) : ?>
23
- <?php if (!in_array($field['name'], WOOCCM()->shipping->get_defaults())) : ?>
24
- <?php if ($value = get_post_meta($order_id, sprintf('_%s', 'shipping', $field['key']), true)): ?>
25
- <tr id="tr-<?php echo esc_attr($field['key']); ?>">
26
- <th>
27
- <?php echo esc_html($field['label']); ?>
28
- </th>
29
- <td>
30
- <?php echo esc_html($value); ?>
31
- </td>
32
- </tr>
33
- <?php endif; ?>
34
- <?php endif; ?>
35
- <?php endforeach; ?>
36
-
37
- <?php foreach (WOOCCM()->additional->get_fields() as $field_id => $field) : ?>
38
- <?php if (!in_array($field['name'], WOOCCM()->billing->get_defaults())) : ?>
39
- <?php if (($value = get_post_meta($order_id, sprintf('_%s', $field['key']), true)) ? $value : get_post_meta($order_id, sprintf('%s', $field['name']), true)): ?>
40
- <tr id="tr-<?php echo esc_attr($field['key']); ?>">
41
- <th>
42
- <?php echo esc_html($field['label']); ?>
43
- </th>
44
- <td>
45
- <?php echo esc_html($value); ?>
46
- </td>
47
- </tr>
48
- <?php endif; ?>
49
- <?php endif; ?>
50
- <?php endforeach; ?>
51
-
52
  </tbody>
53
- </table>
54
- <?php
55
- //endif; ?>
4
  <table class="woocommerce-table shop_table order_details">
5
  <tbody>
6
 
7
+ <?php
8
+ if (count($checkout = WC()->checkout->get_checkout_fields())):
9
+ foreach ($checkout as $field_type => $fields) :
10
+ foreach ($fields as $key => $field) :
11
+ if (isset(WOOCCM()->$field_type)) :
12
+ ?>
13
+ <?php if (!in_array($field['name'], WOOCCM()->$field_type->get_defaults())) : ?>
14
+ <?php if ($value = get_post_meta($order_id, sprintf('_%s', $key), true)): ?>
15
+ <tr id="tr-<?php echo esc_attr($key); ?>">
16
+ <th>
17
+ <?php echo esc_html($field['label']); ?>
18
+ </th>
19
+ <td>
20
+ <?php echo esc_html($value); ?>
21
+ </td>
22
+ </tr>
23
+ <?php endif; ?>
24
+ <?php endif; ?>
25
+ <?php endif; ?>
26
+ <?php endforeach; ?>
27
+ <?php endforeach; ?>
28
+ <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  </tbody>
30
+ </table>
 
 
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.6.3
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.6.3');
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.6.4
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.6.4');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);