Version Description
- Fix: premium compatibility
- Fix: datepicker remove all days
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 5.2.0 |
Comparing to | |
See all releases |
Code changes from version 5.1.9 to 5.2.0
- assets/backend/js/wooccm-admin-field.js +0 -2
- assets/backend/js/wooccm-admin.js +27 -10
- assets/backend/js/wooccm-admin.min.js +1 -1
- assets/frontend/js/wooccm-checkout.js +3 -4
- assets/frontend/js/wooccm-checkout.min.js +1 -1
- includes/controller/class-wooccm-checkout.php +1 -1
- includes/view/frontend/class-wooccm-fields-disable.php +15 -0
- includes/view/frontend/class-wooccm-fields-filters.php +39 -14
- includes/view/frontend/class-wooccm-fields-register.php +1 -1
- readme.txt +6 -2
- woocommerce-checkout-manager.php +2 -2
assets/backend/js/wooccm-admin-field.js
CHANGED
@@ -29,8 +29,6 @@
|
|
29 |
},
|
30 |
getFormData: function ($form) {
|
31 |
return $form.serializeJSON({ checkboxUncheckedValue: 'false', parseBooleans: true, parseNulls: true });
|
32 |
-
//breakes image highlight id
|
33 |
-
// return $form.serializeJSON({checkboxUncheckedValue: 'false', parseBooleans: true, parseNumbers: true, parseNulls: true});
|
34 |
}
|
35 |
});
|
36 |
|
29 |
},
|
30 |
getFormData: function ($form) {
|
31 |
return $form.serializeJSON({ checkboxUncheckedValue: 'false', parseBooleans: true, parseNulls: true });
|
|
|
|
|
32 |
}
|
33 |
});
|
34 |
|
assets/backend/js/wooccm-admin.js
CHANGED
@@ -5,8 +5,8 @@
|
|
5 |
|
6 |
function date_picker_select(datepicker) {
|
7 |
var option = $(datepicker).next().is('.hasDatepicker') ? 'minDate' : 'maxDate',
|
8 |
-
|
9 |
-
|
10 |
|
11 |
$(otherDateField).datepicker('option', option, date);
|
12 |
$(datepicker).change();
|
@@ -111,14 +111,14 @@
|
|
111 |
$('.wooccm-enhanced-options').each(function () {
|
112 |
|
113 |
var $table = $(this),
|
114 |
-
|
115 |
-
|
116 |
|
117 |
$add.on('click', function (e) {
|
118 |
|
119 |
var $tr = $table.find('tbody > tr'),
|
120 |
-
|
121 |
-
|
122 |
|
123 |
$tr.last().after($('<tr>' + tr + '</tr>')).find('input').trigger('change');
|
124 |
|
@@ -150,6 +150,13 @@
|
|
150 |
placeholder: $(this).data('placeholder')
|
151 |
}, getEnhancedSelectFormatString());
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
$(this).selectWoo(select2_args).addClass('enhanced');
|
154 |
});
|
155 |
|
@@ -183,7 +190,7 @@
|
|
183 |
var terms = [];
|
184 |
if (data) {
|
185 |
$.each(data, function (id, text) {
|
186 |
-
terms.push({id: id, text: text});
|
187 |
});
|
188 |
}
|
189 |
return {
|
@@ -196,6 +203,13 @@
|
|
196 |
|
197 |
select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
|
198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
$(this).selectWoo(select2_args).addClass('enhanced');
|
200 |
|
201 |
if ($(this).data('sortable')) {
|
@@ -217,9 +231,11 @@
|
|
217 |
});
|
218 |
// Keep multiselects ordered alphabetically if they are not sortable.
|
219 |
} else if ($(this).prop('multiple')) {
|
|
|
220 |
$(this).on('change', function () {
|
221 |
var $children = $(this).children();
|
222 |
-
|
|
|
223 |
var atext = a.text.toLowerCase();
|
224 |
var btext = b.text.toLowerCase();
|
225 |
|
@@ -231,6 +247,7 @@
|
|
231 |
}
|
232 |
return 0;
|
233 |
});
|
|
|
234 |
$(this).html($children);
|
235 |
});
|
236 |
}
|
@@ -264,10 +281,10 @@
|
|
264 |
var terms = [];
|
265 |
if (data) {
|
266 |
$.each(data, function (id, text) {
|
267 |
-
terms.push({id: id, text: text});
|
268 |
});
|
269 |
}
|
270 |
-
return {results: terms};
|
271 |
}
|
272 |
}
|
273 |
};
|
5 |
|
6 |
function date_picker_select(datepicker) {
|
7 |
var option = $(datepicker).next().is('.hasDatepicker') ? 'minDate' : 'maxDate',
|
8 |
+
otherDateField = 'minDate' === option ? $(datepicker).next() : $(datepicker).prev(),
|
9 |
+
date = $(datepicker).datepicker('getDate');
|
10 |
|
11 |
$(otherDateField).datepicker('option', option, date);
|
12 |
$(datepicker).change();
|
111 |
$('.wooccm-enhanced-options').each(function () {
|
112 |
|
113 |
var $table = $(this),
|
114 |
+
$add = $table.find('.add-option'),
|
115 |
+
$remove = $table.find('.remove-options');
|
116 |
|
117 |
$add.on('click', function (e) {
|
118 |
|
119 |
var $tr = $table.find('tbody > tr'),
|
120 |
+
id = $tr.length,
|
121 |
+
tr = $tr.first().clone().html().replace(/options\[([0-9]+)\]/g, 'options[' + id + ']').replace('disabled="disabled"', '').replace('checked="checked"', '').replace('<input value="0"', '<input value="' + id + '"').replace('<input value="0"', '<input value="' + id + '"');
|
122 |
|
123 |
$tr.last().after($('<tr>' + tr + '</tr>')).find('input').trigger('change');
|
124 |
|
150 |
placeholder: $(this).data('placeholder')
|
151 |
}, getEnhancedSelectFormatString());
|
152 |
|
153 |
+
var name = $(this).attr('name');
|
154 |
+
|
155 |
+
// fix serializeJSON empty select and multiselect
|
156 |
+
if (name.indexOf('[]') >= 0) {
|
157 |
+
$(this).prepend('<input type="hidden" name="' + name + '" value="[]" />');
|
158 |
+
}
|
159 |
+
|
160 |
$(this).selectWoo(select2_args).addClass('enhanced');
|
161 |
});
|
162 |
|
190 |
var terms = [];
|
191 |
if (data) {
|
192 |
$.each(data, function (id, text) {
|
193 |
+
terms.push({ id: id, text: text });
|
194 |
});
|
195 |
}
|
196 |
return {
|
203 |
|
204 |
select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
|
205 |
|
206 |
+
var name = $(this).attr('name');
|
207 |
+
|
208 |
+
// fix serializeJSON empty select and multiselect
|
209 |
+
if (name.indexOf('[]') >= 0) {
|
210 |
+
$(this).prepend('<input type="hidden" name="' + name + '" value="[]" />');
|
211 |
+
}
|
212 |
+
|
213 |
$(this).selectWoo(select2_args).addClass('enhanced');
|
214 |
|
215 |
if ($(this).data('sortable')) {
|
231 |
});
|
232 |
// Keep multiselects ordered alphabetically if they are not sortable.
|
233 |
} else if ($(this).prop('multiple')) {
|
234 |
+
|
235 |
$(this).on('change', function () {
|
236 |
var $children = $(this).children();
|
237 |
+
//filter option fix appended input hidden
|
238 |
+
$children.filter('option').sort(function (a, b) {
|
239 |
var atext = a.text.toLowerCase();
|
240 |
var btext = b.text.toLowerCase();
|
241 |
|
247 |
}
|
248 |
return 0;
|
249 |
});
|
250 |
+
|
251 |
$(this).html($children);
|
252 |
});
|
253 |
}
|
281 |
var terms = [];
|
282 |
if (data) {
|
283 |
$.each(data, function (id, text) {
|
284 |
+
terms.push({ id: id, text: text });
|
285 |
});
|
286 |
}
|
287 |
+
return { results: terms };
|
288 |
}
|
289 |
}
|
290 |
};
|
assets/backend/js/wooccm-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function($){"use strict";function date_picker_select(datepicker){var option=$(datepicker).next().is(".hasDatepicker")?"minDate":"maxDate",otherDateField="minDate"===option?$(datepicker).next():$(datepicker).prev(),date=$(datepicker).datepicker("getDate");$(otherDateField).datepicker("option",option,date),$(datepicker).change()}function getEnhancedSelectFormatString(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(args){var overChars=args.input.length-args.maximum;return 1===overChars?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",overChars)},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;return 1===remainingChars?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",remainingChars)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(args){return 1===args.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",args.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}$(".wooccm-premium-field").closest("tr").addClass("wooccm-premium"),$(document).on("wooccm-enhanced-between-dates",(function(e){$(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each((function(){$(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(){date_picker_select($(this))}}),$(this).find("input").each((function(){date_picker_select($(this))}))}))})),$(document).on("wooccm-enhanced-options",(function(e){$("table.wc_gateways tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(event,ui){return ui.children().each((function(){$(this).width($(this).width())})),ui.css("left","0"),ui},start:function(event,ui){ui.item.css("background-color","#f6f6f6")},stop:function(event,ui){ui.item.removeAttr("style"),ui.item.trigger("updateMoveButtons")},update:function(event,ui){$(this).find("tr").each((function(i,tr){$(tr).find("input.add-order").val(i).trigger("change")}))}}),$(".wooccm-enhanced-options").each((function(){var $table=$(this),$add=$table.find(".add-option"),$remove=$table.find(".remove-options");$add.on("click",(function(e){var $tr=$table.find("tbody > tr"),id=$tr.length,tr=$tr.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+id+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+id+'"').replace('<input value="0"','<input value="'+id+'"');$tr.last().after($("<tr>"+tr+"</tr>")).find("input").trigger("change"),$remove.removeProp("disabled")})),$remove.on("click",(function(e){var $tr;$table.find("tr > td.check-column input:checked").closest("tr").remove(),$table.find("tbody > tr").length<2&&$(this).prop("disabled",!0)}))}))})),$(document).on("wooccm-enhanced-select",(function(e){$(".wooccm-enhanced-select").filter(":not(.enhanced)").each((function(){var select2_args=$.extend({minimumResultsForSearch:10,allowClear:!!$(this).data("allow_clear"),placeholder:$(this).data("placeholder")},getEnhancedSelectFormatString())
|
1 |
+
!function($){"use strict";function date_picker_select(datepicker){var option=$(datepicker).next().is(".hasDatepicker")?"minDate":"maxDate",otherDateField="minDate"===option?$(datepicker).next():$(datepicker).prev(),date=$(datepicker).datepicker("getDate");$(otherDateField).datepicker("option",option,date),$(datepicker).change()}function getEnhancedSelectFormatString(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(args){var overChars=args.input.length-args.maximum;return 1===overChars?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",overChars)},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;return 1===remainingChars?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",remainingChars)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(args){return 1===args.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",args.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}$(".wooccm-premium-field").closest("tr").addClass("wooccm-premium"),$(document).on("wooccm-enhanced-between-dates",(function(e){$(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each((function(){$(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(){date_picker_select($(this))}}),$(this).find("input").each((function(){date_picker_select($(this))}))}))})),$(document).on("wooccm-enhanced-options",(function(e){$("table.wc_gateways tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(event,ui){return ui.children().each((function(){$(this).width($(this).width())})),ui.css("left","0"),ui},start:function(event,ui){ui.item.css("background-color","#f6f6f6")},stop:function(event,ui){ui.item.removeAttr("style"),ui.item.trigger("updateMoveButtons")},update:function(event,ui){$(this).find("tr").each((function(i,tr){$(tr).find("input.add-order").val(i).trigger("change")}))}}),$(".wooccm-enhanced-options").each((function(){var $table=$(this),$add=$table.find(".add-option"),$remove=$table.find(".remove-options");$add.on("click",(function(e){var $tr=$table.find("tbody > tr"),id=$tr.length,tr=$tr.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+id+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+id+'"').replace('<input value="0"','<input value="'+id+'"');$tr.last().after($("<tr>"+tr+"</tr>")).find("input").trigger("change"),$remove.removeProp("disabled")})),$remove.on("click",(function(e){var $tr;$table.find("tr > td.check-column input:checked").closest("tr").remove(),$table.find("tbody > tr").length<2&&$(this).prop("disabled",!0)}))}))})),$(document).on("wooccm-enhanced-select",(function(e){$(".wooccm-enhanced-select").filter(":not(.enhanced)").each((function(){var select2_args=$.extend({minimumResultsForSearch:10,allowClear:!!$(this).data("allow_clear"),placeholder:$(this).data("placeholder")},getEnhancedSelectFormatString()),name=$(this).attr("name");name.indexOf("[]")>=0&&$(this).prepend('<input type="hidden" name="'+name+'" value="[]" />'),$(this).selectWoo(select2_args).addClass("enhanced")})),$(".wooccm-product-search").filter(":not(.enhanced)").each((function(){var select2_args={allowClear:!!$(this).data("allow_clear"),placeholder:$(this).data("placeholder"),minimumInputLength:$(this).data("minimum_input_length")?$(this).data("minimum_input_length"):"3",escapeMarkup:function(m){return m},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(params){return{term:params.term,action:$(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:$(this).select2("val")||0,exclude:$(this).data("exclude"),include:$(this).data("include"),limit:$(this).data("limit"),display_stock:$(this).data("display_stock")}},processResults:function(data){var terms=[];return data&&$.each(data,(function(id,text){terms.push({id:id,text:text})})),{results:terms}},cache:!0}};select2_args=$.extend(select2_args,getEnhancedSelectFormatString());var name=$(this).attr("name");if(name.indexOf("[]")>=0&&$(this).prepend('<input type="hidden" name="'+name+'" value="[]" />'),$(this).selectWoo(select2_args).addClass("enhanced"),$(this).data("sortable")){var $select=$(this),$list=$(this).next(".select2-container").find("ul.select2-selection__rendered");$list.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){$($list.find(".select2-selection__choice").get().reverse()).each((function(){var id=$(this).data("data").id,option=$select.find('option[value="'+id+'"]')[0];$select.prepend(option)}))}})}else $(this).prop("multiple")&&$(this).on("change",(function(){var $children=$(this).children();$children.filter("option").sort((function(a,b){var atext=a.text.toLowerCase(),btext=b.text.toLowerCase();return atext>btext?1:atext<btext?-1:0})),$(this).html($children)}))}))})),$(".wooccm-enhanced-search").filter(":not(.enhanced)").each((function(){var select2_args={allowClear:!!$(this).data("allow_clear"),placeholder:$(this).data("placeholder"),minimumInputLength:$(this).data("minimum_input_length")||"3",escapeMarkup:function(m){return m},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:!0,delay:250,data:function(params){return{term:params.term,key:$(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce}},processResults:function(data,params){var terms=[];return data&&$.each(data,(function(id,text){terms.push({id:id,text:text})})),{results:terms}}}};select2_args=$.extend(select2_args,getEnhancedSelectFormatString()),$(this).select2(select2_args).addClass("enhanced")}))}(jQuery);
|
assets/frontend/js/wooccm-checkout.js
CHANGED
@@ -365,16 +365,15 @@
|
|
365 |
|
366 |
$('.wooccm-enhanced-datepicker').each(function (i, field) {
|
367 |
|
|
|
368 |
var $input = $(this),
|
369 |
disable = $input.data('disable') || false;
|
370 |
|
371 |
-
console.log('mindate', $input.data('mindate'));
|
372 |
-
|
373 |
if ($.isFunction($.fn.datepicker)) {
|
374 |
$input.datepicker({
|
375 |
dateFormat: $input.data('formatdate') || 'dd-mm-yy',
|
376 |
-
minDate: $input.data('mindate'),
|
377 |
-
maxDate: $input.data('maxdate'),
|
378 |
beforeShowDay: function (date) {
|
379 |
var day = date.getDay() != undefined && date.getDay().toString();
|
380 |
if (disable) {
|
365 |
|
366 |
$('.wooccm-enhanced-datepicker').each(function (i, field) {
|
367 |
|
368 |
+
|
369 |
var $input = $(this),
|
370 |
disable = $input.data('disable') || false;
|
371 |
|
|
|
|
|
372 |
if ($.isFunction($.fn.datepicker)) {
|
373 |
$input.datepicker({
|
374 |
dateFormat: $input.data('formatdate') || 'dd-mm-yy',
|
375 |
+
minDate: $input.data('mindate') || null,
|
376 |
+
maxDate: $input.data('maxdate') || null,
|
377 |
beforeShowDay: function (date) {
|
378 |
var day = date.getDay() != undefined && date.getDay().toString();
|
379 |
if (disable) {
|
assets/frontend/js/wooccm-checkout.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function($){"use strict";var is_blocked=function($node){return $node.is(".processing")||$node.parents(".processing").length},block=function($node){is_blocked($node)||$node.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock=function($node){$node.removeClass("processing").unblock()},append_image=function(list,i,source,name,filetype){var $field_list=$(list),source_class;filetype.match("image.*")?source_class="image":filetype.match("application/ms.*")?(source=wooccm_upload.icons.spreadsheet,source_class="spreadsheet"):filetype.match("application/x.*")?(source=wooccm_upload.icons.archive,source_class="application"):filetype.match("audio.*")?(source=wooccm_upload.icons.audio,source_class="audio"):filetype.match("text.*")?(source=wooccm_upload.icons.text,source_class="text"):filetype.match("video.*")?(source=wooccm_upload.icons.video,source_class="video"):(source=wooccm_upload.icons.interactive,source_class="interactive");var html='<span data-file_id="'+i+'" title="'+name+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+name+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+source_class+'" alt="'+name+'" src="'+source+'"/>\n </span>\n </span>\n </span>';$field_list.append(html).fadeIn()};function field_is_required(field,is_required){is_required?(field.find("label .optional").remove(),field.addClass("validate-required"),0===field.find("label .required").length&&field.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),field.show(),field.find("input[type=hidden]").prop("type","text")):(field.find("label .required").remove(),field.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===field.find("label .optional").length&&field.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}$(document).on("country_to_state_changing",(function(event,country,wrapper){var thisform=wrapper,thislocale,locale_fields=$.parseJSON(wc_address_i18n_params.locale_fields);$.each(locale_fields,(function(key,value){var field=thisform.find(value),required=field.find("[data-required]").data("required")||field.find(".wooccm-required-field").length;field_is_required(field,required)}))}));var fileList={};if($(".wooccm-type-file").each((function(i,field){var $field=$(field),$button_file=$field.find("[type=file]"),$button_click=$field.find(".wooccm-file-button"),$field_list=$field.find(".wooccm-file-list");fileList[$field.attr("id")]=[],$button_click.on("click",(function(e){e.preventDefault(),$button_file.trigger("click")})),$field_list.on("click",".wooccm-file-list-delete",(function(e){var $file=$(this).closest(".wooccm-file-file"),file_id=$(this).closest("[data-file_id]").data("file_id");fileList[$field.attr("id")]=$.grep(fileList[$field.attr("id")],(function(value,index){return index!=file_id})),$file.remove(),$("#order_review").trigger("wooccm_upload")})),$button_file.on("change",(function(e){var files=$(this)[0].files;files.length&&window.FileReader&&$.each(files,(function(i,file){var count,theFile;return $field_list.find("span[data-file_id]").length+i>=wooccm_upload.limit.max_files?(alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):file.size>wooccm_upload.limit.max_file_size?(alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0):(reader=new FileReader,reader.onload=(theFile=file,function(e){setTimeout((function(){append_image($field_list,fileList[$field.attr("id")].push(file)-1,e.target.result,theFile.name,theFile.type),$("#order_review").trigger("wooccm_upload")}),200)}),void reader.readAsDataURL(file))}))}))})),$("#order_review").on("ajaxSuccess wooccm_upload",(function(e,xhr,settings){var $order_review,$place_order=$(e.target).find("#place_order"),$fields,fields;$(".wooccm-type-file").length?$place_order.addClass("wooccm-upload-process"):$place_order.removeClass("wooccm-upload-process")})),$(document).on("click","#place_order.wooccm-upload-process",(function(e){e.preventDefault();var $form=$("form.checkout"),$place_order=$(this),$fields;$(".wooccm-type-file").length&&window.FormData&&Object.keys(fileList).length&&(is_blocked($form)||($place_order.html(wooccm_upload.message.uploading),block($form)),$.each(fileList,(function(field_id,files){var $field,$attachment_ids=$("#"+field_id).find(".wooccm-file-field"),data=new FormData;$.each(files,(function(file_id,file){return file_id>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):file.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 "+file.name),void data.append("wooccm_checkout_attachment_upload[]",file))})),data.append("action","wooccm_checkout_attachment_upload"),data.append("nonce",wooccm_upload.nonce),$.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:data,processData:!1,contentType:!1,beforeSend:function(response){},success:function(response){response.success?$attachment_ids.val(response.data):$("body").trigger("update_checkout")},complete:function(response){}})})),unblock($form),$place_order.removeClass("wooccm-upload-process").trigger("click"))})),$(document).on("change",".wooccm-add-price",(function(e){$("body").trigger("update_checkout")})),$(".wooccm-conditional-child").each((function(i,field){var $field=$(field),$parent=$("#"+$field.find("[data-conditional-parent]").data("conditional-parent")+"_field"),show_if_value=$field.find("[data-conditional-parent-value]").length&&$field.find("[data-conditional-parent-value]").data("conditional-parent-value").toString();$parent.length?($parent.on("wooccm_change change keyup",(function(e){var $this=$(e.target),value=$this.val();$this.hasClass("select2-selection")||("checkbox"==$this.prop("type")&&(value=-1!==$this.attr("name").indexOf("[]")?$parent.find("input:checked").map((function(i,e){return e.value})).toArray():$this.is(":checked")),show_if_value==value||$.isArray(value)&&value.indexOf(show_if_value)>-1?$field.fadeIn():$field.fadeOut(),$this.off("wooccm_change"),$this.off("change"),$this.off("keyup"),$field.trigger("change"))})),$parent.find("select:first").trigger("wooccm_change"),$parent.find("textarea:first").trigger("wooccm_change"),$parent.find("input[type=button]:first").trigger("wooccm_change"),$parent.find("input[type=radio]:checked:first").trigger("wooccm_change"),$parent.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),$parent.find("input[type=color]:first").trigger("wooccm_change"),$parent.find("input[type=date]:first").trigger("wooccm_change"),$parent.find("input[type=datetime-local]:first").trigger("wooccm_change"),$parent.find("input[type=email]:first").trigger("wooccm_change"),$parent.find("input[type=file]:first").trigger("wooccm_change"),$parent.find("input[type=hidden]:first").trigger("wooccm_change"),$parent.find("input[type=image]:first").trigger("wooccm_change"),$parent.find("input[type=month]:first").trigger("wooccm_change"),$parent.find("input[type=number]:first").trigger("wooccm_change"),$parent.find("input[type=password]:first").trigger("wooccm_change"),$parent.find("input[type=range]:first").trigger("wooccm_change"),$parent.find("input[type=reset]:first").trigger("wooccm_change"),$parent.find("input[type=search]:first").trigger("wooccm_change"),$parent.find("input[type=submit]:first").trigger("wooccm_change"),$parent.find("input[type=tel]:first").trigger("wooccm_change"),$parent.find("input[type=text]:first").trigger("wooccm_change"),$parent.find("input[type=time]:first").trigger("wooccm_change"),$parent.find("input[type=url]:first").trigger("wooccm_change"),$parent.find("input[type=week]:first").trigger("wooccm_change")):$field.show()})),$(".wooccm-enhanced-datepicker").each((function(i,field){var $input=$(this),disable=$input.data("disable")||!1;console.log("mindate",$input.data("mindate")),$.isFunction($.fn.datepicker)&&$input.datepicker({dateFormat:$input.data("formatdate")||"dd-mm-yy",minDate:$input.data("mindate"),maxDate:$input.data("maxdate"),beforeShowDay:function(date){var day=null!=date.getDay()&&date.getDay().toString();return disable?[-1===$.inArray(day,disable)]:[!0]}})})),$(".wooccm-enhanced-timepicker").each((function(i,field){var $input=$(this);$.isFunction($.fn.timepicker)&&$input.timepicker({showPeriod:!0,showLeadingZero:!0,hours:$input.data("hours")||void 0,minutes:$input.data("minutes")||void 0})})),$(".wooccm-colorpicker-farbtastic").each((function(i,field){var $field=$(field),$input=$field.find("input[type=text]"),$container=$field.find(".wooccmcolorpicker_container");$input.hide(),$.isFunction($.fn.farbtastic)&&($container.farbtastic("#"+$input.attr("id")),$container.on("click",(function(e){$input.fadeIn()})))})),$(".wooccm-colorpicker-iris").each((function(i,field){var $field=$(field),$input=$field.find("input[type=text]");$input.css("background",$input.val()),$input.on("click",(function(e){$field.toggleClass("active")})),$input.iris({class:$input.attr("id"),palettes:!0,color:"",hide:!1,change:function(event,ui){$input.css("background",ui.color.toString()).fadeIn()}})})),$(document).on("click",(function(e){0===$(e.target).closest(".iris-picker").length&&$(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;if($().selectWoo){var getEnhancedSelectFormatString=function(){return{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(args){var overChars=args.input.length-args.maximum;return 1===overChars?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",overChars)},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;return 1===remainingChars?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",remainingChars)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(args){return 1===args.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",args.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}}},wooccm_enhanced_select;(function(){$("select.wooccm-enhanced-select").each((function(){var select2_args=$.extend({width:"100%",placeholder:$(this).data("placeholder")||"",allowClear:$(this).data("allowclear")||!1,selectOnClose:$(this).data("selectonclose")||!1,closeOnSelect:$(this).data("closeonselect")||!1,minimumResultsForSearch:$(this).data("search")||-1},getEnhancedSelectFormatString());$(this).on("select2:select",(function(){$(this).focus()})).selectWoo(select2_args)}))})()}}(jQuery);
|
1 |
+
!function($){"use strict";var is_blocked=function($node){return $node.is(".processing")||$node.parents(".processing").length},block=function($node){is_blocked($node)||$node.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock=function($node){$node.removeClass("processing").unblock()},append_image=function(list,i,source,name,filetype){var $field_list=$(list),source_class;filetype.match("image.*")?source_class="image":filetype.match("application/ms.*")?(source=wooccm_upload.icons.spreadsheet,source_class="spreadsheet"):filetype.match("application/x.*")?(source=wooccm_upload.icons.archive,source_class="application"):filetype.match("audio.*")?(source=wooccm_upload.icons.audio,source_class="audio"):filetype.match("text.*")?(source=wooccm_upload.icons.text,source_class="text"):filetype.match("video.*")?(source=wooccm_upload.icons.video,source_class="video"):(source=wooccm_upload.icons.interactive,source_class="interactive");var html='<span data-file_id="'+i+'" title="'+name+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+name+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+source_class+'" alt="'+name+'" src="'+source+'"/>\n </span>\n </span>\n </span>';$field_list.append(html).fadeIn()};function field_is_required(field,is_required){is_required?(field.find("label .optional").remove(),field.addClass("validate-required"),0===field.find("label .required").length&&field.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),field.show(),field.find("input[type=hidden]").prop("type","text")):(field.find("label .required").remove(),field.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===field.find("label .optional").length&&field.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}$(document).on("country_to_state_changing",(function(event,country,wrapper){var thisform=wrapper,thislocale,locale_fields=$.parseJSON(wc_address_i18n_params.locale_fields);$.each(locale_fields,(function(key,value){var field=thisform.find(value),required=field.find("[data-required]").data("required")||field.find(".wooccm-required-field").length;field_is_required(field,required)}))}));var fileList={};if($(".wooccm-type-file").each((function(i,field){var $field=$(field),$button_file=$field.find("[type=file]"),$button_click=$field.find(".wooccm-file-button"),$field_list=$field.find(".wooccm-file-list");fileList[$field.attr("id")]=[],$button_click.on("click",(function(e){e.preventDefault(),$button_file.trigger("click")})),$field_list.on("click",".wooccm-file-list-delete",(function(e){var $file=$(this).closest(".wooccm-file-file"),file_id=$(this).closest("[data-file_id]").data("file_id");fileList[$field.attr("id")]=$.grep(fileList[$field.attr("id")],(function(value,index){return index!=file_id})),$file.remove(),$("#order_review").trigger("wooccm_upload")})),$button_file.on("change",(function(e){var files=$(this)[0].files;files.length&&window.FileReader&&$.each(files,(function(i,file){var count,theFile;return $field_list.find("span[data-file_id]").length+i>=wooccm_upload.limit.max_files?(alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):file.size>wooccm_upload.limit.max_file_size?(alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0):(reader=new FileReader,reader.onload=(theFile=file,function(e){setTimeout((function(){append_image($field_list,fileList[$field.attr("id")].push(file)-1,e.target.result,theFile.name,theFile.type),$("#order_review").trigger("wooccm_upload")}),200)}),void reader.readAsDataURL(file))}))}))})),$("#order_review").on("ajaxSuccess wooccm_upload",(function(e,xhr,settings){var $order_review,$place_order=$(e.target).find("#place_order"),$fields,fields;$(".wooccm-type-file").length?$place_order.addClass("wooccm-upload-process"):$place_order.removeClass("wooccm-upload-process")})),$(document).on("click","#place_order.wooccm-upload-process",(function(e){e.preventDefault();var $form=$("form.checkout"),$place_order=$(this),$fields;$(".wooccm-type-file").length&&window.FormData&&Object.keys(fileList).length&&(is_blocked($form)||($place_order.html(wooccm_upload.message.uploading),block($form)),$.each(fileList,(function(field_id,files){var $field,$attachment_ids=$("#"+field_id).find(".wooccm-file-field"),data=new FormData;$.each(files,(function(file_id,file){return file_id>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):file.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 "+file.name),void data.append("wooccm_checkout_attachment_upload[]",file))})),data.append("action","wooccm_checkout_attachment_upload"),data.append("nonce",wooccm_upload.nonce),$.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:data,processData:!1,contentType:!1,beforeSend:function(response){},success:function(response){response.success?$attachment_ids.val(response.data):$("body").trigger("update_checkout")},complete:function(response){}})})),unblock($form),$place_order.removeClass("wooccm-upload-process").trigger("click"))})),$(document).on("change",".wooccm-add-price",(function(e){$("body").trigger("update_checkout")})),$(".wooccm-conditional-child").each((function(i,field){var $field=$(field),$parent=$("#"+$field.find("[data-conditional-parent]").data("conditional-parent")+"_field"),show_if_value=$field.find("[data-conditional-parent-value]").length&&$field.find("[data-conditional-parent-value]").data("conditional-parent-value").toString();$parent.length?($parent.on("wooccm_change change keyup",(function(e){var $this=$(e.target),value=$this.val();$this.hasClass("select2-selection")||("checkbox"==$this.prop("type")&&(value=-1!==$this.attr("name").indexOf("[]")?$parent.find("input:checked").map((function(i,e){return e.value})).toArray():$this.is(":checked")),show_if_value==value||$.isArray(value)&&value.indexOf(show_if_value)>-1?$field.fadeIn():$field.fadeOut(),$this.off("wooccm_change"),$this.off("change"),$this.off("keyup"),$field.trigger("change"))})),$parent.find("select:first").trigger("wooccm_change"),$parent.find("textarea:first").trigger("wooccm_change"),$parent.find("input[type=button]:first").trigger("wooccm_change"),$parent.find("input[type=radio]:checked:first").trigger("wooccm_change"),$parent.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),$parent.find("input[type=color]:first").trigger("wooccm_change"),$parent.find("input[type=date]:first").trigger("wooccm_change"),$parent.find("input[type=datetime-local]:first").trigger("wooccm_change"),$parent.find("input[type=email]:first").trigger("wooccm_change"),$parent.find("input[type=file]:first").trigger("wooccm_change"),$parent.find("input[type=hidden]:first").trigger("wooccm_change"),$parent.find("input[type=image]:first").trigger("wooccm_change"),$parent.find("input[type=month]:first").trigger("wooccm_change"),$parent.find("input[type=number]:first").trigger("wooccm_change"),$parent.find("input[type=password]:first").trigger("wooccm_change"),$parent.find("input[type=range]:first").trigger("wooccm_change"),$parent.find("input[type=reset]:first").trigger("wooccm_change"),$parent.find("input[type=search]:first").trigger("wooccm_change"),$parent.find("input[type=submit]:first").trigger("wooccm_change"),$parent.find("input[type=tel]:first").trigger("wooccm_change"),$parent.find("input[type=text]:first").trigger("wooccm_change"),$parent.find("input[type=time]:first").trigger("wooccm_change"),$parent.find("input[type=url]:first").trigger("wooccm_change"),$parent.find("input[type=week]:first").trigger("wooccm_change")):$field.show()})),$(".wooccm-enhanced-datepicker").each((function(i,field){var $input=$(this),disable=$input.data("disable")||!1;$.isFunction($.fn.datepicker)&&$input.datepicker({dateFormat:$input.data("formatdate")||"dd-mm-yy",minDate:$input.data("mindate")||null,maxDate:$input.data("maxdate")||null,beforeShowDay:function(date){var day=null!=date.getDay()&&date.getDay().toString();return disable?[-1===$.inArray(day,disable)]:[!0]}})})),$(".wooccm-enhanced-timepicker").each((function(i,field){var $input=$(this);$.isFunction($.fn.timepicker)&&$input.timepicker({showPeriod:!0,showLeadingZero:!0,hours:$input.data("hours")||void 0,minutes:$input.data("minutes")||void 0})})),$(".wooccm-colorpicker-farbtastic").each((function(i,field){var $field=$(field),$input=$field.find("input[type=text]"),$container=$field.find(".wooccmcolorpicker_container");$input.hide(),$.isFunction($.fn.farbtastic)&&($container.farbtastic("#"+$input.attr("id")),$container.on("click",(function(e){$input.fadeIn()})))})),$(".wooccm-colorpicker-iris").each((function(i,field){var $field=$(field),$input=$field.find("input[type=text]");$input.css("background",$input.val()),$input.on("click",(function(e){$field.toggleClass("active")})),$input.iris({class:$input.attr("id"),palettes:!0,color:"",hide:!1,change:function(event,ui){$input.css("background",ui.color.toString()).fadeIn()}})})),$(document).on("click",(function(e){0===$(e.target).closest(".iris-picker").length&&$(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;if($().selectWoo){var getEnhancedSelectFormatString=function(){return{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(args){var overChars=args.input.length-args.maximum;return 1===overChars?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",overChars)},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;return 1===remainingChars?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",remainingChars)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(args){return 1===args.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",args.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}}},wooccm_enhanced_select;(function(){$("select.wooccm-enhanced-select").each((function(){var select2_args=$.extend({width:"100%",placeholder:$(this).data("placeholder")||"",allowClear:$(this).data("allowclear")||!1,selectOnClose:$(this).data("selectonclose")||!1,closeOnSelect:$(this).data("closeonselect")||!1,minimumResultsForSearch:$(this).data("search")||-1},getEnhancedSelectFormatString());$(this).on("select2:select",(function(){$(this).focus()})).selectWoo(select2_args)}))})()}}(jQuery);
|
includes/controller/class-wooccm-checkout.php
CHANGED
@@ -42,7 +42,7 @@ class WOOCCM_Checkout_Controller
|
|
42 |
public function enqueue_scripts()
|
43 |
{
|
44 |
|
45 |
-
if (is_checkout()
|
46 |
|
47 |
WOOCCM()->register_scripts();
|
48 |
|
42 |
public function enqueue_scripts()
|
43 |
{
|
44 |
|
45 |
+
if (is_checkout()) {
|
46 |
|
47 |
WOOCCM()->register_scripts();
|
48 |
|
includes/view/frontend/class-wooccm-fields-disable.php
CHANGED
@@ -13,6 +13,8 @@ class WOOCCM_Fields_Display
|
|
13 |
add_filter('wooccm_checkout_field_filter', array($this, 'disable_by_category'));
|
14 |
// Remove by role
|
15 |
add_filter('wooccm_checkout_field_filter', array($this, 'disable_by_role'));
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public static function instance()
|
@@ -23,6 +25,19 @@ class WOOCCM_Fields_Display
|
|
23 |
return self::$_instance;
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
function disable_by_role($field)
|
27 |
{
|
28 |
|
13 |
add_filter('wooccm_checkout_field_filter', array($this, 'disable_by_category'));
|
14 |
// Remove by role
|
15 |
add_filter('wooccm_checkout_field_filter', array($this, 'disable_by_role'));
|
16 |
+
// Fix country
|
17 |
+
add_filter('wooccm_checkout_field_filter', array($this, 'fix_country'));
|
18 |
}
|
19 |
|
20 |
public static function instance()
|
25 |
return self::$_instance;
|
26 |
}
|
27 |
|
28 |
+
function fix_country($field)
|
29 |
+
{
|
30 |
+
|
31 |
+
if ($field['type'] == 'country' && $field['disabled'] == true) {
|
32 |
+
$field['disabled'] = false;
|
33 |
+
$field['required'] = false;
|
34 |
+
$field['type'] = 'hidden';
|
35 |
+
//$field['class'] = array('hidden');
|
36 |
+
}
|
37 |
+
|
38 |
+
return $field;
|
39 |
+
}
|
40 |
+
|
41 |
function disable_by_role($field)
|
42 |
{
|
43 |
|
includes/view/frontend/class-wooccm-fields-filters.php
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class WOOCCM_Fields_Filter
|
|
|
4 |
|
5 |
protected static $_instance;
|
6 |
public $count = 0;
|
7 |
|
8 |
-
public function __construct()
|
|
|
9 |
$this->init();
|
10 |
}
|
11 |
|
12 |
-
public static function instance()
|
|
|
13 |
if (is_null(self::$_instance)) {
|
14 |
self::$_instance = new self();
|
15 |
}
|
@@ -18,7 +21,8 @@ class WOOCCM_Fields_Filter {
|
|
18 |
|
19 |
// Custom fields
|
20 |
// ---------------------------------------------------------------------------
|
21 |
-
public function custom_field($field = '', $key, $args, $value)
|
|
|
22 |
|
23 |
$field = '';
|
24 |
|
@@ -75,7 +79,7 @@ class WOOCCM_Fields_Filter {
|
|
75 |
$field_container = '<p class="form-row %1$s" id="%2$s" data-priority="' . esc_attr($sort) . '">%3$s</p>';
|
76 |
switch ($args['type']) {
|
77 |
|
78 |
-
case 'radio'
|
79 |
$field = '';
|
80 |
|
81 |
if (!empty($args['options'])) {
|
@@ -109,7 +113,7 @@ class WOOCCM_Fields_Filter {
|
|
109 |
|
110 |
break;
|
111 |
|
112 |
-
case 'multiselect'
|
113 |
|
114 |
$field = '';
|
115 |
|
@@ -125,7 +129,7 @@ class WOOCCM_Fields_Filter {
|
|
125 |
|
126 |
break;
|
127 |
|
128 |
-
case 'multicheckbox'
|
129 |
|
130 |
$field = '';
|
131 |
|
@@ -145,7 +149,7 @@ class WOOCCM_Fields_Filter {
|
|
145 |
|
146 |
break;
|
147 |
|
148 |
-
case 'file'
|
149 |
|
150 |
$field = '';
|
151 |
|
@@ -183,7 +187,8 @@ class WOOCCM_Fields_Filter {
|
|
183 |
|
184 |
// Heading
|
185 |
// ---------------------------------------------------------------------------
|
186 |
-
public function heading_field($field = '', $key, $args, $value)
|
|
|
187 |
|
188 |
// Custom attribute handling.
|
189 |
$custom_attributes = array();
|
@@ -207,7 +212,8 @@ class WOOCCM_Fields_Filter {
|
|
207 |
|
208 |
// Colorpicker
|
209 |
// ---------------------------------------------------------------------------
|
210 |
-
public function colorpicker_field($field = '', $key, $args, $value)
|
|
|
211 |
|
212 |
$args['type'] = 'text';
|
213 |
$args['maxlength'] = 7;
|
@@ -225,7 +231,8 @@ class WOOCCM_Fields_Filter {
|
|
225 |
|
226 |
// Country
|
227 |
// ---------------------------------------------------------------------------
|
228 |
-
public function country_field($field = '', $key, $args, $value)
|
|
|
229 |
|
230 |
static $instance = 0;
|
231 |
|
@@ -250,7 +257,8 @@ class WOOCCM_Fields_Filter {
|
|
250 |
|
251 |
// State
|
252 |
// ---------------------------------------------------------------------------
|
253 |
-
public function state_field($field = '', $key, $args, $value)
|
|
|
254 |
|
255 |
static $instance = 0;
|
256 |
|
@@ -273,7 +281,24 @@ class WOOCCM_Fields_Filter {
|
|
273 |
return $field;
|
274 |
}
|
275 |
|
276 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
add_filter('woocommerce_form_field_radio', array($this, 'custom_field'), 10, 4);
|
278 |
add_filter('woocommerce_form_field_multicheckbox', array($this, 'custom_field'), 10, 4);
|
279 |
add_filter('woocommerce_form_field_multiselect', array($this, 'custom_field'), 10, 4);
|
@@ -283,8 +308,8 @@ class WOOCCM_Fields_Filter {
|
|
283 |
add_filter('woocommerce_form_field_colorpicker', array($this, 'colorpicker_field'), 10, 4);
|
284 |
add_filter('woocommerce_form_field_country', array($this, 'country_field'), 10, 4);
|
285 |
add_filter('woocommerce_form_field_state', array($this, 'state_field'), 10, 4);
|
|
|
286 |
}
|
287 |
-
|
288 |
}
|
289 |
|
290 |
WOOCCM_Fields_Filter::instance();
|
1 |
<?php
|
2 |
|
3 |
+
class WOOCCM_Fields_Filter
|
4 |
+
{
|
5 |
|
6 |
protected static $_instance;
|
7 |
public $count = 0;
|
8 |
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
$this->init();
|
12 |
}
|
13 |
|
14 |
+
public static function instance()
|
15 |
+
{
|
16 |
if (is_null(self::$_instance)) {
|
17 |
self::$_instance = new self();
|
18 |
}
|
21 |
|
22 |
// Custom fields
|
23 |
// ---------------------------------------------------------------------------
|
24 |
+
public function custom_field($field = '', $key, $args, $value)
|
25 |
+
{
|
26 |
|
27 |
$field = '';
|
28 |
|
79 |
$field_container = '<p class="form-row %1$s" id="%2$s" data-priority="' . esc_attr($sort) . '">%3$s</p>';
|
80 |
switch ($args['type']) {
|
81 |
|
82 |
+
case 'radio':
|
83 |
$field = '';
|
84 |
|
85 |
if (!empty($args['options'])) {
|
113 |
|
114 |
break;
|
115 |
|
116 |
+
case 'multiselect':
|
117 |
|
118 |
$field = '';
|
119 |
|
129 |
|
130 |
break;
|
131 |
|
132 |
+
case 'multicheckbox':
|
133 |
|
134 |
$field = '';
|
135 |
|
149 |
|
150 |
break;
|
151 |
|
152 |
+
case 'file':
|
153 |
|
154 |
$field = '';
|
155 |
|
187 |
|
188 |
// Heading
|
189 |
// ---------------------------------------------------------------------------
|
190 |
+
public function heading_field($field = '', $key, $args, $value)
|
191 |
+
{
|
192 |
|
193 |
// Custom attribute handling.
|
194 |
$custom_attributes = array();
|
212 |
|
213 |
// Colorpicker
|
214 |
// ---------------------------------------------------------------------------
|
215 |
+
public function colorpicker_field($field = '', $key, $args, $value)
|
216 |
+
{
|
217 |
|
218 |
$args['type'] = 'text';
|
219 |
$args['maxlength'] = 7;
|
231 |
|
232 |
// Country
|
233 |
// ---------------------------------------------------------------------------
|
234 |
+
public function country_field($field = '', $key, $args, $value)
|
235 |
+
{
|
236 |
|
237 |
static $instance = 0;
|
238 |
|
257 |
|
258 |
// State
|
259 |
// ---------------------------------------------------------------------------
|
260 |
+
public function state_field($field = '', $key, $args, $value)
|
261 |
+
{
|
262 |
|
263 |
static $instance = 0;
|
264 |
|
281 |
return $field;
|
282 |
}
|
283 |
|
284 |
+
public function hidden_field($field = '', $key, $args, $value)
|
285 |
+
{
|
286 |
+
|
287 |
+
static $instance = 0;
|
288 |
+
|
289 |
+
if ($instance) {
|
290 |
+
return $field;
|
291 |
+
}
|
292 |
+
|
293 |
+
$instance++;
|
294 |
+
|
295 |
+
$field .= '<input type="hidden" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" value="' . esc_html($value) . '" ' . implode(' ', $args['custom_attributes']) . ' readonly="readonly" />';
|
296 |
+
|
297 |
+
return $field;
|
298 |
+
}
|
299 |
+
|
300 |
+
public function init()
|
301 |
+
{
|
302 |
add_filter('woocommerce_form_field_radio', array($this, 'custom_field'), 10, 4);
|
303 |
add_filter('woocommerce_form_field_multicheckbox', array($this, 'custom_field'), 10, 4);
|
304 |
add_filter('woocommerce_form_field_multiselect', array($this, 'custom_field'), 10, 4);
|
308 |
add_filter('woocommerce_form_field_colorpicker', array($this, 'colorpicker_field'), 10, 4);
|
309 |
add_filter('woocommerce_form_field_country', array($this, 'country_field'), 10, 4);
|
310 |
add_filter('woocommerce_form_field_state', array($this, 'state_field'), 10, 4);
|
311 |
+
add_filter('woocommerce_form_field_hidden', array($this, 'hidden_field'), 10, 4);
|
312 |
}
|
|
|
313 |
}
|
314 |
|
315 |
WOOCCM_Fields_Filter::instance();
|
includes/view/frontend/class-wooccm-fields-register.php
CHANGED
@@ -28,7 +28,7 @@ class WOOCCM_Fields_Register
|
|
28 |
// My account
|
29 |
// woocommerce 4.2 issue, the shipping and billing fields not working on my account when required field is empty
|
30 |
// temporary fix excluding required fields in my account
|
31 |
-
add_filter('woocommerce_address_to_edit', array($this, 'add_my_account_fields'), 10, 2);
|
32 |
}
|
33 |
|
34 |
public static function instance()
|
28 |
// My account
|
29 |
// woocommerce 4.2 issue, the shipping and billing fields not working on my account when required field is empty
|
30 |
// temporary fix excluding required fields in my account
|
31 |
+
///add_filter('woocommerce_address_to_edit', array($this, 'add_my_account_fields'), 10, 2);
|
32 |
}
|
33 |
|
34 |
public static function instance()
|
readme.txt
CHANGED
@@ -4,9 +4,9 @@ Donate link: https://quadlayers.com/
|
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.5.0
|
7 |
-
Stable tag: 5.
|
8 |
WC requires at least: 3.1.0
|
9 |
-
WC tested up to: 4.3.
|
10 |
License: GPLv3
|
11 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
12 |
|
@@ -107,6 +107,10 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
110 |
= 5.1.9 =
|
111 |
* Fix: WordPress 5.5 compatibility
|
112 |
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.5.0
|
7 |
+
Stable tag: 5.2.0
|
8 |
WC requires at least: 3.1.0
|
9 |
+
WC tested up to: 4.3.3
|
10 |
License: GPLv3
|
11 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
12 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 5.2.0 =
|
111 |
+
* Fix: premium compatibility
|
112 |
+
* Fix: datepicker remove all days
|
113 |
+
|
114 |
= 5.1.9 =
|
115 |
* Fix: WordPress 5.5 compatibility
|
116 |
|
woocommerce-checkout-manager.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Checkout Manager for WooCommerce
|
5 |
* Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
|
6 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
7 |
-
* Version: 5.
|
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 Manager for WooCommerce');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
23 |
-
define('WOOCCM_PLUGIN_VERSION', '5.
|
24 |
}
|
25 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
26 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
4 |
* Plugin Name: Checkout Manager for WooCommerce
|
5 |
* Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
|
6 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
7 |
+
* Version: 5.2.0
|
8 |
* Author: QuadLayers
|
9 |
* Author URI: https://quadlayers.com
|
10 |
* License: GPLv3
|
20 |
define('WOOCCM_PLUGIN_NAME', 'Checkout Manager for WooCommerce');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
23 |
+
define('WOOCCM_PLUGIN_VERSION', '5.2.0');
|
24 |
}
|
25 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
26 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|