WooCommerce Checkout Manager - Version 4.6.1

Version Description

  • Fix: select field placeholder
  • Fix: missing additional fields saved data
  • Fix: missing additional fields saved data array
  • Fix: saved additional fields option value
Download this release

Release Info

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

Code changes from version 4.6.0 to 4.6.1

assets/backend/css/wooccm-admin.css CHANGED
@@ -5,6 +5,9 @@ table.wooccm-enhanced-options {
5
  border: none;
6
  box-shadow: none;
7
  }
 
 
 
8
  table.wooccm-enhanced-options > tbody > tr > td input.label {
9
  width: 100%;
10
  }
@@ -39,6 +42,10 @@ table.wooccm-enhanced-options > tbody > tr > td.sort .wc-item-reorder-nav {
39
  .attachment-info .woocommerce_options_panel .select2-container {
40
  width: 100%!important;
41
  }
 
 
 
 
42
  .woocommerce_options_panel input,
43
  .woocommerce_options_panel select,
44
  .woocommerce_options_panel textarea {
5
  border: none;
6
  box-shadow: none;
7
  }
8
+ table.wooccm-enhanced-options > thead > th .woocommerce-help-tip {
9
+ margin: -1px 0 0 0.25em;
10
+ }
11
  table.wooccm-enhanced-options > tbody > tr > td input.label {
12
  width: 100%;
13
  }
42
  .attachment-info .woocommerce_options_panel .select2-container {
43
  width: 100%!important;
44
  }
45
+ .woocommerce_options_panel .premium {
46
+ display: block;
47
+ clear: both;
48
+ }
49
  .woocommerce_options_panel input,
50
  .woocommerce_options_panel select,
51
  .woocommerce_options_panel textarea {
assets/backend/css/wooccm-admin.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../less/wooccm-admin.less"],"names":[],"mappings":"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","file":"wooccm-admin.css"}
1
+ {"version":3,"sources":["../../less/wooccm-admin.less"],"names":[],"mappings":"AASU,KAPP,YAEC,QAEE,KACE,KAEG;EACC,gBAAA;;AAQV,KAAC;EACC,YAAA;EACA,gBAAA;;AAFF,KAAC,wBAIC,QACE,KACE;EACE,uBAAA;;AAPR,KAAC,wBAYC,QACE,KACE,KACE,MAAK;EACH,WAAA;;AAhBV,KAAC,wBAYC,QACE,KACE,KAIE,OAAM;EACJ,kBAAA;;AAnBV,KAAC,wBAYC,QACE,KACE,KAOE,MAAK;EACH,aAAA;;AAGF,KAzBP,wBAYC,QACE,KACE,KAWG,KAAM;EACL,WAAA;;AAQZ,gBACE;AADF,gBAEE;EACE,WAAA;;AAHJ,gBAME,2BAA2B;AAN7B,gBAOE,2BAA2B;EACzB,WAAA;EACA,mBAAA;EACA,gBAAA;;AAVJ,gBAaE,2BAA2B,SAAQ;AAbrC,gBAcE,2BAA2B,EAAC;EAC1B,gCAAA;;AAfJ,gBAkBE,2BAA2B,MAAK;AAlBlC,gBAmBE,2BAA2B,MAAK;AAnBlC,gBAoBE,2BAA2B,MAAK;AApBlC,gBAqBE,2BAA2B,MAAK;AArBlC,gBAsBE,2BAA2B;AAtB7B,gBAuBE,2BAA2B;EACzB,qBAAA;;AAKJ,0BAEE;EACE,cAAA;EACA,WAAA;;AAJJ,0BAOE;AAPF,0BAQE;AARF,0BASE;EACE,SAAA;;AAVJ,0BAaE;EACE,mBAAA;;AAdJ,0BAiBE;EACE,oBAAA;EACA,iBAAA;;AAnBJ,0BAiBE,mBAIE;EACE,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;;AAzBN,0BAiBE,mBAWE;EACE,iBAAA;EACA,gBAAA;EACA,+CAAA;;AAGF,wBAA2C;EAyH9C,0BA1IC;IAkBI,oBAAA;;;AAnCN,0BAuCE,4BAEE,6BAA6B,6BAA6B;EACxD,mBAAA;;AAGF,0BANF,4BAMG,yBAA0B;EACzB,+BAAA;EACA,2CAAA;EACA,wCAAA;;AAMN,kCAAkC,mBAAmB,iEAAkE;AAAmC,kCAAkC,mBAAmB,mEAAoE;AACnR,kCAAkC,mBAAmB,mEAAoE;EACvH,kBAAA;;AAGF,kCAAkC,mBAAoB,kCAAkC,IAAG;EACzF,YAAA;EACA,SAAA;EACA,mBAAA;EACA,mBAAA;EACA,sBAAA;EACA,cAAA;;AAGF,kCAAkC,mBAAoB,kCAAkC;EACtF,mBAAA;EACA,qBAAA;EACA,aAAA;EACA,gBAAA;EACA,iBAAA;;AAGF,CAAC,mBAAmB;EAClB,sBAAA;EACA,WAAA;EACA,gBAAA;EACA,oBAAA;EACA,oBAAA;EACA,cAAA;EACA,mCAAA;EACA,SAAS,GAAT;EACA,qBAAA;EACA,gBAAA;;AAGF,kCAAkC,mBAAmB,iEAAkE,kCAAkC,sCAAsC,EAAC;EAC9L,qBAAA;EACA,gBAAA;EACA,kBAAA;EACA,SAAA;;AAGF,kCAAkC,mBAAmB;EACnD,YAAA;EACA,0BAAA;EACA,6BAAA;;AAGF,kCAAkC,mBAAoB,kCAAkC,sCAAsC;EAC5H,qBAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;EACA,gBAAA;;AAEF,CAAC;EACC,YAAA;EACA,gBAAA;EACA,WAAA;;AAGF,kCAAkC,mBAAoB;EACpD,wBAAA;EACA,+BAAA;EACA,uBAAA;EACA,oBAAA;EACA,qBAAA;EACA,aAAA;EACA,4BAAA;EACA,6BAAA;EACA,8BAAA;EACA,sBAAA;EACA,kBAAA;;AAGF,kCAAkC,mBAAoB,kCAAkC,0CAA0C;EAChI,SAAA;;AAGF,kCAAkC,mBAAmB,iEAAkE,kCAAkC,0CAA0C;EACjM,UAAA;EACA,gBAAA;;AAGF,kCAAkC,mBAAoB,kCAAkC,0CAA0C;EAChI,SAAA;EACA,eAAA;EACA,WAAA;;AAGF,mBAAqC;EAEnC,kCAAkC,mBAAoB;IACpD,yBAAA;IACA,2BAAA;IACA,mBAAA;IACA,8BAAA;IACA,6BAAA;IACA,2BAAA;IACA,mBAAA","file":"wooccm-admin.css"}
assets/backend/js/wooccm-admin.js CHANGED
@@ -106,7 +106,7 @@
106
 
107
  });
108
 
109
- $(document).on('wooccm-enhanced-select', function (e) {
110
 
111
  $('.wooccm-enhanced-between-dates').filter(':not(.enhanced)').each(function () {
112
 
@@ -260,4 +260,43 @@
260
 
261
  });
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  })(jQuery);
106
 
107
  });
108
 
109
+ $(document).on('wooccm-enhanced-between-dates', function (e) {
110
 
111
  $('.wooccm-enhanced-between-dates').filter(':not(.enhanced)').each(function () {
112
 
260
 
261
  });
262
 
263
+ $('.wooccm-enhanced-search').filter(':not(.enhanced)').each(function () {
264
+
265
+ var select2_args = {
266
+ allowClear: $(this).data('allow_clear') ? true : false,
267
+ placeholder: $(this).data('placeholder'),
268
+ minimumInputLength: $(this).data('minimum_input_length') || '3',
269
+ escapeMarkup: function (m) {
270
+ return m;
271
+ },
272
+ ajax: {
273
+ url: wooccm_admin.ajax_url,
274
+ dataType: 'json',
275
+ cache: true,
276
+ delay: 250,
277
+ data: function (params) {
278
+ return {
279
+ term: params.term,
280
+ key: $(this).data('key'),
281
+ action: 'wooccm_search_field',
282
+ nonce: wooccm_admin.nonce,
283
+ };
284
+ },
285
+ processResults: function (data, params) {
286
+ var terms = [];
287
+ if (data) {
288
+ $.each(data, function (id, text) {
289
+ terms.push({id: id, text: text});
290
+ });
291
+ }
292
+ return {results: terms};
293
+ }
294
+ }
295
+ };
296
+
297
+ select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
298
+
299
+ $(this).select2(select2_args).addClass('enhanced');
300
+ });
301
+
302
  })(jQuery);
