WooCommerce Checkout Manager - Version 4.3.3

Version Description

  • Improvement: woocommerce order upload rebuilt
  • Improvement: woocommerce checkout upload rebuilt
  • Improvement: woocommerce order admin upload rebuilt
  • Improvement: woocommerce register fields rebuilt
  • Improvement: woocommerce register fields rebuilt
  • Fix: woocommerce checkout additional fields required
Download this release

Release Info

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

Code changes from version 4.3.2 to 4.3.3

assets/css/wooccm.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .button.fileinput-button {
2
+ position: relative;
3
+ overflow: hidden!important;
4
+ }
5
+ .button.fileinput-button input {
6
+ position: absolute;
7
+ top: 0;
8
+ right: 0;
9
+ margin: 0;
10
+ opacity: 0;
11
+ -ms-filter: 'alpha(opacity=0)';
12
+ font-size: 200px;
13
+ direction: ltr;
14
+ cursor: pointer;
15
+ }
16
+ .wooccmupload_list {
17
+ margin: 0 -5px;
18
+ padding: 0;
19
+ display: flex;
20
+ flex-wrap: wrap;
21
+ align-items: center;
22
+ justify-content: start;
23
+ }
24
+ .wooccmupload_list .wooccmupload_file {
25
+ display: flex;
26
+ justify-content: center;
27
+ align-items: stretch;
28
+ box-sizing: border-box;
29
+ padding: 10px 5px 0 5px;
30
+ width: 25%;
31
+ max-height: 90px;
32
+ position: relative;
33
+ }
34
+ .wooccmupload_list .wooccmupload_file .wooccmupload_file_delete {
35
+ position: absolute;
36
+ top: 2px;
37
+ right: -3px;
38
+ width: 16px;
39
+ height: 16px;
40
+ background-color: #222;
41
+ display: block;
42
+ line-height: 13px;
43
+ text-align: center;
44
+ color: #fefefe;
45
+ font-weight: 900;
46
+ border-radius: 50%;
47
+ font-size: 14px;
48
+ cursor: pointer;
49
+ }
50
+ .wooccmupload_list .wooccmupload_file .wooccmupload_file_container {
51
+ width: 100%;
52
+ overflow: hidden;
53
+ }
54
+ /*# sourceMappingURL=wooccm.css.map */
assets/css/wooccm.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["../less/wooccm.less"],"names":[],"mappings":"AACE,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,kBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EACA,gBAAA;EACA,kBAAA;;AAhBJ,kBAQE,mBAWE;EACE,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;;AAjCN,kBAQE,mBA6BE;EACE,WAAA;EACA,gBAAA","file":"wooccm.css"}
assets/css/wooccm.min.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+
2
+ .fileinput-button{position:relative;overflow:hidden!important}.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}
assets/js/wooccm-admin.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ // Toggle gateway on/off.
4
+ $('.wooccm_billing_fields').on('click', '.wooccm-field-toggle-enabled', function () {
5
+
6
+ var $link = $(this),
7
+ $row = $link.closest('tr'),
8
+ $toggle = $link.find('.woocommerce-input-toggle');
9
+
10
+ var data = {
11
+ action: 'wooccm_toggle_field_enabled',
12
+ nonce: wooccm.nonce,
13
+ field_id: $row.data('field_id')
14
+ };
15
+
16
+ $toggle.addClass('woocommerce-input-toggle--loading');
17
+
18
+ $.ajax({
19
+ url: woocommerce_admin.ajax_url,
20
+ data: data,
21
+ dataType: 'json',
22
+ type: 'POST',
23
+ success: function (response) {
24
+
25
+ if (true === response.data) {
26
+ $toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
27
+ $toggle.addClass('woocommerce-input-toggle--enabled');
28
+ $toggle.removeClass('woocommerce-input-toggle--loading');
29
+ } else if (true !== response.data) {
30
+ $toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
31
+ $toggle.addClass('woocommerce-input-toggle--disabled');
32
+ $toggle.removeClass('woocommerce-input-toggle--loading');
33
+ } //else if ('needs_setup' === response.data) {
34
+ //window.location.href = $link.attr('href');
35
+ //}
36
+ }
37
+ });
38
+ return false;
39
+ });
40
+ })(jQuery);
assets/js/wooccm-admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(a){a(".wooccm_billing_fields").on("click",".wooccm-field-toggle-enabled",function(){var c=a(this),b=c.closest("tr"),d=c.find(".woocommerce-input-toggle");var e={action:"wooccm_toggle_field_enabled",nonce:wooccm.nonce,field_id:b.data("field_id")};d.addClass("woocommerce-input-toggle--loading");a.ajax({url:woocommerce_admin.ajax_url,data:e,dataType:"json",type:"POST",success:function(f){if(true===f.data){d.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");d.addClass("woocommerce-input-toggle--enabled");d.removeClass("woocommerce-input-toggle--loading")}else{if(true!==f.data){d.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");d.addClass("woocommerce-input-toggle--disabled");d.removeClass("woocommerce-input-toggle--loading")}}}});return false})})(jQuery);
assets/js/wooccm-checkout-upload.funciona.js ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ var is_blocked = function ($node) {
4
+ return $node.is('.processing') || $node.parents('.processing').length;
5
+ };
6
+ var block = function ($node) {
7
+ if (!is_blocked($node)) {
8
+ $node.addClass('processing').block({
9
+ message: null,
10
+ overlayCSS: {
11
+ background: '#fff',
12
+ opacity: 0.6
13
+ }
14
+ });
15
+ }
16
+ };
17
+ var unblock = function ($node) {
18
+ $node.removeClass('processing').unblock();
19
+ };
20
+
21
+ var append_image = function (list, i, source, name, filetype) {
22
+
23
+ var $list = $(list);
24
+
25
+ if ((false === filetype.match('application/ms.*') && false === filetype.match('application/x.*') && false === filetype.match('audio.*') && false === filetype.match('text.*') && false === filetype.match('video.*')) || (0 === filetype.length || !filetype)) {
26
+ source = wooccm.icons.interactive;
27
+ }
28
+ if (filetype.match('application/ms.*')) {
29
+ source = wooccm.icons.spreadsheet;
30
+ }
31
+ if (filetype.match('application/x.*')) {
32
+ source = wooccm.icons.archive;
33
+ }
34
+ if (filetype.match('audio.*')) {
35
+ source = wooccm.icons.audio;
36
+ }
37
+ if (filetype.match('text.*')) {
38
+ source = wooccm.icons.text;
39
+ }
40
+ if (filetype.match('video.*')) {
41
+ source = wooccm.icons.video;
42
+ }
43
+
44
+ var html = '<span data-file_id="' + i + '" title="' + name + '" class="wooccm_file">\n\
45
+ <span class="wooccm_file_container">\n\
46
+ <img alt="' + name + '" src="' + source + '"/>\n\
47
+ <a title="' + name + '" class="wooccm_file_delete" class="wooccm_dele wooccm-btn wooccm-btn-danger">×</a>\n\
48
+ </span>\n\
49
+ </span>';
50
+
51
+ $list.append(html).fadeIn();
52
+
53
+ }
54
+
55
+
56
+ // Field
57
+ // ---------------------------------------------------------------------------
58
+
59
+ $('.wooccmupload-field').each(function (i, field) {
60
+
61
+ var $field = $(field),
62
+ $button = $field.find('[type=button]'),
63
+ $files = $field.find('[type=file]'),
64
+ $list = $field.find('.wooccm_checkout_attachment_upload');
65
+
66
+ // Click
67
+ // -------------------------------------------------------------------------
68
+
69
+ $button.on('click', function (e) {
70
+ e.preventDefault();
71
+ $files.trigger('click');
72
+ });
73
+
74
+ // Delete
75
+ // ---------------------------------------------------------------------------
76
+
77
+ $(document).on('click', '.wooccm_file_delete', function (e) {
78
+
79
+ alert('delete');
80
+
81
+ //var $tr = $(this).closest('tr'),
82
+ // attachment_id = $(this).data('attachment_id');
83
+
84
+ //$tr.hide();
85
+
86
+ //$('#delete_attachments_ids').val($('#delete_attachments_ids').val().replace(attachment_id, ''));
87
+ });
88
+
89
+ // Append images
90
+ // -------------------------------------------------------------------------
91
+
92
+ $files.on('change', function (e) {
93
+
94
+ var $field = $(field),
95
+ $files = $field.find('[type=file]'),
96
+ files = $files[0].files;
97
+
98
+ if (files.length) {
99
+ $.each(files, function (i, file) {
100
+
101
+ if (window.FileReader) {
102
+
103
+ reader = new FileReader();
104
+
105
+ reader.onload = (function (theFile) {
106
+ return function (e) {
107
+
108
+ setTimeout(function () {
109
+ append_image($list, i, e.target.result, theFile.name, theFile.type);
110
+ }, 200);
111
+
112
+ };
113
+ })(file);
114
+
115
+ reader.readAsDataURL(file);
116
+ }
117
+
118
+ });
119
+ }
120
+
121
+ });
122
+ });
123
+
124
+ // Upload
125
+ // ---------------------------------------------------------------------------
126
+
127
+ $('#order_review').on('ajaxSuccess', function (e) {
128
+
129
+ var $order_review = $(e.target),
130
+ $place_order = $order_review.find('#place_order'),
131
+ $fields = $('.wooccmupload-field'),
132
+ fields = $fields.length;
133
+
134
+ if (fields) {
135
+ $place_order.addClass('wooccm-upload-process');
136
+ }
137
+
138
+ });
139
+
140
+ $(document).on('click', '#place_order.wooccm-upload-process', function (e) {
141
+
142
+ e.preventDefault();
143
+
144
+ var $form = $('form.checkout'),
145
+ $place_order = $(this),
146
+ $results = $('#wooccm_checkout_attachment_results'),
147
+ $fields = $('.wooccmupload-field'),
148
+ fields = $fields.length;
149
+
150
+ $fields.each(function (i, field) {
151
+
152
+ var $field = $(field),
153
+ $input = $field.find('[type=hidden]'),
154
+ $files = $field.find('[type=file]'),
155
+ files = $files[0].files;
156
+
157
+ if (window.FormData && files.length) {
158
+
159
+ if (!is_blocked($form)) {
160
+ $place_order.html(wooccm.uploading);
161
+ block($form);
162
+ }
163
+
164
+ var data = new FormData();
165
+
166
+ $.each(files, function (i, file) {
167
+ data.append('wooccm_checkout_attachment_upload[]', file);
168
+ });
169
+
170
+ data.append('action', 'wooccm_checkout_attachment_upload');
171
+ data.append('nonce', wooccm.nonce);
172
+
173
+ $.ajax({
174
+ async: false,
175
+ url: wooccm.ajaxurl,
176
+ type: 'POST',
177
+ cache: false,
178
+ data: data,
179
+ processData: false,
180
+ contentType: false,
181
+ beforeSend: function (response) {
182
+ //$place_order.html(wooccm.uploading);
183
+ },
184
+ success: function (response) {
185
+ $results.removeClass('woocommerce-message');
186
+ if (response.success) {
187
+ //$results.addClass('woocommerce-message').html(wooccm.success);
188
+ //console.log(response.data);
189
+ $input.val(response.data);
190
+ } else {
191
+ $results.addClass('woocommerce-error').html(response.data).show();
192
+ }
193
+ //$results.show();
194
+ },
195
+ complete: function (response) {
196
+ //$place_order.html(text);
197
+ fields = fields - 1;
198
+ //console.log('ajax: fields = ' + fields);
199
+ }
200
+ });
201
+
202
+ } else {
203
+ fields = fields - 1;
204
+ //console.log('no ajax: fields = ' + fields);
205
+ }
206
+
207
+ //console.log('fields = ' + fields);
208
+
209
+ if (fields == 0) {
210
+ //console.log('llamar al click aca');
211
+ unblock($form);
212
+ $place_order.removeClass('wooccm-upload-process').trigger('click');
213
+ //return;
214
+ }
215
+
216
+ });
217
+ //return false;
218
+ //}
219
+ });
220
+
221
+ })(jQuery);
assets/js/wooccm-checkout-upload.js ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ var is_blocked = function ($node) {
4
+ return $node.is('.processing') || $node.parents('.processing').length;
5
+ };
6
+ var block = function ($node) {
7
+ if (!is_blocked($node)) {
8
+ $node.addClass('processing').block({
9
+ message: null,
10
+ overlayCSS: {
11
+ background: '#fff',
12
+ opacity: 0.6
13
+ }
14
+ });
15
+ }
16
+ };
17
+ var unblock = function ($node) {
18
+ $node.removeClass('processing').unblock();
19
+ };
20
+
21
+ var append_image = function (list, i, source, name, filetype) {
22
+
23
+ var $list = $(list);
24
+
25
+ if ((false === filetype.match('application/ms.*') && false === filetype.match('application/x.*') && false === filetype.match('audio.*') && false === filetype.match('text.*') && false === filetype.match('video.*')) || (0 === filetype.length || !filetype)) {
26
+ source = wooccm.icons.interactive;
27
+ }
28
+ if (filetype.match('application/ms.*')) {
29
+ source = wooccm.icons.spreadsheet;
30
+ }
31
+ if (filetype.match('application/x.*')) {
32
+ source = wooccm.icons.archive;
33
+ }
34
+ if (filetype.match('audio.*')) {
35
+ source = wooccm.icons.audio;
36
+ }
37
+ if (filetype.match('text.*')) {
38
+ source = wooccm.icons.text;
39
+ }
40
+ if (filetype.match('video.*')) {
41
+ source = wooccm.icons.video;
42
+ }
43
+
44
+ var html = '<span data-file_id="' + i + '" title="' + name + '" class="wooccmupload_file">\n\
45
+ <span class="wooccmupload_file_container">\n\
46
+ <img alt="' + name + '" src="' + source + '"/>\n\
47
+ <a title="' + name + '" class="wooccmupload_file_delete" class="wooccm_dele wooccm-btn wooccm-btn-danger">×</a>\n\
48
+ </span>\n\
49
+ </span>';
50
+
51
+ $list.append(html).fadeIn();
52
+
53
+ }
54
+
55
+
56
+ // Field
57
+ // ---------------------------------------------------------------------------
58
+
59
+ $('.wooccmupload-field').each(function (i, field) {
60
+
61
+ var $field = $(field),
62
+ $files = $field.find('[type=file]'),
63
+ $button = $field.find('.wooccmupload_button'),
64
+ $list = $field.find('.wooccmupload_list');
65
+
66
+ // Simulate click
67
+ // -------------------------------------------------------------------------
68
+
69
+ $button.on('click', function (e) {
70
+ e.preventDefault();
71
+ $files.trigger('click');
72
+ });
73
+
74
+ // Delete images
75
+ // ---------------------------------------------------------------------------
76
+
77
+ $field.on('click', '.wooccmupload_file_delete', function (e) {
78
+ $(this).closest('.wooccmupload_file').remove();
79
+ });
80
+
81
+ // Append images
82
+ // -------------------------------------------------------------------------
83
+
84
+ $files.on('change', function (e) {
85
+
86
+ var $field = $(field),
87
+ $files = $field.find('[type=file]'),
88
+ files = $files[0].files;
89
+
90
+ if (files.length) {
91
+ $.each(files, function (i, file) {
92
+
93
+ if (window.FileReader) {
94
+
95
+ reader = new FileReader();
96
+
97
+ reader.onload = (function (theFile) {
98
+ return function (e) {
99
+
100
+ setTimeout(function () {
101
+ append_image($list, i, e.target.result, theFile.name, theFile.type);
102
+ }, 200);
103
+
104
+ };
105
+ })(file);
106
+
107
+ reader.readAsDataURL(file);
108
+ }
109
+
110
+ });
111
+ }
112
+
113
+ });
114
+ });
115
+
116
+ // Add class on place order reload if upload field exists
117
+ // ---------------------------------------------------------------------------
118
+
119
+ $('#order_review').on('ajaxSuccess', function (e) {
120
+
121
+ var $order_review = $(e.target),
122
+ $place_order = $order_review.find('#place_order'),
123
+ $fields = $('.wooccmupload-field'),
124
+ fields = $fields.length;
125
+
126
+ if (fields) {
127
+ $place_order.addClass('wooccm-upload-process');
128
+ }
129
+
130
+ });
131
+
132
+ // Upload files
133
+ // ---------------------------------------------------------------------------
134
+
135
+ $(document).on('click', '#place_order.wooccm-upload-process', function (e) {
136
+
137
+ e.preventDefault();
138
+
139
+ var $form = $('form.checkout'),
140
+ $place_order = $(this),
141
+ $results = $('#wooccm_checkout_attachment_results'),
142
+ $fields = $('.wooccmupload-field'),
143
+ fields = $fields.length;
144
+
145
+ $fields.each(function (i, field) {
146
+
147
+ var $field = $(field),
148
+ $files = $field.find('[type=file]'),
149
+ $input = $field.find('.wooccmupload_field'),
150
+ $list = $field.find('.wooccmupload_list'),
151
+ files = $files[0].files;
152
+
153
+ if (window.FormData && files.length) {
154
+
155
+ if (!is_blocked($form)) {
156
+ $place_order.html(wooccm.uploading);
157
+ block($form);
158
+ }
159
+
160
+ var data = new FormData();
161
+
162
+ $.each(files, function (i, file) {
163
+
164
+ if ($list.find('span[data-file_id=' + i + ']').length) {
165
+ console.log('existe: ' + i);
166
+ data.append('wooccm_checkout_attachment_upload[]', file);
167
+ } else {
168
+ console.log('no existe: ' + i);
169
+ }
170
+ });
171
+
172
+ data.append('action', 'wooccm_checkout_attachment_upload');
173
+ data.append('nonce', wooccm.nonce);
174
+
175
+ $.ajax({
176
+ async: false,
177
+ url: wooccm.ajaxurl,
178
+ type: 'POST',
179
+ cache: false,
180
+ data: data,
181
+ processData: false,
182
+ contentType: false,
183
+ beforeSend: function (response) {
184
+ //$place_order.html(wooccm.uploading);
185
+ },
186
+ success: function (response) {
187
+ $results.removeClass('woocommerce-message');
188
+ if (response.success) {
189
+ //console.log(response.data);
190
+ $input.val(response.data);
191
+ } else {
192
+ $results.addClass('woocommerce-error').html(response.data).show();
193
+ }
194
+ },
195
+ complete: function (response) {
196
+ fields = fields - 1;
197
+ //console.log('ajax: fields = ' + fields);
198
+ }
199
+ });
200
+
201
+ } else {
202
+ fields = fields - 1;
203
+ //console.log('no ajax: fields = ' + fields);
204
+ }
205
+
206
+ //console.log('fields = ' + fields);
207
+
208
+ if (fields == 0) {
209
+ //console.log('llamar al click aca');
210
+ unblock($form);
211
+ $place_order.removeClass('wooccm-upload-process').trigger('click');
212
+ //return;
213
+ }
214
+
215
+ });
216
+ //return false;
217
+ //}
218
+ });
219
+
220
+ })(jQuery);
assets/js/wooccm-checkout-upload.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(c){var d=function(f){return f.is(".processing")||f.parents(".processing").length};var e=function(f){if(!d(f)){f.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(f){f.removeClass("processing").unblock()};var b=function(m,k,l,g,j){var f=c(m);if((false===j.match("application/ms.*")&&false===j.match("application/x.*")&&false===j.match("audio.*")&&false===j.match("text.*")&&false===j.match("video.*"))||(0===j.length||!j)){l=wooccm.icons.interactive}if(j.match("application/ms.*")){l=wooccm.icons.spreadsheet}if(j.match("application/x.*")){l=wooccm.icons.archive}if(j.match("audio.*")){l=wooccm.icons.audio}if(j.match("text.*")){l=wooccm.icons.text}if(j.match("video.*")){l=wooccm.icons.video}var h='<span data-file_id="'+k+'" title="'+g+'" class="wooccmupload_file">\n <span class="wooccmupload_file_container">\n <img alt="'+g+'" src="'+l+'"/>\n <a title="'+g+'" class="wooccmupload_file_delete" class="wooccm_dele wooccm-btn wooccm-btn-danger">×</a>\n </span>\n </span>';f.append(h).fadeIn()};c(".wooccmupload-field").each(function(h,l){var j=c(l),g=j.find("[type=file]"),k=j.find(".wooccmupload_button"),f=j.find(".wooccmupload_list");k.on("click",function(i){i.preventDefault();g.trigger("click")});j.on("click",".wooccmupload_file_delete",function(i){c(this).closest(".wooccmupload_file").remove()});g.on("change",function(o){var m=c(l),i=m.find("[type=file]"),n=i[0].files;if(n.length){c.each(n,function(q,p){if(window.FileReader){reader=new FileReader();reader.onload=(function(r){return function(s){setTimeout(function(){b(f,q,s.target.result,r.name,r.type)},200)}})(p);reader.readAsDataURL(p)}})}})});c("#order_review").on("ajaxSuccess",function(j){var i=c(j.target),h=i.find("#place_order"),g=c(".wooccmupload-field"),f=g.length;if(f){h.addClass("wooccm-upload-process")}});c(document).on("click","#place_order.wooccm-upload-process",function(k){k.preventDefault();var h=c("form.checkout"),j=c(this),g=c("#wooccm_checkout_attachment_results"),i=c(".wooccmupload-field"),f=i.length;i.each(function(n,r){var o=c(r),m=o.find("[type=file]"),s=o.find(".wooccmupload_field"),l=o.find(".wooccmupload_list"),p=m[0].files;if(window.FormData&&p.length){if(!d(h)){j.html(wooccm.uploading);e(h)}var q=new FormData();c.each(p,function(u,t){if(l.find("span[data-file_id="+u+"]").length){console.log("existe: "+u);q.append("wooccm_checkout_attachment_upload[]",t)}else{console.log("no existe: "+u)}});q.append("action","wooccm_checkout_attachment_upload");q.append("nonce",wooccm.nonce);c.ajax({async:false,url:wooccm.ajaxurl,type:"POST",cache:false,data:q,processData:false,contentType:false,beforeSend:function(t){},success:function(t){g.removeClass("woocommerce-message");if(t.success){s.val(t.data)}else{g.addClass("woocommerce-error").html(t.data).show()}},complete:function(t){f=f-1}})}else{f=f-1}if(f==0){a(h);j.removeClass("wooccm-upload-process").trigger("click")}})})})(jQuery);
assets/js/wooccm-order-upload.js ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ var is_blocked = function ($node) {
4
+ return $node.is('.processing') || $node.parents('.processing').length;
5
+ };
6
+ var block = function ($node) {
7
+ if (!is_blocked($node)) {
8
+ $node.addClass('processing').block({
9
+ message: null,
10
+ overlayCSS: {
11
+ background: '#fff',
12
+ opacity: 0.6
13
+ }
14
+ });
15
+ }
16
+ };
17
+ var unblock = function ($node) {
18
+ $node.removeClass('processing').unblock();
19
+ };
20
+
21
+ $(document).ready(function ($) {
22
+
23
+ // Delete
24
+ // -------------------------------------------------------------------------
25
+ $(document).on('click', '.wooccm_delete_attachment', function (e) {
26
+
27
+ var $tr = $(this).closest('tr'),
28
+ attachment_id = $(this).data('attachment_id');
29
+
30
+ $tr.hide();
31
+
32
+ $('#wooccm_order_attachment_update').prop('disabled', false);
33
+
34
+ $('#delete_attachments_ids').val($('#delete_attachments_ids').val().replace(attachment_id, ''));
35
+ });
36
+
37
+ $(document).on('click', '#wooccm_order_attachment_update', function (e) {
38
+
39
+ $.ajax({
40
+ url: wooccm.ajaxurl,
41
+ type: 'POST',
42
+ cache: false,
43
+ data: {
44
+ action: 'wooccm_order_attachment_update',
45
+ nonce: wooccm.nonce,
46
+ delete_attachments_ids: $('#delete_attachments_ids').val(),
47
+ all_attachments_ids: $('#all_attachments_ids').val()
48
+ },
49
+ beforeSend: function (response) {
50
+ $('.wccm_results').html(wooccm.saving);
51
+ },
52
+ success: function (response) {
53
+ if (response.success) {
54
+ $('.wccm_results').html(wooccm.deleted);
55
+ } else {
56
+ $('.wccm_results').html(response.data);
57
+ }
58
+ }
59
+ });
60
+ });
61
+ // Upload
62
+ // -------------------------------------------------------------------------
63
+
64
+ $(document).on('change', '#wooccm_order_attachment_upload', function (e) {
65
+
66
+ var data = false,
67
+ order_id = $(this).data('order_id');
68
+
69
+ if (window.FormData) {
70
+ data = new FormData();
71
+ }
72
+
73
+ var i = 0, len = this.files.length, img, reader, file;
74
+ for (; i < len; i++) {
75
+ file = this.files[i];
76
+ if (data) {
77
+ data.append('wooccm_order_attachment_upload[]', file);
78
+ }
79
+ }
80
+
81
+ /*
82
+ * filter file types
83
+ * var file_array = ' . wooccm_js_array($file_types) . ';
84
+ var wooempt = "' . implode(',', $file_types) . '";
85
+
86
+ for ( i = 0; i < length; i++ ) {
87
+ file = this.files[i];
88
+ for(x=0; x < ' . $number_of_types . '; x++){
89
+ if( !wooempt || file.type.match(file_array[x]) ) {
90
+ if (formdata) {
91
+ formdata.append("files_wccm[]",file);
92
+ }
93
+ }
94
+ }
95
+ }
96
+ */
97
+
98
+ if (data) {
99
+
100
+ data.append('action', 'wooccm_order_attachment_upload');
101
+ data.append('nonce', wooccm.nonce);
102
+ data.append('order_id', order_id);
103
+
104
+ $.ajax({
105
+ url: wooccm.ajaxurl,
106
+ type: 'POST',
107
+ cache: false,
108
+ data: data,
109
+ processData: false,
110
+ contentType: false,
111
+ beforeSend: function (response) {
112
+
113
+ $('.wccm_results').html(wooccm.uploading);
114
+
115
+ block($('#wooccm_order_attachment_inner'));
116
+ },
117
+ success: function (response) {
118
+
119
+ if (response.success) {
120
+ $('#wooccm_order_attachment_inner').replaceWith(response.data);
121
+ $('.wccm_results').html(wooccm.success);
122
+ } else {
123
+ $('.wccm_results').html(response.data);
124
+ }
125
+
126
+ unblock($('#wooccm_order_attachment_inner'));
127
+ }
128
+ });
129
+ }
130
+ });
131
+ });
132
+ })(jQuery);
assets/js/wooccm-order-upload.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(b){var c=function(e){return e.is(".processing")||e.parents(".processing").length};var d=function(e){if(!c(e)){e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(e){e.removeClass("processing").unblock()};b(document).ready(function(e){e(document).on("click",".wooccm_delete_attachment",function(h){var g=e(this).closest("tr"),f=e(this).data("attachment_id");g.hide();e("#wooccm_order_attachment_update").prop("disabled",false);e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(f,""))});e(document).on("click","#wooccm_order_attachment_update",function(f){e.ajax({url:wooccm.ajaxurl,type:"POST",cache:false,data:{action:"wooccm_order_attachment_update",nonce:wooccm.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(g){e(".wccm_results").html(wooccm.saving)},success:function(g){if(g.success){e(".wccm_results").html(wooccm.deleted)}else{e(".wccm_results").html(g.data)}}})});e(document).on("change","#wooccm_order_attachment_upload",function(m){var l=false,n=e(this).data("order_id");if(window.FormData){l=new FormData()}var k=0,g=this.files.length,h,f,j;for(;k<g;k++){j=this.files[k];if(l){l.append("wooccm_order_attachment_upload[]",j)}}if(l){l.append("action","wooccm_order_attachment_upload");l.append("nonce",wooccm.nonce);l.append("order_id",n);e.ajax({url:wooccm.ajaxurl,type:"POST",cache:false,data:l,processData:false,contentType:false,beforeSend:function(i){e(".wccm_results").html(wooccm.uploading);d(e("#wooccm_order_attachment_inner"))},success:function(i){if(i.success){e("#wooccm_order_attachment_inner").replaceWith(i.data);e(".wccm_results").html(wooccm.success)}else{e(".wccm_results").html(i.data)}a(e("#wooccm_order_attachment_inner"))}})}})})})(jQuery);
assets/less/wooccm.less ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .button {
2
+ &.fileinput-button {
3
+ position: relative;
4
+ overflow: hidden!important;
5
+
6
+ input {
7
+ position: absolute;
8
+ top: 0;
9
+ right: 0;
10
+ margin: 0;
11
+ opacity: 0;
12
+ -ms-filter:'alpha(opacity=0)';
13
+ font-size: 200px;
14
+ direction: ltr;
15
+ cursor: pointer;
16
+ }
17
+
18
+ }
19
+
20
+ }
21
+ .wooccmupload_list {
22
+ margin: 0 -5px;
23
+ padding: 0;
24
+ display: flex;
25
+ flex-wrap: wrap;
26
+ align-items: center;
27
+ justify-content: start;
28
+
29
+ .wooccmupload_file {
30
+ display: flex;
31
+ justify-content: center;
32
+ align-items: stretch;
33
+ box-sizing: border-box;
34
+ padding: 10px 5px 0 5px;
35
+ width: 25%;
36
+ max-height: 90px;
37
+ position: relative;
38
+
39
+
40
+ .wooccmupload_file_delete {
41
+ position: absolute;
42
+ top: 2px;
43
+ right: -3px;
44
+ width: 16px;
45
+ height: 16px;
46
+ background-color: #222;
47
+ display: block;
48
+ line-height: 13px;
49
+ text-align: center;
50
+ color: #fefefe;
51
+ font-weight: 900;
52
+ border-radius: 50%;
53
+ font-size: 14px;
54
+ cursor: pointer;
55
+
56
+ }
57
+
58
+ .wooccmupload_file_container {
59
+ width: 100%;
60
+ overflow: hidden;
61
+ }
62
+ }
63
+
64
+ }
changelog.txt ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Fifteen ( 15 ) fields types included: Text Input, Text Area, Password, Radio Button, Check Box, Select Options, Date Picker, Time Picker, Color Picker, Heading, Multi-Select, Multi-Checkbox, Country, State, File Picker.
2
+
3
+ Compatible with WPML, WooCommerce Print Invoice & Delivery Note, Store Exporter Deluxe, WooCommerce Order/Customer CSV Export.
4
+
5
+ Sort Orders by Field Name.
6
+ Export Orders by Field Name.
7
+
8
+ Create fields to remove tax
9
+ Create fields to add additional amount
10
+ Display Payment Method and Shipping Method used by customer.
11
+ Disable any added field from Checkout details page and Order Receipt.
12
+
13
+ DatePicker: Change the default format (dd-mm-yy), Set Minimum Date and Maximum Date, Disable days in the week (Sun – Sat).
14
+ TimePicker: Includes restriction of both start and end hours, set the minutes interval and manually input labels.
15
+ Display Order Time.
16
+
17
+ Re-position the added fields: Before Shipping Form, After Shipping Form, Before Billing Form, After Billing Form or After Order Notes
18
+
19
+ = 4.4.0 Beta =
20
+ * Improvement: woocommerce order upload rebuilt
21
+ * Improvement: woocommerce checkout upload rebuilt
22
+ * Improvement: woocommerce order admin upload rebuilt
23
+ * Improvement: woocommerce register fields rebuilt
24
+ * Improvement: woocommerce register fields rebuilt
25
+ * Fix: woocommerce checkout additional fields required
includes/admin.php CHANGED
@@ -11,7 +11,8 @@ if (is_admin()) {
11
  add_action('admin_init', 'wooccm_admin_actions');
12
  add_action('admin_init', 'wooccm_admin_woocheckout_actions');
13
  // Updater notice
14
- add_action('admin_notices', 'wooccm_admin_notices');
 
15
  // Add fields to the Edit Order screen
16
  add_action('woocommerce_admin_order_data_after_order_details', 'wooccm_admin_edit_order_additional_details');
17
  add_action('woocommerce_admin_order_data_after_billing_address', 'wooccm_admin_edit_order_billing_details');
@@ -930,7 +931,7 @@ function wooccm_options_validate_billing($input) {
930
  return $input;
931
  }
932
 
933
- function wooccm_admin_notices() {
934
 
935
  // Check the User has the manage_options capability
936
  if (current_user_can('manage_options') == false)
@@ -956,7 +957,7 @@ function wooccm_admin_notices() {
956
  </p>';
957
  echo wooccm_admin_notice_html($message);
958
  }
959
- }
960
 
961
  function wooccm_admin_updater_notice() {
962
 
@@ -1416,7 +1417,7 @@ function wooccm_admin_edit_order_shipping_details($order) {
1416
  }
1417
  }
1418
 
1419
- function wooccm_validate_upload_process_customer() {
1420
 
1421
  $options = get_option('wccs_settings');
1422
 
@@ -1425,23 +1426,25 @@ function wooccm_validate_upload_process_customer() {
1425
  } else {
1426
  return false;
1427
  }
1428
- }
1429
 
1430
  // Check if the customer can upload images
1431
  // @mod - This disables the Order Uploaded Files meta box even for Administrators...?
1432
- if (wooccm_validate_upload_process_customer()) {
 
 
1433
  add_action('woocommerce_view_order', 'wooccm_file_uploader_front_end');
1434
  add_action('add_meta_boxes', 'wooccm_admin_edit_order_metaboxes');
1435
- }
1436
 
1437
- function wooccm_admin_edit_order_metaboxes() {
1438
 
1439
  global $post;
1440
 
1441
  $post_type = 'shop_order';
1442
  add_meta_box('woocommerce-order-files', __('Order Uploaded Files', 'woocommerce-checkout-manager'), 'wooccm_admin_edit_order_uploaded_files_meta_box', $post_type, 'normal', 'default');
1443
- }
1444
-
1445
  function wooccm_admin_edit_order_uploaded_files_meta_box($post) {
1446
 
1447
  global $wpdb, $thepostid, $theorder, $woocommerce, $post;
@@ -1605,7 +1608,7 @@ function wooccm_admin_edit_order_uploaded_files_meta_box($post) {
1605
  <td>' . strtoupper($wp_filetype['ext']) . '</td>
1606
  <td class="column-actions" nowrap>
1607
  <a href="' . $image_attributes2[0] . '" target="_blank" class="button">' . __('Download', 'woocommerce-checkout-manager') . '</a>
1608
- <a class="delete tips wccm_delete wccmx_' . esc_attr($attachment_id) . ' button" data-tip="' . __('Delete file', 'woocommerce-checkout-manager') . '">' . __('Delete file', 'woocommerce-checkout-manager') . '</a>
1609
  </td>
1610
  </tr>
1611
  ';
@@ -1669,7 +1672,7 @@ function wooccm_admin_edit_order_uploaded_files_meta_box($post) {
1669
  success: function (res) {
1670
  $('#files_wccm').show();
1671
  $(".wccm_results").html("Files uploaded successfully.");
1672
- /* $(".wccm_results").html(res); */
1673
 
1674
  $.ajax({
1675
  url: '<?php echo admin_url('/post.php?post=' . $post->ID . '&action=edit'); ?>',
@@ -1677,7 +1680,7 @@ function wooccm_admin_edit_order_uploaded_files_meta_box($post) {
1677
  success: function (data) {
1678
  $("div#product_images_container").html($(data).find("div#product_images_container"));
1679
  $(".wccm_results").html("Files uploaded successfully.");
1680
- /* $(".wccm_results").html(data); */
1681
  },
1682
  dataType: 'html'
1683
  });
@@ -1699,9 +1702,11 @@ function wooccm_admin_edit_order_uploaded_files_meta_box($post) {
1699
  </div>
1700
  <!-- .woocommerce_order_items_wrapper -->
1701
  <?php
1702
- }
1703
 
1704
- // front end for user
 
 
1705
  function wooccm_file_uploader_front_end($order_id) {
1706
 
1707
  global $wpdb, $thepostid, $theorder, $woocommerce, $post;
@@ -1768,7 +1773,7 @@ function wooccm_file_uploader_front_end($order_id) {
1768
 
1769
  <h2><?php echo ( empty($options['checkness']['upload_title']) ? 'Order Uploaded Files' : esc_attr($options['checkness']['upload_title']) ); ?></h2>
1770
  <div class="woocommerce_order_items_wrapper front_end">
1771
- <table class="woocommerce_order_items front_end">
1772
 
1773
  <thead>
1774
  <tr>
@@ -1823,7 +1828,7 @@ function wooccm_file_uploader_front_end($order_id) {
1823
  </td>
1824
  <td>' . strtoupper($wp_filetype['ext']) . '</td>
1825
  <td class="column-actions" nowrap>
1826
- <a class="delete tips wccm_delete wccmx_' . esc_attr($attachment_id) . ' button" data-tip="' . __('Delete file', 'woocommerce-checkout-manager') . '">' . __('Delete file', 'woocommerce-checkout-manager') . '</a>
1827
  </td>
1828
  </tr>';
1829
  }
@@ -1938,8 +1943,8 @@ jQuery(document).ready(function($){
1938
  // ------------
1939
  }
1940
  }
1941
-
1942
- function wccs_upload_file_func_callback($order_id) {
1943
 
1944
  $name = ( isset($_REQUEST['name']) ? $_REQUEST['name'] : false );
1945
  $order_id = ( isset($_REQUEST['order_id']) ? absint($_REQUEST['order_id']) : false );
@@ -2058,14 +2063,17 @@ function wccs_upload_file_func_callback($order_id) {
2058
  echo ' ' . __('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager') . '';
2059
  }
2060
  die();
2061
- }
2062
 
2063
- add_action("wp_ajax_wccs_upload_file_func", "wccs_upload_file_func_callback");
 
2064
 
2065
- function wooccm_set_html_content_type() {
 
 
2066
 
2067
  return 'text/html';
2068
- }
2069
 
2070
  function wooccm_js_str($s) {
2071
 
@@ -2078,7 +2086,7 @@ function wooccm_js_array($array) {
2078
  return '[' . implode(',', $temp) . ']';
2079
  }
2080
 
2081
- function update_attachment_wccm_callback() {
2082
 
2083
  global $post, $wpdb, $woocommerce;
2084
 
@@ -2114,7 +2122,6 @@ function update_attachment_wccm_callback() {
2114
  echo __('Deleted successfully.', 'woocommerce-checkout-manager');
2115
  }
2116
  die();
2117
- }
2118
 
2119
- add_action('wp_ajax_update_attachment_wccm', 'update_attachment_wccm_callback');
2120
- ?>
11
  add_action('admin_init', 'wooccm_admin_actions');
12
  add_action('admin_init', 'wooccm_admin_woocheckout_actions');
13
  // Updater notice
14
+ //1326
15
+ //add_action('admin_notices', 'wooccm_admin_notices');
16
  // Add fields to the Edit Order screen
17
  add_action('woocommerce_admin_order_data_after_order_details', 'wooccm_admin_edit_order_additional_details');
18
  add_action('woocommerce_admin_order_data_after_billing_address', 'wooccm_admin_edit_order_billing_details');
931
  return $input;
932
  }
933
 
934
+ /*function wooccm_admin_notices() {
935
 
936
  // Check the User has the manage_options capability
937
  if (current_user_can('manage_options') == false)
957
  </p>';
958
  echo wooccm_admin_notice_html($message);
959
  }
960
+ }*/
961
 
962
  function wooccm_admin_updater_notice() {
963
 
1417
  }
1418
  }
1419
 
1420
+ /*function wooccm_validate_upload_process_customer() {
1421
 
1422
  $options = get_option('wccs_settings');
1423
 
1426
  } else {
1427
  return false;
1428
  }
1429
+ }*/
1430
 
1431
  // Check if the customer can upload images
1432
  // @mod - This disables the Order Uploaded Files meta box even for Administrators...?
1433
+ /*
1434
+ * 1326
1435
+ * if (wooccm_validate_upload_process_customer()) {
1436
  add_action('woocommerce_view_order', 'wooccm_file_uploader_front_end');
1437
  add_action('add_meta_boxes', 'wooccm_admin_edit_order_metaboxes');
1438
+ }*/
1439
 
1440
+ /*function wooccm_admin_edit_order_metaboxes() {
1441
 
1442
  global $post;
1443
 
1444
  $post_type = 'shop_order';
1445
  add_meta_box('woocommerce-order-files', __('Order Uploaded Files', 'woocommerce-checkout-manager'), 'wooccm_admin_edit_order_uploaded_files_meta_box', $post_type, 'normal', 'default');
1446
+ }*/
1447
+ /*
1448
  function wooccm_admin_edit_order_uploaded_files_meta_box($post) {
1449
 
1450
  global $wpdb, $thepostid, $theorder, $woocommerce, $post;
1608
  <td>' . strtoupper($wp_filetype['ext']) . '</td>
1609
  <td class="column-actions" nowrap>
1610
  <a href="' . $image_attributes2[0] . '" target="_blank" class="button">' . __('Download', 'woocommerce-checkout-manager') . '</a>
1611
+ <a class="delete tips wccm_delete wccmx_' . esc_attr($attachment_id) . ' button" data-tip="' . __('Delete', 'woocommerce-checkout-manager') . '">' . __('Delete', 'woocommerce-checkout-manager') . '</a>
1612
  </td>
1613
  </tr>
1614
  ';
1672
  success: function (res) {
1673
  $('#files_wccm').show();
1674
  $(".wccm_results").html("Files uploaded successfully.");
1675
+
1676
 
1677
  $.ajax({
1678
  url: '<?php echo admin_url('/post.php?post=' . $post->ID . '&action=edit'); ?>',
1680
  success: function (data) {
1681
  $("div#product_images_container").html($(data).find("div#product_images_container"));
1682
  $(".wccm_results").html("Files uploaded successfully.");
1683
+
1684
  },
1685
  dataType: 'html'
1686
  });
1702
  </div>
1703
  <!-- .woocommerce_order_items_wrapper -->
1704
  <?php
1705
+ }*/
1706
 
1707
+ /*
1708
+ * 1326
1709
+ * front end for user
1710
  function wooccm_file_uploader_front_end($order_id) {
1711
 
1712
  global $wpdb, $thepostid, $theorder, $woocommerce, $post;
1773
 
1774
  <h2><?php echo ( empty($options['checkness']['upload_title']) ? 'Order Uploaded Files' : esc_attr($options['checkness']['upload_title']) ); ?></h2>
1775
  <div class="woocommerce_order_items_wrapper front_end">
1776
+ <table class="shop_table woocommerce_order_items front_end">
1777
 
1778
  <thead>
1779
  <tr>
1828
  </td>
1829
  <td>' . strtoupper($wp_filetype['ext']) . '</td>
1830
  <td class="column-actions" nowrap>
1831
+ <a class="delete tips wccm_delete wccmx_' . esc_attr($attachment_id) . ' button" data-tip="' . __('Delete', 'woocommerce-checkout-manager') . '">' . __('Delete', 'woocommerce-checkout-manager') . '</a>
1832
  </td>
1833
  </tr>';
1834
  }
1943
  // ------------
1944
  }
1945
  }
1946
+ */
1947
+ /*function wccs_upload_file_func_callback($order_id) {
1948
 
1949
  $name = ( isset($_REQUEST['name']) ? $_REQUEST['name'] : false );
1950
  $order_id = ( isset($_REQUEST['order_id']) ? absint($_REQUEST['order_id']) : false );
2063
  echo ' ' . __('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager') . '';
2064
  }
2065
  die();
2066
+ }*/
2067
 
2068
+ //1326
2069
+ //add_action("wp_ajax_wccs_upload_file_func", "wccs_upload_file_func_callback");
2070
 
2071
+ /*
2072
+ * 1326
2073
+ * function wooccm_set_html_content_type() {
2074
 
2075
  return 'text/html';
2076
+ }*/
2077
 
2078
  function wooccm_js_str($s) {
2079
 
2086
  return '[' . implode(',', $temp) . ']';
2087
  }
2088
 
2089
+ /*function update_attachment_wccm_callback() {
2090
 
2091
  global $post, $wpdb, $woocommerce;
2092
 
2122
  echo __('Deleted successfully.', 'woocommerce-checkout-manager');
2123
  }
2124
  die();
2125
+ }*/
2126
 
2127
+ //add_action('wp_ajax_update_attachment_wccm', 'update_attachment_wccm_callback');
 
includes/checkout.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  // Decides where the Additional Checkout fields appear on the Checkout page
3
- function wooccm_checkout_additional_positioning() {
 
 
4
 
5
  $options = get_option( 'wccs_settings' );
6
  // Defaults to after_order_notes
@@ -17,7 +19,7 @@ function wooccm_checkout_additional_positioning() {
17
 
18
  }
19
 
20
- }
21
 
22
  function wooccm_checkout_default_address_fields( $fields = array() ) {
23
 
@@ -126,162 +128,10 @@ var ajaxnonce = "' . wp_create_nonce( "wccs_ajax_nonce" ) . '";
126
  }
127
  }
128
 
129
- @media screen and (max-width: 770px) {
130
- .checkout .wooccm_each_file .wooccm-image-holder {
131
- width: 20%;
132
- }
133
- .checkout name.wooccm_name, .wooccm_each_file span.container{
134
- width: 80%;
135
- }
136
- .checkout .container .wooccm-btn {
137
- padding: 1% 10%;
138
- }
139
- }
140
-
141
- @media screen and (max-width: 992px) {
142
- .wooccm_each_file .wooccm-image-holder {
143
- width: 26%;
144
- }
145
- name.wooccm_name, .wooccm_each_file span.container{
146
- width: 74%;
147
- }
148
- .container .wooccm-btn {
149
- padding: 5px 8px;
150
- font-size: 12px;
151
- }
152
- }
153
-
154
  .container .wooccm-btn {
155
  padding: 1.7% 6.7%;
156
  }
157
 
158
- #caman_content .blockUI.blockOverlay:before, #caman_content .loader:before {
159
- height: 1em;
160
- width: 1em;
161
- position: absolute;
162
- top: 50%;
163
- left: 50%;
164
- margin-left: -.5em;
165
- margin-top: -.5em;
166
- display: block;
167
- -webkit-animation: spin 1s ease-in-out infinite;
168
- -moz-animation: spin 1s ease-in-out infinite;
169
- animation: spin 1s ease-in-out infinite;
170
- content: "";
171
- /* @mod - We need to check this file exists */
172
- background: url('.plugins_url( 'woocommerce/assets/images/icons/loader.svg' ).') center center/cover;
173
- line-height: 1;
174
- text-align: center;
175
- font-size: 2em;
176
- color: rgba(0,0,0,.75);
177
- }
178
- body.admin-bar #caman_content {
179
- margin-top: 32px;
180
- }
181
-
182
- .file_upload_button_hide {
183
- display: none;
184
- }
185
-
186
- .wooccm_each_file {
187
- display: block;
188
- padding-top: 20px;
189
- clear: both;
190
- text-align: center;
191
- }
192
- .wooccm_each_file .wooccm-image-holder {
193
- width: 20%;
194
- display: block;
195
- float: left;
196
- }
197
- .wooccm-btn.disable {
198
- margin-right: 10px;
199
- cursor: auto;
200
- }
201
- zoom.wooccm_zoom, edit.wooccm_edit, dele.wooccm_dele {
202
- padding: 5px;
203
- }
204
- .wooccm_each_file name {
205
- font-size: 18px;
206
- }
207
- name.wooccm_name, .wooccm_each_file span.container {
208
- display: block;
209
- padding: 0 0 10px 20px;
210
- float: left;
211
- width: 80%;
212
- }
213
-
214
- .wooccm_each_file img{
215
- display: inline-block;
216
- height: 90px;
217
- border: 2px solid #767676;
218
- border-radius: 4px;
219
- }
220
- .file_upload_account:before{ content: "\f317";font-family: dashicons; margin-right: 10px; }
221
- .wooccm_each_file .wooccm_zoom:before{ content: "\f179";font-family: dashicons; margin-right: 5px; }
222
- .wooccm_each_file .wooccm_edit:before{ content: "\f464";font-family: dashicons; margin-right: 5px; }
223
- .wooccm_each_file .wooccm_dele:before{ content: "\f158";font-family: dashicons; margin-right: 5px; }
224
- .wooccm-btn{
225
- display: inline-block;
226
- padding: 6px 12px;
227
- margin-bottom: 0;
228
- font-size: 14px;
229
- font-weight: 400;
230
- line-height: 1.42857143;
231
- text-align: center;
232
- white-space: nowrap;
233
- vertical-align: middle;
234
- cursor: pointer;
235
- -webkit-user-select: none;
236
- -moz-user-select: none;
237
- -ms-user-select: none;
238
- user-select: none;
239
- background-image: none;
240
- border: 1px solid transparent;
241
- border-radius: 4px;
242
- font-family: "Raleway", Arial, Helvetica, sans-serif;
243
- color: #767676;
244
- background-color: buttonface;
245
- align-items: flex-start;
246
- text-indent: 0px;
247
- text-shadow: none;
248
- letter-spacing: normal;
249
- word-spacing: normal;
250
- text-rendering: auto;
251
- }
252
- .wooccm-btn-primary {
253
- width: 100%;
254
- color: #fff;
255
- background-color: #428bca;
256
- border-color: #357ebd;
257
- }
258
-
259
- .wooccm-btn-danger {
260
- color: #fff;
261
- background-color: #d9534f;
262
- border-color: #d43f3a;
263
- margin-right: 10px;
264
- }
265
- .wooccm_each_file .container a:hover, .wooccm_each_file .container a:focus, .wooccm_each_file .container a:active, .wooccm_each_file .container a:visited, .wooccm_each_file .container a:link {
266
- color: #fff;
267
- }
268
- #caman_content #wooccmtoolbar #close:hover, #caman_content #wooccmtoolbar #save:hover {
269
- background: #1b1917;
270
- }
271
- .wooccm-btn-zoom {
272
- color: #fff;
273
- background-color: #5cb85c;
274
- border-color: #4cae4c;
275
- margin-right: 10px;
276
- }
277
-
278
- .wooccm-btn-edit {
279
- color: #fff;
280
- background-color: #f0ad4e;
281
- border-color: #eea236;
282
- margin-right: 10px;
283
- }
284
-
285
  </style>
286
  ';
287
 
@@ -332,7 +182,7 @@ function wooccm_checkout_text_before(){
332
  }
333
 
334
  // We are overriding the default Order Post meta values with our own secret sauce
335
- function wooccm_custom_checkout_field_update_order_meta( $order ) {
336
 
337
  // Additional section
338
  $options = get_option( 'wccs_settings' );
@@ -341,15 +191,15 @@ function wooccm_custom_checkout_field_update_order_meta( $order ) {
341
  foreach( $buttons as $btn ) {
342
  if( $btn['type'] == 'wooccmtextarea' ) {
343
  if( !empty( $_POST[$btn['cow']] ) ) {
344
- update_post_meta( $order, $btn['cow'] , wp_kses( $_POST[ $btn['cow']], false ) );
345
  }
346
  } else if( $btn['type'] !== 'multiselect' && $btn['type'] !== 'multicheckbox' ) {
347
  if( !empty( $_POST[$btn['cow']] ) ) {
348
- update_post_meta( $order, $btn['cow'] , sanitize_text_field( $_POST[ $btn['cow'] ] ) );
349
  }
350
  } elseif( $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox' ) {
351
  if( !empty( $_POST[$btn['cow']] ) ) {
352
- update_post_meta( $order, $btn['cow'] , maybe_serialize( array_map( 'sanitize_text_field', $_POST[$btn['cow']] ) ) );
353
  }
354
  }
355
  }
@@ -362,7 +212,7 @@ function wooccm_custom_checkout_field_update_order_meta( $order ) {
362
  foreach( $buttons as $btn ) {
363
  if( $btn['type'] == 'wooccmtextarea' ) {
364
  if( !empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
365
- update_post_meta( $order, sprintf( '_shipping_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'shipping_%s', $btn['cow'] )], false ) );
366
  }
367
  }
368
  }
@@ -375,7 +225,7 @@ function wooccm_custom_checkout_field_update_order_meta( $order ) {
375
  foreach( $buttons as $btn ) {
376
  if( $btn['type'] == 'wooccmtextarea' ) {
377
  if( !empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
378
- update_post_meta( $order, sprintf( '_billing_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'billing_%s', $btn['cow'] )], false ) );
379
  }
380
  }
381
  }
1
  <?php
2
  // Decides where the Additional Checkout fields appear on the Checkout page
3
+ /*
4
+ * 1326
5
+ * function wooccm_checkout_additional_positioning() {
6
 
7
  $options = get_option( 'wccs_settings' );
8
  // Defaults to after_order_notes
19
 
20
  }
21
 
22
+ }*/
23
 
24
  function wooccm_checkout_default_address_fields( $fields = array() ) {
25
 
128
  }
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  .container .wooccm-btn {
132
  padding: 1.7% 6.7%;
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  </style>
136
  ';
137
 
182
  }
183
 
184
  // We are overriding the default Order Post meta values with our own secret sauce
185
+ function wooccm_custom_checkout_field_update_order_meta( $order_id ) {
186
 
187
  // Additional section
188
  $options = get_option( 'wccs_settings' );
191
  foreach( $buttons as $btn ) {
192
  if( $btn['type'] == 'wooccmtextarea' ) {
193
  if( !empty( $_POST[$btn['cow']] ) ) {
194
+ update_post_meta( $order_id, $btn['cow'] , wp_kses( $_POST[ $btn['cow']], false ) );
195
  }
196
  } else if( $btn['type'] !== 'multiselect' && $btn['type'] !== 'multicheckbox' ) {
197
  if( !empty( $_POST[$btn['cow']] ) ) {
198
+ update_post_meta( $order_id, $btn['cow'] , sanitize_text_field( $_POST[ $btn['cow'] ] ) );
199
  }
200
  } elseif( $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox' ) {
201
  if( !empty( $_POST[$btn['cow']] ) ) {
202
+ update_post_meta( $order_id, $btn['cow'] , maybe_serialize( array_map( 'sanitize_text_field', $_POST[$btn['cow']] ) ) );
203
  }
204
  }
205
  }
212
  foreach( $buttons as $btn ) {
213
  if( $btn['type'] == 'wooccmtextarea' ) {
214
  if( !empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
215
+ update_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'shipping_%s', $btn['cow'] )], false ) );
216
  }
217
  }
218
  }
225
  foreach( $buttons as $btn ) {
226
  if( $btn['type'] == 'wooccmtextarea' ) {
227
  if( !empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
228
+ update_post_meta( $order_id, sprintf( '_billing_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'billing_%s', $btn['cow'] )], false ) );
229
  }
230
  }
231
  }
includes/template.php CHANGED
@@ -1,745 +1,732 @@
1
  <?php
2
- function wooccm_front_end_upload() {
3
-
4
- check_ajax_referer( 'wccs_ajax_nonce', 'nonce' );
5
-
6
- $name = ( isset( $_REQUEST["name"] ) ? $_REQUEST["name"] : false );
7
-
8
- // Check if a file has been uploaded
9
- if( empty( $_FILES ) ) {
10
- wooccm_error_log( '[' . $name . '] $_FILES is empty' );
11
- return;
12
- }
13
-
14
- // Check if the $_REQUEST name attribute matches the $_FILES field name
15
- if( !isset( $_FILES[$name] ) ) {
16
- wooccm_error_log( '[' . $name . '] $_REQUEST name does not match' );
17
- return;
18
- }
19
-
20
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
21
- require_once( ABSPATH . 'wp-admin/includes/media.php' );
22
-
23
- $wp_upload_dir = wp_upload_dir();
24
-
25
- $number_of_files = 0;
26
- $attach_ids = array();
27
-
28
- $files = $_FILES[$name];
29
- foreach( $files['name'] as $key => $value ) {
30
- if( $files['name'][$key] ) {
31
- $file = array(
32
- 'name' => $_FILES[$name]['name'][$key],
33
- 'type' => $_FILES[$name]['type'][$key],
34
- 'tmp_name' => $_FILES[$name]['tmp_name'][$key],
35
- 'error' => $_FILES[$name]['error'][$key],
36
- 'size' => $_FILES[$name]['size'][$key]
37
- );
38
- $upload_overrides = array( 'test_form' => false );
39
- $movefile = wp_handle_upload( $file, $upload_overrides );
40
-
41
- // Check if upload was successful
42
- if( isset( $movefile['error'] ) && $movefile['error'] > 0 ) {
43
- wooccm_error_log( '[' . $name . '] upload failed: ' . print_r( $movefile, true ) );
44
- return;
45
- }
46
-
47
- $post_title = basename( $file['name'] );
48
- if( isset( $movefile['file'] ) )
49
- $post_title = basename( $movefile['file'] );
50
- $attachment = array(
51
- 'guid' => ( isset( $movefile['url'] ) ? $movefile['url'] : false ),
52
- 'post_mime_type' => ( isset( $movefile['type'] ) ? $movefile['type'] : $file['type'] ),
53
- 'post_title' => preg_replace( '/\.[^.]+$/', '', $post_title ),
54
- 'post_content' => '',
55
- 'post_status' => 'inherit'
56
- );
57
-
58
- if( !empty( $movefile['url'] ) ) {
59
- $attach_id = wp_insert_attachment( $attachment, $movefile['url'] );
60
- $attach_ids[] = $attach_id;
61
- $number_of_files++;
62
- // echo json_encode( array( $number_of_files, $attach_id ) );
63
- }
64
-
65
- }
66
- }
67
-
68
- if( !empty( $attach_ids ) ) {
69
- $output = implode( ',', $attach_ids );
70
- $output = json_encode( $output );
71
- echo $output;
72
- }
73
-
74
- die();
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
 
77
  add_action("wp_ajax_wooccm_front_end_upload", "wooccm_front_end_upload");
78
  add_action("wp_ajax_nopriv_wooccm_front_end_upload", "wooccm_front_end_upload");
 
79
 
80
- function wooccm_front_end_upload_save() {
81
-
82
- global $wpdb, $woocommerce, $post;
83
-
84
- check_ajax_referer( 'wccs_ajax_nonce', 'nonce' );
85
 
86
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
87
- require_once( ABSPATH . 'wp-admin/includes/media.php' );
88
 
89
- $name = ( isset( $_REQUEST["name"] ) ? $_REQUEST["name"] : false );
90
- $attachtoremove = ( isset( $_REQUEST["remove"] ) ? $_REQUEST["remove"] : false );
91
 
92
- if( !empty( $attachtoremove ) ) {
93
- // Check the Attachment exists...
94
- if( get_post_status( $attachtoremove ) == false )
95
- die();
96
 
97
- // Check the Attachment is associated with an Order
98
- $post_parent = get_post_field( 'post_parent', $attachtoremove );
99
- if( empty( $post_parent ) ) {
100
- die();
101
- } else {
102
- if( get_post_type( $post_parent ) <> 'shop_order' )
103
- die();
104
- }
105
 
106
- // Delete the Attachment
107
- wp_delete_attachment( $attachtoremove );
108
- }
 
 
 
 
 
109
 
110
- $file = array(
111
- 'name' => $_FILES[$name]['name'],
112
- 'type' => $_FILES[$name]['type'],
113
- 'tmp_name' => $_FILES[$name]['tmp_name'],
114
- 'error' => $_FILES[$name]['error'],
115
- 'size' => $_FILES[$name]['size']
116
- );
117
 
118
- $upload_overrides = array( 'test_form' => false );
119
- $movefile = wp_handle_upload( $file, $upload_overrides );
 
 
 
 
 
120
 
121
- $attachment = array(
122
- 'guid' => $movefile['url'],
123
- 'post_mime_type' => $movefile['type'],
124
- 'post_title' => preg_replace( '/\.[^.]+$/', '', basename($movefile['file'])),
125
- 'post_content' => '',
126
- 'post_status' => 'inherit'
127
- );
128
 
129
- $attach_id = wp_insert_attachment( $attachment, $movefile['url'] );
 
 
 
 
 
 
130
 
131
- echo json_encode( $attach_id );
132
 
133
- die();
134
 
 
 
135
  }
 
136
  //frontend handle
137
  add_action("wp_ajax_wooccm_front_end_upload_save", "wooccm_front_end_upload_save");
138
- add_action("wp_ajax_nopriv_wooccm_front_end_upload_save", "wooccm_front_end_upload_save");
139
-
140
- function wooccm_update_attachment_ids( $order_id = 0 ) {
141
-
142
- $has_uploads = false;
143
- $email_attachments = array();
144
-
145
- $shipping = array(
146
- 'country',
147
- 'first_name',
148
- 'last_name',
149
- 'company',
150
- 'address_1',
151
- 'address_2',
152
- 'city',
153
- 'state',
154
- 'postcode'
155
- );
156
- $billing = array(
157
- 'country',
158
- 'first_name',
159
- 'last_name',
160
- 'company',
161
- 'address_1',
162
- 'address_2',
163
- 'city',
164
- 'state',
165
- 'postcode',
166
- 'email',
167
- 'phone'
168
- );
169
-
170
- $names = array(
171
- 'billing',
172
- 'shipping'
173
- );
174
- $inc = 3;
175
-
176
- foreach( $names as $name ) {
177
-
178
- $array = ( $name == 'billing' ) ? $billing : $shipping;
179
-
180
- $options = get_option( 'wccs_settings'.$inc );
181
- if( !empty( $options[sprintf( '%s_buttons', $name )] ) ) {
182
- foreach( $options[sprintf( '%s_buttons', $name )] as $btn ) {
183
-
184
- if( !in_array( $btn['cow'], $array ) ) {
185
- if( $btn['type'] == 'wooccmupload' ) {
186
- $attachments = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
187
- if( !empty( $attachments ) ) {
188
-
189
- // Check for delimiter
190
- if( strstr( $attachments, '||' ) !== false )
191
- $attachments = explode( '||', $attachments );
192
- else if( strstr( $attachments, ',' ) !== false )
193
- $attachments = explode( ',', $attachments );
194
- else
195
- $attachments = array( $attachments );
196
-
197
- if( !empty( $attachments ) ) {
198
- foreach( $attachments as $image_id ) {
199
-
200
- if( !empty( $image_id ) ) {
201
- $has_uploads = true;
202
- wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
203
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
204
- wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
205
- $email_attachments[] = get_attached_file( $image_id );
206
- }
207
-
208
- }
209
- }
210
- }
211
- }
212
- }
213
-
214
- }
215
- }
216
- $inc--;
217
- }
218
-
219
- $options = get_option( 'wccs_settings' );
220
- $buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
221
- if( !empty( $buttons ) ) {
222
- foreach( $buttons as $btn ) {
223
-
224
- if( $btn['type'] == 'wooccmupload' ) {
225
- $attachments = get_post_meta( $order_id , $btn['cow'], true );
226
- if( !empty( $attachments ) ) {
227
-
228
- // Check for delimiter
229
- if( strstr( $attachments, '||' ) !== false )
230
- $attachments = explode( '||', $attachments );
231
- else if( strstr( $attachments, ',' ) !== false )
232
- $attachments = explode( ',', $attachments );
233
- else if( is_numeric( $attachments ) )
234
- $attachments = array( $attachments );
235
-
236
- if( !is_array( $attachments ) )
237
- continue;
238
-
239
- foreach( $attachments as $image_id ) {
240
-
241
- if( !empty( $image_id ) ) {
242
- $has_uploads = true;
243
- wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
244
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
245
- wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
246
- $email_attachments[] = get_attached_file( $image_id );
247
- }
248
-
249
- }
250
- }
251
- }
252
-
253
- }
254
- }
255
-
256
- if( $has_uploads ) {
257
-
258
- $order = new WC_Order( $order_id );
259
-
260
- // send email
261
- $email_recipients = $options['checkness']['wooccm_notification_email'];
262
- if( empty( $email_recipients ) )
263
- $email_recipients = get_option( 'admin_email' );
264
- $email_heading = __( 'Files Uploaded at Checkout', 'woocommerce-checkout-manager' );
265
- $subject = sprintf( __( 'WooCommerce Checkout Manager - %s', 'woocommerce-checkout-manager' ), $email_heading );
266
-
267
- $mailer = WC()->mailer();
268
-
269
- // Buffer
270
- ob_start();
271
- ?>
272
- <p>This is an automatic message from WooCommerce Checkout Manager, reporting that files have been uploaded by <?php echo $order->billing_first_name; ?> <?php echo $order->billing_last_name; ?>.</p>
273
- <h3>Customer Details</h3>
274
- <ul>
275
- <li>Name: <?php echo $order->billing_first_name; ?> <?php $order->billing_last_name; ?></li>
276
- <li>E-mail: <?php echo $order->billing_email; ?></li>
277
- <li>Order Number: <?php echo $order_id; ?></li>
278
- </ul>
279
- <p>You can view the files and order details via back-end by following this <a href="<?php echo admin_url( '/post.php?post='.$order_id.'&action=edit' ); ?>" target="_blank">link</a>.</p>
280
- <?php
281
- // Get contents
282
- $message = ob_get_clean();
283
-
284
- $message = $mailer->wrap_message( $email_heading, $message );
285
-
286
- // add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
287
- // wc_mail( $email_recipients, $message_subject, $message_content );
288
- $mailer->send( $email_recipients, strip_tags( $subject ), $message, $email_attachments );
289
- // remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
290
 
291
- }
292
 
293
- }
294
- add_action( 'woocommerce_thankyou', 'wooccm_update_attachment_ids' );
295
  // @mod - Change to thank you page to catch all Order Status
296
  // add_action( 'woocommerce_order_status_completed', 'wooccm_update_attachment_ids' );
297
-
298
  // Checkout - Order Received
299
- function wooccm_order_received_checkout_details( $order ) {
300
-
301
- if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) )
302
- $order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
303
- else
304
- $order_id = ( isset( $order->id ) ? $order->id : 0 );
305
-
306
- $shipping = array(
307
- 'country',
308
- 'first_name',
309
- 'last_name',
310
- 'company',
311
- 'address_1',
312
- 'address_2',
313
- 'city',
314
- 'state',
315
- 'postcode'
316
- );
317
- $billing = array(
318
- 'country',