WooCommerce Checkout Manager - Version 6.0.7.2

Version Description

Download this release

Release Info

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

Code changes from version 6.0.7 to 6.0.7.2

assets/frontend/css/checkout.css CHANGED
@@ -1 +1 @@
1
- .woocommerce form .wooccm-clearfix:before,.woocommerce form .wooccm-clearfix:after{content:"";display:table}.woocommerce form .wooccm-clearfix:after{clear:both}.woocommerce form .wooccm-conditional-child{display:none}.woocommerce form .wooccm-type-hidden{display:none}.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label{display:inline-block}.woocommerce form .wooccm-colorpicker-iris .iris-picker{display:none}.woocommerce form .wooccm-colorpicker-iris.active .iris-picker{display:block}.button.fileinput-button{position:relative;overflow:hidden !important}.button.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}.wooccm-file-list{margin:0 -5px;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:start}.wooccm-file-list .wooccm-file-file{display:flex;justify-content:center;align-items:stretch;box-sizing:border-box;padding:10px 5px 0 5px;width:25%;position:relative}.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete{z-index:1;position:absolute;top:2px;right:-3px;width:16px;height:16px;background-color:#222;display:block;line-height:16px;text-align:center;color:#fefefe;font-weight:900;border-radius:50%;font-size:12px;cursor:pointer;font-family:code;text-decoration:none !important}.wooccm-file-list .wooccm-file-file .wooccm-file-list-container{width:100%;overflow:hidden}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;padding-top:100%;position:relative;background:#eee}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img{overflow:hidden;object-fit:cover;position:absolute;top:30%;bottom:auto;height:40%;opacity:0.8}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img.image{top:0;bottom:0;left:0;right:0;max-height:100%;max-height:100%;height:100%;width:100%}.wooccm-file-list .ui-timepicker-table a{word-break:normal}.wooccm-file-list .ui-state-disabled,.wooccm-file-list .ui-widget-content .ui-state-disabled,.wooccm-file-list .ui-widget-header .ui-state-disabled{width:100%}
1
+ .woocommerce form .wooccm-clearfix:before,.woocommerce form .wooccm-clearfix:after{content:"";display:table}.woocommerce form .wooccm-clearfix:after{clear:both}.woocommerce form .wooccm-conditional-child{display:none !important}.woocommerce form .wooccm-type-hidden{display:none}.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label{display:inline-block}.woocommerce form .wooccm-colorpicker-iris .iris-picker{display:none}.woocommerce form .wooccm-colorpicker-iris.active .iris-picker{display:block}.button.fileinput-button{position:relative;overflow:hidden !important}.button.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}.wooccm-file-list{margin:0 -5px;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:start}.wooccm-file-list .wooccm-file-file{display:flex;justify-content:center;align-items:stretch;box-sizing:border-box;padding:10px 5px 0 5px;width:25%;position:relative}.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete{z-index:1;position:absolute;top:2px;right:-3px;width:16px;height:16px;background-color:#222;display:block;line-height:16px;text-align:center;color:#fefefe;font-weight:900;border-radius:50%;font-size:12px;cursor:pointer;font-family:code;text-decoration:none !important}.wooccm-file-list .wooccm-file-file .wooccm-file-list-container{width:100%;overflow:hidden}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;padding-top:100%;position:relative;background:#eee}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img{overflow:hidden;object-fit:cover;position:absolute;top:30%;bottom:auto;height:40%;opacity:0.8}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img.image{top:0;bottom:0;left:0;right:0;max-height:100%;max-height:100%;height:100%;width:100%}.wooccm-file-list .ui-timepicker-table a{word-break:normal}.wooccm-file-list .ui-state-disabled,.wooccm-file-list .ui-widget-content .ui-state-disabled,.wooccm-file-list .ui-widget-header .ui-state-disabled{width:100%}
assets/frontend/js/checkout.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => 'acb3437adce2bd11ff9c4881456b2708');
1
+ <?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => 'd965767de0d000d90ae9a4a9ab4908af');
assets/frontend/js/checkout.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function o(c){if(t[c])return t[c].exports;var i=t[c]={i:c,l:!1,exports:{}};return e[c].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,c){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(o.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(c,i,function(t){return e[t]}.bind(null,i));return c},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(3),o(1),o(2);!function(e){var t=function(e){return e.is(".processing")||e.parents(".processing").length};e(document).on("country_to_state_changing",(function(t,o,c){var i=c,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,(function(e,t){var o=i.find(t),c=o.find("[data-required]").data("required")||o.find(".wooccm-required-field").length;!function(e,t){t?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.show(),e.find("input[type=hidden]").prop("type","text")):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}(o,c)}))}));var o={};if(e(".wooccm-type-file").each((function(t,c){var i=e(c),n=i.find("[type=file]"),a=i.find(".wooccm-file-button"),r=i.find(".wooccm-file-list");o[i.attr("id")]=[],a.on("click",(function(e){e.preventDefault(),n.trigger("click")})),r.on("click",".wooccm-file-list-delete",(function(t){var c=e(this).closest(".wooccm-file-file"),n=e(this).closest("[data-file_id]").data("file_id");o[i.attr("id")]=e.grep(o[i.attr("id")],(function(e,t){return t!=n})),c.remove(),e("#order_review").trigger("wooccm_upload")})),n.on("change",(function(t){var c=e(this)[0].files;c.length&&window.FileReader&&e.each(c,(function(t,c){if(r.find("span[data-file_id]").length+t>=wooccm_upload.limit.max_files)return alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1;if(c.size>wooccm_upload.limit.max_file_size)return alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0;var n,a=new FileReader;a.onload=(n=c,function(t){setTimeout((function(){!function(t,o,c,i,n){var a,r=e(t);n.match("image.*")?a="image":n.match("application/ms.*")?(c=wooccm_upload.icons.spreadsheet,a="spreadsheet"):n.match("application/x.*")?(c=wooccm_upload.icons.archive,a="application"):n.match("audio.*")?(c=wooccm_upload.icons.audio,a="audio"):n.match("text.*")?(c=wooccm_upload.icons.text,a="text"):n.match("video.*")?(c=wooccm_upload.icons.video,a="video"):(c=wooccm_upload.icons.interactive,a="interactive");var l='<span data-file_id="'+o+'" title="'+i+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+i+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+a+'" alt="'+i+'" src="'+c+'"/>\n </span>\n </span>\n </span>';r.append(l).fadeIn()}(r,o[i.attr("id")].push(c)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")}),200)}),a.readAsDataURL(c)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,c){var i=e(t.target).find("#place_order");e(".wooccm-type-file").length?i.addClass("wooccm-upload-process"):i.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(c){c.preventDefault();var i,n=e("form.checkout"),a=e(this);e(".wooccm-type-file").length&&(window.FormData&&Object.keys(o).length&&(t(n)||(a.html(wooccm_upload.message.uploading),t(i=n)||i.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var c=e("#"+t).find(".wooccm-file-field"),i=new FormData;e.each(o,(function(e,t){return e>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):t.size>wooccm_upload.limit.max_file_size?(console.log("Exeeds max file size of "+wooccm_upload.limit.max_files),!0):(console.log("We're ready to upload "+t.name),void i.append("wooccm_checkout_attachment_upload[]",t))})),i.append("action","wooccm_checkout_attachment_upload"),i.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:i,processData:!1,contentType:!1,beforeSend:function(e){},success:function(t){t.success?c.val(t.data):e("body").trigger("update_checkout")},complete:function(e){}})})),function(e){e.removeClass("processing").unblock()}(n),a.removeClass("wooccm-upload-process").trigger("click")))})),e(document).on("change",".wooccm-add-price",(function(t){e("body").trigger("update_checkout")})),e(".wooccm-field").each((function(t,o){e(o).find("input,textarea,select").on("change keyup wooccm_change",(function(t){var o=e(t.target).attr("name").replace("[]",""),c=e(t.target).prop("type"),i=e(t.target).val();"checkbox"==c&&(i=-1!==e(t.target).attr("name").indexOf("[]")?e(t.target).closest(".wooccm-field").find("input:checked").map((function(e,t){return t.value})).toArray():e(t.target).is(":checked")),e("*[data-conditional-parent="+o+"]").closest(".wooccm-field").hide(),e("*[data-conditional-parent="+o+"]").each((function(t,o){var c=e(o),n=c&&c.data("conditional-parent-value");(i==n||e.isArray(i)&&i.indexOf(n)>-1)&&c.closest(".wooccm-field").fadeIn()}))}))})),e(".wooccm-conditional-child").each((function(t,o){var c=e(o),i=e("#"+c.find("[data-conditional-parent]").data("conditional-parent")+"_field");i.find("select:first").trigger("wooccm_change"),i.find("textarea:first").trigger("wooccm_change"),i.find("input[type=button]:first").trigger("wooccm_change"),i.find("input[type=radio]:checked:first").trigger("wooccm_change"),i.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),i.find("input[type=color]:first").trigger("wooccm_change"),i.find("input[type=date]:first").trigger("wooccm_change"),i.find("input[type=datetime-local]:first").trigger("wooccm_change"),i.find("input[type=email]:first").trigger("wooccm_change"),i.find("input[type=file]:first").trigger("wooccm_change"),i.find("input[type=hidden]:first").trigger("wooccm_change"),i.find("input[type=image]:first").trigger("wooccm_change"),i.find("input[type=month]:first").trigger("wooccm_change"),i.find("input[type=number]:first").trigger("wooccm_change"),i.find("input[type=password]:first").trigger("wooccm_change"),i.find("input[type=range]:first").trigger("wooccm_change"),i.find("input[type=reset]:first").trigger("wooccm_change"),i.find("input[type=search]:first").trigger("wooccm_change"),i.find("input[type=submit]:first").trigger("wooccm_change"),i.find("input[type=tel]:first").trigger("wooccm_change"),i.find("input[type=text]:first").trigger("wooccm_change"),i.find("input[type=time]:first").trigger("wooccm_change"),i.find("input[type=url]:first").trigger("wooccm_change"),i.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var c=e(this),i=c.data("disable")||!1;e.isFunction(e.fn.datepicker)&&c.datepicker({dateFormat:c.data("formatdate")||"dd-mm-yy",minDate:c.data("mindate"),maxDate:c.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return i?[-1===e.inArray(o,i)]:[!0]}})})),e(".wooccm-enhanced-timepicker").each((function(t,o){var c=e(this);e.isFunction(e.fn.timepicker)&&(console.log(c.data("format-ampm")),c.timepicker({showPeriodLabels:!!c.data("format-ampm"),showPeriod:!!c.data("format-ampm"),showLeadingZero:!0,hours:c.data("hours")||void 0,minutes:c.data("minutes")||void 0}))})),e(".wooccm-colorpicker-farbtastic").each((function(t,o){var c=e(o),i=c.find("input[type=text]"),n=c.find(".wooccmcolorpicker_container");i.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+i.attr("id")),n.on("click",(function(e){i.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var c=e(o),i=c.find("input[type=text]");i.css("background",i.val()),i.on("click",(function(e){c.toggleClass("active")})),i.iris({class:i.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){i.css("background",t.color.toString()).fadeIn()}})})),e(document).on("click",(function(t){0===e(t.target).closest(".iris-picker").length&&e(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;if(e().selectWoo){e("select.wooccm-enhanced-select").each((function(){var t=e.extend({width:"100%",placeholder:e(this).data("placeholder")||"",allowClear:e(this).data("allowclear")||!1,selectOnClose:e(this).data("selectonclose")||!1,closeOnSelect:e(this).data("closeonselect")||!1,minimumResultsForSearch:e(this).data("search")||-1},{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}});e(this).on("select2:select",(function(){e(this).focus()})).selectWoo(t)}))}}(jQuery)},function(e,t){!function(){e.exports=this.jQuery}()},function(e,t){!function(){e.exports=this.window.selectWoo}()},function(e,t){}]);
1
+ !function(e){var t={};function o(i){if(t[i])return t[i].exports;var c=t[i]={i:i,l:!1,exports:{}};return e[i].call(c.exports,c,c.exports,o),c.l=!0,c.exports}o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)o.d(i,c,function(t){return e[t]}.bind(null,c));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(3),o(1),o(2);!function(e){var t=function(e){return e.is(".processing")||e.parents(".processing").length};e(document).on("country_to_state_changing",(function(t,o,i){var c=i,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,(function(e,t){var o=c.find(t),i=o.find("[data-required]").data("required")||o.find(".wooccm-required-field").length;!function(e,t){t?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.show(),e.find("input[type=hidden]").prop("type","text")):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}(o,i)}))}));var o={};if(e(".wooccm-type-file").each((function(t,i){var c=e(i),n=c.find("[type=file]"),a=c.find(".wooccm-file-button"),r=c.find(".wooccm-file-list");o[c.attr("id")]=[],a.on("click",(function(e){e.preventDefault(),n.trigger("click")})),r.on("click",".wooccm-file-list-delete",(function(t){var i=e(this).closest(".wooccm-file-file"),n=e(this).closest("[data-file_id]").data("file_id");o[c.attr("id")]=e.grep(o[c.attr("id")],(function(e,t){return t!=n})),i.remove(),e("#order_review").trigger("wooccm_upload")})),n.on("change",(function(t){var i=e(this)[0].files;i.length&&window.FileReader&&e.each(i,(function(t,i){if(r.find("span[data-file_id]").length+t>=wooccm_upload.limit.max_files)return alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1;if(i.size>wooccm_upload.limit.max_file_size)return alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0;var n,a=new FileReader;a.onload=(n=i,function(t){setTimeout((function(){!function(t,o,i,c,n){var a,r=e(t);n.match("image.*")?a="image":n.match("application/ms.*")?(i=wooccm_upload.icons.spreadsheet,a="spreadsheet"):n.match("application/x.*")?(i=wooccm_upload.icons.archive,a="application"):n.match("audio.*")?(i=wooccm_upload.icons.audio,a="audio"):n.match("text.*")?(i=wooccm_upload.icons.text,a="text"):n.match("video.*")?(i=wooccm_upload.icons.video,a="video"):(i=wooccm_upload.icons.interactive,a="interactive");var l='<span data-file_id="'+o+'" title="'+c+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+c+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+a+'" alt="'+c+'" src="'+i+'"/>\n </span>\n </span>\n </span>';r.append(l).fadeIn()}(r,o[c.attr("id")].push(i)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")}),200)}),a.readAsDataURL(i)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,i){var c=e(t.target).find("#place_order");e(".wooccm-type-file").length?c.addClass("wooccm-upload-process"):c.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(i){i.preventDefault();var c,n=e("form.checkout"),a=e(this);e(".wooccm-type-file").length&&(window.FormData&&Object.keys(o).length&&(t(n)||(a.html(wooccm_upload.message.uploading),t(c=n)||c.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var i=e("#"+t).find(".wooccm-file-field"),c=new FormData;e.each(o,(function(e,t){return e>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):t.size>wooccm_upload.limit.max_file_size?(console.log("Exeeds max file size of "+wooccm_upload.limit.max_files),!0):(console.log("We're ready to upload "+t.name),void c.append("wooccm_checkout_attachment_upload[]",t))})),c.append("action","wooccm_checkout_attachment_upload"),c.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:c,processData:!1,contentType:!1,beforeSend:function(e){},success:function(t){t.success?i.val(t.data):e("body").trigger("update_checkout")},complete:function(e){}})})),function(e){e.removeClass("processing").unblock()}(n),a.removeClass("wooccm-upload-process").trigger("click")))})),e(document).on("change",".wooccm-add-price",(function(t){e("body").trigger("update_checkout")})),e(".wooccm-field").each((function(t,o){e(o).find("input,textarea,select").on("change keyup wooccm_change",(function(t){var o=e(t.target).attr("name").replace("[]",""),i=e(t.target).prop("type"),c=e(t.target).val();"checkbox"==i&&(c=-1!==e(t.target).attr("name").indexOf("[]")?e(t.target).closest(".wooccm-field").find("input:checked").map((function(e,t){return t.value})).toArray():e(t.target).is(":checked")),e("*[data-conditional-parent="+o+"]").closest(".wooccm-field").hide(),e("*[data-conditional-parent="+o+"]").each((function(t,o){var i=e(o),n=i&&i.data("conditional-parent-value");(c==n||e.isArray(c)&&c.indexOf(n)>-1)&&i.closest(".wooccm-field").attr("style","display: block !important")}))}))})),e(".wooccm-conditional-child").each((function(t,o){var i=e(o),c=e("#"+i.find("[data-conditional-parent]").data("conditional-parent")+"_field");c.find("select:first").trigger("wooccm_change"),c.find("textarea:first").trigger("wooccm_change"),c.find("input[type=button]:first").trigger("wooccm_change"),c.find("input[type=radio]:checked:first").trigger("wooccm_change"),c.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),c.find("input[type=color]:first").trigger("wooccm_change"),c.find("input[type=date]:first").trigger("wooccm_change"),c.find("input[type=datetime-local]:first").trigger("wooccm_change"),c.find("input[type=email]:first").trigger("wooccm_change"),c.find("input[type=file]:first").trigger("wooccm_change"),c.find("input[type=hidden]:first").trigger("wooccm_change"),c.find("input[type=image]:first").trigger("wooccm_change"),c.find("input[type=month]:first").trigger("wooccm_change"),c.find("input[type=number]:first").trigger("wooccm_change"),c.find("input[type=password]:first").trigger("wooccm_change"),c.find("input[type=range]:first").trigger("wooccm_change"),c.find("input[type=reset]:first").trigger("wooccm_change"),c.find("input[type=search]:first").trigger("wooccm_change"),c.find("input[type=submit]:first").trigger("wooccm_change"),c.find("input[type=tel]:first").trigger("wooccm_change"),c.find("input[type=text]:first").trigger("wooccm_change"),c.find("input[type=time]:first").trigger("wooccm_change"),c.find("input[type=url]:first").trigger("wooccm_change"),c.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var i=e(this),c=i.data("disable")||!1;e.isFunction(e.fn.datepicker)&&i.datepicker({dateFormat:i.data("formatdate")||"mm/dd/yy",minDate:i.data("mindate"),maxDate:i.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return c?[-1===e.inArray(o,c)]:[!0]}})})),e(".wooccm-enhanced-timepicker").each((function(t,o){var i=e(this);e.isFunction(e.fn.timepicker)&&(console.log(i.data("format-ampm")),i.timepicker({showPeriodLabels:!!i.data("format-ampm"),showPeriod:!!i.data("format-ampm"),showLeadingZero:!0,hours:i.data("hours")||void 0,minutes:i.data("minutes")||void 0}))})),e(".wooccm-colorpicker-farbtastic").each((function(t,o){var i=e(o),c=i.find("input[type=text]"),n=i.find(".wooccmcolorpicker_container");c.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+c.attr("id")),n.on("click",(function(e){c.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var i=e(o),c=i.find("input[type=text]");c.css("background",c.val()),c.on("click",(function(e){i.toggleClass("active")})),c.iris({class:c.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){c.css("background",t.color.toString()).fadeIn()}})})),e(document).on("click",(function(t){0===e(t.target).closest(".iris-picker").length&&e(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;if(e().selectWoo){e("select.wooccm-enhanced-select").each((function(){var t=e.extend({width:"100%",placeholder:e(this).data("placeholder")||"",allowClear:e(this).data("allowclear")||!1,selectOnClose:e(this).data("selectonclose")||!1,closeOnSelect:e(this).data("closeonselect")||!1,minimumResultsForSearch:e(this).data("search")||-1},{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}});e(this).on("select2:select",(function(){e(this).focus()})).selectWoo(t)}))}}(jQuery)},function(e,t){!function(){e.exports=this.jQuery}()},function(e,t){!function(){e.exports=this.window.selectWoo}()},function(e,t){}]);
includes/controller/class-wooccm-email.php CHANGED
@@ -117,7 +117,11 @@ class WOOCCM_Order_Email_Controller {
117
  }
118
 
119
  public function save_settings() {
120
- woocommerce_update_options( $this->get_settings() );
 
 
 
 
121
  }
122
  }
123
 
117
  }
118
 
119
  public function save_settings() {
120
+ global $current_section;
121
+
122
+ if ( 'email' == $current_section ) {
123
+ woocommerce_update_options( $this->get_settings() );
124
+ }
125
  }
126
  }
127
 
includes/controller/class-wooccm-order.php CHANGED
@@ -2,11 +2,10 @@
2
 
3
  class WOOCCM_Order_Controller extends WOOCCM_Upload {
4
 
5
-
6
  protected static $_instance;
7
 
8
  public function __construct() {
9
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
10
  add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
11
  add_action( 'wp_ajax_wooccm_order_attachment_upload', array( $this, 'ajax_order_attachment_upload' ) );
12
  add_action( 'wp_ajax_nopriv_wooccm_order_attachment_upload', array( $this, 'ajax_order_attachment_upload' ) );
2
 
3
  class WOOCCM_Order_Controller extends WOOCCM_Upload {
4
 
 
5
  protected static $_instance;
6
 
7
  public function __construct() {
8
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
9
  add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
10
  add_action( 'wp_ajax_wooccm_order_attachment_upload', array( $this, 'ajax_order_attachment_upload' ) );
11
  add_action( 'wp_ajax_nopriv_wooccm_order_attachment_upload', array( $this, 'ajax_order_attachment_upload' ) );
includes/model/class-wooccm-field.php CHANGED
@@ -1,395 +1,372 @@
1
  <?php
2
 
3
- include_once('class-wooccm-model.php');
4
-
5
- class WOOCCM_Field extends WOOCCM_Model
6
- {
7
- protected $prefix = '';
8
- protected $table = '';
9
- protected $defaults = array();
10
-
11
- protected function order_fields($a, $b)
12
- {
13
-
14
- if (!isset($a['order']) || !isset($b['order']))
15
- return 0;
16
-
17
- if ($a['order'] == $b['order'])
18
- return 0;
19
-
20
- return ($a['order'] < $b['order']) ? -1 : 1;
21
- }
22
-
23
- protected function duplicated_name($name, $fields)
24
- {
25
-
26
- if (!empty($fields)) {
27
- if (is_array($fields)) {
28
- foreach ($fields as $item) {
29
- if (isset($item['name']) && $item['name'] == $name) {
30
- return true;
31
- }
32
- }
33
- }
34
- }
35
-
36
- return false;
37
- }
38
-
39
- public function get_field_id($fields, $key = 'key', $value = null)
40
- {
41
-
42
- if (count($fields)) {
43
-
44
- foreach ($fields as $id => $field) {
45
- if ($field[$key] == $value) {
46
- return $id;
47
- }
48
- }
49
- }
50
-
51
- return 0;
52
- }
53
-
54
- public function get_name($field_id)
55
- {
56
- return WOOCCM_PREFIX . $field_id;
57
- }
58
-
59
- public function get_key($prefix = '', $name = '')
60
- {
61
- return sprintf("%s_%s", $prefix, $name);
62
- }
63
-
64
- public function get_conditional_types()
65
- {
66
- $fields = self::get_types();
67
-
68
- unset($fields['heading']);
69
- unset($fields['button']);
70
-
71
- return array_keys($fields);
72
- }
73
-
74
- public function get_option_types()
75
- {
76
- return array(
77
- 'multicheckbox',
78
- 'multiselect',
79
- 'select',
80
- 'radio'
81
- );
82
- }
83
-
84
- public function get_multiple_types()
85
- {
86
- return array(
87
- 'multicheckbox',
88
- 'multiselect',
89
- );
90
- }
91
-
92
- public function get_template_types()
93
- {
94
- return array(
95
- 'heading',
96
- 'message',
97
- 'button',
98
- 'file',
99
- // 'country',
100
- // 'state'
101
- );
102
- }
103
-
104
- public function get_disabled_types()
105
- {
106
- return apply_filters('wooccm_fields_disabled_types', array(
107
- 'message',
108
- 'button',
109
- ));
110
- }
111
-
112
- public function get_types()
113
- {
114
-
115
- return apply_filters('wooccm_fields_types', array(
116
- 'heading' => 'Heading',
117
- 'email' => 'Email',
118
- 'tel' => 'Phone',
119
- 'message' => 'Message',
120
- 'button' => 'Button',
121
- 'text' => 'Text',
122
- 'textarea' => 'Textarea',
123
- 'password' => 'Password',
124
- 'select' => 'Select',
125
- 'radio' => 'Radio',
126
- 'checkbox' => 'Checkbox',
127
- 'time' => 'Timepicker',
128
- 'date' => 'Datepicker',
129
- 'number' => 'Number',
130
- 'country' => 'Country',
131
- 'state' => 'State',
132
- 'multiselect' => 'Multiselect',
133
- 'multicheckbox' => 'Multicheckbox',
134
- 'colorpicker' => 'Colorpicker',
135
- 'file' => 'File',
136
- ));
137
- }
138
-
139
- function get_args()
140
- {
141
-
142
- return array(
143
- 'id' => null,
144
- 'key' => '',
145
- 'name' => '',
146
- 'type' => 'text',
147
- 'disabled' => false,
148
- 'order' => null,
149
- 'priority' => null,
150
- 'label' => '',
151
- 'placeholder' => '',
152
- 'description' => '',
153
- 'default' => '',
154
- 'position' => '',
155
- 'clear' => false,
156
- 'options' => array(
157
- 0 => array(
158
- 'label' => esc_html__('Option', 'woocommerce-checkout-manager'),
159
- 'add_price_total' => 0,
160
- 'add_price_type' => 'fixed',
161
- 'add_price_tax' => 0,
162
- 'default' => '',
163
- 'order' => 0
164
- )
165
- ),
166
- 'required' => false,
167
- 'message_type' => 'info',
168
- 'button_type' => '',
169
- 'button_link' => '',
170
- 'class' => array(),
171
- // Input/Textarea
172
- 'maxlength' => null,
173
- // Display
174
- // -------------------------------------------------------------------
175
- 'show_cart_minimum' => 0,
176
- 'show_cart_maximun' => 0,
177
- 'show_role' => array(),
178
- 'hide_role' => array(),
179
- 'more_product' => false,
180
- 'show_product' => array(),
181
- 'hide_product' => array(),
182
- 'show_product_cat' => array(),
183
- 'hide_product_cat' => array(),
184
- 'hide_account' => false,
185
- 'hide_checkout' => false,
186
- 'hide_email' => false,
187
- 'hide_order' => false,
188
- 'hide_invoice' => false,
189
- // Pickers
190
- // -------------------------------------------------------------------
191
- 'time_format_ampm' => true,
192
- 'time_limit_start' => null,
193
- 'time_limit_end' => null,
194
- 'time_limit_interval' => null,
195
- 'date_limit' => 'fixed',
196
- 'date_format' => '',
197
- 'date_limit_variable_min' => -1,
198
- 'date_limit_variable_max' => 1,
199
- 'date_limit_fixed_min' => date('Y-m-d'),
200
- 'date_limit_fixed_max' => date('Y-m-d'),
201
- 'date_limit_days' => array(),
202
- // Price
203
- // -------------------------------------------------------------------
204
- 'add_price' => false,
205
- 'add_price_name' => '',
206
- 'add_price_total' => null,
207
- 'add_price_type' => 'fixed',
208
- 'add_price_tax' => false,
209
- 'extra_class' => '',
210
- // Conditional
211
- // -------------------------------------------------------------------
212
- 'conditional' => false,
213
- 'conditional_parent_key' => '',
214
- 'conditional_parent_value' => '',
215
- // State
216
- // -------------------------------------------------------------------
217
- 'country' => '',
218
- // Select 2
219
- // -------------------------------------------------------------------
220
- 'select2' => false,
221
- 'select2_allowclear' => false,
222
- 'select2_selectonclose' => false,
223
- 'select2_closeonselect' => false,
224
- 'select2_search' => false,
225
- // Upload
226
- // -------------------------------------------------------------------
227
- 'file_limit' => 1,
228
- 'file_types' => array(),
229
- // Color
230
- // -------------------------------------------------------------------
231
- 'pickertype' => '',
232
- // Listing
233
- // -------------------------------------------------------------------
234
- 'listable' => false,
235
- 'sortable' => false,
236
- 'filterable' => false,
237
- 'max' => '',
238
- 'min' => '',
239
- );
240
- }
241
-
242
- public function get_defaults()
243
- {
244
- return $this->get_default_fields();
245
- }
246
-
247
- public function get_default_fields()
248
- {
249
-
250
- $fields = array();
251
-
252
- if ($this->prefix !== 'additional') {
253
-
254
- $prefix = sprintf('%s_', $this->prefix);
255
-
256
- //$filters = WOOCCM_Fields_Register::instance();
257
- //fix nesting level
258
- //remove_filter('woocommerce_' . $prefix . 'fields', array($filters, 'add_' . $prefix . 'fields'));
259
- remove_all_filters('woocommerce_' . $prefix . 'fields');
260
-
261
- $i = 0;
262
- foreach (WC()->countries->get_address_fields('', $prefix) as $key => $field) {
263
-
264
- $field['id'] = $i;
265
- $field['key'] = $key;
266
- $field['name'] = str_replace($prefix, '', $key);
267
-
268
- $fields[$i] = $field;
269
- $i++;
270
- }
271
- }
272
-
273
- return $fields;
274
- }
275
-
276
- public function get_fields()
277
- {
278
-
279
- // (is_array($fields = $this->get_items())) {
280
-
281
- if (count($fields = $this->get_items())) {
282
-
283
- foreach ($fields as $field_id => $field) {
284
-
285
- $fields[$field_id] = apply_filters('wooccm_checkout_field_filter', $this->sanitize_field($field_id, $field, $fields), $field_id);
286
- }
287
-
288
- uasort($fields, array(__CLASS__, 'order_fields'));
289
-
290
- $fields = apply_filters('wooccm_' . $this->prefix . '_fields', $fields);
291
- }
292
- //}
293
-
294
- return $fields;
295
- }
296
-
297
- public function update_fields($fields)
298
- {
299
-
300
- if (is_array($fields)) {
301
-
302
- foreach ($fields as $field_id => $field) {
303
- if (!array_key_exists('name', $field)) {
304
- return false;
305
- }
306
- }
307
-
308
- //reorder array based on ids
309
- ksort($fields);
310
-
311
- if ($this->save_items($fields)) {
312
- return $fields;
313
- }
314
- }
315
-
316
- return false;
317
- }
318
-
319
- public function delete_fields()
320
- {
321
- $this->delete();
322
- $this->save_items($this->get_defaults());
323
- }
324
 
325
- // Field
326
- // ---------------------------------------------------------------------------
 
327
 
328
- public function add_field($field_data)
329
- {
330
- return $this->add_item($field_data);
331
- }
332
 
333
- public function get_field($field_id)
334
- {
335
- return $this->get_item($field_id);
336
- }
337
 
338
- public function update_field($field_data)
339
- {
340
- return $this->update_item($field_data);
341
- }
342
 
343
- public function delete_field($field_id)
344
- {
345
- return $this->delete_item($field_id);
346
- }
347
 
348
- // Sanitize
349
- public function sanitize_field($field_id, $field, $fields)
350
- {
351
 
352
- $field['id'] = $field_id;
 
 
 
353
 
354
- if (empty($field['name'])) {
355
 
356
- $field['name'] = $this->get_name($field_id);
 
 
 
 
 
 
 
357
 
358
- if ($this->duplicated_name($field['name'], $fields)) {
359
- $field['name'] .= 'b';
360
- }
361
- }
362
 
363
- $field['key'] = $this->get_key($this->prefix, $field['name']);
364
 
365
- if (empty($field['position']) && is_array($field['class'])) {
366
- $position = array_intersect((array) $field['class'], array('form-row-wide', 'form-row-first', 'form-row-last'));
367
- if (isset($position[0])) {
368
- $field['position'] = $position[0];
369
- } else {
370
- $field['position'] = 'form-row-wide';
371
- }
372
- }
373
 
374
- if (empty($field['order'])) {
375
- $field['order'] = $field_id + 1;
376
- }
 
377
 
378
- if (!empty($field['conditional_parent_key'])) {
 
 
379
 
380
- if (strpos($field['conditional_parent_key'], $this->prefix) === false) {
381
- $field['conditional_parent_key'] = sprintf('%s_%s', $this->prefix, $field['conditional_parent_key']);
382
- }
383
-
384
- if ($field['conditional_parent_key'] == $field['key']) {
385
- $field['conditional_parent_key'] = '';
386
- }
387
- }
388
-
389
- if (is_array($field['options']) && count($field['options']) > 1) {
390
- uasort($field['options'], array(__CLASS__, 'order_fields'));
391
- }
392
-
393
- return wp_unslash($field);
394
- }
395
  }
1
  <?php
2
 
3
+ require_once 'class-wooccm-model.php';
4
+
5
+ class WOOCCM_Field extends WOOCCM_Model {
6
+
7
+ protected $prefix = '';
8
+ protected $table = '';
9
+ protected $defaults = array();
10
+
11
+ protected function order_fields( $a, $b ) {
12
+ if ( ! isset( $a['order'] ) || ! isset( $b['order'] ) ) {
13
+ return 0;
14
+ }
15
+
16
+ if ( $a['order'] == $b['order'] ) {
17
+ return 0;
18
+ }
19
+
20
+ return ( $a['order'] < $b['order'] ) ? -1 : 1;
21
+ }
22
+
23
+ protected function duplicated_name( $name, $fields ) {
24
+ if ( ! empty( $fields ) ) {
25
+ if ( is_array( $fields ) ) {
26
+ foreach ( $fields as $item ) {
27
+ if ( isset( $item['name'] ) && $item['name'] == $name ) {
28
+ return true;
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ return false;
35
+ }
36
+
37
+ public function get_field_id( $fields, $key = 'key', $value = null ) {
38
+ if ( count( $fields ) ) {
39
+
40
+ foreach ( $fields as $id => $field ) {
41
+ if ( $field[ $key ] == $value ) {
42
+ return $id;
43
+ }
44
+ }
45
+ }
46
+
47
+ return 0;
48
+ }
49
+
50
+ public function get_name( $field_id ) {
51
+ return WOOCCM_PREFIX . $field_id;
52
+ }
53
+
54
+ public function get_key( $prefix = '', $name = '' ) {
55
+ return sprintf( '%s_%s', $prefix, $name );
56
+ }
57
+
58
+ public function get_conditional_types() {
59
+ $fields = self::get_types();
60
+
61
+ unset( $fields['heading'] );
62
+ unset( $fields['button'] );
63
+
64
+ return array_keys( $fields );
65
+ }
66
+
67
+ public function get_option_types() {
68
+ return array(
69
+ 'multicheckbox',
70
+ 'multiselect',
71
+ 'select',
72
+ 'radio',
73
+ );
74
+ }
75
+
76
+ public function get_multiple_types() {
77
+ return array(
78
+ 'multicheckbox',
79
+ 'multiselect',
80
+ );
81
+ }
82
+
83
+ public function get_template_types() {
84
+ return array(
85
+ 'heading',
86
+ 'message',
87
+ 'button',
88
+ 'file',
89
+ // 'country',
90
+ // 'state'
91
+ );
92
+ }
93
+
94
+ public function get_disabled_types() {
95
+ return apply_filters(
96
+ 'wooccm_fields_disabled_types',
97
+ array(
98
+ 'message',
99
+ 'button',
100
+ )
101
+ );
102
+ }
103
+
104
+ public function get_types() {
105
+ return apply_filters(
106
+ 'wooccm_fields_types',
107
+ array(
108
+ 'heading' => 'Heading',
109
+ 'email' => 'Email',
110
+ 'tel' => 'Phone',
111
+ 'message' => 'Message',
112
+ 'button' => 'Button',
113
+ 'text' => 'Text',
114
+ 'textarea' => 'Textarea',
115
+ 'password' => 'Password',
116
+ 'select' => 'Select',
117
+ 'radio' => 'Radio',
118
+ 'checkbox' => 'Checkbox',
119
+ 'time' => 'Timepicker',
120
+ 'date' => 'Datepicker',
121
+ 'number' => 'Number',
122
+ 'country' => 'Country',
123
+ 'state' => 'State',
124
+ 'multiselect' => 'Multiselect',
125
+ 'multicheckbox' => 'Multicheckbox',
126
+ 'colorpicker' => 'Colorpicker',
127
+ 'file' => 'File',
128
+ )
129
+ );
130
+ }
131
+
132
+ function get_args() {
133
+ return array(
134
+ 'id' => null,
135
+ 'key' => '',
136
+ 'name' => '',
137
+ 'type' => 'text',
138
+ 'disabled' => false,
139
+ 'order' => null,
140
+ 'priority' => null,
141
+ 'label' => '',
142
+ 'placeholder' => '',
143
+ 'description' => '',
144
+ 'default' => '',
145
+ 'position' => '',
146
+ 'clear' => false,
147
+ 'options' => array(
148
+ 0 => array(
149
+ 'label' => esc_html__( 'Option', 'woocommerce-checkout-manager' ),
150
+ 'add_price_total' => 0,
151
+ 'add_price_type' => 'fixed',
152
+ 'add_price_tax' => 0,
153
+ 'default' => '',
154
+ 'order' => 0,
155
+ ),
156
+ ),
157
+ 'required' => false,
158
+ 'message_type' => 'info',
159
+ 'button_type' => '',
160
+ 'button_link' => '',
161
+ 'class' => array(),
162
+ // Input/Textarea
163
+ 'maxlength' => null,
164
+ // Display
165
+ // -------------------------------------------------------------------
166
+ 'show_cart_minimum' => 0,
167
+ 'show_cart_maximun' => 0,
168
+ 'show_role' => array(),
169
+ 'hide_role' => array(),
170
+ 'more_product' => false,
171
+ 'show_product' => array(),
172
+ 'hide_product' => array(),
173
+ 'show_product_cat' => array(),
174
+ 'hide_product_cat' => array(),
175
+ 'hide_account' => false,
176
+ 'hide_checkout' => false,
177
+ 'hide_email' => false,
178
+ 'hide_order' => false,
179
+ 'hide_invoice' => false,
180
+ // Pickers
181
+ // -------------------------------------------------------------------
182
+ 'time_format_ampm' => true,
183
+ 'time_limit_start' => null,
184
+ 'time_limit_end' => null,
185
+ 'time_limit_interval' => null,
186
+ 'date_limit' => 'fixed',
187
+ 'date_format' => 'mm/dd/yy',
188
+ 'date_limit_variable_min' => -1,
189
+ 'date_limit_variable_max' => 1,
190
+ 'date_limit_fixed_min' => date( 'Y-m-d' ),
191
+ 'date_limit_fixed_max' => date( 'Y-m-d' ),
192
+ 'date_limit_days' => array(),
193
+ // Price
194
+ // -------------------------------------------------------------------
195
+ 'add_price' => false,
196
+ 'add_price_name' => '',
197
+ 'add_price_total' => null,
198
+ 'add_price_type' => 'fixed',
199
+ 'add_price_tax' => false,
200
+ 'extra_class' => '',
201
+ // Conditional
202
+ // -------------------------------------------------------------------
203
+ 'conditional' => false,
204
+ 'conditional_parent_key' => '',
205
+ 'conditional_parent_value' => '',
206
+ // State
207
+ // -------------------------------------------------------------------
208
+ 'country' => '',
209
+ // Select 2
210
+ // -------------------------------------------------------------------
211
+ 'select2' => false,
212
+ 'select2_allowclear' => false,
213
+ 'select2_selectonclose' => false,
214
+ 'select2_closeonselect' => false,
215
+ 'select2_search' => false,
216
+ // Upload
217
+ // -------------------------------------------------------------------
218
+ 'file_limit' => 1,
219
+ 'file_types' => array(),
220
+ // Color
221
+ // -------------------------------------------------------------------
222
+ 'pickertype' => '',
223
+ // Listing
224
+ // -------------------------------------------------------------------
225
+ 'listable' => false,
226
+ 'sortable' => false,
227
+ 'filterable' => false,
228
+ 'max' => '',
229
+ 'min' => '',
230
+ );
231
+ }
232
+
233
+ public function get_defaults() {
234
+ return $this->get_default_fields();
235
+ }
236
+
237
+ public function get_default_fields() {
238
+ $fields = array();
239
+
240
+ if ( $this->prefix !== 'additional' ) {
241
+
242
+ $prefix = sprintf( '%s_', $this->prefix );
243
+
244
+ // $filters = WOOCCM_Fields_Register::instance();
245
+ // fix nesting level
246
+ // remove_filter('woocommerce_' . $prefix . 'fields', array($filters, 'add_' . $prefix . 'fields'));
247
+ remove_all_filters( 'woocommerce_' . $prefix . 'fields' );
248
+
249
+ $i = 0;
250
+ foreach ( WC()->countries->get_address_fields( '', $prefix ) as $key => $field ) {
251
+
252
+ $field['id'] = $i;
253
+ $field['key'] = $key;
254
+ $field['name'] = str_replace( $prefix, '', $key );
255
+
256
+ $fields[ $i ] = $field;
257
+ $i++;
258
+ }
259
+ }
260
+
261
+ return $fields;
262
+ }
263
+
264
+ public function get_fields() {
265
+ // (is_array($fields = $this->get_items())) {
266
+
267
+ if ( count( $fields = $this->get_items() ) ) {
268
+
269
+ foreach ( $fields as $field_id => $field ) {
270
+
271
+ $fields[ $field_id ] = apply_filters( 'wooccm_checkout_field_filter', $this->sanitize_field( $field_id, $field, $fields ), $field_id );
272
+ }
273
+
274
+ uasort( $fields, array( __CLASS__, 'order_fields' ) );
275
+
276
+ $fields = apply_filters( 'wooccm_' . $this->prefix . '_fields', $fields );
277
+ }
278
+ // }
279
+
280
+ return $fields;
281
+ }
282
+
283
+ public function update_fields( $fields ) {
284
+ if ( is_array( $fields ) ) {
285
+
286
+ foreach ( $fields as $field_id => $field ) {
287
+ if ( ! array_key_exists( 'name', $field ) ) {
288
+ return false;
289
+ }
290
+ }
291
+
292
+ // reorder array based on ids
293
+ ksort( $fields );
294
+
295
+ if ( $this->save_items( $fields ) ) {
296
+ return $fields;
297
+ }
298
+ }
299
+
300
+ return false;
301
+ }
302
+
303
+ public function delete_fields() {
304
+ $this->delete();
305
+ $this->save_items( $this->get_defaults() );
306
+ }
307
+
308
+ // Field
309
+ // ---------------------------------------------------------------------------
310
+
311
+ public function add_field( $field_data ) {
312
+ return $this->add_item( $field_data );
313
+ }
 
 
 
 
 
 
 
 
 
 
314
 
315
+ public function get_field( $field_id ) {
316
+ return $this->get_item( $field_id );
317
+ }
318
 
319
+ public function update_field( $field_data ) {
320
+ return $this->update_item( $field_data );
321
+ }
 
322
 
323
+ public function delete_field( $field_id ) {
324
+ return $this->delete_item( $field_id );
325
+ }
 
326
 
327
+ // Sanitize
328
+ public function sanitize_field( $field_id, $field, $fields ) {
329
+ $field['id'] = $field_id;
 
330
 
331
+ if ( empty( $field['name'] ) ) {
 
 
 
332
 
333
+ $field['name'] = $this->get_name( $field_id );
 
 
334
 
335
+ if ( $this->duplicated_name( $field['name'], $fields ) ) {
336
+ $field['name'] .= 'b';
337
+ }
338
+ }
339
 
340
+ $field['key'] = $this->get_key( $this->prefix, $field['name'] );
341
 
342
+ if ( empty( $field['position'] ) && is_array( $field['class'] ) ) {
343
+ $position = array_intersect( (array) $field['class'], array( 'form-row-wide', 'form-row-first', 'form-row-last' ) );
344
+ if ( isset( $position[0] ) ) {
345
+ $field['position'] = $position[0];
346
+ } else {
347
+ $field['position'] = 'form-row-wide';
348
+ }
349
+ }
350
 
351
+ if ( empty( $field['order'] ) ) {
352
+ $field['order'] = $field_id + 1;
353
+ }
 
354
 
355
+ if ( ! empty( $field['conditional_parent_key'] ) ) {
356
 
357
+ if ( strpos( $field['conditional_parent_key'], $this->prefix ) === false ) {
358
+ $field['conditional_parent_key'] = sprintf( '%s_%s', $this->prefix, $field['conditional_parent_key'] );
359
+ }
 
 
 
 
 
360
 
361
+ if ( $field['conditional_parent_key'] == $field['key'] ) {
362
+ $field['conditional_parent_key'] = '';
363
+ }
364
+ }
365
 
366
+ if ( is_array( $field['options'] ) && count( $field['options'] ) > 1 ) {
367
+ uasort( $field['options'], array( __CLASS__, 'order_fields' ) );
368
+ }
369
 
370
+ return wp_unslash( $field );
371
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  }
includes/view/backend/pages/modals/parts/panel-datepicker.php CHANGED
@@ -11,7 +11,7 @@
11
  <div class="options_group wooccm-premium">
12
  <p class="form-field">
13
  <label><?php esc_html_e( 'Date format', 'woocommerce-checkout-manager' ); ?></label>
14
- <input <# if ( !data.select2 ) { #>disabled="disabled"<# } #> class="short" type="text" placeholder="dd-mm-yy" name="date_format" value="{{data.date_format}}">
15
  <span class="description"><a target="_blank" href="https://quadlayers.com/documentation/woocommerce-checkout-manager/fields/datepicker/?utm_source=wooccm_admin">Documentation on date and time formatting</a>.</span>
16
  <span class="description premium">(<?php esc_html_e( 'This is a premium feature', 'woocommerce-checkout-manager' ); ?>)</span>
17
  </p>
11
  <div class="options_group wooccm-premium">
12
  <p class="form-field">
13
  <label><?php esc_html_e( 'Date format', 'woocommerce-checkout-manager' ); ?></label>
14
+ <input <# if ( !data.select2 ) { #>disabled="disabled"<# } #> class="short" type="text" placeholder="mm/dd/yy" name="date_format" value="{{data.date_format}}">
15
  <span class="description"><a target="_blank" href="https://quadlayers.com/documentation/woocommerce-checkout-manager/fields/datepicker/?utm_source=wooccm_admin">Documentation on date and time formatting</a>.</span>
16
  <span class="description premium">(<?php esc_html_e( 'This is a premium feature', 'woocommerce-checkout-manager' ); ?>)</span>
17
  </p>
includes/view/frontend/class-wooccm-fields-register.php CHANGED
@@ -80,8 +80,13 @@ class WOOCCM_Fields_Register {
80
  $frontend_fields = array();
81
 
82
  foreach ( $fields as $field_id => $field ) {
83
- if ( ! empty( $field['key'] ) && empty( $field['disabled'] ) ) {
84
  $frontend_fields[ $field['key'] ] = $field;
 
 
 
 
 
85
  }
86
  }
87
 
80
  $frontend_fields = array();
81
 
82
  foreach ( $fields as $field_id => $field ) {
83
+ if ( ! empty( $field['key'] ) ) {
84
  $frontend_fields[ $field['key'] ] = $field;
85
+
86
+ // Preveser empty keys to revemo the core fields in the array_merge of the add_billing_fields|add_shipping_fields|add_additional_fields
87
+ if ( ! empty( $field['disabled'] ) ) {
88
+ $frontend_fields[ $field['key'] ] = null;
89
+ }
90
  }
91
  }
92
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: checkout field editor, woocommerce checkout field editor, checkout manager
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
- Stable tag: 6.0.7
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.6.1
11
  License: GPLv3
@@ -149,7 +149,13 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
149
 
150
  == Changelog ==
151
 
152
- = 6.0.7
 
 
 
 
 
 
153
  * Fix. WooCommerce billing & shipping filters order to allow third party plugins hooks checkout fields
154
 
155
  = 6.0.6
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
+ Stable tag: 6.0.7.2
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.6.1
11
  License: GPLv3
149
 
150
  == Changelog ==
151
 
152
+ = 6.0.7.2
153
+ * Fix. WooCommerce Checkout remove fields
154
+ * Fix. WooCommerce Checkout email settings save
155
+ * Fix: WooCommerce Checkout Datepicker placeholder
156
+ * Fix: WooCommerce Checkout Address field conditional hidden
157
+
158
+ = 6.0.7
159
  * Fix. WooCommerce billing & shipping filters order to allow third party plugins hooks checkout fields
160
 
161
  = 6.0.6
woocommerce-checkout-manager.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
- * Version: 6.0.7
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -20,7 +20,7 @@ if ( ! defined( 'WOOCCM_PLUGIN_NAME' ) ) {
20
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
21
  }
22
  if ( ! defined( 'WOOCCM_PLUGIN_VERSION' ) ) {
23
- define( 'WOOCCM_PLUGIN_VERSION', '6.0.7' );
24
  }
25
  if ( ! defined( 'WOOCCM_PLUGIN_FILE' ) ) {
26
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
+ * Version: 6.0.7.2
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
20
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
21
  }
22
  if ( ! defined( 'WOOCCM_PLUGIN_VERSION' ) ) {
23
+ define( 'WOOCCM_PLUGIN_VERSION', '6.0.7.2' );
24
  }
25
  if ( ! defined( 'WOOCCM_PLUGIN_FILE' ) ) {
26
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );