Version Description
- Fix: woocommerce checkout upload
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 4.9.3 |
Comparing to | |
See all releases |
Code changes from version 4.9.2 to 4.9.3
- assets/frontend/js/wooccm-checkout.js +80 -76
- readme.txt +5 -2
- woocommerce-checkout-manager.php +2 -2
assets/frontend/js/wooccm-checkout.js
CHANGED
@@ -92,14 +92,17 @@
|
|
92 |
// Field
|
93 |
// ---------------------------------------------------------------------------
|
94 |
|
95 |
-
var fileList =
|
|
|
96 |
$('.wooccm-type-file').each(function (i, field) {
|
97 |
|
98 |
var $field = $(field),
|
99 |
$button_file = $field.find('[type=file]'),
|
100 |
$button_click = $field.find('.wooccm-file-button'),
|
101 |
$field_list = $field.find('.wooccm-file-list');
|
|
|
102 |
fileList[$field.attr('id')] = [];
|
|
|
103 |
// Simulate click
|
104 |
// -------------------------------------------------------------------------
|
105 |
|
@@ -107,11 +110,22 @@
|
|
107 |
e.preventDefault();
|
108 |
$button_file.trigger('click');
|
109 |
});
|
|
|
110 |
// Delete images
|
111 |
// ---------------------------------------------------------------------------
|
112 |
|
113 |
$field_list.on('click', '.wooccm-file-list-delete', function (e) {
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
});
|
116 |
// Append images
|
117 |
// -------------------------------------------------------------------------
|
@@ -139,9 +153,9 @@
|
|
139 |
reader = new FileReader();
|
140 |
reader.onload = (function (theFile) {
|
141 |
return function (e) {
|
142 |
-
|
143 |
setTimeout(function () {
|
144 |
append_image($field_list, fileList[$field.attr('id')].push(file) - 1, e.target.result, theFile.name, theFile.type);
|
|
|
145 |
}, 200);
|
146 |
};
|
147 |
})(file);
|
@@ -155,14 +169,17 @@
|
|
155 |
// Add class on place order reload if upload field exists
|
156 |
// ---------------------------------------------------------------------------
|
157 |
|
158 |
-
$('#order_review').on('ajaxSuccess', function (e) {
|
159 |
|
160 |
var $order_review = $(e.target),
|
161 |
$place_order = $order_review.find('#place_order'),
|
162 |
$fields = $('.wooccm-type-file'),
|
163 |
fields = $fields.length;
|
|
|
164 |
if (fields) {
|
165 |
$place_order.addClass('wooccm-upload-process');
|
|
|
|
|
166 |
}
|
167 |
|
168 |
});
|
@@ -174,92 +191,79 @@
|
|
174 |
e.preventDefault();
|
175 |
var $form = $('form.checkout'),
|
176 |
$place_order = $(this),
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
-
|
|
|
|
|
183 |
$attachment_ids = $field.find('.wooccm-file-field'),
|
184 |
-
|
185 |
|
186 |
-
|
187 |
|
188 |
-
if (
|
189 |
-
|
190 |
-
|
191 |
}
|
192 |
|
193 |
-
|
194 |
-
|
|
|
|
|
195 |
|
196 |
-
|
197 |
-
if (i > wooccm_upload.limit.max_files) {
|
198 |
-
console.log('Exeeds max files limit of ' + wooccm_upload.limit.max_files);
|
199 |
-
return false;
|
200 |
-
}
|
201 |
|
202 |
-
|
203 |
-
console.log('Undefined ' + file_id);
|
204 |
-
return true;
|
205 |
-
}
|
206 |
|
207 |
-
|
208 |
-
console.log('Exeeds max file size of ' + wooccm_upload.limit.max_files);
|
209 |
-
return true;
|
210 |
-
}
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
}
|
230 |
-
|
231 |
-
//$results.removeClass('woocommerce-message');
|
232 |
-
if (response.success) {
|
233 |
-
//alert(response.data);
|
234 |
-
$attachment_ids.val(response.data);
|
235 |
-
} else {
|
236 |
-
$('body').trigger('update_checkout');
|
237 |
-
//console.log(response.data);
|
238 |
-
//$results.addClass('woocommerce-error').html(response.data).show();
|
239 |
-
}
|
240 |
-
},
|
241 |
-
complete: function (response) {
|
242 |
-
fields = fields - 1;
|
243 |
-
//console.log('ajax: fields = ' + fields);
|
244 |
}
|
245 |
-
}
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
}
|
250 |
|
251 |
-
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
unblock($form);
|
256 |
-
$place_order.removeClass('wooccm-upload-process').trigger('click');
|
257 |
-
//return;
|
258 |
-
}
|
259 |
|
260 |
-
});
|
261 |
-
//return false;
|
262 |
-
//}
|
263 |
});
|
264 |
// Update checkout fees
|
265 |
// ---------------------------------------------------------------------------
|
92 |
// Field
|
93 |
// ---------------------------------------------------------------------------
|
94 |
|
95 |
+
var fileList = {};
|
96 |
+
|
97 |
$('.wooccm-type-file').each(function (i, field) {
|
98 |
|
99 |
var $field = $(field),
|
100 |
$button_file = $field.find('[type=file]'),
|
101 |
$button_click = $field.find('.wooccm-file-button'),
|
102 |
$field_list = $field.find('.wooccm-file-list');
|
103 |
+
|
104 |
fileList[$field.attr('id')] = [];
|
105 |
+
|
106 |
// Simulate click
|
107 |
// -------------------------------------------------------------------------
|
108 |
|
110 |
e.preventDefault();
|
111 |
$button_file.trigger('click');
|
112 |
});
|
113 |
+
|
114 |
// Delete images
|
115 |
// ---------------------------------------------------------------------------
|
116 |
|
117 |
$field_list.on('click', '.wooccm-file-list-delete', function (e) {
|
118 |
+
|
119 |
+
var $file = $(this).closest('.wooccm-file-file'),
|
120 |
+
file_id = $(this).closest('[data-file_id]').data('file_id');
|
121 |
+
|
122 |
+
fileList[$field.attr('id')] = $.grep(fileList[$field.attr('id')], function (value, index) {
|
123 |
+
return index != file_id;
|
124 |
+
});
|
125 |
+
|
126 |
+
$file.remove();
|
127 |
+
|
128 |
+
$('#order_review').trigger('wooccm_upload');
|
129 |
});
|
130 |
// Append images
|
131 |
// -------------------------------------------------------------------------
|
153 |
reader = new FileReader();
|
154 |
reader.onload = (function (theFile) {
|
155 |
return function (e) {
|
|
|
156 |
setTimeout(function () {
|
157 |
append_image($field_list, fileList[$field.attr('id')].push(file) - 1, e.target.result, theFile.name, theFile.type);
|
158 |
+
$('#order_review').trigger('wooccm_upload');
|
159 |
}, 200);
|
160 |
};
|
161 |
})(file);
|
169 |
// Add class on place order reload if upload field exists
|
170 |
// ---------------------------------------------------------------------------
|
171 |
|
172 |
+
$('#order_review').on('ajaxSuccess wooccm_upload', function (e) {
|
173 |
|
174 |
var $order_review = $(e.target),
|
175 |
$place_order = $order_review.find('#place_order'),
|
176 |
$fields = $('.wooccm-type-file'),
|
177 |
fields = $fields.length;
|
178 |
+
|
179 |
if (fields) {
|
180 |
$place_order.addClass('wooccm-upload-process');
|
181 |
+
} else {
|
182 |
+
$place_order.removeClass('wooccm-upload-process');
|
183 |
}
|
184 |
|
185 |
});
|
191 |
e.preventDefault();
|
192 |
var $form = $('form.checkout'),
|
193 |
$place_order = $(this),
|
194 |
+
$fields = $('.wooccm-type-file');
|
195 |
+
|
196 |
+
if (!$fields.length) {
|
197 |
+
return;
|
198 |
+
}
|
199 |
+
|
200 |
+
if (!window.FormData) {
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
|
204 |
+
if (!Object.keys(fileList).length) {
|
205 |
+
return;
|
206 |
+
}
|
207 |
+
|
208 |
+
if (!is_blocked($form)) {
|
209 |
+
$place_order.html(wooccm_upload.message.uploading);
|
210 |
+
block($form);
|
211 |
+
}
|
212 |
|
213 |
+
$.each(fileList, function (field_id, files) {
|
214 |
+
|
215 |
+
var $field = $('#' + field_id),
|
216 |
$attachment_ids = $field.find('.wooccm-file-field'),
|
217 |
+
data = new FormData();
|
218 |
|
219 |
+
$.each(files, function (file_id, file) {
|
220 |
|
221 |
+
if (file_id > wooccm_upload.limit.max_files) {
|
222 |
+
console.log('Exeeds max files limit of ' + wooccm_upload.limit.max_files);
|
223 |
+
return false;
|
224 |
}
|
225 |
|
226 |
+
if (file.size > wooccm_upload.limit.max_file_size) {
|
227 |
+
console.log('Exeeds max file size of ' + wooccm_upload.limit.max_files);
|
228 |
+
return true;
|
229 |
+
}
|
230 |
|
231 |
+
console.log('We\'re ready to upload ' + file.name);
|
|
|
|
|
|
|
|
|
232 |
|
233 |
+
data.append('wooccm_checkout_attachment_upload[]', file);
|
|
|
|
|
|
|
234 |
|
235 |
+
});
|
|
|
|
|
|
|
236 |
|
237 |
+
data.append('action', 'wooccm_checkout_attachment_upload');
|
238 |
+
data.append('nonce', wooccm_upload.nonce);
|
239 |
+
|
240 |
+
$.ajax({
|
241 |
+
async: false,
|
242 |
+
url: wooccm_upload.ajax_url,
|
243 |
+
type: 'POST',
|
244 |
+
cache: false,
|
245 |
+
data: data,
|
246 |
+
processData: false,
|
247 |
+
contentType: false,
|
248 |
+
beforeSend: function (response) {
|
249 |
+
//$place_order.html(wooccm_upload.message.uploading);
|
250 |
+
},
|
251 |
+
success: function (response) {
|
252 |
+
if (response.success) {
|
253 |
+
$attachment_ids.val(response.data);
|
254 |
+
} else {
|
255 |
+
$('body').trigger('update_checkout');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
}
|
257 |
+
},
|
258 |
+
complete: function (response) {
|
259 |
+
}
|
260 |
+
});
|
|
|
261 |
|
262 |
+
});
|
263 |
|
264 |
+
unblock($form);
|
265 |
+
$place_order.removeClass('wooccm-upload-process').trigger('click');
|
|
|
|
|
|
|
|
|
266 |
|
|
|
|
|
|
|
267 |
});
|
268 |
// Update checkout fees
|
269 |
// ---------------------------------------------------------------------------
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: quadlayers
|
|
3 |
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.4
|
6 |
-
Tested up to: 5.3
|
7 |
-
Stable tag: 4.9.
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 3.9
|
10 |
License: GPLv2 or later
|
@@ -101,6 +101,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
104 |
= 4.9.2 =
|
105 |
* Fix: woocommerce sortable fields
|
106 |
|
3 |
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.4
|
6 |
+
Tested up to: 5.3.2
|
7 |
+
Stable tag: 4.9.3
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 3.9
|
10 |
License: GPLv2 or later
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 4.9.3 =
|
105 |
+
* Fix: woocommerce checkout upload
|
106 |
+
|
107 |
= 4.9.2 =
|
108 |
* Fix: woocommerce sortable fields
|
109 |
|
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.9.
|
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.9.
|
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.9.3
|
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.9.3');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|