Version Description
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 6.3.1 |
Comparing to | |
See all releases |
Code changes from version 6.2.8 to 6.3.1
- build/backend/css/style.css +1 -1
- build/backend/js/index.asset.php +1 -1
- build/frontend/css/style.css +1 -1
- build/frontend/js/index.asset.php +1 -1
- build/frontend/js/index.js +1 -1
- includes/model/class-wooccm-field.php +3 -2
- includes/view/frontend/class-wooccm-fields-conditional.php +13 -4
- includes/view/frontend/class-wooccm-fields-handler.php +289 -307
- readme.txt +5 -1
- woocommerce-checkout-manager.php +2 -2
build/backend/css/style.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.select2-container{z-index:9999999}.select2-container .select2-selection--single,.select2-container .select2-selection--single .select2-selection__rendered,.select2-container .select2-selection--single .select2-selection__arrow{height:30px !important;line-height:30px !important}.wooccm-premium{opacity:.5;pointer-events:none}.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}table.wc_gateways>tbody>tr>td select{line-height:1 !important}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:none;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 .25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}#wooccm_modal.processing{pointer-events:none}#wooccm_modal.processing:before{content:"";position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;z-index:99999999;opacity:.8}#wooccm_modal select{min-height:30px}#wooccm_modal .form-field .wrap{padding:0}#wooccm_modal .attachment-info .details,#wooccm_modal .attachment-info .settings{width:100%}#wooccm_modal .attachment-info .woocommerce_options_panel label,#wooccm_modal .attachment-info .woocommerce_options_panel legend{width:75px;margin:0 0 0 -90px;font-weight:600}#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field{padding:0 20px 0 92px !important}#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],#wooccm_modal .attachment-info .woocommerce_options_panel select,#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container{width:100% !important}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel{width:100%}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium{display:block;clear:both}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip{margin:0 0 0 .5em}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:50% !important;line-height:16px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection{box-shadow:none;border-radius:3px;padding:0 24px 0 8px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple{line-height:16px;min-height:30px}@media only screen and (max-width: 1280px){#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:80% !important}}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li{margin:3px 3px 0 0}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#5b9dd9 !important;box-shadow:0 0 2px rgba(30,140,190,.8) !important;outline:2px solid rgba(0,0,0,0) !important}#wooccm-order-files .inside{margin:0;padding:0;background:#fefefe;display:block !important}#wooccm-order-files .handlediv,#wooccm-order-files .hndle{display:none}#wooccm-order-files .wooccm_upload_results{display:inline-block;margin:0 10px}#wooccm-order-files .wooccm_order_attachments_wrapper{margin:0;overflow-x:auto}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments{width:100%;background:#fff}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable{cursor:pointer}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item{min-width:200px}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th{text-align:left;padding:1em;font-weight:400;color:#999;background:#f8f8f8;user-select:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td{border-top:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td{border-bottom:1px solid #dfdfdf}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb{text-align:left;width:38px;padding-bottom:1.5em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail{width:38px;height:38px;border:2px solid #e8e8e8;background:#f8f8f8;color:#ccc;position:relative;font-size:21px;display:block;text-align:center}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td{padding:1.5em 1em 1em;text-align:left;line-height:1.5em;vertical-align:top;border-bottom:1px solid #f8f8f8}#wooccm-order-files .wc-order-data-row{border-bottom:1px solid #dfdfdf;padding:1.5em 2em;background:#f8f8f8;line-height:2em;text-align:left}
|
1 |
+
.select2-container{z-index:9999999}.select2-container .select2-selection--single,.select2-container .select2-selection--single .select2-selection__rendered,.select2-container .select2-selection--single .select2-selection__arrow{height:30px !important;line-height:30px !important}.wooccm-premium{opacity:.5;pointer-events:none}.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}table.wc_gateways>tbody>tr>td select{line-height:1 !important}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:none;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 .25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}#wooccm_modal.processing{pointer-events:none}#wooccm_modal.processing:before{content:"";position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;z-index:99999999;opacity:.8}#wooccm_modal select{min-height:30px}#wooccm_modal .form-field .wrap{padding:0}#wooccm_modal .attachment-info .details,#wooccm_modal .attachment-info .settings{width:100%}#wooccm_modal .attachment-info .woocommerce_options_panel label,#wooccm_modal .attachment-info .woocommerce_options_panel legend{width:75px;margin:0 0 0 -90px;font-weight:600}#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field{padding:0 20px 0 92px !important}#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],#wooccm_modal .attachment-info .woocommerce_options_panel select,#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container{width:100% !important}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel{width:100%}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium{display:block;clear:both}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip{margin:0 0 0 .5em}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:50% !important;line-height:16px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection{box-shadow:none;border-radius:3px;padding:0 24px 0 8px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple{line-height:16px;min-height:30px}@media only screen and (max-width: 1280px){#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:80% !important}}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li{margin:3px 3px 0 0}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#5b9dd9 !important;box-shadow:0 0 2px rgba(30,140,190,.8) !important;outline:2px solid rgba(0,0,0,0) !important}#wooccm-order-files .inside{margin:0;padding:0;background:#fefefe;display:block !important}#wooccm-order-files .handlediv,#wooccm-order-files .hndle{display:none}#wooccm-order-files .wooccm_upload_results{display:inline-block;margin:0 10px}#wooccm-order-files .wooccm_order_attachments_wrapper{margin:0;overflow-x:auto}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments{width:100%;background:#fff}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable{cursor:pointer}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item{min-width:200px}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th{text-align:left;padding:1em;font-weight:400;color:#999;background:#f8f8f8;user-select:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td{border-top:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td{border-bottom:1px solid #dfdfdf}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb{text-align:left;width:38px;padding-bottom:1.5em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail{width:38px;height:38px;border:2px solid #e8e8e8;background:#f8f8f8;color:#ccc;position:relative;font-size:21px;display:block;text-align:center}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td{padding:1.5em 1em 1em;text-align:left;line-height:1.5em;vertical-align:top;border-bottom:1px solid #f8f8f8}#wooccm-order-files .wc-order-data-row{border-bottom:1px solid #dfdfdf;padding:1.5em 2em;background:#f8f8f8;line-height:2em;text-align:left}
|
build/backend/js/index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('backbone', 'jquery', 'jquery-serializejson', 'jquery-ui-datepicker', 'wp-util'), 'version' => 'f67e0ed96ee9b0e5e761');
|
1 |
+
<?php return array('dependencies' => array('backbone', 'jquery', 'jquery-serializejson', 'jquery-ui-datepicker', 'wp-util'), 'version' => 'f67e0ed96ee9b0e5e761');
|
build/frontend/css/style.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 !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:.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:.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%}
|
build/frontend/js/index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => '482dd2ea7a20556d894b');
|
build/frontend/js/index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";window.jQuery,jQuery(document).ready((function(e){e(document).on("click",".wooccm_delete_attachment",(function(t){var o=e(this).closest("tr"),c=e(this).data("attachment_id");o.hide(),e("#wooccm_order_attachment_update").prop("disabled",!1),e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(c,""))})),e(document).on("click","#wooccm_order_attachment_update",(function(t){e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(t){e(".wooccm_upload_results").html(wooccm_upload.message.saving)},success:function(t){t.success?(e(".wooccm_upload_results").html(wooccm_upload.message.deleted),e("#wooccm_order_attachment_update").prop("disabled",!0)):e(".wooccm_upload_results").html(t.data)}})})),e(document).on("change","#wooccm_order_attachment_upload",(function(t){var o=!1,c=e(this).data("order_id");window.FormData&&(o=new FormData);for(var a,n=0,i=this.files.length;n<i;n++)a=this.files[n],o&&o.append("wooccm_order_attachment_upload[]",a);o&&(o.append("action","wooccm_order_attachment_upload"),o.append("nonce",wooccm_upload.nonce),o.append("order_id",c),e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:o,processData:!1,contentType:!1,beforeSend:function(t){var o;e(".wooccm_upload_results").html(wooccm_upload.message.uploading),function(e){return e.is(".processing")||e.parents(".processing").length}(o=e(".wooccm_order_attachments_wrapper"))||o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},success:function(t){t.success?(e(".wooccm_order_attachments_wrapper").fadeOut(),e(".wooccm_order_attachments_wrapper").replaceWith(e(t.data).fadeIn()),e(".wooccm_upload_results").html(wooccm_upload.message.success)):e(".wooccm_upload_results").html(t.data),e(".wooccm_order_attachments_wrapper").removeClass("processing").unblock()}}))}))})),window.window.selectWoo,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 a=c,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,(function(e,t){var o=a.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 a=e(c),n=a.find("[type=file]"),i=a.find(".wooccm-file-button"),r=a.find(".wooccm-file-list");o[a.attr("id")]=[],i.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[a.attr("id")]=e.grep(o[a.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,i=new FileReader;i.onload=(n=c,function(t){setTimeout((function(){!function(t,o,c,a,n){var i,r=e(t);n.match("image.*")?i="image":n.match("application/ms.*")?(c=wooccm_upload.icons.spreadsheet,i="spreadsheet"):n.match("application/x.*")?(c=wooccm_upload.icons.archive,i="application"):n.match("audio.*")?(c=wooccm_upload.icons.audio,i="audio"):n.match("text.*")?(c=wooccm_upload.icons.text,i="text"):n.match("video.*")?(c=wooccm_upload.icons.video,i="video"):(c=wooccm_upload.icons.interactive,i="interactive");var s='<span data-file_id="'+o+'" title="'+a+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+a+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+i+'" alt="'+a+'" src="'+c+'"/>\n </span>\n </span>\n </span>';r.append(s).fadeIn()}(r,o[a.attr("id")].push(c)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")}),200)}),i.readAsDataURL(c)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,c){e(t.target);var a=e("#place_order");e(".wooccm-type-file").length?a.addClass("wooccm-upload-process"):a.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(c){c.preventDefault();var a,n=e("form.checkout"),i=e(this);e(".wooccm-type-file").length&&window.FormData&&Object.keys(o).length&&(t(n)||(i.html(wooccm_upload.message.uploading),t(a=n)||a.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var c=e("#"+t).find(".wooccm-file-field"),a=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 a.append("wooccm_checkout_attachment_upload[]",t))})),a.append("action","wooccm_checkout_attachment_upload"),a.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:a,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),i.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"),a=e(t.target).val();"checkbox"==c&&(a=-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");(a==n||e.isArray(a)&&a.indexOf(n)>-1)&&c.closest(".wooccm-field").attr("style","display: block !important")}))}))})),e(".wooccm-conditional-child").each((function(t,o){var c=e(o),a=e("#"+c.find("[data-conditional-parent]").data("conditional-parent")+"_field");a.find("select:first").trigger("wooccm_change"),a.find("textarea:first").trigger("wooccm_change"),a.find("input[type=button]:first").trigger("wooccm_change"),a.find("input[type=radio]:checked:first").trigger("wooccm_change"),a.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),a.find("input[type=color]:first").trigger("wooccm_change"),a.find("input[type=date]:first").trigger("wooccm_change"),a.find("input[type=datetime-local]:first").trigger("wooccm_change"),a.find("input[type=email]:first").trigger("wooccm_change"),a.find("input[type=file]:first").trigger("wooccm_change"),a.find("input[type=hidden]:first").trigger("wooccm_change"),a.find("input[type=image]:first").trigger("wooccm_change"),a.find("input[type=month]:first").trigger("wooccm_change"),a.find("input[type=number]:first").trigger("wooccm_change"),a.find("input[type=password]:first").trigger("wooccm_change"),a.find("input[type=range]:first").trigger("wooccm_change"),a.find("input[type=reset]:first").trigger("wooccm_change"),a.find("input[type=search]:first").trigger("wooccm_change"),a.find("input[type=submit]:first").trigger("wooccm_change"),a.find("input[type=tel]:first").trigger("wooccm_change"),a.find("input[type=text]:first").trigger("wooccm_change"),a.find("input[type=time]:first").trigger("wooccm_change"),a.find("input[type=url]:first").trigger("wooccm_change"),a.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var c=e(this),a=c.data("disable")||!1;e.isFunction(e.fn.datepicker)&&c.datepicker({dateFormat:c.data("formatdate")||"mm/dd/yy",minDate:c.data("mindate"),maxDate:c.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return a?[-1===e.inArray(o,a)]:[!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),a=c.find("input[type=text]"),n=c.find(".wooccmcolorpicker_container");a.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+a.attr("id")),n.on("click",(function(e){a.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var c=e(o),a=c.find("input[type=text]");a.css("background",a.val()),a.on("click",(function(e){c.toggleClass("active")})),a.iris({class:a.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){a.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;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)}();
|
1 |
+
!function(){"use strict";window.jQuery,jQuery(document).ready((function(e){e(document).on("click",".wooccm_delete_attachment",(function(t){var o=e(this).closest("tr"),c=e(this).data("attachment_id");o.hide(),e("#wooccm_order_attachment_update").prop("disabled",!1),e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(c,""))})),e(document).on("click","#wooccm_order_attachment_update",(function(t){e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(t){e(".wooccm_upload_results").html(wooccm_upload.message.saving)},success:function(t){t.success?(e(".wooccm_upload_results").html(wooccm_upload.message.deleted),e("#wooccm_order_attachment_update").prop("disabled",!0)):e(".wooccm_upload_results").html(t.data)}})})),e(document).on("change","#wooccm_order_attachment_upload",(function(t){var o=!1,c=e(this).data("order_id");window.FormData&&(o=new FormData);for(var a,i=0,n=this.files.length;i<n;i++)a=this.files[i],o&&o.append("wooccm_order_attachment_upload[]",a);o&&(o.append("action","wooccm_order_attachment_upload"),o.append("nonce",wooccm_upload.nonce),o.append("order_id",c),e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:o,processData:!1,contentType:!1,beforeSend:function(t){var o;e(".wooccm_upload_results").html(wooccm_upload.message.uploading),function(e){return e.is(".processing")||e.parents(".processing").length}(o=e(".wooccm_order_attachments_wrapper"))||o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},success:function(t){t.success?(e(".wooccm_order_attachments_wrapper").fadeOut(),e(".wooccm_order_attachments_wrapper").replaceWith(e(t.data).fadeIn()),e(".wooccm_upload_results").html(wooccm_upload.message.success)):e(".wooccm_upload_results").html(t.data),e(".wooccm_order_attachments_wrapper").removeClass("processing").unblock()}}))}))})),window.window.selectWoo,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 a=c,i=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(i,(function(e,t){var o=a.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 a=e(c),i=a.find("[type=file]"),n=a.find(".wooccm-file-button"),r=a.find(".wooccm-file-list");o[a.attr("id")]=[],n.on("click",(function(e){e.preventDefault(),i.trigger("click")})),r.on("click",".wooccm-file-list-delete",(function(t){var c=e(this).closest(".wooccm-file-file"),i=e(this).closest("[data-file_id]").data("file_id");o[a.attr("id")]=e.grep(o[a.attr("id")],(function(e,t){return t!=i})),c.remove(),e("#order_review").trigger("wooccm_upload")})),i.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 i,n=new FileReader;n.onload=(i=c,function(t){setTimeout((function(){!function(t,o,c,a,i){var n,r=e(t);i.match("image.*")?n="image":i.match("application/ms.*")?(c=wooccm_upload.icons.spreadsheet,n="spreadsheet"):i.match("application/x.*")?(c=wooccm_upload.icons.archive,n="application"):i.match("audio.*")?(c=wooccm_upload.icons.audio,n="audio"):i.match("text.*")?(c=wooccm_upload.icons.text,n="text"):i.match("video.*")?(c=wooccm_upload.icons.video,n="video"):(c=wooccm_upload.icons.interactive,n="interactive");var s='<span data-file_id="'+o+'" title="'+a+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+a+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+n+'" alt="'+a+'" src="'+c+'"/>\n </span>\n </span>\n </span>';r.append(s).fadeIn()}(r,o[a.attr("id")].push(c)-1,t.target.result,i.name,i.type),e("#order_review").trigger("wooccm_upload")}),200)}),n.readAsDataURL(c)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,c){e(t.target);var a=e("#place_order");e(".wooccm-type-file").length?a.addClass("wooccm-upload-process"):a.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(c){c.preventDefault();var a,i=e("form.checkout"),n=e(this);e(".wooccm-type-file").length&&window.FormData&&Object.keys(o).length&&(t(i)||(n.html(wooccm_upload.message.uploading),t(a=i)||a.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var c=e("#"+t).find(".wooccm-file-field"),a=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 a.append("wooccm_checkout_attachment_upload[]",t))})),a.append("action","wooccm_checkout_attachment_upload"),a.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:a,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()}(i),n.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"),a=e(t.target).val();"checkbox"==c&&(a=-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"));var i=e("*[data-conditional-parent="+o+"]"),n=i.closest(".wooccm-field");i.prop("disabled",!0),n.hide(),i.find("input,textarea,select").prop("disabled",!0),i.each((function(t,o){var c=e(o),i=c&&c.data("conditional-parent-value");if(a==i||e.isArray(a)&&a.indexOf(i)>-1){var n=c.closest(".wooccm-field");c.prop("disabled",!1),c.trigger("change"),n.attr("style","display: block !important"),c.find("input,textarea,select").prop("disabled",!1),c.find("input,textarea,select").trigger("change")}}))}))})),e(".wooccm-conditional-child").each((function(t,o){var c=e(o),a=e("#"+c.find("[data-conditional-parent]").data("conditional-parent")+"_field");a.find("select:first").trigger("wooccm_change"),a.find("textarea:first").trigger("wooccm_change"),a.find("input[type=button]:first").trigger("wooccm_change"),a.find("input[type=radio]:checked:first").trigger("wooccm_change"),a.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),a.find("input[type=color]:first").trigger("wooccm_change"),a.find("input[type=date]:first").trigger("wooccm_change"),a.find("input[type=datetime-local]:first").trigger("wooccm_change"),a.find("input[type=email]:first").trigger("wooccm_change"),a.find("input[type=file]:first").trigger("wooccm_change"),a.find("input[type=hidden]:first").trigger("wooccm_change"),a.find("input[type=image]:first").trigger("wooccm_change"),a.find("input[type=month]:first").trigger("wooccm_change"),a.find("input[type=number]:first").trigger("wooccm_change"),a.find("input[type=password]:first").trigger("wooccm_change"),a.find("input[type=range]:first").trigger("wooccm_change"),a.find("input[type=reset]:first").trigger("wooccm_change"),a.find("input[type=search]:first").trigger("wooccm_change"),a.find("input[type=submit]:first").trigger("wooccm_change"),a.find("input[type=tel]:first").trigger("wooccm_change"),a.find("input[type=text]:first").trigger("wooccm_change"),a.find("input[type=time]:first").trigger("wooccm_change"),a.find("input[type=url]:first").trigger("wooccm_change"),a.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var c=e(this),a=c.data("disable")||!1;e.isFunction(e.fn.datepicker)&&c.datepicker({dateFormat:c.data("formatdate")||"mm/dd/yy",minDate:c.data("mindate"),maxDate:c.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return a?[-1===e.inArray(o,a)]:[!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),a=c.find("input[type=text]"),i=c.find(".wooccmcolorpicker_container");a.hide(),e.isFunction(e.fn.farbtastic)&&(i.farbtastic("#"+a.attr("id")),i.on("click",(function(e){a.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var c=e(o),a=c.find("input[type=text]");a.css("background",a.val()),a.on("click",(function(e){c.toggleClass("active")})),a.iris({class:a.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){a.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;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)}();
|
includes/model/class-wooccm-field.php
CHANGED
@@ -231,7 +231,8 @@ class WOOCCM_Field extends WOOCCM_Model {
|
|
231 |
}
|
232 |
|
233 |
public function get_defaults() {
|
234 |
-
return
|
|
|
235 |
}
|
236 |
|
237 |
public function get_default_fields() {
|
@@ -302,7 +303,7 @@ class WOOCCM_Field extends WOOCCM_Model {
|
|
302 |
|
303 |
public function delete_fields() {
|
304 |
$this->delete();
|
305 |
-
$this->save_items( $this->
|
306 |
}
|
307 |
|
308 |
// Field
|
231 |
}
|
232 |
|
233 |
public function get_defaults() {
|
234 |
+
return array();
|
235 |
+
// return $this->get_default_fields();
|
236 |
}
|
237 |
|
238 |
public function get_default_fields() {
|
303 |
|
304 |
public function delete_fields() {
|
305 |
$this->delete();
|
306 |
+
$this->save_items( $this->get_default_fields() );
|
307 |
}
|
308 |
|
309 |
// Field
|
includes/view/frontend/class-wooccm-fields-conditional.php
CHANGED
@@ -20,6 +20,7 @@ class WOOCCM_Fields_Conditional {
|
|
20 |
}
|
21 |
|
22 |
public function remove_required( $fields ) {
|
|
|
23 |
foreach ( $fields as $field_id => $field ) {
|
24 |
|
25 |
/**
|
@@ -47,9 +48,10 @@ class WOOCCM_Fields_Conditional {
|
|
47 |
continue;
|
48 |
}
|
49 |
|
50 |
-
$action = $this->
|
51 |
-
|
52 |
switch ( $action ) {
|
|
|
53 |
case 'save':
|
54 |
$is_valid_conditional_field = $this->is_valid_conditional_field( $_POST, $field );
|
55 |
if ( ! $is_valid_conditional_field ) {
|
@@ -97,10 +99,17 @@ class WOOCCM_Fields_Conditional {
|
|
97 |
return false;
|
98 |
}
|
99 |
|
100 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
101 |
if ( isset( $_REQUEST['woocommerce-process-checkout-nonce'] ) ) {
|
102 |
return 'save';
|
103 |
-
}
|
|
|
|
|
104 |
return 'update';
|
105 |
}
|
106 |
}
|
20 |
}
|
21 |
|
22 |
public function remove_required( $fields ) {
|
23 |
+
|
24 |
foreach ( $fields as $field_id => $field ) {
|
25 |
|
26 |
/**
|
48 |
continue;
|
49 |
}
|
50 |
|
51 |
+
$action = $this->get_form_action();
|
52 |
+
|
53 |
switch ( $action ) {
|
54 |
+
case 'account':
|
55 |
case 'save':
|
56 |
$is_valid_conditional_field = $this->is_valid_conditional_field( $_POST, $field );
|
57 |
if ( ! $is_valid_conditional_field ) {
|
99 |
return false;
|
100 |
}
|
101 |
|
102 |
+
public function get_form_action() {
|
103 |
+
|
104 |
+
if ( isset( $_REQUEST['action'] ) && 'edit_address' === $_REQUEST['action'] ) {
|
105 |
+
return 'account';
|
106 |
+
}
|
107 |
+
|
108 |
if ( isset( $_REQUEST['woocommerce-process-checkout-nonce'] ) ) {
|
109 |
return 'save';
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( isset( $_REQUEST['post_data'] ) && isset( $_REQUEST['wc-ajax'] ) && $_REQUEST['wc-ajax'] == 'update_order_review' ) {
|
113 |
return 'update';
|
114 |
}
|
115 |
}
|
includes/view/frontend/class-wooccm-fields-handler.php
CHANGED
@@ -1,314 +1,296 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class WOOCCM_Fields_Handler
|
4 |
-
{
|
5 |
|
6 |
-
protected static $_instance;
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
'address_2',
|
297 |
-
'city',
|
298 |
-
'state',
|
299 |
-
'postcode',
|
300 |
-
))) {
|
301 |
-
|
302 |
-
$field['class'][] = 'address-field';
|
303 |
-
|
304 |
-
if ($key == 'country') {
|
305 |
-
$field['class'][] = 'update_totals_on_change';
|
306 |
-
}
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
return $field;
|
311 |
-
}
|
312 |
}
|
313 |
|
314 |
WOOCCM_Fields_Handler::instance();
|
1 |
<?php
|
2 |
|
3 |
+
class WOOCCM_Fields_Handler {
|
|
|
4 |
|
|
|
5 |
|
6 |
+
protected static $_instance;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
// Prepare
|
10 |
+
add_filter( 'wooccm_checkout_field_filter', array( $this, 'add_field_filter' ) );
|
11 |
+
|
12 |
+
// Add field classes
|
13 |
+
add_filter( 'wooccm_checkout_field_filter', array( $this, 'add_field_classes' ) );
|
14 |
+
|
15 |
+
// Remove fields
|
16 |
+
// -----------------------------------------------------------------------
|
17 |
+
add_filter( 'woocommerce_checkout_fields', array( $this, 'remove_checkout_fields' ) );
|
18 |
+
|
19 |
+
// Fix defualt address fields classes
|
20 |
+
add_filter( 'wooccm_checkout_field_filter', array( $this, 'fix_address_fields_classes' ) );
|
21 |
+
|
22 |
+
// Fix address_2 field
|
23 |
+
// -----------------------------------------------------------------------
|
24 |
+
// add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
25 |
+
// Fix address fields priority, required, placeholder, label
|
26 |
+
// add_filter('woocommerce_get_country_locale', '__return_empty_array');
|
27 |
+
add_filter( 'woocommerce_get_country_locale_default', array( $this, 'remove_fields_priority' ) );
|
28 |
+
add_filter( 'woocommerce_get_country_locale_base', array( $this, 'remove_fields_priority' ) );
|
29 |
+
|
30 |
+
// Fix required country notice when shipping address is activated
|
31 |
+
// -----------------------------------------------------------------------
|
32 |
+
if ( is_account_page() ) {
|
33 |
+
add_filter( 'woocommerce_checkout_posted_data', array( $this, 'remove_address_fields' ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
// Clear session
|
37 |
+
add_action( 'woocommerce_checkout_posted_data', array( $this, 'posted_data' ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
public static function instance() {
|
41 |
+
if ( is_null( self::$_instance ) ) {
|
42 |
+
self::$_instance = new self();
|
43 |
+
}
|
44 |
+
return self::$_instance;
|
45 |
+
}
|
46 |
+
|
47 |
+
public function posted_data( $data ) {
|
48 |
+
if ( count( $fields = WC()->session->wooccm['fields'] ) ) {
|
49 |
+
|
50 |
+
foreach ( $fields as $key => $field ) {
|
51 |
+
|
52 |
+
switch ( $field['type'] ) {
|
53 |
+
|
54 |
+
case 'multicheckbox':
|
55 |
+
$data[ $key ] = isset( $_POST[ $key ] ) ? implode( ', ', wc_clean( wp_unslash( $_POST[ $key ] ) ) ) : '';
|
56 |
+
|
57 |
+
break;
|
58 |
+
|
59 |
+
case 'checkbox':
|
60 |
+
if ( ! empty( $_POST[ $key ] ) ) {
|
61 |
+
$data[ $key ] = esc_html__( 'Yes', 'woocommerce-checkout-manager' );
|
62 |
+
}
|
63 |
+
|
64 |
+
// else {
|
65 |
+
// $data[$key] = esc_html__('No', 'woocommerce-checkout-manager');
|
66 |
+
// }
|
67 |
+
|
68 |
+
break;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
return $data;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function add_field_filter( $field ) {
|
77 |
+
if ( isset( WC()->session ) ) {
|
78 |
+
$session_data = WC()->session->wooccm;
|
79 |
+
}
|
80 |
+
|
81 |
+
// keep attr id = attr name
|
82 |
+
// -------------------------------------------------------------------------
|
83 |
+
unset( $field['id'] );
|
84 |
+
|
85 |
+
switch ( $field['type'] ) {
|
86 |
+
|
87 |
+
case 'select':
|
88 |
+
case 'radio':
|
89 |
+
if ( ! empty( $field['options'] ) ) {
|
90 |
+
if ( is_array( $field['options'] ) ) {
|
91 |
+
$field['add_price_total'] = array_column( $field['options'], 'add_price_total' );
|
92 |
+
$field['add_price_type'] = array_column( $field['options'], 'add_price_type' );
|
93 |
+
$field['add_price_tax'] = array_column( $field['options'], 'add_price_tax' );
|
94 |
+
$field['options'] = array_column( $field['options'], 'label' );
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
$field['disabled'] = true;
|
98 |
+
}
|
99 |
+
|
100 |
+
break;
|
101 |
+
|
102 |
+
case 'multiselect':
|
103 |
+
case 'multicheckbox':
|
104 |
+
if ( ! empty( $field['options'] ) ) {
|
105 |
+
if ( is_array( $field['options'] ) ) {
|
106 |
+
$field['add_price_total'] = array_column( $field['options'], 'add_price_total' );
|
107 |
+
$field['add_price_type'] = array_column( $field['options'], 'add_price_type' );
|
108 |
+
$field['add_price_tax'] = array_column( $field['options'], 'add_price_tax' );
|
109 |
+
$field['default'] = array_column( $field['options'], 'default' );
|
110 |
+
$field['options'] = array_column( $field['options'], 'label' );
|
111 |
+
}
|
112 |
+
} else {
|
113 |
+
$field['disabled'] = true;
|
114 |
+
}
|
115 |
+
|
116 |
+
break;
|
117 |
+
|
118 |
+
case 'heading':
|
119 |
+
$field['required'] = false;
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
|
123 |
+
// Priority
|
124 |
+
// -----------------------------------------------------------------------
|
125 |
+
if ( isset( $field['order'] ) ) {
|
126 |
+
$field['priority'] = $field['order'] * 10;
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( isset( WC()->session ) ) {
|
130 |
+
$session_data['fields'][ $field['key'] ] = $field;
|
131 |
+
WC()->session->wooccm = $session_data;
|
132 |
+
}
|
133 |
+
|
134 |
+
return $field;
|
135 |
+
}
|
136 |
+
|
137 |
+
public function add_field_classes( $field ) {
|
138 |
+
// Position
|
139 |
+
// -----------------------------------------------------------------------
|
140 |
+
if ( ! empty( $field['position'] ) ) {
|
141 |
+
$field['class'] = array_diff( $field['class'], array( 'form-row-wide', 'form-row-first', 'form-row-last' ) );
|
142 |
+
$field['class'][] = $field['position'];
|
143 |
+
}
|
144 |
+
|
145 |
+
// WOOCCM
|
146 |
+
// -----------------------------------------------------------------------
|
147 |
+
|
148 |
+
$field['class'][] = 'wooccm-field';
|
149 |
+
$field['class'][] = 'wooccm-field-' . $field['name'];
|
150 |
+
|
151 |
+
// Type
|
152 |
+
// -----------------------------------------------------------------------
|
153 |
+
if ( ! empty( $field['type'] ) ) {
|
154 |
+
$field['class'][] = 'wooccm-type-' . $field['type'];
|
155 |
+
}
|
156 |
+
|
157 |
+
// Color
|
158 |
+
// -----------------------------------------------------------------------
|
159 |
+
if ( ! empty( $field['type'] ) && $field['type'] == 'colorpicker' ) {
|
160 |
+
$field['class'][] = 'wooccm-colorpicker-' . $field['pickertype'];
|
161 |
+
}
|
162 |
+
|
163 |
+
// Extra
|
164 |
+
// -----------------------------------------------------------------------
|
165 |
+
if ( ! empty( $field['extra_class'] ) ) {
|
166 |
+
$field['class'][] = $field['extra_class'];
|
167 |
+
}
|
168 |
+
|
169 |
+
// Clearfix
|
170 |
+
// -----------------------------------------------------------------------
|
171 |
+
if ( ! empty( $field['clear'] ) ) {
|
172 |
+
$field['class'][] = 'wooccm-clearfix';
|
173 |
+
}
|
174 |
+
|
175 |
+
// Required
|
176 |
+
// -----------------------------------------------------------------------
|
177 |
+
|
178 |
+
if ( isset( $field['required'] ) ) {
|
179 |
+
|
180 |
+
$required = (int) $field['required'];
|
181 |
+
|
182 |
+
$field['custom_attributes']['data-required'] = $required;
|
183 |
+
|
184 |
+
if ( $required ) {
|
185 |
+
$field['input_class'][] = 'wooccm-required-field';
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
// Number
|
190 |
+
if ( $field['type'] == 'number' ) {
|
191 |
+
if ( $field['max'] || $field['max'] == 0 ) {
|
192 |
+
$field['custom_attributes']['max'] = (int) $field['max'];
|
193 |
+
}
|
194 |
+
if ( $field['min'] || $field['min'] == 0 ) {
|
195 |
+
$field['custom_attributes']['min'] = (int) $field['min'];
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
// Text/Textarea
|
200 |
+
if ( $field['type'] == 'text' || $field['type'] == 'textarea' ) {
|
201 |
+
if ( $field['maxlength'] ) {
|
202 |
+
$field['custom_attributes']['maxlength'] = (int) $field['maxlength'];
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
return $field;
|
207 |
+
}
|
208 |
+
|
209 |
+
public function remove_checkout_fields( $fields ) {
|
210 |
+
foreach ( $fields as $key => $type ) {
|
211 |
+
|
212 |
+
if ( is_array( $type ) ) {
|
213 |
+
if ( count( $type ) ) {
|
214 |
+
foreach ( $type as $field_id => $field ) {
|
215 |
+
// Remove disabled
|
216 |
+
// -------------------------------------------------------------------
|
217 |
+
if ( ! empty( $field['disabled'] ) ) {
|
218 |
+
unset( $fields[ $key ][ $field_id ] );
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
// Fix for required address field
|
226 |
+
if ( get_option( 'woocommerce_ship_to_destination' ) == 'billing_only' ) {
|
227 |
+
unset( $fields['shipping'] );
|
228 |
+
}
|
229 |
+
|
230 |
+
return $fields;
|
231 |
+
}
|
232 |
+
|
233 |
+
// function woocommerce_checkout_address_2_field($option) {
|
234 |
+
// return 'required';
|
235 |
+
// }
|
236 |
+
|
237 |
+
public function remove_fields_priority( $fields ) {
|
238 |
+
foreach ( $fields as $key => $field ) {
|
239 |
+
unset( $fields[ $key ]['label'] );
|
240 |
+
unset( $fields[ $key ]['placeholder'] );
|
241 |
+
unset( $fields[ $key ]['priority'] );
|
242 |
+
unset( $fields[ $key ]['required'] );
|
243 |
+
unset( $fields[ $key ]['class'] );
|
244 |
+
}
|
245 |
+
|
246 |
+
return $fields;
|
247 |
+
}
|
248 |
+
|
249 |
+
public function remove_address_fields( $data ) {
|
250 |
+
$remove = array(
|
251 |
+
'shipping_country',
|
252 |
+
'shipping_address_1',
|
253 |
+
'shipping_city',
|
254 |
+
'shipping_state',
|
255 |
+
'shipping_postcode',
|
256 |
+
);
|
257 |
+
|
258 |
+
foreach ( $remove as $key ) {
|
259 |
+
if ( empty( $data[ $key ] ) ) {
|
260 |
+
unset( $data[ $key ] );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
return $data;
|
265 |
+
}
|
266 |
+
|
267 |
+
public function fix_address_fields_classes( $field ) {
|
268 |
+
if ( isset( $field['key'] ) ) {
|
269 |
+
|
270 |
+
$key = str_replace( array( 'shipping_', 'billing_' ), '', $field['key'] );
|
271 |
+
|
272 |
+
if ( in_array(
|
273 |
+
$key,
|
274 |
+
array(
|
275 |
+
'country',
|
276 |
+
'address_1',
|
277 |
+
'address_2',
|
278 |
+
'city',
|
279 |
+
'state',
|
280 |
+
'postcode',
|
281 |
+
)
|
282 |
+
) ) {
|
283 |
+
|
284 |
+
$field['class'][] = 'address-field';
|
285 |
+
|
286 |
+
if ( $key == 'country' ) {
|
287 |
+
$field['class'][] = 'update_totals_on_change';
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
return $field;
|
293 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
|
296 |
WOOCCM_Fields_Handler::instance();
|
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.
|
9 |
WC requires at least: 3.1.0
|
10 |
WC tested up to: 6.9
|
11 |
License: GPLv3
|
@@ -149,6 +149,10 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
|
|
149 |
|
150 |
== Changelog ==
|
151 |
|
|
|
|
|
|
|
|
|
152 |
= 6.2.8
|
153 |
* Fix. WooCommerce Checkout alert removed
|
154 |
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 6.0.1
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 6.3.1
|
9 |
WC requires at least: 3.1.0
|
10 |
WC tested up to: 6.9
|
11 |
License: GPLv3
|
149 |
|
150 |
== Changelog ==
|
151 |
|
152 |
+
= 6.3.1
|
153 |
+
* Fix. WooCommerce Account fields
|
154 |
+
* Fix. WooCommerce Checkout conditional field prices
|
155 |
+
|
156 |
= 6.2.8
|
157 |
* Fix. WooCommerce Checkout alert removed
|
158 |
|
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.
|
8 |
* Author: QuadLayers
|
9 |
* Author URI: https://quadlayers.com
|
10 |
* License: GPLv3
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
}
|
18 |
|
19 |
define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
|
20 |
-
define( 'WOOCCM_PLUGIN_VERSION', '6.
|
21 |
define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
|
22 |
define( 'WOOCCM_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
|
23 |
define( 'WOOCCM_PLUGIN_BASENAME', plugin_basename( __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.3.1
|
8 |
* Author: QuadLayers
|
9 |
* Author URI: https://quadlayers.com
|
10 |
* License: GPLv3
|
17 |
}
|
18 |
|
19 |
define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
|
20 |
+
define( 'WOOCCM_PLUGIN_VERSION', '6.3.1' );
|
21 |
define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
|
22 |
define( 'WOOCCM_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
|
23 |
define( 'WOOCCM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|