assets/backend/js/wooccm-admin.min.js CHANGED
@@ -1 +1 @@
1
- (function(b){b.fn.serializeArrayAll=function(){var f={};var e=this.serializeArray();b.each(e,function(){if(f[this.name]!==undefined){if(!f[this.name].push){f[this.name]=[f[this.name]]}f[this.name].push(this.value||"")}else{f[this.name]=this.value||""}});var d=b("input[type=radio],input[type=checkbox]",this);b.each(d,function(){if(!f.hasOwnProperty(this.name)){f[this.name]=""}});return f};function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-tab-panels",function(i,h){var g=b(i.target),f=g.find("ul.wc-tabs"),d=f.find('a[href="'+h+'"]');f.show();f.find("a").click(function(k){k.preventDefault();var j=b(this).closest("div.panel-wrap");f.find("li",j).removeClass("active");b(this).parent().addClass("active");b("div.panel",j).hide();b(b(this).attr("href")).show()});if(d.length&&b(d.attr("href")).length){d.click()}else{f.find("li.active").find("a").click()}});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-options",function(d){b(".wooccm-enhanced-options").each(function(){var f=b(this),g=f.find(".add-option"),e=f.find(".remove-options");g.on("click",function(j){var h=f.find("tbody > tr"),k=h.length,i=h.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+k+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+k+'"');h.last().after(b('<tr class="row">'+i+"</tr>"));e.removeProp("disabled")});e.on("click",function(i){f.find("tr > td.check-column input:checked").closest("tr").remove();var h=f.find("tbody > tr");if(h.length<2){b(this).prop("disabled",true)}})})});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-select").filter(":not(.enhanced)").each(function(){var e=b.extend({minimumResultsForSearch:10,allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder")},a());b(this).selectWoo(e).addClass("enhanced")});b(".wooccm-product-search").filter(":not(.enhanced)").each(function(){var g={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):"3",escapeMarkup:function(h){return h},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(h){return{term:h.term,action:b(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:b(this).select2("val")||0,exclude:b(this).data("exclude"),include:b(this).data("include"),limit:b(this).data("limit"),display_stock:b(this).data("display_stock")}},processResults:function(i){var h=[];if(i){b.each(i,function(k,j){h.push({id:k,text:j})})}return{results:h}},cache:true}};g=b.extend(g,a());b(this).selectWoo(g).addClass("enhanced");if(b(this).data("sortable")){var f=b(this);var e=b(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){b(e.find(".select2-selection__choice").get().reverse()).each(function(){var i=b(this).data("data").id;var h=f.find('option[value="'+i+'"]')[0];f.prepend(h)})}})}else{if(b(this).prop("multiple")){b(this).on("change",function(){var h=b(this).children();h.sort(function(j,i){var l=j.text.toLowerCase();var k=i.text.toLowerCase();if(l>k){return 1}if(l<k){return -1}return 0});b(this).html(h)})}}})})})(jQuery);
1
+ (function(b){b.fn.serializeArrayAll=function(){var f={};var e=this.serializeArray();b.each(e,function(){if(f[this.name]!==undefined){if(!f[this.name].push){f[this.name]=[f[this.name]]}f[this.name].push(this.value||"")}else{f[this.name]=this.value||""}});var d=b("input[type=radio],input[type=checkbox]",this);b.each(d,function(){if(!f.hasOwnProperty(this.name)){f[this.name]=""}});return f};function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-tab-panels",function(i,h){var g=b(i.target),f=g.find("ul.wc-tabs"),d=f.find('a[href="'+h+'"]');f.show();f.find("a").click(function(k){k.preventDefault();var j=b(this).closest("div.panel-wrap");f.find("li",j).removeClass("active");b(this).parent().addClass("active");b("div.panel",j).hide();b(b(this).attr("href")).show()});if(d.length&&b(d.attr("href")).length){d.click()}else{f.find("li.active").find("a").click()}});b(document).on("wooccm-enhanced-between-dates",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-options",function(d){b(".wooccm-enhanced-options").each(function(){var f=b(this),g=f.find(".add-option"),e=f.find(".remove-options");g.on("click",function(j){var h=f.find("tbody > tr"),k=h.length,i=h.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+k+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+k+'"');h.last().after(b('<tr class="row">'+i+"</tr>"));e.removeProp("disabled")});e.on("click",function(i){f.find("tr > td.check-column input:checked").closest("tr").remove();var h=f.find("tbody > tr");if(h.length<2){b(this).prop("disabled",true)}})})});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-select").filter(":not(.enhanced)").each(function(){var e=b.extend({minimumResultsForSearch:10,allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder")},a());b(this).selectWoo(e).addClass("enhanced")});b(".wooccm-product-search").filter(":not(.enhanced)").each(function(){var g={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):"3",escapeMarkup:function(h){return h},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(h){return{term:h.term,action:b(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:b(this).select2("val")||0,exclude:b(this).data("exclude"),include:b(this).data("include"),limit:b(this).data("limit"),display_stock:b(this).data("display_stock")}},processResults:function(i){var h=[];if(i){b.each(i,function(k,j){h.push({id:k,text:j})})}return{results:h}},cache:true}};g=b.extend(g,a());b(this).selectWoo(g).addClass("enhanced");if(b(this).data("sortable")){var f=b(this);var e=b(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){b(e.find(".select2-selection__choice").get().reverse()).each(function(){var i=b(this).data("data").id;var h=f.find('option[value="'+i+'"]')[0];f.prepend(h)})}})}else{if(b(this).prop("multiple")){b(this).on("change",function(){var h=b(this).children();h.sort(function(j,i){var l=j.text.toLowerCase();var k=i.text.toLowerCase();if(l>k){return 1}if(l<k){return -1}return 0});b(this).html(h)})}}})});b(".wooccm-enhanced-search").filter(":not(.enhanced)").each(function(){var d={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")||"3",escapeMarkup:function(e){return e},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:true,delay:250,data:function(e){return{term:e.term,key:b(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce,}},processResults:function(f,g){var e=[];if(f){b.each(f,function(i,h){e.push({id:i,text:h})})}return{results:e}}}};d=b.extend(d,a());b(this).select2(d).addClass("enhanced")})})(jQuery);
assets/frontend/js/wooccm-checkout.js CHANGED
@@ -226,7 +226,7 @@
226
  data.append('nonce', wooccm_upload.nonce);
227
  $.ajax({
228
  async: false,
229
- url: wooccm_upload.ajaxurl,
230
  type: 'POST',
231
  cache: false,
232
  data: data,
226
  data.append('nonce', wooccm_upload.nonce);
227
  $.ajax({
228
  async: false,
229
+ url: wooccm_upload.ajax_url,
230
  type: 'POST',
231
  cache: false,
232
  data: data,
assets/frontend/js/wooccm-checkout.min.js CHANGED
@@ -1 +1 @@
1
- (function(e){var f=function(h){return h.is(".processing")||h.parents(".processing").length};var g=function(h){if(!f(h)){h.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(h){h.removeClass("processing").unblock()};var d=function(n,l,m,h,k){var o=e(n),p;if(k.match("image.*")){p="image"}else{if(k.match("application/ms.*")){m=wooccm_upload.icons.spreadsheet;p="spreadsheet"}else{if(k.match("application/x.*")){m=wooccm_upload.icons.archive;p="application"}else{if(k.match("audio.*")){m=wooccm_upload.icons.audio;p="audio"}else{if(k.match("text.*")){m=wooccm_upload.icons.text;p="text"}else{if(k.match("video.*")){m=wooccm_upload.icons.video;p="video"}else{m=wooccm_upload.icons.interactive;p="interactive"}}}}}}var j='<span data-file_id="'+l+'" title="'+h+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+h+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+p+'" alt="'+h+'" src="'+m+'"/>\n </span>\n </span>\n </span>';o.append(j).fadeIn()};function b(i,h){if(h){i.find("label .optional").remove();i.addClass("validate-required");if(i.find("label .required").length===0){i.find("label").append('&nbsp;<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')}}else{i.find("label .required").remove();i.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field");if(i.find("label .optional").length===0){i.find("label").append('&nbsp;<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>")}}}e(document).on("country_to_state_changing",function(i,k,m){var j=m,h;var l=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(l,function(n,o){var p=j.find(o),q=p.find("[data-required]").data("required")||0;b(p,q)})});var c=[];e(".wooccm-type-file").each(function(j,m){var k=e(m),l=k.find("[type=file]"),h=k.find(".wooccm-file-button"),n=k.find(".wooccm-file-list");c[k.attr("id")]=[];h.on("click",function(i){i.preventDefault();l.trigger("click")});n.on("click",".wooccm-file-list-delete",function(i){e(this).closest(".wooccm-file-file").remove()});l.on("change",function(o){var i=e(this)[0].files;if(i.length){if(window.FileReader){e.each(i,function(q,p){var r=n.find("span[data-file_id]").length+q;if(r>=wooccm_upload.limit.max_files){alert("Exeeds max files limit of "+wooccm_upload.limit.max_files);return false}if(p.size>wooccm_upload.limit.max_file_size){alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size);return true}reader=new FileReader();reader.onload=(function(s){return function(t){setTimeout(function(){d(n,c[k.attr("id")].push(p)-1,t.target.result,s.name,s.type)},200)}})(p);console.log(p.name);reader.readAsDataURL(p)})}}})});e("#order_review").on("ajaxSuccess",function(l){var k=e(l.target),j=k.find("#place_order"),i=e(".wooccm-type-file"),h=i.length;if(h){j.addClass("wooccm-upload-process")}});e(document).on("click","#place_order.wooccm-upload-process",function(l){l.preventDefault();var i=e("form.checkout"),k=e(this),j=e(".wooccm-type-file"),h=j.length;j.each(function(m,p){var n=e(p),r=n.find(".wooccm-file-field"),q=n.find(".wooccm-file-list");if(window.FormData&&c[n.attr("id")].length){if(!f(i)){k.html(wooccm_upload.message.uploading);g(i)}var o=new FormData();q.find("span[data-file_id]").each(function(t,s){var u=e(s).data("file_id");if(t>wooccm_upload.limit.max_files){console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files);return false}if(c[n.attr("id")][u]===undefined){console.log("Undefined "+u);return true}if(c[n.attr("id")][u].size>wooccm_upload.limit.max_file_size){console.log("Exeeds max file size of "+wooccm_upload.limit.max_files);return true}console.log("We're ready to upload "+c[n.attr("id")][u].name);o.append("wooccm_checkout_attachment_upload[]",c[n.attr("id")][u])});o.append("action","wooccm_checkout_attachment_upload");o.append("nonce",wooccm_upload.nonce);e.ajax({async:false,url:wooccm_upload.ajaxurl,type:"POST",cache:false,data:o,processData:false,contentType:false,beforeSend:function(s){},success:function(s){if(s.success){r.val(s.data)}else{e("body").trigger("update_checkout")}},complete:function(s){h=h-1}})}else{h=h-1}if(h==0){a(i);k.removeClass("wooccm-upload-process").trigger("click")}})});e(document).on("change",".wooccm-add-price",function(h){e("body").trigger("update_checkout")});e(".wooccm-conditional-child").each(function(h,m){var j=e(m),l=e("#"+j.find("[data-conditional-parent]").data("conditional-parent")+"_field"),k=j.find("[data-conditional-parent-value]").data("conditional-parent-value").toString();if(l.length){l.on("wooccm_change change keyup",function(o){var n=e(o.target),i=n.val();if(n.hasClass("select2-selection")){return}if(n.prop("type")=="checkbox"){i=n.is(":checked")}if(k==i||(e.isArray(i)&&i.indexOf(k)>-1)){j.fadeIn()}else{j.fadeOut()}n.off("wooccm_change");n.off("change");n.off("keyup")});l.find("select:first").trigger("wooccm_change");l.find("textarea:first").trigger("wooccm_change");l.find("input[type=button]:first").trigger("wooccm_change");l.find("input[type=radio]:checked:first").trigger("wooccm_change");l.find("input[type=checkbox]:checked:first").trigger("wooccm_change");l.find("input[type=color]:first").trigger("wooccm_change");l.find("input[type=date]:first").trigger("wooccm_change");l.find("input[type=datetime-local]:first").trigger("wooccm_change");l.find("input[type=email]:first").trigger("wooccm_change");l.find("input[type=file]:first").trigger("wooccm_change");l.find("input[type=hidden]:first").trigger("wooccm_change");l.find("input[type=image]:first").trigger("wooccm_change");l.find("input[type=month]:first").trigger("wooccm_change");l.find("input[type=number]:first").trigger("wooccm_change");l.find("input[type=password]:first").trigger("wooccm_change");l.find("input[type=range]:first").trigger("wooccm_change");l.find("input[type=reset]:first").trigger("wooccm_change");l.find("input[type=search]:first").trigger("wooccm_change");l.find("input[type=submit]:first").trigger("wooccm_change");l.find("input[type=tel]:first").trigger("wooccm_change");l.find("input[type=text]:first").trigger("wooccm_change");l.find("input[type=time]:first").trigger("wooccm_change");l.find("input[type=url]:first").trigger("wooccm_change");l.find("input[type=week]:first").trigger("wooccm_change")}else{j.show()}});e(".wooccm-type-datepicker").each(function(h,k){var j=e(k),l=j.find("input[type=text]");if(e.isFunction(e.fn.datepicker)){l.datepicker({dateFormat:l.data("formatdate")||"dd-mm-yy",minDate:l.data("mindate")||undefined,maxDate:l.data("maxdate")||undefined,beforeShowDay:function(n){var i=n.getDay(),m=l.data("disable")||false;if(!m){return[true]}else{return[m[i]!==undefined]}}})}});e(".wooccm-type-timepicker").each(function(h,k){var j=e(k),l=j.find("input[type=text]");if(e.isFunction(e.fn.timepicker)){l.timepicker({showPeriod:true,showLeadingZero:true,hours:l.data("hours")||undefined,minutes:l.data("minutes")||undefined,})}});e(".wooccm-colorpicker-farbtastic").each(function(h,k){var j=e(k),m=j.find("input[type=text]"),l=j.find(".wooccmcolorpicker_container");m.hide();if(e.isFunction(e.fn.farbtastic)){l.farbtastic("#"+m.attr("id"));l.on("click",function(i){m.fadeIn()})}});e(".wooccm-colorpicker-iris").each(function(h,k){var j=e(k),l=j.find("input[type=text]");l.css("color","#fff").css("background",l.val()).hide();l.iris({wccmclass:l.attr("id"),palettes:true,color:"",hide:false,change:function(i,m){l.css("color","#000").css("background",m.color.toString()).fadeIn()}})})})(jQuery);
1
+ (function(e){var f=function(h){return h.is(".processing")||h.parents(".processing").length};var g=function(h){if(!f(h)){h.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(h){h.removeClass("processing").unblock()};var d=function(n,l,m,h,k){var o=e(n),p;if(k.match("image.*")){p="image"}else{if(k.match("application/ms.*")){m=wooccm_upload.icons.spreadsheet;p="spreadsheet"}else{if(k.match("application/x.*")){m=wooccm_upload.icons.archive;p="application"}else{if(k.match("audio.*")){m=wooccm_upload.icons.audio;p="audio"}else{if(k.match("text.*")){m=wooccm_upload.icons.text;p="text"}else{if(k.match("video.*")){m=wooccm_upload.icons.video;p="video"}else{m=wooccm_upload.icons.interactive;p="interactive"}}}}}}var j='<span data-file_id="'+l+'" title="'+h+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+h+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+p+'" alt="'+h+'" src="'+m+'"/>\n </span>\n </span>\n </span>';o.append(j).fadeIn()};function b(i,h){if(h){i.find("label .optional").remove();i.addClass("validate-required");if(i.find("label .required").length===0){i.find("label").append('&nbsp;<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')}}else{i.find("label .required").remove();i.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field");if(i.find("label .optional").length===0){i.find("label").append('&nbsp;<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>")}}}e(document).on("country_to_state_changing",function(i,k,m){var j=m,h;var l=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(l,function(n,o){var p=j.find(o),q=p.find("[data-required]").data("required")||0;b(p,q)})});var c=[];e(".wooccm-type-file").each(function(j,m){var k=e(m),l=k.find("[type=file]"),h=k.find(".wooccm-file-button"),n=k.find(".wooccm-file-list");c[k.attr("id")]=[];h.on("click",function(i){i.preventDefault();l.trigger("click")});n.on("click",".wooccm-file-list-delete",function(i){e(this).closest(".wooccm-file-file").remove()});l.on("change",function(o){var i=e(this)[0].files;if(i.length){if(window.FileReader){e.each(i,function(q,p){var r=n.find("span[data-file_id]").length+q;if(r>=wooccm_upload.limit.max_files){alert("Exeeds max files limit of "+wooccm_upload.limit.max_files);return false}if(p.size>wooccm_upload.limit.max_file_size){alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size);return true}reader=new FileReader();reader.onload=(function(s){return function(t){setTimeout(function(){d(n,c[k.attr("id")].push(p)-1,t.target.result,s.name,s.type)},200)}})(p);console.log(p.name);reader.readAsDataURL(p)})}}})});e("#order_review").on("ajaxSuccess",function(l){var k=e(l.target),j=k.find("#place_order"),i=e(".wooccm-type-file"),h=i.length;if(h){j.addClass("wooccm-upload-process")}});e(document).on("click","#place_order.wooccm-upload-process",function(l){l.preventDefault();var i=e("form.checkout"),k=e(this),j=e(".wooccm-type-file"),h=j.length;j.each(function(m,p){var n=e(p),r=n.find(".wooccm-file-field"),q=n.find(".wooccm-file-list");if(window.FormData&&c[n.attr("id")].length){if(!f(i)){k.html(wooccm_upload.message.uploading);g(i)}var o=new FormData();q.find("span[data-file_id]").each(function(t,s){var u=e(s).data("file_id");if(t>wooccm_upload.limit.max_files){console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files);return false}if(c[n.attr("id")][u]===undefined){console.log("Undefined "+u);return true}if(c[n.attr("id")][u].size>wooccm_upload.limit.max_file_size){console.log("Exeeds max file size of "+wooccm_upload.limit.max_files);return true}console.log("We're ready to upload "+c[n.attr("id")][u].name);o.append("wooccm_checkout_attachment_upload[]",c[n.attr("id")][u])});o.append("action","wooccm_checkout_attachment_upload");o.append("nonce",wooccm_upload.nonce);e.ajax({async:false,url:wooccm_upload.ajax_url,type:"POST",cache:false,data:o,processData:false,contentType:false,beforeSend:function(s){},success:function(s){if(s.success){r.val(s.data)}else{e("body").trigger("update_checkout")}},complete:function(s){h=h-1}})}else{h=h-1}if(h==0){a(i);k.removeClass("wooccm-upload-process").trigger("click")}})});e(document).on("change",".wooccm-add-price",function(h){e("body").trigger("update_checkout")});e(".wooccm-conditional-child").each(function(h,m){var j=e(m),l=e("#"+j.find("[data-conditional-parent]").data("conditional-parent")+"_field"),k=j.find("[data-conditional-parent-value]").data("conditional-parent-value").toString();if(l.length){l.on("wooccm_change change keyup",function(o){var n=e(o.target),i=n.val();if(n.hasClass("select2-selection")){return}if(n.prop("type")=="checkbox"){i=n.is(":checked")}if(k==i||(e.isArray(i)&&i.indexOf(k)>-1)){j.fadeIn()}else{j.fadeOut()}n.off("wooccm_change");n.off("change");n.off("keyup")});l.find("select:first").trigger("wooccm_change");l.find("textarea:first").trigger("wooccm_change");l.find("input[type=button]:first").trigger("wooccm_change");l.find("input[type=radio]:checked:first").trigger("wooccm_change");l.find("input[type=checkbox]:checked:first").trigger("wooccm_change");l.find("input[type=color]:first").trigger("wooccm_change");l.find("input[type=date]:first").trigger("wooccm_change");l.find("input[type=datetime-local]:first").trigger("wooccm_change");l.find("input[type=email]:first").trigger("wooccm_change");l.find("input[type=file]:first").trigger("wooccm_change");l.find("input[type=hidden]:first").trigger("wooccm_change");l.find("input[type=image]:first").trigger("wooccm_change");l.find("input[type=month]:first").trigger("wooccm_change");l.find("input[type=number]:first").trigger("wooccm_change");l.find("input[type=password]:first").trigger("wooccm_change");l.find("input[type=range]:first").trigger("wooccm_change");l.find("input[type=reset]:first").trigger("wooccm_change");l.find("input[type=search]:first").trigger("wooccm_change");l.find("input[type=submit]:first").trigger("wooccm_change");l.find("input[type=tel]:first").trigger("wooccm_change");l.find("input[type=text]:first").trigger("wooccm_change");l.find("input[type=time]:first").trigger("wooccm_change");l.find("input[type=url]:first").trigger("wooccm_change");l.find("input[type=week]:first").trigger("wooccm_change")}else{j.show()}});e(".wooccm-type-datepicker").each(function(h,k){var j=e(k),l=j.find("input[type=text]");if(e.isFunction(e.fn.datepicker)){l.datepicker({dateFormat:l.data("formatdate")||"dd-mm-yy",minDate:l.data("mindate")||undefined,maxDate:l.data("maxdate")||undefined,beforeShowDay:function(n){var i=n.getDay(),m=l.data("disable")||false;if(!m){return[true]}else{return[m[i]!==undefined]}}})}});e(".wooccm-type-timepicker").each(function(h,k){var j=e(k),l=j.find("input[type=text]");if(e.isFunction(e.fn.timepicker)){l.timepicker({showPeriod:true,showLeadingZero:true,hours:l.data("hours")||undefined,minutes:l.data("minutes")||undefined,})}});e(".wooccm-colorpicker-farbtastic").each(function(h,k){var j=e(k),m=j.find("input[type=text]"),l=j.find(".wooccmcolorpicker_container");m.hide();if(e.isFunction(e.fn.farbtastic)){l.farbtastic("#"+m.attr("id"));l.on("click",function(i){m.fadeIn()})}});e(".wooccm-colorpicker-iris").each(function(h,k){var j=e(k),l=j.find("input[type=text]");l.css("color","#fff").css("background",l.val()).hide();l.iris({wccmclass:l.attr("id"),palettes:true,color:"",hide:false,change:function(i,m){l.css("color","#000").css("background",m.color.toString()).fadeIn()}})})})(jQuery);
includes/class-wooccm-admin.php CHANGED
@@ -64,13 +64,19 @@ class WOOCCM_Field_Admin {
64
 
65
  function enqueue_scripts() {
66
 
 
 
67
  wp_register_style('wooccm-admin', plugins_url('assets/backend/css/wooccm-admin.css', WOOCCM_PLUGIN_FILE), array('media-views', /* 'woocommerce_admin_marketplace_styles' */), WOOCCM_PLUGIN_VERSION, 'all');
68
 
69
  wp_register_script('wooccm-admin', plugins_url('assets/backend/js/wooccm-admin.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
70
 
71
- if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
72
  wp_enqueue_style('wooccm-admin');
73
  wp_enqueue_script('wooccm-admin');
 
 
 
 
74
  }
75
  }
76
 
64
 
65
  function enqueue_scripts() {
66
 
67
+ $screen = get_current_screen();
68
+
69
  wp_register_style('wooccm-admin', plugins_url('assets/backend/css/wooccm-admin.css', WOOCCM_PLUGIN_FILE), array('media-views', /* 'woocommerce_admin_marketplace_styles' */), WOOCCM_PLUGIN_VERSION, 'all');
70
 
71
  wp_register_script('wooccm-admin', plugins_url('assets/backend/js/wooccm-admin.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
72
 
73
+ if ((isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) || in_array($screen->id, array(/* 'product', 'edit-product', */'shop_order', 'edit-shop_order'))) {
74
  wp_enqueue_style('wooccm-admin');
75
  wp_enqueue_script('wooccm-admin');
76
+ wp_localize_script('wooccm-admin', 'wooccm_admin', array(
77
+ 'ajax_url' => admin_url('admin-ajax.php'),
78
+ 'nonce' => wp_create_nonce('wooccm_search_field'),
79
+ ));
80
  }
81
  }
82
 
includes/class-wooccm-notices.php CHANGED
@@ -49,7 +49,7 @@ class WOOCCM_Notices {
49
  <h3>Hello! the new admin panel is here!</h3>
50
  </p>
51
  <p>
52
- As you know, we've recently acquired this plugin and we've ween working very hard to bring you a quality product.
53
  </p>
54
  <p>
55
  Finally, we're glad to introduce you to the new admin panel available in the WooCommerce &gt; Checkout dashboard.
49
  <h3>Hello! the new admin panel is here!</h3>
50
  </p>
51
  <p>
52
+ As you know, we've recently acquired this plugin and we've been working very hard to bring you a quality product.
53
  </p>
54
  <p>
55
  Finally, we're glad to introduce you to the new admin panel available in the WooCommerce &gt; Checkout dashboard.
includes/{controller/class-wooccm-field-upload.php → class-wooccm-upload.php} RENAMED
File without changes
includes/class-wooccm.php CHANGED
@@ -16,6 +16,7 @@ final class WOOCCM {
16
  add_action('woocommerce_init', array($this, 'init_session'));
17
  add_action('woocommerce_init', array($this, 'includes'));
18
  add_action('woocommerce_init', array($this, 'field'));
 
19
  }
20
 
21
  public static function instance() {
@@ -36,11 +37,11 @@ final class WOOCCM {
36
 
37
  public function includes() {
38
  include_once( WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-admin.php' );
 
39
  include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-checkout.php' );
40
  include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field.php' );
41
- include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-upload.php' );
42
  include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-order.php' );
43
- include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-checkout-advanced.php' );
44
  }
45
 
46
  public function register_scripts() {
@@ -52,7 +53,7 @@ final class WOOCCM {
52
  wp_register_script('wooccm-checkout', plugins_url('assets/frontend/js/wooccm-checkout.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
53
 
54
  wp_localize_script('wooccm-checkout', 'wooccm_upload', array(
55
- 'ajaxurl' => admin_url('admin-ajax.php'),
56
  'nonce' => wp_create_nonce('wooccm_upload'),
57
  'limit' => array(
58
  'max_file_size' => wp_max_upload_size(),
@@ -100,6 +101,10 @@ final class WOOCCM {
100
  wp_register_script('farbtastic', admin_url('js/farbtastic.js'), array('jquery'), false);
101
  }
102
 
 
 
 
 
103
  public function init_session() {
104
 
105
  if (isset(WC()->session) && !WC()->session->wooccm) {
16
  add_action('woocommerce_init', array($this, 'init_session'));
17
  add_action('woocommerce_init', array($this, 'includes'));
18
  add_action('woocommerce_init', array($this, 'field'));
19
+ add_action('woocommerce_checkout_order_processed', array($this, 'clear_session'), 150);
20
  }
21
 
22
  public static function instance() {
37
 
38
  public function includes() {
39
  include_once( WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-admin.php' );
40
+ include_once( WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-upload.php' );
41
  include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-checkout.php' );
42
  include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field.php' );
 
43
  include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-order.php' );
44
+ include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-advanced.php' );
45
  }
46
 
47
  public function register_scripts() {
53
  wp_register_script('wooccm-checkout', plugins_url('assets/frontend/js/wooccm-checkout.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
54
 
55
  wp_localize_script('wooccm-checkout', 'wooccm_upload', array(
56
+ 'ajax_url' => admin_url('admin-ajax.php'),
57
  'nonce' => wp_create_nonce('wooccm_upload'),
58
  'limit' => array(
59
  'max_file_size' => wp_max_upload_size(),
101
  wp_register_script('farbtastic', admin_url('js/farbtastic.js'), array('jquery'), false);
102
  }
103
 
104
+ public function clear_session() {
105
+ unset(WC()->session->wooccm);
106
+ }
107
+
108
  public function init_session() {
109
 
110
  if (isset(WC()->session) && !WC()->session->wooccm) {
includes/controller/{class-wooccm-checkout-advanced.php → class-wooccm-advanced.php} RENAMED
File without changes
includes/controller/class-wooccm-checkout.php CHANGED
@@ -354,10 +354,6 @@ class WOOCCM_Checkout_Controller {
354
 
355
  public function init() {
356
 
357
- // global $wooccm_sections;
358
- //
359
- // $wooccm_sections = array('' => esc_html__('Checkout', 'woocommerce-checkout-manager'));
360
-
361
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
362
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
363
  add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
354
 
355
  public function init() {
356
 
 
 
 
 
357
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
358
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
359
  add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
includes/controller/class-wooccm-field.php CHANGED
@@ -443,7 +443,7 @@ class WOOCCM_Field_Controller {
443
  }
444
  </style>
445
  <div class="order_data_column">
446
- <h3><?php esc_html_e('Additional Details', 'woocommerce-checkout-manager'); ?></h3>
447
  <?php
448
  $defaults = WOOCCM()->additional->get_defaults();
449
 
@@ -451,7 +451,17 @@ class WOOCCM_Field_Controller {
451
 
452
  $key = sprintf('_%s', $field['key']);
453
 
454
- ($value = get_post_meta($order->get_id(), $key, true)) ? $value : get_post_meta($order->get_id(), sprintf('%s', $field['name']), true);
 
 
 
 
 
 
 
 
 
 
455
 
456
  if ($value) {
457
  ?>
443
  }
444
  </style>
445
  <div class="order_data_column">
446
+ <h3><?php esc_html_e('Additional', 'woocommerce-checkout-manager'); ?></h3>
447
  <?php
448
  $defaults = WOOCCM()->additional->get_defaults();
449
 
451
 
452
  $key = sprintf('_%s', $field['key']);
453
 
454
+ if (!$value = get_post_meta($order->get_id(), $key, true)) {
455
+
456
+ $value = maybe_unserialize(get_post_meta($order->get_id(), sprintf('%s', $field['name']), true));
457
+
458
+ if (is_array($value)) {
459
+ $value = implode(',', $value);
460
+ }
461
+
462
+ update_post_meta($order->get_id(), $key, $value);
463
+ delete_post_meta($order->get_id(), sprintf('%s', $field['name']));
464
+ }
465
 
466
  if ($value) {
467
  ?>
includes/controller/class-wooccm-order.php CHANGED
@@ -167,12 +167,7 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
167
  'post_status' => null,
168
  'post_parent' => $order->get_id()
169
  ));
170
- ?>
171
-
172
- <?php include WOOCCM_PLUGIN_DIR . 'includes/view/backend/meta-boxes/html-order-uploads.php'; ?>
173
-
174
- <?php
175
-
176
  }
177
  }
178
 
@@ -182,6 +177,9 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
182
  public function add_metabox() {
183
  add_meta_box('woocommerce-order-files', esc_html__('Order Uploaded Files', 'woocommerce-checkout-manager'), array($this, 'add_metabox_content'), 'shop_order', 'normal', 'default');
184
  }
 
 
 
185
 
186
  public function get_settings() {
187
  return array(
@@ -266,8 +264,8 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
266
  woocommerce_update_options($this->get_settings());
267
  }
268
 
269
- // Compatibility
270
- // -------------------------------------------------------------------------
271
 
272
  public function enable_file_upload($value) {
273
 
@@ -303,23 +301,23 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
303
  }
304
 
305
  function init() {
306
- //
307
- // global $wooccm_sections;
308
- //
309
- // $wooccm_sections['order'] = esc_html__('Order', 'woocommerce-checkout-manager');
310
 
311
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
312
 
313
  add_action('wp_ajax_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
314
  add_action('wp_ajax_nopriv_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
315
 
 
 
316
  add_action('add_meta_boxes', array($this, 'add_metabox'));
317
 
 
 
318
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
319
  add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
320
 
321
  // Frontend
322
- // -----------------------------------------------------------------------
323
 
324
  add_action('woocommerce_thankyou', array($this, 'add_upload_files'));
325
  add_action('woocommerce_view_order', array($this, 'add_upload_files'));
@@ -328,7 +326,7 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
328
  add_action('woocommerce_view_order', array($this, 'add_custom_fields'));
329
 
330
  // Compatibility
331
- // -----------------------------------------------------------------------
332
 
333
  add_filter('default_option_wooccm_order_upload_files', array($this, 'enable_file_upload'));
334
  add_filter('default_option_wooccm_order_upload_files_order_status', array($this, 'upload_os'));
167
  'post_status' => null,
168
  'post_parent' => $order->get_id()
169
  ));
170
+ include WOOCCM_PLUGIN_DIR . 'includes/view/backend/meta-boxes/html-order-uploads.php';
 
 
 
 
 
171
  }
172
  }
173
 
177
  public function add_metabox() {
178
  add_meta_box('woocommerce-order-files', esc_html__('Order Uploaded Files', 'woocommerce-checkout-manager'), array($this, 'add_metabox_content'), 'shop_order', 'normal', 'default');
179
  }
180
+
181
+ // Panel
182
+ // ---------------------------------------------------------------------------
183
 
184
  public function get_settings() {
185
  return array(
264
  woocommerce_update_options($this->get_settings());
265
  }
266
 
267
+ // Compatibility
268
+ // -------------------------------------------------------------------------
269
 
270
  public function enable_file_upload($value) {
271
 
301
  }
302
 
303
  function init() {
 
 
 
 
304
 
305
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
306
 
307
  add_action('wp_ajax_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
308
  add_action('wp_ajax_nopriv_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
309
 
310
+ // Order
311
+ //--------------------------------------------------------------------------
312
  add_action('add_meta_boxes', array($this, 'add_metabox'));
313
 
314
+ // Panel
315
+ // -------------------------------------------------------------------------
316
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
317
  add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
318
 
319
  // Frontend
320
+ // -------------------------------------------------------------------------
321
 
322
  add_action('woocommerce_thankyou', array($this, 'add_upload_files'));
323
  add_action('woocommerce_view_order', array($this, 'add_upload_files'));
326
  add_action('woocommerce_view_order', array($this, 'add_custom_fields'));
327
 
328
  // Compatibility
329
+ // -------------------------------------------------------------------------
330
 
331
  add_filter('default_option_wooccm_order_upload_files', array($this, 'enable_file_upload'));
332
  add_filter('default_option_wooccm_order_upload_files_order_status', array($this, 'upload_os'));
includes/model/class-wooccm-field.php CHANGED
@@ -122,7 +122,7 @@ class WOOCCM_Field {
122
  'clear' => false,
123
  'options' => array(
124
  0 => array(
125
- 'label' => '',
126
  'add_price_total' => 0,
127
  'add_price_type' => 'fixed',
128
  'add_price_tax' => 0,
@@ -251,7 +251,6 @@ class WOOCCM_Field {
251
  if ($field['conditional_parent_key'] == $field['key']) {
252
  $field['conditional_parent_key'] = '';
253
  }
254
-
255
  }
256
 
257
  return $field;
122
  'clear' => false,
123
  'options' => array(
124
  0 => array(
125
+ 'label' => esc_html__('Option', 'woocommerce-checkout-manager'),
126
  'add_price_total' => 0,
127
  'add_price_type' => 'fixed',
128
  'add_price_tax' => 0,
251
  if ($field['conditional_parent_key'] == $field['key']) {
252
  $field['conditional_parent_key'] = '';
253
  }
 
254
  }
255
 
256
  return $field;
includes/view/backend/pages/modals/modal-field.php CHANGED
@@ -27,13 +27,12 @@
27
  <?php include_once( 'parts/panel-options.php' ); ?>
28
  <# } #>
29
  <?php include_once( 'parts/panel-display.php' ); ?>
30
- <?php //include_once( 'parts/panel-conditional.php' ); ?>
31
  <# if ( !_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
32
- <?php include_once( 'parts/panel-price.php' ); ?>
33
  <# } #>
34
  <?php //include_once( 'parts/panel-datepicker.php' ); ?>
35
  <?php //include_once( 'parts/panel-timepicker.php' ); ?>
36
- <?php //include_once('parts/panel-advanced.php' ); ?>
37
  <?php //include_once( 'parts/panel-suggestions.php' ); ?>
38
  <div class="clear"></div>
39
  </div>
27
  <?php include_once( 'parts/panel-options.php' ); ?>
28
  <# } #>
29
  <?php include_once( 'parts/panel-display.php' ); ?>
 
30
  <# if ( !_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
31
+ <?php //include_once( 'parts/panel-price.php' ); ?>
32
  <# } #>
33
  <?php //include_once( 'parts/panel-datepicker.php' ); ?>
34
  <?php //include_once( 'parts/panel-timepicker.php' ); ?>
35
+ <?php //include_once('parts/panel-admin.php' ); ?>
36
  <?php //include_once( 'parts/panel-suggestions.php' ); ?>
37
  <div class="clear"></div>
38
  </div>
includes/view/backend/pages/modals/parts/field-info.php CHANGED
@@ -11,7 +11,6 @@
11
  <# } #>
12
  </div>
13
 
14
-
15
  <div class="panel woocommerce_options_panel">
16
  <div class="settings">
17
  <p class="form-field">
11
  <# } #>
12
  </div>
13
 
 
14
  <div class="panel woocommerce_options_panel">
15
  <div class="settings">
16
  <p class="form-field">
includes/view/backend/pages/modals/parts/field-tabs.php CHANGED
@@ -7,9 +7,6 @@
7
  <a href="#tab_panel_options"><span><?php esc_html_e('Options', 'woocommerce-checkout-manager'); ?></span></a>
8
  </li>
9
  <# } #>
10
- <!--<li class="conditional_options">
11
- <a href="#tab_panel_conditional"><span><?php esc_html_e('Conditional', 'woocommerce-checkout-manager'); ?></span></a>
12
- </li>-->
13
  <li class="display_options">
14
  <a href="#tab_panel_display"><span><?php esc_html_e('Display', 'woocommerce-checkout-manager'); ?></span></a>
15
  </li>
@@ -23,15 +20,15 @@
23
  <a href="#tab_panel_timepicker"><span><?php esc_html_e('Timepicker', 'woocommerce-checkout-manager'); ?></span></a>
24
  </li>
25
  <# } #>-->
26
- <# if ( !_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
27
  <li class="price_options">
28
  <a href="#tab_panel_price"><span><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></span></a>
29
  </li>
30
  <# } #>
31
- <!--<li class="advanced_advanced">
32
- <a href="#tab_panel_advanced"><span><?php esc_html_e('Advanced', 'woocommerce-checkout-manager'); ?></span></a>
33
- </li>-->
34
- <!--<li class="suggestions_options">
35
  <a href="#tab_panel_suggestions"><span><?php esc_html_e('Suggestions', 'woocommerce-checkout-manager'); ?></span></a>
36
  </li>-->
37
  </ul>
7
  <a href="#tab_panel_options"><span><?php esc_html_e('Options', 'woocommerce-checkout-manager'); ?></span></a>
8
  </li>
9
  <# } #>
 
 
 
10
  <li class="display_options">
11
  <a href="#tab_panel_display"><span><?php esc_html_e('Display', 'woocommerce-checkout-manager'); ?></span></a>
12
  </li>
20
  <a href="#tab_panel_timepicker"><span><?php esc_html_e('Timepicker', 'woocommerce-checkout-manager'); ?></span></a>
21
  </li>
22
  <# } #>-->
23
+ <!-- <# if ( !_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
24
  <li class="price_options">
25
  <a href="#tab_panel_price"><span><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></span></a>
26
  </li>
27
  <# } #>
28
+ <li class="admin_options">
29
+ <a href="#tab_panel_admin"><span><?php esc_html_e('Admin', 'woocommerce-checkout-manager'); ?></span></a>
30
+ </li>
31
+ <li class="suggestions_options">
32
  <a href="#tab_panel_suggestions"><span><?php esc_html_e('Suggestions', 'woocommerce-checkout-manager'); ?></span></a>
33
  </li>-->
34
  </ul>
includes/view/backend/pages/modals/parts/{panel-advanced.php → panel-admin.php} RENAMED
@@ -1,19 +1,22 @@
1
- <div id="tab_panel_advanced" class="panel woocommerce_options_panel hidden" style="display: none;">
2
  <div class="options_group">
3
  <p class="form-field">
4
  <label><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></label>
5
- <input <# if ( data.clear ) { #>checked="checked"<# } #> type="checkbox" name="listable" value="1">
6
  <span class="description"><?php esc_html_e('Display in View Orders screen ', 'woocommerce-checkout-manager'); ?></span>
7
  </p>
8
  <p class="form-field">
9
  <label><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></label>
10
- <input <# if ( data.clear ) { #>checked="checked"<# } #> type="checkbox" name="sortable" value="1">
11
  <span class="description"><?php esc_html_e('Allow Sorting on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
12
  </p>
13
  <p class="form-field">
14
  <label><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></label>
15
- <input <# if ( data.clear ) { #>checked="checked"<# } #> type="checkbox" name="filterable" value="1">
16
  <span class="description"><?php esc_html_e('Allow Filtering on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
17
  </p>
18
  </div>
 
 
 
19
  </div>
1
+ <div id="tab_panel_admin" class="panel woocommerce_options_panel hidden" style="display: none;">
2
  <div class="options_group">
3
  <p class="form-field">
4
  <label><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></label>
5
+ <input disabled="disabled" <# if ( data.listable ) { #>checked="checked"<# } #> type="checkbox" name="listable" value="1">
6
  <span class="description"><?php esc_html_e('Display in View Orders screen ', 'woocommerce-checkout-manager'); ?></span>
7
  </p>
8
  <p class="form-field">
9
  <label><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></label>
10
+ <input disabled="disabled" <# if ( data.sortable ) { #>checked="checked"<# } #> type="checkbox" name="sortable" value="1">
11
  <span class="description"><?php esc_html_e('Allow Sorting on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
12
  </p>
13
  <p class="form-field">
14
  <label><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></label>
15
+ <input disabled="disabled" <# if ( data.filterable ) { #>checked="checked"<# } #> type="checkbox" name="filterable" value="1">
16
  <span class="description"><?php esc_html_e('Allow Filtering on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
17
  </p>
18
  </div>
19
+ <div class="options_group">
20
+ <p><em><?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?></em></p>
21
+ </div>
22
  </div>
includes/view/backend/pages/modals/parts/panel-options.php CHANGED
@@ -8,11 +8,21 @@
8
  <label class="screen-reader-text" for="select-all"><?php esc_html_e('Select all', 'woocommerce-checkout-manager'); ?></label>
9
  <input type="checkbox" id="select-all">
10
  </th>
11
- <th scope="col" class="label" style="width: 40%;"><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></th>
12
- <th scope="col" class="add-price" style="width: 30%;min-width: 85px;"><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></th>
13
- <th scope="col" class="default" style="width: 10%;"><?php esc_html_e('Taxable', 'woocommerce-checkout-manager'); ?></th>
14
- <th scope="col" class="default" style="width: 15%;"><?php esc_html_e('Default', 'woocommerce-checkout-manager'); ?></th>
15
- <th scope="col" class="reorder" style="width: 5%;">&nbsp;</th>
 
 
 
 
 
 
 
 
 
 
16
  </tr>
17
  </thead>
18
  <tbody class="ui-sortable">
8
  <label class="screen-reader-text" for="select-all"><?php esc_html_e('Select all', 'woocommerce-checkout-manager'); ?></label>
9
  <input type="checkbox" id="select-all">
10
  </th>
11
+ <th scope="col" style="width: 40%;">
12
+ <?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?>
13
+ </th>
14
+ <th scope="col" style="width: 30%;max-width: 85px;">
15
+ <?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?>
16
+ <span class="woocommerce-help-tip" data-tip="<?php esc_html_e('This is a premium feature.', 'woocommerce-checkout-manager'); ?>"></span>
17
+ </th>
18
+ <th scope="col" style="width: 10%;min-width: 80px;">
19
+ <?php esc_html_e('Taxable', 'woocommerce-checkout-manager'); ?>
20
+ <span class="woocommerce-help-tip" data-tip="<?php esc_html_e('This is a premium feature.', 'woocommerce-checkout-manager'); ?>"></span>
21
+ </th>
22
+ <th scope="col" style="width: 15%;">
23
+ <?php esc_html_e('Default', 'woocommerce-checkout-manager'); ?>
24
+ </th>
25
+ <th scope="col" style="width: 5%;">&nbsp;</th>
26
  </tr>
27
  </thead>
28
  <tbody class="ui-sortable">
includes/view/backend/pages/modals/parts/panel-price.php CHANGED
@@ -1,38 +1,29 @@
1
  <div id="tab_panel_price" class="panel woocommerce_options_panel hidden" style="display: none;">
2
-
3
  <div class="options_group">
4
  <p class="form-field">
5
  <label><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></label>
6
- <input <# if (data.add_price) { #>checked="checked"<# } #> type="checkbox" name="add_price" value="1">
7
  </p>
8
  <p class="form-field">
9
  <label><?php esc_html_e('Name', 'woocommerce-checkout-manager'); ?></label>
10
- <input class="short" name="add_price_name" type="text" value="{{data.add_price_name}}" placeholder="<?php esc_html_e('My Custom Charge', 'woocommerce-checkout-manager'); ?>">
11
  </p>
12
  <p class="form-field">
13
  <label><?php esc_html_e('Total', 'woocommerce-checkout-manager'); ?></label>
14
- <input class="short" name="add_price_total" type="text" value="{{data.add_price_total}}" placeholder="50">
15
- <select style="margin:0 0 0 10px;line-height: 30px; height: 30px;" class="select" name="add_price_type">
16
  <option <# if (data.add_price_type == 'fixed') { #>selected="selected"<# } #> value="fixed">$</option>
17
  <option <# if (data.add_price_type == 'percent') { #>selected="selected"<# } #> value="percent">%</option>
18
  </select>
19
  </p>
20
  </div>
21
-
22
  <div class="options_group">
23
  <p class="form-field">
24
  <label><?php esc_html_e('Tax', 'woocommerce-checkout-manager'); ?></label>
25
- <input <# if (data.add_price_tax) { #>checked="checked"<# } #> type="checkbox" name="add_price_tax" value="1">
26
  </p>
27
- <!--<p class="form-field">
28
- <label><?php esc_html_e('Deny Checkout', 'woocommerce-checkout-manager'); ?></label>
29
- <input <# if (data.deny_checkout) { #>checked="checked"<# } #> type="checkbox" name="deny_checkout" value="1">
30
- </p>
31
- <p class="form-field">
32
- <label><?php esc_html_e('Deny Receipt', 'woocommerce-checkout-manager'); ?></label>
33
- <input <# if (data.deny_receipt) { #>checked="checked"<# } #> type="checkbox" name="deny_receipt" value="1">
34
- </p>-->
35
-
36
  </div>
37
-
 
 
38
  </div>
1
  <div id="tab_panel_price" class="panel woocommerce_options_panel hidden" style="display: none;">
 
2
  <div class="options_group">
3
  <p class="form-field">
4
  <label><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></label>
5
+ <input disabled="disabled" <# if (data.add_price) { #>checked="checked"<# } #> type="checkbox" name="add_price" value="1">
6
  </p>
7
  <p class="form-field">
8
  <label><?php esc_html_e('Name', 'woocommerce-checkout-manager'); ?></label>
9
+ <input disabled="disabled" class="short" name="add_price_name" type="text" value="{{data.add_price_name}}" placeholder="<?php esc_html_e('My Custom Charge', 'woocommerce-checkout-manager'); ?>">
10
  </p>
11
  <p class="form-field">
12
  <label><?php esc_html_e('Total', 'woocommerce-checkout-manager'); ?></label>
13
+ <input disabled="disabled" class="short" name="add_price_total" type="text" value="{{data.add_price_total}}" placeholder="50">
14
+ <select disabled="disabled" style="margin:0 0 0 10px;line-height: 30px; height: 30px;" class="select" name="add_price_type">
15
  <option <# if (data.add_price_type == 'fixed') { #>selected="selected"<# } #> value="fixed">$</option>
16
  <option <# if (data.add_price_type == 'percent') { #>selected="selected"<# } #> value="percent">%</option>
17
  </select>
18
  </p>
19
  </div>
 
20
  <div class="options_group">
21
  <p class="form-field">
22
  <label><?php esc_html_e('Tax', 'woocommerce-checkout-manager'); ?></label>
23
+ <input disabled="disabled" <# if (data.add_price_tax) { #>checked="checked"<# } #> type="checkbox" name="add_price_tax" value="1">
24
  </p>
 
 
 
 
 
 
 
 
 
25
  </div>
26
+ <div class="options_group">
27
+ <p><em><?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?></em></p>
28
+ </div>
29
  </div>
includes/view/frontend/class-wooccm-fields-additional.php CHANGED
@@ -17,13 +17,13 @@ class WOOCCM_Fields_Additional {
17
 
18
  function add_required_notice() {
19
 
20
- if (count($fields = WOOCCM()->additional->get_fields())) {
21
 
22
- foreach ($fields as $field_id => $field) {
23
 
24
- if (!empty($field['key']) && empty($field['disabled']) && !empty($field['required']) && empty($_POST[$field['key']])) {
25
 
26
- $message = sprintf(__('%s is a required field.', 'woocommerce-checkout-manager'), '<strong>' . $field['label'] . '</strong>');
27
 
28
  wc_add_notice($message, 'error');
29
  }
@@ -31,39 +31,46 @@ class WOOCCM_Fields_Additional {
31
  }
32
  }
33
 
34
- function add_order_meta($order_id = 0) {
35
 
36
- if (count($fields = WOOCCM()->additional->get_fields())) {
37
 
38
- foreach ($fields as $id => $field) {
39
 
40
- if (!empty($_POST[$field['key']])) {
41
 
42
- $value = $_POST[$field['key']];
43
 
44
  if ($field['type'] == 'textarea') {
45
- update_post_meta($order_id, sprintf('_%s', $field['key']), wp_kses($value, false));
46
  } else if (is_array($value)) {
47
- update_post_meta($order_id, sprintf('_%s', $field['key']), maybe_serialize(array_map('sanitize_text_field', $value)));
48
  } else {
49
- update_post_meta($order_id, sprintf('_%s', $field['key']), sanitize_text_field($value));
50
  }
51
  }
52
  }
53
  }
54
  }
55
 
 
 
 
 
 
 
 
56
  function add_additional_fields($checkout) {
57
  ?>
58
  <div class="wooccm-additional-fields">
59
  <?php
60
- if ($custom_fields = WOOCCM()->additional->get_fields()) {
61
 
62
- foreach ($custom_fields as $field_id => $custom_field) {
63
 
64
- if (!empty($custom_field['key']) && empty($custom_field['disabled'])) {
65
 
66
- woocommerce_form_field($custom_field['key'], $custom_field, $checkout->get_value($custom_field['key']));
67
  }
68
  }
69
  }
@@ -98,14 +105,16 @@ class WOOCCM_Fields_Additional {
98
 
99
  function init() {
100
  add_action('woocommerce_checkout_process', array($this, 'add_required_notice'));
101
- add_action('woocommerce_checkout_update_order_meta', array($this, 'add_order_meta'));
 
102
  // Compatibility
103
  // -----------------------------------------------------------------------
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
 
17
 
18
  function add_required_notice() {
19
 
20
+ if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
21
 
22
+ foreach ($fields as $key => $field) {
23
 
24
+ if (empty($field['disabled']) && !empty($field['required']) && empty($_POST[$key])) {
25
 
26
+ $message = sprintf(__('%s is a required field.', 'woocommerce-checkout-manager'), '<strong>' . esc_html($field['label']) . '</strong>');
27
 
28
  wc_add_notice($message, 'error');
29
  }
31
  }
32
  }
33
 
34
+ function add_order_meta($order_id = 0, $data) {
35
 
36
+ if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
37
 
38
+ foreach ($fields as $key => $field) {
39
 
40
+ if (!empty($data[$key])) {
41
 
42
+ $value = $data[$key];
43
 
44
  if ($field['type'] == 'textarea') {
45
+ update_post_meta($order_id, sprintf('_%s', $key), wp_kses($value, false));
46
  } else if (is_array($value)) {
47
+ update_post_meta($order_id, sprintf('_%s', $key), implode(',', array_map('sanitize_text_field', $value)));
48
  } else {
49
+ update_post_meta($order_id, sprintf('_%s', $key), sanitize_text_field($value));
50
  }
51
  }
52
  }
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
 
71
+ if (empty($field['disabled'])) {
72
 
73
+ woocommerce_form_field($key, $field, $checkout->get_value($key));
74
  }
75
  }
76
  }
105
 
106
  function init() {
107
  add_action('woocommerce_checkout_process', array($this, 'add_required_notice'));
108
+ add_action('woocommerce_checkout_update_order_meta', array($this, 'add_order_meta'), 10, 2);
109
+
110
  // Compatibility
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
 
includes/view/frontend/class-wooccm-fields-filters.php CHANGED
@@ -14,7 +14,7 @@ class WOOCCM_Fields_Filter {
14
  self::$_instance = new self();
15
  }
16
  return self::$_instance;
17
- }
18
 
19
  // Custom fields
20
  // ---------------------------------------------------------------------------
@@ -92,6 +92,29 @@ class WOOCCM_Fields_Filter {
92
 
93
  break;
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  case 'multiselect' :
96
 
97
  $field = '';
@@ -291,6 +314,7 @@ class WOOCCM_Fields_Filter {
291
  add_filter('woocommerce_form_field_radio', array($this, 'custom_field'), 10, 4);
292
  add_filter('woocommerce_form_field_multicheckbox', array($this, 'custom_field'), 10, 4);
293
  add_filter('woocommerce_form_field_multiselect', array($this, 'custom_field'), 10, 4);
 
294
  add_filter('woocommerce_form_field_file', array($this, 'custom_field'), 10, 4);
295
  add_filter('woocommerce_form_field_heading', array($this, 'heading_field'), 10, 4);
296
  add_filter('woocommerce_form_field_colorpicker', array($this, 'colorpicker_field'), 10, 4);
14
  self::$_instance = new self();
15
  }
16
  return self::$_instance;
17
+ }
18
 
19
  // Custom fields
20
  // ---------------------------------------------------------------------------
92
 
93
  break;
94
 
95
+ case 'select':
96
+
97
+ $field = '';
98
+
99
+ if (!empty($args['options'])) {
100
+ $field .= '<select name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" class="select ' . esc_attr(implode(' ', $args['input_class'])) . '" ' . implode(' ', $custom_attributes) . ' data-placeholder="' . esc_attr($args['placeholder']) . '">';
101
+ if (!empty($args['placeholder'])) {
102
+ $field .= '<option value="" disabled="disabled" selected="selected">' . esc_attr($args['placeholder']) . '</option>';
103
+ }
104
+ foreach ($args['options'] as $option_key => $option_text) {
105
+ // if ('' === $option_key) {
106
+ // if (empty($args['placeholder'])) {
107
+ // $args['placeholder'] = $option_text ? $option_text : __('Choose an option', 'woocommerce-checkout-manager');
108
+ // }
109
+ // $custom_attributes[] = 'data-allow_clear="true"';
110
+ // }
111
+ $field .= '<option value="' . esc_attr($option_key) . '" ' . selected($value, $option_key, false) . '>' . esc_attr($option_text) . '</option>';
112
+ }
113
+ $field .= '</select>';
114
+ }
115
+
116
+ break;
117
+
118
  case 'multiselect' :
119
 
120
  $field = '';
314
  add_filter('woocommerce_form_field_radio', array($this, 'custom_field'), 10, 4);
315
  add_filter('woocommerce_form_field_multicheckbox', array($this, 'custom_field'), 10, 4);
316
  add_filter('woocommerce_form_field_multiselect', array($this, 'custom_field'), 10, 4);
317
+ add_filter('woocommerce_form_field_select', array($this, 'custom_field'), 10, 4);
318
  add_filter('woocommerce_form_field_file', array($this, 'custom_field'), 10, 4);
319
  add_filter('woocommerce_form_field_heading', array($this, 'heading_field'), 10, 4);
320
  add_filter('woocommerce_form_field_colorpicker', array($this, 'colorpicker_field'), 10, 4);
includes/view/frontend/class-wooccm-fields-handler.php CHANGED
@@ -44,29 +44,15 @@ class WOOCCM_Fields_Handler {
44
  }
45
  }
46
  }
 
47
  break;
48
  }
49
  }
50
  }
 
51
  return $data;
52
  }
53
 
54
- public function init_session() {
55
-
56
- if (isset(WC()->session) && !WC()->session->wooccm) {
57
-
58
- WC()->session->wooccm = array(
59
- 'fields' => array(),
60
- 'fees' => array(),
61
- 'files' => array(),
62
- );
63
- }
64
- }
65
-
66
- public function clear_session() {
67
- unset(WC()->session->wooccm);
68
- }
69
-
70
  public function add_field_filter($field) {
71
 
72
  $session_data = WC()->session->wooccm;
@@ -267,9 +253,6 @@ class WOOCCM_Fields_Handler {
267
 
268
  // Clear session
269
  add_action('woocommerce_checkout_posted_data', array($this, 'posted_data'));
270
-
271
- add_action('woocommerce_init', array($this, 'init_session'));
272
- add_action('woocommerce_checkout_order_processed', array($this, 'clear_session'), 150);
273
  }
274
 
275
  }
44
  }
45
  }
46
  }
47
+
48
  break;
49
  }
50
  }
51
  }
52
+
53
  return $data;
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  public function add_field_filter($field) {
57
 
58
  $session_data = WC()->session->wooccm;
253
 
254
  // Clear session
255
  add_action('woocommerce_checkout_posted_data', array($this, 'posted_data'));
 
 
 
256
  }
257
 
258
  }
includes/view/frontend/class-wooccm-fields-register.php CHANGED
@@ -50,7 +50,6 @@ class WOOCCM_Fields_Register {
50
 
51
  // Shipping fields
52
  // -----------------------------------------------------------------------
53
-
54
  add_filter('woocommerce_shipping_fields', array($this, 'add_shipping_fields'));
55
  }
56
 
50
 
51
  // Shipping fields
52
  // -----------------------------------------------------------------------
 
53
  add_filter('woocommerce_shipping_fields', array($this, 'add_shipping_fields'));
54
  }
55
 
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.3
7
- Stable tag: 4.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,7 +29,7 @@ WooCommerce Checkout Manager allows you to customize and manage the fields on yo
29
  * Remove & Make required fields.
30
  * Added fields will appear on Order Summary, Receipt and Back-end in Orders.
31
  * Enable/ Disable "Additional Fields" section name on the Order Summary and Receipt.
32
- * **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.
33
  * Compatible with [WPML](http://wpml.org/), [WooCommerce Print Invoice & Delivery Note](http://wordpress.org/plugins/woocommerce-delivery-notes/), [ Store Exporter Deluxe](http://www.visser.com.au/plugins/store-exporter-deluxe//), [ WooCommerce Order/Customer CSV Export](http://www.woothemes.com/products/ordercustomer-csv-export/).
34
  * Show or Hide fields for different User Roles.
35
  * Upload files on Checkout Page.
@@ -52,8 +52,6 @@ WooCommerce Checkout Manager allows you to customize and manage the fields on yo
52
  * Area to insert your own **Custom CSS**.
53
  * Display **Order Time**.
54
  * Set Default State for checkout.
55
- * **Import/ Export** added fields data.
56
- * Fields label can accept html characters.
57
  * Re-position the added fields: Before Shipping Form, After Shipping Form, Before Billing Form, After Billing Form or After Order Notes
58
  * **Insert Notice:** Before Customer Address Fields and Before Order Summary on checkout page.
59
 
@@ -137,6 +135,12 @@ Example:
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
 
140
  = 4.6.0 =
141
  * Improvement: woocommerce checkout manager admin panel rebuilt
142
  * Improvement: woocommerce checkout manager field conditional rebuilt
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.3
7
+ Stable tag: 4.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
  * Remove & Make required fields.
30
  * Added fields will appear on Order Summary, Receipt and Back-end in Orders.
31
  * Enable/ Disable "Additional Fields" section name on the Order Summary and Receipt.
32
+ * Fields types: Text, Textarea, Password, Radio, Checkbox, Select, Country, State, Color Picker, Multiselect, Multicheckbox, File Upload, Heading.
33
  * Compatible with [WPML](http://wpml.org/), [WooCommerce Print Invoice & Delivery Note](http://wordpress.org/plugins/woocommerce-delivery-notes/), [ Store Exporter Deluxe](http://www.visser.com.au/plugins/store-exporter-deluxe//), [ WooCommerce Order/Customer CSV Export](http://www.woothemes.com/products/ordercustomer-csv-export/).
34
  * Show or Hide fields for different User Roles.
35
  * Upload files on Checkout Page.
52
  * Area to insert your own **Custom CSS**.
53
  * Display **Order Time**.
54
  * Set Default State for checkout.
 
 
55
  * Re-position the added fields: Before Shipping Form, After Shipping Form, Before Billing Form, After Billing Form or After Order Notes
56
  * **Insert Notice:** Before Customer Address Fields and Before Order Summary on checkout page.
57
 
135
 
136
  == Changelog ==
137
 
138
+ = 4.6.1 =
139
+ * Fix: select field placeholder
140
+ * Fix: missing additional fields saved data
141
+ * Fix: missing additional fields saved data array
142
+ * Fix: saved additional fields option value
143
+
144
  = 4.6.0 =
145
  * Improvement: woocommerce checkout manager admin panel rebuilt
146
  * Improvement: woocommerce checkout manager field conditional rebuilt
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.0
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.0');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
@@ -63,4 +63,4 @@ function WOOCCM() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionNam
63
  }
64
 
65
  // Global for backwards compatibility.
66
- $GLOBALS['wooccm'] = WOOCCM();
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
+ * Version: 4.6.1
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.1');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
63
  }
64
 
65
  // Global for backwards compatibility.
66
+ $GLOBALS['wooccm'] = WOOCCM();