Version Description
- Improvement: unnecessary files removed
- Improvement: woocommerce checkout address fields required
- Improvement: woocommerce checkout address fields names
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 4.4.9 |
Comparing to | |
See all releases |
Code changes from version 4.4.8 to 4.4.9
- assets/js/wooccm-admin.js +31 -0
- assets/js/wooccm-admin.min.js +1 -1
- assets/js/wooccm-checkout.js +98 -4
- assets/js/wooccm-checkout.min.js +1 -1
- assets/js/wooccm-modal.js +107 -73
- assets/js/wooccm-modal.min.js +1 -1
- assets/js/wooccm-order-upload.js +4 -4
- assets/js/wooccm-order-upload.min.js +1 -1
- includes/checkout.php +0 -52
- includes/templates/admin/woocheckout-additional-clone.php +2 -2
- includes/templates/admin/woocheckout-billing-clone.php +2 -2
- includes/templates/admin/woocheckout-billing-tbody.php +4 -3
- includes/templates/admin/woocheckout-billing-thead.php +2 -1
- includes/templates/admin/woocheckout-shipping-clone.php +2 -2
- includes/templates/functions/add_functions.php +0 -337
- includes/templates/functions/billing_functions.php +0 -367
- includes/templates/functions/shipping_functions.php +0 -371
- new/fields_conditional.php +4 -129
- new/fields_display.php +4 -2
- new/fields_filters.php +36 -768
- new/fields_handler.php +15 -5
- new/fields_init.php +91 -48
- new/fields_register.php +6 -1
- new/install.php +1 -1
- readme.txt +6 -1
- woocommerce-checkout-manager.php +32 -22
assets/js/wooccm-admin.js
CHANGED
@@ -22,6 +22,15 @@
|
|
22 |
return o;
|
23 |
};
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
function getEnhancedSelectFormatString() {
|
26 |
return {
|
27 |
'language': {
|
@@ -67,6 +76,28 @@
|
|
67 |
};
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
$(document).on('wooccm-enhanced-select', function (e) {
|
71 |
|
72 |
$('.wooccm-enhanced-select').filter(':not(.enhanced)').each(function () {
|
22 |
return o;
|
23 |
};
|
24 |
|
25 |
+
function date_picker_select(datepicker) {
|
26 |
+
var option = $(datepicker).next().is('.hasDatepicker') ? 'minDate' : 'maxDate',
|
27 |
+
otherDateField = 'minDate' === option ? $(datepicker).next() : $(datepicker).prev(),
|
28 |
+
date = $(datepicker).datepicker('getDate');
|
29 |
+
|
30 |
+
$(otherDateField).datepicker('option', option, date);
|
31 |
+
$(datepicker).change();
|
32 |
+
}
|
33 |
+
|
34 |
function getEnhancedSelectFormatString() {
|
35 |
return {
|
36 |
'language': {
|
76 |
};
|
77 |
}
|
78 |
|
79 |
+
$(document).on('wooccm-enhanced-select', function (e) {
|
80 |
+
|
81 |
+
$('.wooccm-enhanced-between-dates').filter(':not(.enhanced)').each(function () {
|
82 |
+
|
83 |
+
$(this).find('input').datepicker({
|
84 |
+
defaultDate: '',
|
85 |
+
dateFormat: 'yy-mm-dd',
|
86 |
+
numberOfMonths: 1,
|
87 |
+
showButtonPanel: true,
|
88 |
+
onSelect: function () {
|
89 |
+
date_picker_select($(this));
|
90 |
+
}
|
91 |
+
});
|
92 |
+
|
93 |
+
$(this).find('input').each(function () {
|
94 |
+
date_picker_select($(this));
|
95 |
+
});
|
96 |
+
|
97 |
+
});
|
98 |
+
|
99 |
+
});
|
100 |
+
|
101 |
$(document).on('wooccm-enhanced-select', function (e) {
|
102 |
|
103 |
$('.wooccm-enhanced-select').filter(':not(.enhanced)').each(function () {
|
assets/js/wooccm-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(b){b.fn.serializeArrayAll=function(){var
|
1 |
+
(function(b){b.fn.serializeArrayAll=function(){var f={};var e=this.serializeArray();b.each(e,function(){if(f[this.name]!==undefined){if(!f[this.name].push){f[this.name]=[f[this.name]]}f[this.name].push(this.value||"")}else{f[this.name]=this.value||""}});var d=b("input[type=radio],input[type=checkbox]",this);b.each(d,function(){if(!f.hasOwnProperty(this.name)){f[this.name]=""}});return f};function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-select").filter(":not(.enhanced)").each(function(){var e=b.extend({minimumResultsForSearch:10,allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder")},a());b(this).selectWoo(e).addClass("enhanced")});b(".wooccm-product-search").filter(":not(.enhanced)").each(function(){var g={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):"3",escapeMarkup:function(h){return h},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(h){return{term:h.term,action:b(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:b(this).select2("val")||0,exclude:b(this).data("exclude"),include:b(this).data("include"),limit:b(this).data("limit"),display_stock:b(this).data("display_stock")}},processResults:function(i){var h=[];if(i){b.each(i,function(k,j){h.push({id:k,text:j})})}return{results:h}},cache:true}};g=b.extend(g,a());b(this).selectWoo(g).addClass("enhanced");if(b(this).data("sortable")){var f=b(this);var e=b(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){b(e.find(".select2-selection__choice").get().reverse()).each(function(){var i=b(this).data("data").id;var h=f.find('option[value="'+i+'"]')[0];f.prepend(h)})}})}else{if(b(this).prop("multiple")){b(this).on("change",function(){var h=b(this).children();h.sort(function(j,i){var l=j.text.toLowerCase();var k=i.text.toLowerCase();if(l>k){return 1}if(l<k){return -1}return 0});b(this).html(h)})}}})});b(document).on("click",".wooccm-field-toggle-enabled",function(){var d=b(this),f=d.closest("tr"),e=d.find(".woocommerce-input-toggle");b.ajax({url:woocommerce_admin.ajax_url,data:{action:"wooccm_toggle_field_enabled",nonce:wooccm.nonce,field_id:f.data("field_id")},dataType:"json",type:"POST",beforeSend:function(g){e.addClass("woocommerce-input-toggle--loading")},success:function(g){if(true===g.data){e.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");e.addClass("woocommerce-input-toggle--enabled");e.removeClass("woocommerce-input-toggle--loading")}else{if(true!==g.data){e.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");e.addClass("woocommerce-input-toggle--disabled");e.removeClass("woocommerce-input-toggle--loading")}}}});return false})})(jQuery);
|
assets/js/wooccm-checkout.js
CHANGED
@@ -14,9 +14,11 @@
|
|
14 |
});
|
15 |
}
|
16 |
};
|
|
|
17 |
var unblock = function ($node) {
|
18 |
$node.removeClass('processing').unblock();
|
19 |
};
|
|
|
20 |
var append_image = function (list, i, source, name, filetype) {
|
21 |
|
22 |
var $field_list = $(list),
|
@@ -57,6 +59,44 @@
|
|
57 |
}
|
58 |
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
// Field
|
61 |
// ---------------------------------------------------------------------------
|
62 |
|
@@ -154,7 +194,7 @@
|
|
154 |
if (window.FormData && fileList[$field.attr('id')].length) {
|
155 |
|
156 |
if (!is_blocked($form)) {
|
157 |
-
$place_order.html(wooccm.uploading);
|
158 |
block($form);
|
159 |
}
|
160 |
|
@@ -193,7 +233,7 @@
|
|
193 |
processData: false,
|
194 |
contentType: false,
|
195 |
beforeSend: function (response) {
|
196 |
-
//$place_order.html(wooccm.uploading);
|
197 |
},
|
198 |
success: function (response) {
|
199 |
//$results.removeClass('woocommerce-message');
|
@@ -295,6 +335,54 @@
|
|
295 |
|
296 |
});
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
// Color fields
|
299 |
// ---------------------------------------------------------------------------
|
300 |
|
@@ -303,20 +391,26 @@
|
|
303 |
var $field = $(field),
|
304 |
$input = $field.find('input[type=text]'),
|
305 |
$container = $field.find('.wooccmcolorpicker_container');
|
|
|
306 |
$input.hide();
|
|
|
307 |
if ($.isFunction($.fn.farbtastic)) {
|
|
|
308 |
$container.farbtastic('#' + $input.attr('id'));
|
|
|
309 |
$container.on('click', function (e) {
|
310 |
$input.fadeIn();
|
311 |
});
|
|
|
312 |
}
|
313 |
|
314 |
});
|
|
|
315 |
$('.wooccm-colorpicker-iris').each(function (i, field) {
|
316 |
|
317 |
var $field = $(field),
|
318 |
-
$input = $field.find('input[type=text]')
|
319 |
-
|
320 |
|
321 |
$input.css('color', '#fff').css('background', $input.val()).hide();
|
322 |
|
14 |
});
|
15 |
}
|
16 |
};
|
17 |
+
|
18 |
var unblock = function ($node) {
|
19 |
$node.removeClass('processing').unblock();
|
20 |
};
|
21 |
+
|
22 |
var append_image = function (list, i, source, name, filetype) {
|
23 |
|
24 |
var $field_list = $(list),
|
59 |
}
|
60 |
|
61 |
|
62 |
+
function field_is_required(field, is_required) {
|
63 |
+
if (is_required) {
|
64 |
+
field.find('label .optional').remove();
|
65 |
+
field.addClass('validate-required');
|
66 |
+
|
67 |
+
if (field.find('label .required').length === 0) {
|
68 |
+
field.find('label').append(
|
69 |
+
' <abbr class="required" title="' +
|
70 |
+
wc_address_i18n_params.i18n_required_text +
|
71 |
+
'">*</abbr>'
|
72 |
+
);
|
73 |
+
}
|
74 |
+
} else {
|
75 |
+
field.find('label .required').remove();
|
76 |
+
field.removeClass('validate-required woocommerce-invalid woocommerce-invalid-required-field');
|
77 |
+
|
78 |
+
if (field.find('label .optional').length === 0) {
|
79 |
+
field.find('label').append(' <span class="optional">(' + wc_address_i18n_params.i18n_optional_text + ')</span>');
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
$(document).on('country_to_state_changing', function (event, country, wrapper) {
|
86 |
+
|
87 |
+
var thisform = wrapper, thislocale;
|
88 |
+
|
89 |
+
var locale_fields = $.parseJSON(wc_address_i18n_params.locale_fields);
|
90 |
+
|
91 |
+
$.each(locale_fields, function (key, value) {
|
92 |
+
|
93 |
+
var field = thisform.find(value),
|
94 |
+
required = field.find('[data-required]').data('required') || 0;
|
95 |
+
|
96 |
+
field_is_required(field, required);
|
97 |
+
});
|
98 |
+
|
99 |
+
});
|
100 |
// Field
|
101 |
// ---------------------------------------------------------------------------
|
102 |
|
194 |
if (window.FormData && fileList[$field.attr('id')].length) {
|
195 |
|
196 |
if (!is_blocked($form)) {
|
197 |
+
$place_order.html(wooccm.message.uploading);
|
198 |
block($form);
|
199 |
}
|
200 |
|
233 |
processData: false,
|
234 |
contentType: false,
|
235 |
beforeSend: function (response) {
|
236 |
+
//$place_order.html(wooccm.message.uploading);
|
237 |
},
|
238 |
success: function (response) {
|
239 |
//$results.removeClass('woocommerce-message');
|
335 |
|
336 |
});
|
337 |
|
338 |
+
// Datepicker fields
|
339 |
+
// ---------------------------------------------------------------------------
|
340 |
+
|
341 |
+
$('.wooccm-type-datepicker').each(function (i, field) {
|
342 |
+
|
343 |
+
var $field = $(field),
|
344 |
+
$input = $field.find('input[type=text]');
|
345 |
+
|
346 |
+
if ($.isFunction($.fn.datepicker)) {
|
347 |
+
|
348 |
+
$input.datepicker({
|
349 |
+
dateFormat: $input.data('formatdate') || 'dd-mm-yy',
|
350 |
+
minDate: $input.data('mindate') || undefined,
|
351 |
+
maxDate: $input.data('maxdate') || undefined,
|
352 |
+
beforeShowDay: function (date) {
|
353 |
+
var day = date.getDay(),
|
354 |
+
disable = $input.data('disable') || false;
|
355 |
+
|
356 |
+
if (!disable) {
|
357 |
+
return [true]
|
358 |
+
} else {
|
359 |
+
return [disable[day] !== undefined];
|
360 |
+
}
|
361 |
+
}
|
362 |
+
});
|
363 |
+
}
|
364 |
+
|
365 |
+
});
|
366 |
+
|
367 |
+
// Timepicker fields
|
368 |
+
// ---------------------------------------------------------------------------
|
369 |
+
|
370 |
+
$('.wooccm-type-timepicker').each(function (i, field) {
|
371 |
+
|
372 |
+
var $field = $(field),
|
373 |
+
$input = $field.find('input[type=text]');
|
374 |
+
|
375 |
+
if ($.isFunction($.fn.timepicker)) {
|
376 |
+
$input.timepicker({
|
377 |
+
showPeriod: true,
|
378 |
+
showLeadingZero: true,
|
379 |
+
hours: $input.data('hours') || undefined,
|
380 |
+
minutes: $input.data('minutes') || undefined,
|
381 |
+
});
|
382 |
+
}
|
383 |
+
|
384 |
+
});
|
385 |
+
|
386 |
// Color fields
|
387 |
// ---------------------------------------------------------------------------
|
388 |
|
391 |
var $field = $(field),
|
392 |
$input = $field.find('input[type=text]'),
|
393 |
$container = $field.find('.wooccmcolorpicker_container');
|
394 |
+
|
395 |
$input.hide();
|
396 |
+
|
397 |
if ($.isFunction($.fn.farbtastic)) {
|
398 |
+
|
399 |
$container.farbtastic('#' + $input.attr('id'));
|
400 |
+
|
401 |
$container.on('click', function (e) {
|
402 |
$input.fadeIn();
|
403 |
});
|
404 |
+
|
405 |
}
|
406 |
|
407 |
});
|
408 |
+
|
409 |
$('.wooccm-colorpicker-iris').each(function (i, field) {
|
410 |
|
411 |
var $field = $(field),
|
412 |
+
$input = $field.find('input[type=text]');//,
|
413 |
+
//$container = $field.find('.wooccmcolorpicker_container');
|
414 |
|
415 |
$input.css('color', '#fff').css('background', $input.val()).hide();
|
416 |
|
assets/js/wooccm-checkout.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(
|
1 |
+
(function(e){var f=function(h){return h.is(".processing")||h.parents(".processing").length};var g=function(h){if(!f(h)){h.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(h){h.removeClass("processing").unblock()};var d=function(n,l,m,h,k){var o=e(n),p;if(k.match("image.*")){p="image"}else{if(k.match("application/ms.*")){m=wooccm.icons.spreadsheet;p="spreadsheet"}else{if(k.match("application/x.*")){m=wooccm.icons.archive;p="application"}else{if(k.match("audio.*")){m=wooccm.icons.audio;p="audio"}else{if(k.match("text.*")){m=wooccm.icons.text;p="text"}else{if(k.match("video.*")){m=wooccm.icons.video;p="video"}else{m=wooccm.icons.interactive;p="interactive"}}}}}}var j='<span data-file_id="'+l+'" title="'+h+'" class="wooccmupload_file">\n <span class="wooccmupload_file_container">\n <a title="'+h+'" class="wooccmupload_file_delete" class="wooccm_dele wooccm-btn wooccm-btn-danger">×</a>\n <span class="wooccmupload_file_image_container">\n <img class="'+p+'" alt="'+h+'" src="'+m+'"/>\n </span>\n </span>\n </span>';o.append(j).fadeIn()};function b(i,h){if(h){i.find("label .optional").remove();i.addClass("validate-required");if(i.find("label .required").length===0){i.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')}}else{i.find("label .required").remove();i.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field");if(i.find("label .optional").length===0){i.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>")}}}e(document).on("country_to_state_changing",function(i,k,m){var j=m,h;var l=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(l,function(n,o){var p=j.find(o),q=p.find("[data-required]").data("required")||0;b(p,q)})});var c=[];e(".wooccmupload-field").each(function(j,m){var k=e(m),l=k.find("[type=file]"),h=k.find(".wooccmupload_button"),n=k.find(".wooccmupload_list");c[k.attr("id")]=[];h.on("click",function(i){i.preventDefault();l.trigger("click")});n.on("click",".wooccmupload_file_delete",function(i){e(this).closest(".wooccmupload_file").remove()});l.on("change",function(o){var i=e(this)[0].files;if(i.length){if(window.FileReader){e.each(i,function(q,p){var r=n.find("span[data-file_id]").length+q;if(r>=wooccm.limit.max_files){alert("Exeeds max files limit of "+wooccm.limit.max_files);return false}if(p.size>wooccm.limit.max_file_size){alert("Exeeds max file size of "+wooccm.limit.max_file_size);return true}reader=new FileReader();reader.onload=(function(s){return function(t){setTimeout(function(){d(n,c[k.attr("id")].push(p)-1,t.target.result,s.name,s.type)},200)}})(p);console.log(p.name);reader.readAsDataURL(p)})}}})});e("#order_review").on("ajaxSuccess",function(l){var k=e(l.target),j=k.find("#place_order"),i=e(".wooccmupload-field"),h=i.length;if(h){j.addClass("wooccm-upload-process")}});e(document).on("click","#place_order.wooccm-upload-process",function(l){l.preventDefault();var i=e("form.checkout"),k=e(this),j=e(".wooccmupload-field"),h=j.length;j.each(function(m,p){var n=e(p),r=n.find(".wooccmupload_field"),q=n.find(".wooccmupload_list");if(window.FormData&&c[n.attr("id")].length){if(!f(i)){k.html(wooccm.message.uploading);g(i)}var o=new FormData();q.find("span[data-file_id]").each(function(t,s){var u=e(s).data("file_id");if(t>wooccm.limit.max_files){console.log("Exeeds max files limit of "+wooccm.limit.max_files);return false}if(c[n.attr("id")][u]===undefined){console.log("Undefined "+u);return true}if(c[n.attr("id")][u].size>wooccm.limit.max_file_size){console.log("Exeeds max file size of "+wooccm.limit.max_files);return true}console.log("We're ready to upload "+c[n.attr("id")][u].name);o.append("wooccm_checkout_attachment_upload[]",c[n.attr("id")][u])});o.append("action","wooccm_checkout_attachment_upload");o.append("nonce",wooccm.nonce);e.ajax({async:false,url:wooccm.ajaxurl,type:"POST",cache:false,data:o,processData:false,contentType:false,beforeSend:function(s){},success:function(s){if(s.success){r.val(s.data)}else{e("body").trigger("update_checkout")}},complete:function(s){h=h-1}})}else{h=h-1}if(h==0){a(i);k.removeClass("wooccm-upload-process").trigger("click")}})});e(document).on("change",".wooccm-add-checkout-fees",function(h){e("body").trigger("update_checkout")});e(".wooccm-conditional-child").each(function(h,m){var j=e(m),l=e(".wooccm-field-"+j.find("[data-conditional-parent]").data("conditional-parent")),k=j.find("[data-conditional-parent-value]").data("conditional-parent-value");if(l.length){l.on("change keyup",function(o){var n=e(o.target),i=n.val();if(n.prop("type")=="checkbox"){i=n.is(":checked")}if(k==i||(e.isArray(i)&&i.indexOf(k)>-1)){j.fadeIn()}else{j.fadeOut()}});l.find("select").trigger("change");l.find("textarea").trigger("keyup");l.find("input[type=button]").trigger("click");l.find("input[type=radio]:checked").trigger("keyup");l.find("input[type=checkbox]:checked").trigger("keyup");l.find("input[type=color]").trigger("keyup");l.find("input[type=date]").trigger("keyup");l.find("input[type=datetime-local]").trigger("keyup");l.find("input[type=email]").trigger("keyup");l.find("input[type=file]").trigger("keyup");l.find("input[type=hidden]").trigger("keyup");l.find("input[type=image]").trigger("keyup");l.find("input[type=month]").trigger("keyup");l.find("input[type=number]").trigger("keyup");l.find("input[type=password]").trigger("keyup");l.find("input[type=range]").trigger("keyup");l.find("input[type=reset]").trigger("keyup");l.find("input[type=search]").trigger("keyup");l.find("input[type=submit]").trigger("keyup");l.find("input[type=tel]").trigger("keyup");l.find("input[type=text]").trigger("keyup");l.find("input[type=time]").trigger("keyup");l.find("input[type=url]").trigger("keyup");l.find("input[type=week]").trigger("keyup")}else{j.show()}});e(".wooccm-type-datepicker").each(function(h,k){var j=e(k),l=j.find("input[type=text]");if(e.isFunction(e.fn.datepicker)){l.datepicker({dateFormat:l.data("formatdate")||"dd-mm-yy",minDate:l.data("mindate")||undefined,maxDate:l.data("maxdate")||undefined,beforeShowDay:function(n){var i=n.getDay(),m=l.data("disable")||false;if(!m){return[true]}else{return[m[i]!==undefined]}}})}});e(".wooccm-type-timepicker").each(function(h,k){var j=e(k),l=j.find("input[type=text]");if(e.isFunction(e.fn.timepicker)){l.timepicker({showPeriod:true,showLeadingZero:true,hours:l.data("hours")||undefined,minutes:l.data("minutes")||undefined,})}});e(".wooccm-colorpicker-farbtastic").each(function(h,k){var j=e(k),m=j.find("input[type=text]"),l=j.find(".wooccmcolorpicker_container");m.hide();if(e.isFunction(e.fn.farbtastic)){l.farbtastic("#"+m.attr("id"));l.on("click",function(i){m.fadeIn()})}});e(".wooccm-colorpicker-iris").each(function(h,k){var j=e(k),l=j.find("input[type=text]");l.css("color","#fff").css("background",l.val()).hide();l.iris({wccmclass:l.attr("id"),palettes:true,color:"",hide:false,change:function(i,m){l.css("color","#000").css("background",m.color.toString()).fadeIn()}})})})(jQuery);
|
assets/js/wooccm-modal.js
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
(function ($) {
|
2 |
|
|
|
|
|
|
|
3 |
var is_blocked = function ($node) {
|
4 |
return $node.is('.processing') || $node.parents('.processing').length;
|
5 |
};
|
|
|
6 |
var block = function ($node) {
|
7 |
if (!is_blocked($node)) {
|
8 |
$node.addClass('processing').block({
|
@@ -14,35 +18,44 @@
|
|
14 |
});
|
15 |
}
|
16 |
};
|
|
|
17 |
var unblock = function ($node) {
|
18 |
$node.removeClass('processing').unblock();
|
19 |
};
|
20 |
-
|
21 |
-
var
|
22 |
-
|
23 |
-
};
|
24 |
-
|
25 |
-
|
|
|
26 |
events: {
|
27 |
-
'click .media-modal-backdrop': '
|
28 |
-
'click .media-modal-close': '
|
29 |
'click .media-modal-delete': 'Delete',
|
30 |
'click .media-modal-prev': 'update',
|
31 |
'click .media-modal-next': 'update',
|
32 |
-
'
|
|
|
33 |
},
|
34 |
templates: {},
|
35 |
-
initialize: function (
|
36 |
-
'
|
37 |
-
_.bindAll(this, 'open', 'update', 'render', 'Close', 'Save');
|
38 |
this.init();
|
39 |
-
this.open(
|
40 |
},
|
41 |
init: function () {
|
42 |
this.templates.window = wp.template('wpmi-modal-window');
|
43 |
},
|
44 |
-
render: function (
|
45 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
var $modal = this;
|
47 |
$.ajax({
|
48 |
url: woocommerce_admin.ajax_url,
|
@@ -51,7 +64,7 @@
|
|
51 |
nonce: wooccm.nonce,
|
52 |
//options_name: $tr.data('options_name'),
|
53 |
//options_key: $tr.data('options_key'),
|
54 |
-
field_id:
|
55 |
},
|
56 |
dataType: 'json',
|
57 |
type: 'POST',
|
@@ -66,110 +79,131 @@
|
|
66 |
},
|
67 |
success: function (response) {
|
68 |
console.log(response);
|
69 |
-
$modal
|
70 |
-
$modal
|
71 |
-
//$(document).on('focusin', $modal.preserveFocus);
|
72 |
-
$modal.$el.focus().trigger('wc-init-tabbed-panels');
|
73 |
-
$modal.$el.focus().trigger('init_tooltips');
|
74 |
-
///$modal.$el.focus().trigger('wc-enhanced-select-init');
|
75 |
-
$modal.$el.focus().trigger('wooccm-enhanced-select');
|
76 |
}
|
77 |
});
|
78 |
},
|
79 |
update: function (e) {
|
80 |
-
'use strict';
|
81 |
-
|
82 |
e.preventDefault();
|
83 |
|
84 |
-
var $
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
},
|
88 |
open: function (e) {
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
field_id = $tr.data('field_id');
|
93 |
-
this.render(field_id);
|
94 |
$('body').addClass('modal-open').append(this.$el);
|
95 |
},
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
105 |
e.preventDefault();
|
106 |
this.undelegateEvents();
|
107 |
$(document).off('focusin');
|
108 |
$('body').removeClass('modal-open');
|
109 |
this.remove();
|
110 |
-
wpmi.__instance = undefined;
|
111 |
},
|
112 |
-
|
113 |
-
|
114 |
e.preventDefault();
|
115 |
var $form = $(e.target),
|
116 |
$modal = this.$el,
|
117 |
-
$
|
118 |
-
//$spinner = settings-save-status
|
119 |
-
//console.log($form.serialize());
|
120 |
|
121 |
$.ajax({
|
122 |
url: woocommerce_admin.ajax_url,
|
123 |
data: {
|
124 |
action: 'wooccm_save_field',
|
125 |
nonce: wooccm.nonce,
|
126 |
-
field_id:
|
127 |
//options_name: $tr.data('options_name'),
|
128 |
//options_key: $tr.data('options_key'),
|
129 |
field_data: $form.serializeArrayAll()
|
130 |
},
|
131 |
-
//data: $.param({field_data: $form.serializeArrayAll()}) + '&' + $.param({action: 'wooccm_save_field'}) + '&' + $.param({nonce: wooccm.nonce}),
|
132 |
dataType: 'json',
|
133 |
type: 'POST',
|
134 |
beforeSend: function () {
|
135 |
-
$
|
136 |
-
block($modal);
|
137 |
},
|
138 |
complete: function () {
|
139 |
-
$
|
140 |
-
|
141 |
-
|
|
|
142 |
},
|
143 |
error: function () {
|
144 |
alert('Error!');
|
145 |
},
|
146 |
success: function (response) {
|
147 |
console.log(response);
|
148 |
-
//$modal.$el.attr('tabindex', '0');
|
149 |
-
//$modal.$el.html($modal.templates.window(response.data));
|
150 |
-
//$(document).on('focusin', $modal.preserveFocus);
|
151 |
-
//$modal.$el.focus().trigger('wc-init-tabbed-panels');
|
152 |
}
|
153 |
});
|
154 |
return false;
|
155 |
-
},
|
156 |
-
Delete: function (e) {
|
157 |
-
'use strict';
|
158 |
-
e.preventDefault();
|
159 |
-
var $modal = this;
|
160 |
-
$modal.Close(e);
|
161 |
}
|
162 |
});
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
});
|
|
|
169 |
$('.wooccm_billing_settings_edit').on('click', function (e) {
|
170 |
e.preventDefault();
|
171 |
-
|
172 |
-
|
173 |
-
}
|
174 |
});
|
|
|
|
|
175 |
})(jQuery);
|
1 |
(function ($) {
|
2 |
|
3 |
+
var count = 0,
|
4 |
+
timer;
|
5 |
+
|
6 |
var is_blocked = function ($node) {
|
7 |
return $node.is('.processing') || $node.parents('.processing').length;
|
8 |
};
|
9 |
+
|
10 |
var block = function ($node) {
|
11 |
if (!is_blocked($node)) {
|
12 |
$node.addClass('processing').block({
|
18 |
});
|
19 |
}
|
20 |
};
|
21 |
+
|
22 |
var unblock = function ($node) {
|
23 |
$node.removeClass('processing').unblock();
|
24 |
};
|
25 |
+
|
26 |
+
var Field = Backbone.Model.extend({
|
27 |
+
defaults: wooccm.fields.args
|
28 |
+
});
|
29 |
+
|
30 |
+
var FieldView = Backbone.View.extend({
|
31 |
+
id: 'wooccm_modal',
|
32 |
events: {
|
33 |
+
'click .media-modal-backdrop': 'close',
|
34 |
+
'click .media-modal-close': 'close',
|
35 |
'click .media-modal-delete': 'Delete',
|
36 |
'click .media-modal-prev': 'update',
|
37 |
'click .media-modal-next': 'update',
|
38 |
+
'change .media-modal-change': 'change',
|
39 |
+
'submit .media-modal-form': 'save',
|
40 |
},
|
41 |
templates: {},
|
42 |
+
initialize: function () {
|
43 |
+
_.bindAll(this, 'open', 'update', 'change', 'load', 'render', 'close', 'save');
|
|
|
44 |
this.init();
|
45 |
+
this.open();
|
46 |
},
|
47 |
init: function () {
|
48 |
this.templates.window = wp.template('wpmi-modal-window');
|
49 |
},
|
50 |
+
render: function () {
|
51 |
+
this.$el.attr('tabindex', '0');
|
52 |
+
this.$el.html(this.templates.window(this.model.attributes));
|
53 |
+
this.$el.focus().trigger('wc-init-tabbed-panels');
|
54 |
+
this.$el.focus().trigger('init_tooltips');
|
55 |
+
this.$el.focus().trigger('wooccm-enhanced-select');
|
56 |
+
},
|
57 |
+
load: function () {
|
58 |
+
|
59 |
var $modal = this;
|
60 |
$.ajax({
|
61 |
url: woocommerce_admin.ajax_url,
|
64 |
nonce: wooccm.nonce,
|
65 |
//options_name: $tr.data('options_name'),
|
66 |
//options_key: $tr.data('options_key'),
|
67 |
+
field_id: this.model.attributes.id
|
68 |
},
|
69 |
dataType: 'json',
|
70 |
type: 'POST',
|
79 |
},
|
80 |
success: function (response) {
|
81 |
console.log(response);
|
82 |
+
$modal.model.set(response.data)
|
83 |
+
$modal.render();
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
});
|
86 |
},
|
87 |
update: function (e) {
|
|
|
|
|
88 |
e.preventDefault();
|
89 |
|
90 |
+
var $modal = this,
|
91 |
+
$button = $(e.target),
|
92 |
+
field_id = $modal.model.get('id');
|
93 |
+
|
94 |
+
count++;
|
95 |
+
|
96 |
+
if (timer) {
|
97 |
+
clearTimeout(timer);
|
98 |
+
}
|
99 |
+
|
100 |
+
timer = setTimeout(function () {
|
101 |
+
|
102 |
+
if ($button.hasClass('media-modal-next')) {
|
103 |
+
field_id = field_id + count;
|
104 |
+
} else {
|
105 |
+
field_id = field_id - count;
|
106 |
+
}
|
107 |
+
|
108 |
+
$modal.model.set({
|
109 |
+
id: field_id
|
110 |
+
});
|
111 |
+
|
112 |
+
count = 0;
|
113 |
+
|
114 |
+
$modal.load();
|
115 |
+
|
116 |
+
}, 300);
|
117 |
},
|
118 |
open: function (e) {
|
119 |
+
|
120 |
+
this.load();
|
121 |
+
|
|
|
|
|
122 |
$('body').addClass('modal-open').append(this.$el);
|
123 |
},
|
124 |
+
change: function (e) {
|
125 |
+
|
126 |
+
e.preventDefault();
|
127 |
+
|
128 |
+
var $field = $(e.target),
|
129 |
+
name = $field.attr('name'),
|
130 |
+
value = $field.val();
|
131 |
+
|
132 |
+
this.model.attributes[name] = value;
|
133 |
+
|
134 |
+
this.render();
|
135 |
+
},
|
136 |
+
close: function (e) {
|
137 |
e.preventDefault();
|
138 |
this.undelegateEvents();
|
139 |
$(document).off('focusin');
|
140 |
$('body').removeClass('modal-open');
|
141 |
this.remove();
|
142 |
+
//wpmi.__instance = undefined;
|
143 |
},
|
144 |
+
save: function (e) {
|
145 |
+
|
146 |
e.preventDefault();
|
147 |
var $form = $(e.target),
|
148 |
$modal = this.$el,
|
149 |
+
$details = $modal.find('.attachment-details');
|
|
|
|
|
150 |
|
151 |
$.ajax({
|
152 |
url: woocommerce_admin.ajax_url,
|
153 |
data: {
|
154 |
action: 'wooccm_save_field',
|
155 |
nonce: wooccm.nonce,
|
156 |
+
field_id: this.model.attributes.id,
|
157 |
//options_name: $tr.data('options_name'),
|
158 |
//options_key: $tr.data('options_key'),
|
159 |
field_data: $form.serializeArrayAll()
|
160 |
},
|
|
|
161 |
dataType: 'json',
|
162 |
type: 'POST',
|
163 |
beforeSend: function () {
|
164 |
+
$details.addClass('save-waiting');
|
165 |
+
//block($modal);
|
166 |
},
|
167 |
complete: function () {
|
168 |
+
$details.addClass('save-complete');
|
169 |
+
$details.removeClass('save-waiting');
|
170 |
+
//unblock($modal);
|
171 |
+
//$modal.close(e);
|
172 |
},
|
173 |
error: function () {
|
174 |
alert('Error!');
|
175 |
},
|
176 |
success: function (response) {
|
177 |
console.log(response);
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
});
|
180 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
});
|
183 |
+
|
184 |
+
var FieldModal = Backbone.View.extend({
|
185 |
+
initialize: function (e) {
|
186 |
+
|
187 |
+
var $button = $(e.target),
|
188 |
+
field_id = $button.closest('[data-field_id]').data('field_id');
|
189 |
+
|
190 |
+
var model = new Field();
|
191 |
+
|
192 |
+
model.set({
|
193 |
+
id: field_id
|
194 |
+
});
|
195 |
+
|
196 |
+
new FieldView({
|
197 |
+
model: model
|
198 |
+
});
|
199 |
+
},
|
200 |
});
|
201 |
+
|
202 |
$('.wooccm_billing_settings_edit').on('click', function (e) {
|
203 |
e.preventDefault();
|
204 |
+
|
205 |
+
new FieldModal(e);
|
|
|
206 |
});
|
207 |
+
|
208 |
+
|
209 |
})(jQuery);
|
assets/js/wooccm-modal.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(
|
1 |
+
(function(e){var g=0,b;var d=function(j){return j.is(".processing")||j.parents(".processing").length};var c=function(j){if(!d(j)){j.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var f=function(j){j.removeClass("processing").unblock()};var h=Backbone.Model.extend({defaults:wooccm.fields.args});var i=Backbone.View.extend({id:"wooccm_modal",events:{"click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-delete":"Delete","click .media-modal-prev":"update","click .media-modal-next":"update","change .media-modal-change":"change","submit .media-modal-form":"save",},templates:{},initialize:function(){_.bindAll(this,"open","update","change","load","render","close","save");this.init();this.open()},init:function(){this.templates.window=wp.template("wpmi-modal-window")},render:function(){this.$el.attr("tabindex","0");this.$el.html(this.templates.window(this.model.attributes));this.$el.focus().trigger("wc-init-tabbed-panels");this.$el.focus().trigger("init_tooltips");this.$el.focus().trigger("wooccm-enhanced-select")},load:function(){var j=this;e.ajax({url:woocommerce_admin.ajax_url,data:{action:"wooccm_edit_field",nonce:wooccm.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(k){console.log(k);j.model.set(k.data);j.render()}})},update:function(m){m.preventDefault();var j=this,l=e(m.target),k=j.model.get("id");g++;if(b){clearTimeout(b)}b=setTimeout(function(){if(l.hasClass("media-modal-next")){k=k+g}else{k=k-g}j.model.set({id:k});g=0;j.load()},300)},open:function(j){this.load();e("body").addClass("modal-open").append(this.$el)},change:function(m){m.preventDefault();var k=e(m.target),j=k.attr("name"),l=k.val();this.model.attributes[j]=l;this.render()},close:function(j){j.preventDefault();this.undelegateEvents();e(document).off("focusin");e("body").removeClass("modal-open");this.remove()},save:function(m){m.preventDefault();var k=e(m.target),l=this.$el,j=l.find(".attachment-details");e.ajax({url:woocommerce_admin.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm.nonce,field_id:this.model.attributes.id,field_data:k.serializeArrayAll()},dataType:"json",type:"POST",beforeSend:function(){j.addClass("save-waiting")},complete:function(){j.addClass("save-complete");j.removeClass("save-waiting")},error:function(){alert("Error!")},success:function(n){console.log(n)}});return false}});var a=Backbone.View.extend({initialize:function(m){var l=e(m.target),k=l.closest("[data-field_id]").data("field_id");var j=new h();j.set({id:k});new i({model:j})},});e(".wooccm_billing_settings_edit").on("click",function(j){j.preventDefault();new a(j)})})(jQuery);
|
assets/js/wooccm-order-upload.js
CHANGED
@@ -47,11 +47,11 @@
|
|
47 |
all_attachments_ids: $('#all_attachments_ids').val()
|
48 |
},
|
49 |
beforeSend: function (response) {
|
50 |
-
$('.wccm_results').html(wooccm.saving);
|
51 |
},
|
52 |
success: function (response) {
|
53 |
if (response.success) {
|
54 |
-
$('.wccm_results').html(wooccm.deleted);
|
55 |
} else {
|
56 |
$('.wccm_results').html(response.data);
|
57 |
}
|
@@ -110,7 +110,7 @@
|
|
110 |
contentType: false,
|
111 |
beforeSend: function (response) {
|
112 |
|
113 |
-
$('.wccm_results').html(wooccm.uploading);
|
114 |
|
115 |
block($('#wooccm_order_attachment_inner'));
|
116 |
},
|
@@ -118,7 +118,7 @@
|
|
118 |
|
119 |
if (response.success) {
|
120 |
$('#wooccm_order_attachment_inner').replaceWith(response.data);
|
121 |
-
$('.wccm_results').html(wooccm.success);
|
122 |
} else {
|
123 |
$('.wccm_results').html(response.data);
|
124 |
}
|
47 |
all_attachments_ids: $('#all_attachments_ids').val()
|
48 |
},
|
49 |
beforeSend: function (response) {
|
50 |
+
$('.wccm_results').html(wooccm.message.saving);
|
51 |
},
|
52 |
success: function (response) {
|
53 |
if (response.success) {
|
54 |
+
$('.wccm_results').html(wooccm.message.deleted);
|
55 |
} else {
|
56 |
$('.wccm_results').html(response.data);
|
57 |
}
|
110 |
contentType: false,
|
111 |
beforeSend: function (response) {
|
112 |
|
113 |
+
$('.wccm_results').html(wooccm.message.uploading);
|
114 |
|
115 |
block($('#wooccm_order_attachment_inner'));
|
116 |
},
|
118 |
|
119 |
if (response.success) {
|
120 |
$('#wooccm_order_attachment_inner').replaceWith(response.data);
|
121 |
+
$('.wccm_results').html(wooccm.message.success);
|
122 |
} else {
|
123 |
$('.wccm_results').html(response.data);
|
124 |
}
|
assets/js/wooccm-order-upload.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(b){var c=function(e){return e.is(".processing")||e.parents(".processing").length};var d=function(e){if(!c(e)){e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(e){e.removeClass("processing").unblock()};b(document).ready(function(e){e(document).on("click",".wooccm_delete_attachment",function(h){var g=e(this).closest("tr"),f=e(this).data("attachment_id");g.hide();e("#wooccm_order_attachment_update").prop("disabled",false);e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(f,""))});e(document).on("click","#wooccm_order_attachment_update",function(f){e.ajax({url:wooccm.ajaxurl,type:"POST",cache:false,data:{action:"wooccm_order_attachment_update",nonce:wooccm.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(g){e(".wccm_results").html(wooccm.saving)},success:function(g){if(g.success){e(".wccm_results").html(wooccm.deleted)}else{e(".wccm_results").html(g.data)}}})});e(document).on("change","#wooccm_order_attachment_upload",function(m){var l=false,n=e(this).data("order_id");if(window.FormData){l=new FormData()}var k=0,g=this.files.length,h,f,j;for(;k<g;k++){j=this.files[k];if(l){l.append("wooccm_order_attachment_upload[]",j)}}if(l){l.append("action","wooccm_order_attachment_upload");l.append("nonce",wooccm.nonce);l.append("order_id",n);e.ajax({url:wooccm.ajaxurl,type:"POST",cache:false,data:l,processData:false,contentType:false,beforeSend:function(i){e(".wccm_results").html(wooccm.uploading);d(e("#wooccm_order_attachment_inner"))},success:function(i){if(i.success){e("#wooccm_order_attachment_inner").replaceWith(i.data);e(".wccm_results").html(wooccm.success)}else{e(".wccm_results").html(i.data)}a(e("#wooccm_order_attachment_inner"))}})}})})})(jQuery);
|
1 |
+
(function(b){var c=function(e){return e.is(".processing")||e.parents(".processing").length};var d=function(e){if(!c(e)){e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(e){e.removeClass("processing").unblock()};b(document).ready(function(e){e(document).on("click",".wooccm_delete_attachment",function(h){var g=e(this).closest("tr"),f=e(this).data("attachment_id");g.hide();e("#wooccm_order_attachment_update").prop("disabled",false);e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(f,""))});e(document).on("click","#wooccm_order_attachment_update",function(f){e.ajax({url:wooccm.ajaxurl,type:"POST",cache:false,data:{action:"wooccm_order_attachment_update",nonce:wooccm.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(g){e(".wccm_results").html(wooccm.message.saving)},success:function(g){if(g.success){e(".wccm_results").html(wooccm.message.deleted)}else{e(".wccm_results").html(g.data)}}})});e(document).on("change","#wooccm_order_attachment_upload",function(m){var l=false,n=e(this).data("order_id");if(window.FormData){l=new FormData()}var k=0,g=this.files.length,h,f,j;for(;k<g;k++){j=this.files[k];if(l){l.append("wooccm_order_attachment_upload[]",j)}}if(l){l.append("action","wooccm_order_attachment_upload");l.append("nonce",wooccm.nonce);l.append("order_id",n);e.ajax({url:wooccm.ajaxurl,type:"POST",cache:false,data:l,processData:false,contentType:false,beforeSend:function(i){e(".wccm_results").html(wooccm.message.uploading);d(e("#wooccm_order_attachment_inner"))},success:function(i){if(i.success){e("#wooccm_order_attachment_inner").replaceWith(i.data);e(".wccm_results").html(wooccm.message.success)}else{e(".wccm_results").html(i.data)}a(e("#wooccm_order_attachment_inner"))}})}})})})(jQuery);
|
includes/checkout.php
CHANGED
@@ -1,57 +1,5 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
// Decides where the Additional Checkout fields appear on the Checkout page
|
4 |
-
/*
|
5 |
-
* 1326
|
6 |
-
* function wooccm_checkout_additional_positioning() {
|
7 |
-
|
8 |
-
$options = get_option( 'wccs_settings' );
|
9 |
-
// Defaults to after_order_notes
|
10 |
-
$position = ( !empty( $options['checkness']['position'] ) ? sanitize_text_field( $options['checkness']['position'] ) : 'after_order_notes' );
|
11 |
-
switch( $position ) {
|
12 |
-
|
13 |
-
case 'before_shipping_form':
|
14 |
-
case 'after_shipping_form':
|
15 |
-
case 'before_billing_form':
|
16 |
-
case 'after_billing_form':
|
17 |
-
case 'after_order_notes':
|
18 |
-
return $position;
|
19 |
-
break;
|
20 |
-
|
21 |
-
}
|
22 |
-
|
23 |
-
} */
|
24 |
-
|
25 |
-
/*
|
26 |
-
* 1326
|
27 |
-
* break i18 address required field
|
28 |
-
* function wooccm_checkout_default_address_fields( $fields = array() ) {
|
29 |
-
|
30 |
-
|
31 |
-
// Billing fields
|
32 |
-
$options = get_option( 'wccs_settings3' );
|
33 |
-
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
34 |
-
|
35 |
-
if( empty( $buttons ) )
|
36 |
-
return $fields;
|
37 |
-
|
38 |
-
foreach( $buttons as $btn ) {
|
39 |
-
|
40 |
-
if( !empty( $btn['cow'] ) && empty( $btn['deny_checkout'] ) ) {
|
41 |
-
$key = $btn['cow'];
|
42 |
-
|
43 |
-
if( isset( $fields[$key] ) )
|
44 |
-
$fields[$key]['required'] = ( isset( $btn['checkbox'] ) ? absint( $btn['checkbox'] ) : ( isset( $fields[$key]['required'] ) ? absint( $fields[$key]['required'] ) : false ) );
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
}
|
49 |
-
|
50 |
-
return $fields;
|
51 |
-
|
52 |
-
}
|
53 |
-
*/
|
54 |
-
|
55 |
function wooccm_autocreate_account($fields) {
|
56 |
|
57 |
$options = get_option('wccs_settings');
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function wooccm_autocreate_account($fields) {
|
4 |
|
5 |
$options = get_option('wccs_settings');
|
includes/templates/admin/woocheckout-additional-clone.php
CHANGED
@@ -133,11 +133,11 @@ if ( !defined( 'ABSPATH' ) )
|
|
133 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
134 |
|
135 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change_tog hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Swapper Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
136 |
-
|
137 |
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
138 |
|
139 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e( 'Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
140 |
-
|
141 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e( 'Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
142 |
|
143 |
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e( 'More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
133 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
134 |
|
135 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change_tog hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Swapper Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
136 |
+
<!--
|
137 |
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
138 |
|
139 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e( 'Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
140 |
+
-->
|
141 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e( 'Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
142 |
|
143 |
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e( 'More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
includes/templates/admin/woocheckout-billing-clone.php
CHANGED
@@ -127,11 +127,11 @@ if ( !defined( 'ABSPATH' ) )
|
|
127 |
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1||Option 2||Option 3" /></td>
|
128 |
|
129 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
130 |
-
|
131 |
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
132 |
|
133 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
134 |
-
|
135 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
136 |
|
137 |
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
127 |
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1||Option 2||Option 3" /></td>
|
128 |
|
129 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
130 |
+
<!--
|
131 |
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
132 |
|
133 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
134 |
+
-->
|
135 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
136 |
|
137 |
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
includes/templates/admin/woocheckout-billing-tbody.php
CHANGED
@@ -230,14 +230,15 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
230 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
231 |
<?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?>
|
232 |
</td>
|
233 |
-
|
234 |
-
|
235 |
<?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?>
|
236 |
</td>
|
237 |
|
238 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;">
|
239 |
-
<?php _e('Date Toggler', 'woocommerce-checkout-manager' );
|
240 |
</td>
|
|
|
241 |
|
242 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1">
|
243 |
<?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?>
|
230 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
231 |
<?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?>
|
232 |
</td>
|
233 |
+
<!--
|
234 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
235 |
<?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?>
|
236 |
</td>
|
237 |
|
238 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;">
|
239 |
+
<?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?>
|
240 |
</td>
|
241 |
+
-->
|
242 |
|
243 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1">
|
244 |
<?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?>
|
includes/templates/admin/woocheckout-billing-thead.php
CHANGED
@@ -116,7 +116,8 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
116 |
|
117 |
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
118 |
|
119 |
-
|
|
|
120 |
|
121 |
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_days hide_stuff_color_tog hide_stuff_op more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
122 |
-->
|
116 |
|
117 |
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
118 |
|
119 |
+
<!--
|
120 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_opcheck hide_stuff_op hide_stuff_change hide_stuff_time_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
121 |
|
122 |
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_days hide_stuff_color_tog hide_stuff_op more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
123 |
-->
|
includes/templates/admin/woocheckout-shipping-clone.php
CHANGED
@@ -128,11 +128,11 @@ if ( !defined( 'ABSPATH' ) )
|
|
128 |
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1||Option 2||Option 3" /></td>
|
129 |
|
130 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
131 |
-
|
132 |
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
133 |
|
134 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
135 |
-
|
136 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
137 |
|
138 |
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
128 |
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1||Option 2||Option 3" /></td>
|
129 |
|
130 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
131 |
+
<!--
|
132 |
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
133 |
|
134 |
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
135 |
+
-->
|
136 |
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
137 |
|
138 |
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
includes/templates/functions/add_functions.php
DELETED
@@ -1,337 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
-
*/
|
5 |
-
// Exit if accessed directly
|
6 |
-
if (!defined('ABSPATH'))
|
7 |
-
exit;
|
8 |
-
|
9 |
-
function wooccm_scripts() {
|
10 |
-
|
11 |
-
global $woocommerce;
|
12 |
-
|
13 |
-
$options = get_option('wccs_settings');
|
14 |
-
|
15 |
-
$saved = WC()->session->get('wooccm_retain', array());
|
16 |
-
|
17 |
-
// Check if we have any buttons
|
18 |
-
if (empty($options['buttons']))
|
19 |
-
return;
|
20 |
-
|
21 |
-
foreach ($options['buttons'] as $btn) {
|
22 |
-
|
23 |
-
if ($btn['type'] == 'datepicker') {
|
24 |
-
echo '
|
25 |
-
<script type="text/javascript">
|
26 |
-
jQuery(document).ready(function() {
|
27 |
-
var today = new Date();
|
28 |
-
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
29 |
-
jQuery("input#' . $btn['cow'] . '").datepicker({
|
30 |
-
';
|
31 |
-
// Default date format
|
32 |
-
if (empty($btn['format_date']))
|
33 |
-
$btn['format_date'] = apply_filters('wooccm_datepicker_default_date_format', 'dd-mm-yy');
|
34 |
-
if (!empty($btn['format_date'])) {
|
35 |
-
echo 'dateFormat : "' . str_replace(' ', '', $btn['format_date']) . '",';
|
36 |
-
}
|
37 |
-
if (!empty($btn['single_yy'])) {
|
38 |
-
echo 'minDate: new Date( ' . $btn['single_yy'] . ', ' . $btn['single_mm'] . ' - 1, ' . $btn['single_dd'] . '),';
|
39 |
-
}
|
40 |
-
if (!empty($btn['min_before'])) {
|
41 |
-
echo 'minDate: ' . $btn['min_before'] . ',';
|
42 |
-
}
|
43 |
-
if (!empty($btn['single_max_yy'])) {
|
44 |
-
echo 'maxDate: new Date( ' . $btn['single_max_yy'] . ', ' . $btn['single_max_mm'] . ' - 1, ' . $btn['single_max_dd'] . '),';
|
45 |
-
}
|
46 |
-
if (!empty($btn['max_after'])) {
|
47 |
-
echo 'maxDate: ' . $btn['max_after'] . ',';
|
48 |
-
}
|
49 |
-
if (!empty($btn['days_disabler'])) {
|
50 |
-
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
51 |
-
if (!empty($btn['days_disabler0'])) {
|
52 |
-
echo 'day == 0';
|
53 |
-
} else {
|
54 |
-
echo 'day == "x"';
|
55 |
-
}
|
56 |
-
if (!empty($btn['days_disabler1'])) {
|
57 |
-
echo ' || day == 1';
|
58 |
-
}
|
59 |
-
if (!empty($btn['days_disabler2'])) {
|
60 |
-
echo ' || day == 2';
|
61 |
-
}
|
62 |
-
if (!empty($btn['days_disabler3'])) {
|
63 |
-
echo ' || day == 3';
|
64 |
-
}
|
65 |
-
if (!empty($btn['days_disabler4'])) {
|
66 |
-
echo ' || day == 4';
|
67 |
-
}
|
68 |
-
if (!empty($btn['days_disabler5'])) {
|
69 |
-
echo ' || day == 5';
|
70 |
-
}
|
71 |
-
if (!empty($btn['days_disabler6'])) {
|
72 |
-
echo '|| day == 6';
|
73 |
-
}
|
74 |
-
echo ')]; }';
|
75 |
-
}
|
76 |
-
do_action('wooccm_js_datepicker_additional_args', $btn);
|
77 |
-
echo '
|
78 |
-
});
|
79 |
-
}
|
80 |
-
});
|
81 |
-
</script>
|
82 |
-
';
|
83 |
-
}
|
84 |
-
|
85 |
-
if ($btn['type'] == 'time') {
|
86 |
-
$args = '
|
87 |
-
showPeriod: true,';
|
88 |
-
if (!empty($btn['start_hour'])) {
|
89 |
-
$args .= '
|
90 |
-
hours: { starts: ' . $btn['start_hour'] . ', ends: ' . $btn['end_hour'] . ' },';
|
91 |
-
}
|
92 |
-
if (!empty($btn['interval_min'])) {
|
93 |
-
$args .= '
|
94 |
-
minutes: {interval: ' . $btn['interval_min'] . ', manual: [' . $btn['manual_min'] . '] },';
|
95 |
-
}
|
96 |
-
$args .= '
|
97 |
-
showLeadingZero: true';
|
98 |
-
$args = apply_filters('wooccm_timepicker_jquery_args', $args, $btn);
|
99 |
-
echo '
|
100 |
-
<!-- Additional section: TimePicker -->
|
101 |
-
<script type="text/javascript">
|
102 |
-
jQuery(document).ready(function() {
|
103 |
-
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
104 |
-
jQuery("#' . $btn['cow'] . '_field input#' . $btn['cow'] . '").timepicker({'
|
105 |
-
;
|
106 |
-
echo $args;
|
107 |
-
echo '
|
108 |
-
});
|
109 |
-
}
|
110 |
-
});
|
111 |
-
</script>
|
112 |
-
';
|
113 |
-
}
|
114 |
-
|
115 |
-
if ($btn['type'] == 'password') {
|
116 |
-
echo '
|
117 |
-
<script type="text/javascript">
|
118 |
-
jQuery(document).ready(function() {
|
119 |
-
jQuery("p#' . $btn['cow'] . '_field").css("display");
|
120 |
-
});
|
121 |
-
</script>
|
122 |
-
';
|
123 |
-
}
|
124 |
-
|
125 |
-
/*if ($btn['type'] == 'colorpicker') {
|
126 |
-
switch ($btn['colorpickertype']) {
|
127 |
-
|
128 |
-
case 'farbtastic':
|
129 |
-
?>
|
130 |
-
<script type="text/javascript">
|
131 |
-
jQuery(document).ready(function ($) {
|
132 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
133 |
-
if (jQuery.isFunction(jQuery.fn.farbtastic)) {
|
134 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#<?php echo $btn['cow']; ?>_colorpicker");
|
135 |
-
jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
136 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
|
137 |
-
});
|
138 |
-
}
|
139 |
-
});
|
140 |
-
</script>
|
141 |
-
<?php
|
142 |
-
break;
|
143 |
-
|
144 |
-
case 'iris':
|
145 |
-
?>
|
146 |
-
<script type="text/javascript">
|
147 |
-
jQuery(document).ready(function ($) {
|
148 |
-
|
149 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#fff');
|
150 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('background', '<?php echo $btn['colorpickerd']; ?>');
|
151 |
-
|
152 |
-
var options = {
|
153 |
-
wccmclass: "<?php echo $btn['cow']; ?>_colorpickerdiv",
|
154 |
-
palettes: true,
|
155 |
-
color: "",
|
156 |
-
hide: false,
|
157 |
-
change: function (event, ui) {
|
158 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#000');
|
159 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('background', ui.color.toString());
|
160 |
-
}
|
161 |
-
};
|
162 |
-
|
163 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpicker').iris(options);
|
164 |
-
jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
165 |
-
jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
166 |
-
jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
|
167 |
-
});
|
168 |
-
|
169 |
-
});
|
170 |
-
</script>
|
171 |
-
<?php
|
172 |
-
break;
|
173 |
-
}
|
174 |
-
}*/
|
175 |
-
|
176 |
-
// ============================== radio button & checkbox ===========================================
|
177 |
-
|
178 |
-
/*if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
|
179 |
-
?>
|
180 |
-
<script type="text/javascript">
|
181 |
-
jQuery(document).ready(function ($) {
|
182 |
-
|
183 |
-
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
184 |
-
jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
|
185 |
-
<?php } ?>
|
186 |
-
|
187 |
-
jQuery('#<?php echo $btn['cow']; ?>_field input').click(function () {
|
188 |
-
|
189 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
190 |
-
|
191 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
192 |
-
data = {
|
193 |
-
action: 'remove_tax_wccm',
|
194 |
-
tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
|
195 |
-
};
|
196 |
-
|
197 |
-
jQuery.post(ajaxurl, data, function (response) {
|
198 |
-
$('body').trigger('update_checkout');
|
199 |
-
jQuery('form.checkout').unblock();
|
200 |
-
});
|
201 |
-
|
202 |
-
});
|
203 |
-
});
|
204 |
-
</script>
|
205 |
-
<?php
|
206 |
-
}*/
|
207 |
-
|
208 |
-
/*if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
209 |
-
?>
|
210 |
-
<script type="text/javascript">
|
211 |
-
jQuery(document).ready(function ($) {
|
212 |
-
|
213 |
-
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
214 |
-
jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
|
215 |
-
<?php } ?>
|
216 |
-
jQuery('#<?php echo $btn['cow']; ?>_field input').click(function () {
|
217 |
-
|
218 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
219 |
-
|
220 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
221 |
-
data = {
|
222 |
-
action: 'remove_tax_wccm',
|
223 |
-
add_amount_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
|
224 |
-
};
|
225 |
-
|
226 |
-
jQuery.post(ajaxurl, data, function (response) {
|
227 |
-
$('body').trigger('update_checkout');
|
228 |
-
jQuery('form.checkout').unblock();
|
229 |
-
});
|
230 |
-
|
231 |
-
});
|
232 |
-
});
|
233 |
-
</script>
|
234 |
-
<?php
|
235 |
-
}*/
|
236 |
-
|
237 |
-
// =========================================== select options =========================================
|
238 |
-
|
239 |
-
/*if (($btn['type'] == 'wooccmselect') && !empty($btn['tax_remove'])) {
|
240 |
-
?>
|
241 |
-
<script type="text/javascript">
|
242 |
-
jQuery(document).ready(function ($) {
|
243 |
-
|
244 |
-
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
245 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_tax_save_method']; ?>');
|
246 |
-
<?php } ?>
|
247 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').change(function () {
|
248 |
-
|
249 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
250 |
-
|
251 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
252 |
-
data = {
|
253 |
-
action: 'remove_tax_wccm',
|
254 |
-
tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
|
255 |
-
};
|
256 |
-
|
257 |
-
jQuery.post(ajaxurl, data, function (response) {
|
258 |
-
$('body').trigger('update_checkout');
|
259 |
-
jQuery('form.checkout').unblock();
|
260 |
-
});
|
261 |
-
|
262 |
-
});
|
263 |
-
});
|
264 |
-
</script>
|
265 |
-
<?php
|
266 |
-
}*/
|
267 |
-
|
268 |
-
/*if (($btn['type'] == 'wooccmselect') && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
269 |
-
?>
|
270 |
-
<script type="text/javascript">
|
271 |
-
jQuery(document).ready(function ($) {
|
272 |
-
|
273 |
-
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
274 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_addamount453user']; ?>');
|
275 |
-
<?php } ?>
|
276 |
-
|
277 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').change(function () {
|
278 |
-
|
279 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
280 |
-
|
281 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
282 |
-
data = {
|
283 |
-
action: 'remove_tax_wccm',
|
284 |
-
add_amount_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
|
285 |
-
};
|
286 |
-
|
287 |
-
jQuery.post(ajaxurl, data, function (response) {
|
288 |
-
$('body').trigger('update_checkout');
|
289 |
-
jQuery('form.checkout').unblock();
|
290 |
-
});
|
291 |
-
|
292 |
-
});
|
293 |
-
});
|
294 |
-
</script>
|
295 |
-
<?php
|
296 |
-
}*/
|
297 |
-
|
298 |
-
// =========================================== add apply button ==========================================
|
299 |
-
|
300 |
-
/*if (($btn['type'] == 'text') && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
|
301 |
-
?>
|
302 |
-
<script type="text/javascript">
|
303 |
-
jQuery(document).ready(function () {
|
304 |
-
jQuery("#<?php echo $btn['cow']; ?>_field").append('<span id="<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply', 'woocommerce-checkout-manager'); ?></span>');
|
305 |
-
});
|
306 |
-
|
307 |
-
jQuery(document).ready(function ($) {
|
308 |
-
|
309 |
-
<?php if (!empty($saved['wooccm_addamount453userf'])) { ?>
|
310 |
-
jQuery('input#<?php echo $btn['cow']; ?>').val('<?php echo $saved['wooccm_addamount453userf']; ?>');
|
311 |
-
<?php } ?>
|
312 |
-
|
313 |
-
jQuery('#<?php echo $btn['cow']; ?>_field #<?php echo $btn['cow']; ?>_applynow').click(function () {
|
314 |
-
|
315 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
316 |
-
|
317 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
318 |
-
data = {
|
319 |
-
action: 'remove_tax_wccm',
|
320 |
-
add_amount_faj: jQuery('input#<?php echo $btn['cow']; ?>').val()
|
321 |
-
};
|
322 |
-
|
323 |
-
jQuery.post(ajaxurl, data, function (response) {
|
324 |
-
$('body').trigger('update_checkout');
|
325 |
-
jQuery('form.checkout').unblock();
|
326 |
-
});
|
327 |
-
|
328 |
-
});
|
329 |
-
|
330 |
-
});
|
331 |
-
</script>
|
332 |
-
<?php
|
333 |
-
}*/
|
334 |
-
|
335 |
-
// =====================================================
|
336 |
-
}
|
337 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/templates/functions/billing_functions.php
DELETED
@@ -1,367 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
-
*/
|
5 |
-
// Exit if accessed directly
|
6 |
-
if (!defined('ABSPATH'))
|
7 |
-
exit;
|
8 |
-
|
9 |
-
function wooccm_billing_hide_required() {
|
10 |
-
|
11 |
-
global $woocommerce;
|
12 |
-
|
13 |
-
$options = get_option('wccs_settings3');
|
14 |
-
|
15 |
-
$billing = array(
|
16 |
-
'address_1',
|
17 |
-
'address_2',
|
18 |
-
'city',
|
19 |
-
'state',
|
20 |
-
'postcode'
|
21 |
-
);
|
22 |
-
|
23 |
-
if (!empty($options['billing_buttons'])) {
|
24 |
-
echo '
|
25 |
-
<style>
|
26 |
-
';
|
27 |
-
foreach ($options['billing_buttons'] as $btn) {
|
28 |
-
if (in_array($btn['cow'], $billing) && empty($btn['checkbox'])) {
|
29 |
-
echo '
|
30 |
-
p#billing_' . $btn['cow'] . '_field .required{
|
31 |
-
display:none;
|
32 |
-
}';
|
33 |
-
}
|
34 |
-
}
|
35 |
-
echo '
|
36 |
-
</style>';
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
function wooccm_billing_scripts() {
|
41 |
-
|
42 |
-
global $woocommerce;
|
43 |
-
|
44 |
-
$options = get_option('wccs_settings3');
|
45 |
-
|
46 |
-
$saved = WC()->session->get('wooccm_retain', array());
|
47 |
-
|
48 |
-
// Check if we have any buttons
|
49 |
-
if (empty($options['billing_buttons']))
|
50 |
-
return;
|
51 |
-
|
52 |
-
foreach ($options['billing_buttons'] as $btn) {
|
53 |
-
|
54 |
-
if ($btn['type'] == 'datepicker') {
|
55 |
-
echo '
|
56 |
-
<script type="text/javascript">
|
57 |
-
jQuery(document).ready(function() {
|
58 |
-
var today = new Date();
|
59 |
-
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
60 |
-
jQuery("input#billing_' . $btn['cow'] . '").datepicker({
|
61 |
-
';
|
62 |
-
// Default date format
|
63 |
-
if (empty($btn['format_date']))
|
64 |
-
$btn['format_date'] = apply_filters('wooccm_datepicker_default_date_format', 'dd-mm-yy');
|
65 |
-
if (!empty($btn['format_date'])) {
|
66 |
-
echo 'dateFormat : "' . str_replace(' ', '', $btn['format_date']) . '",';
|
67 |
-
}
|
68 |
-
if (!empty($btn['single_yy'])) {
|
69 |
-
echo 'minDate: new Date( ' . $btn['single_yy'] . ', ' . $btn['single_mm'] . ' - 1, ' . $btn['single_dd'] . '),';
|
70 |
-
}
|
71 |
-
if (!empty($btn['min_before'])) {
|
72 |
-
echo 'minDate: ' . $btn['min_before'] . ',';
|
73 |
-
}
|
74 |
-
if (!empty($btn['single_max_yy'])) {
|
75 |
-
echo 'maxDate: new Date( ' . $btn['single_max_yy'] . ', ' . $btn['single_max_mm'] . ' - 1, ' . $btn['single_max_dd'] . '),';
|
76 |
-
}
|
77 |
-
if (!empty($btn['max_after'])) {
|
78 |
-
echo 'maxDate: ' . $btn['max_after'] . ',';
|
79 |
-
}
|
80 |
-
if (!empty($btn['days_disabler'])) {
|
81 |
-
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
82 |
-
if (!empty($btn['days_disabler0'])) {
|
83 |
-
echo 'day == 0';
|
84 |
-
} else {
|
85 |
-
echo 'day == "x"';
|
86 |
-
}
|
87 |
-
if (!empty($btn['days_disabler1'])) {
|
88 |
-
echo ' || day == 1';
|
89 |
-
}
|
90 |
-
if (!empty($btn['days_disabler2'])) {
|
91 |
-
echo ' || day == 2';
|
92 |
-
}
|
93 |
-
if (!empty($btn['days_disabler3'])) {
|
94 |
-
echo ' || day == 3';
|
95 |
-
}
|
96 |
-
if (!empty($btn['days_disabler4'])) {
|
97 |
-
echo ' || day == 4';
|
98 |
-
}
|
99 |
-
if (!empty($btn['days_disabler5'])) {
|
100 |
-
echo ' || day == 5';
|
101 |
-
}
|
102 |
-
if (!empty($btn['days_disabler6'])) {
|
103 |
-
echo '|| day == 6';
|
104 |
-
}
|
105 |
-
echo ')]; }';
|
106 |
-
}
|
107 |
-
do_action('wooccm_js_datepicker_billing_args', $btn);
|
108 |
-
echo '
|
109 |
-
});
|
110 |
-
}
|
111 |
-
});
|
112 |
-
</script>
|
113 |
-
';
|
114 |
-
}
|
115 |
-
|
116 |
-
if ($btn['type'] == 'time') {
|
117 |
-
$args = '
|
118 |
-
showPeriod: true,';
|
119 |
-
if (!empty($btn['start_hour'])) {
|
120 |
-
$args .= '
|
121 |
-
hours: { starts: ' . $btn['start_hour'] . ', ends: ' . $btn['end_hour'] . ' },';
|
122 |
-
}
|
123 |
-
if (!empty($btn['interval_min'])) {
|
124 |
-
$args .= '
|
125 |
-
minutes: {interval: ' . $btn['interval_min'] . ', manual: [' . $btn['manual_min'] . '] },';
|
126 |
-
}
|
127 |
-
$args .= '
|
128 |
-
showLeadingZero: true';
|
129 |
-
$args = apply_filters('wooccm_timepicker_jquery_args', $args, $btn);
|
130 |
-
echo '
|
131 |
-
<!-- Billing section: TimePicker -->
|
132 |
-
<script type="text/javascript">
|
133 |
-
jQuery(document).ready(function() {
|
134 |
-
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
135 |
-
jQuery("#billing_' . $btn['cow'] . '_field input#billing_' . $btn['cow'] . '").timepicker({
|
136 |
-
';
|
137 |
-
echo $args;
|
138 |
-
echo '
|
139 |
-
});
|
140 |
-
}
|
141 |
-
});
|
142 |
-
</script>
|
143 |
-
';
|
144 |
-
}
|
145 |
-
|
146 |
-
if ($btn['type'] == 'password') {
|
147 |
-
echo '
|
148 |
-
<script type="text/javascript">
|
149 |
-
jQuery(document).ready(function() {
|
150 |
-
jQuery("p#billing_' . $btn['cow'] . '_field").css("display");
|
151 |
-
});
|
152 |
-
</script>
|
153 |
-
';
|
154 |
-
}
|
155 |
-
|
156 |
-
/*if ($btn['type'] == 'colorpicker') {
|
157 |
-
switch ($btn['colorpickertype']) {
|
158 |
-
case 'farbtastic':
|
159 |
-
?>
|
160 |
-
<script type="text/javascript">
|
161 |
-
jQuery(document).ready(function ($) {
|
162 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').hide();
|
163 |
-
if (jQuery.isFunction(jQuery.fn.farbtastic)) {
|
164 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').farbtastic("#billing_<?php echo $btn['cow']; ?>_colorpicker");
|
165 |
-
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
166 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').slideToggle()
|
167 |
-
});
|
168 |
-
}
|
169 |
-
});
|
170 |
-
</script>
|
171 |
-
<?php
|
172 |
-
break;
|
173 |
-
|
174 |
-
case 'iris':
|
175 |
-
?>
|
176 |
-
<script type="text/javascript">
|
177 |
-
jQuery(document).ready(function ($) {
|
178 |
-
|
179 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#fff');
|
180 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('background', '<?php echo $btn['colorpickerd']; ?>');
|
181 |
-
|
182 |
-
var options = {
|
183 |
-
wccmclass: "billing_<?php echo $btn['cow']; ?>_colorpicker",
|
184 |
-
palettes: true,
|
185 |
-
color: "",
|
186 |
-
hide: false,
|
187 |
-
change: function (event, ui) {
|
188 |
-
$('#billing_<?php echo $btn['cow']; ?>_colorpicker').css('color', '#000');
|
189 |
-
$('#billing_<?php echo $btn['cow']; ?>_colorpicker').css('background', ui.color.toString());
|
190 |
-
}
|
191 |
-
};
|
192 |
-
|
193 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').iris(options);
|
194 |
-
jQuery('.billing_<?php echo $btn['cow']; ?>_colorpicker').hide();
|
195 |
-
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
196 |
-
jQuery('.billing_<?php echo $btn['cow']; ?>_colorpicker').slideToggle()
|
197 |
-
});
|
198 |
-
|
199 |
-
});
|
200 |
-
</script>
|
201 |
-
<?php
|
202 |
-
break;
|
203 |
-
}
|
204 |
-
}*/
|
205 |
-
|
206 |
-
// ============================== radio button & checkbox ===========================================
|
207 |
-
|
208 |
-
/* if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
|
209 |
-
?>
|
210 |
-
<script type="text/javascript">
|
211 |
-
jQuery(document).ready(function ($) {
|
212 |
-
|
213 |
-
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
214 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
215 |
-
<?php } ?>
|
216 |
-
|
217 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field input').click(function () {
|
218 |
-
|
219 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
220 |
-
|
221 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
222 |
-
data = {
|
223 |
-
action: 'remove_tax_wccm',
|
224 |
-
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
225 |
-
};
|
226 |
-
|
227 |
-
jQuery.post(ajaxurl, data, function (response) {
|
228 |
-
$('body').trigger('update_checkout');
|
229 |
-
jQuery('form.checkout').unblock();
|
230 |
-
});
|
231 |
-
|
232 |
-
});
|
233 |
-
});
|
234 |
-
</script>
|
235 |
-
<?php
|
236 |
-
} */
|
237 |
-
|
238 |
-
/* if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
239 |
-
?>
|
240 |
-
<script type="text/javascript">
|
241 |
-
jQuery(document).ready(function ($) {
|
242 |
-
|
243 |
-
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
244 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
245 |
-
<?php } ?>
|
246 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field input').click(function () {
|
247 |
-
|
248 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
249 |
-
|
250 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
251 |
-
data = {
|
252 |
-
action: 'remove_tax_wccm',
|
253 |
-
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
254 |
-
};
|
255 |
-
|
256 |
-
jQuery.post(ajaxurl, data, function (response) {
|
257 |
-
$('body').trigger('update_checkout');
|
258 |
-
jQuery('form.checkout').unblock();
|
259 |
-
});
|
260 |
-
|
261 |
-
});
|
262 |
-
});
|
263 |
-
</script>
|
264 |
-
<?php
|
265 |
-
} */
|
266 |
-
|
267 |
-
// =========================================== select options =========================================
|
268 |
-
|
269 |
-
/* if ($btn['type'] == 'wooccmselect' && !empty($btn['tax_remove'])) {
|
270 |
-
?>
|
271 |
-
<script type="text/javascript">
|
272 |
-
jQuery(document).ready(function ($) {
|
273 |
-
|
274 |
-
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
275 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_tax_save_method']; ?>');
|
276 |
-
<?php } ?>
|
277 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function () {
|
278 |
-
|
279 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
280 |
-
|
281 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
282 |
-
data = {
|
283 |
-
action: 'remove_tax_wccm',
|
284 |
-
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
285 |
-
};
|
286 |
-
|
287 |
-
jQuery.post(ajaxurl, data, function (response) {
|
288 |
-
$('body').trigger('update_checkout');
|
289 |
-
jQuery('form.checkout').unblock();
|
290 |
-
});
|
291 |
-
|
292 |
-
});
|
293 |
-
});
|
294 |
-
</script>
|
295 |
-
<?php
|
296 |
-
} */
|
297 |
-
|
298 |
-
/* if ($btn['type'] == 'wooccmselect' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
299 |
-
?>
|
300 |
-
<script type="text/javascript">
|
301 |
-
jQuery(document).ready(function ($) {
|
302 |
-
|
303 |
-
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
304 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_addamount453user']; ?>');
|
305 |
-
<?php } ?>
|
306 |
-
|
307 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function () {
|
308 |
-
|
309 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
310 |
-
|
311 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
312 |
-
data = {
|
313 |
-
action: 'remove_tax_wccm',
|
314 |
-
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
315 |
-
};
|
316 |
-
|
317 |
-
jQuery.post(ajaxurl, data, function (response) {
|
318 |
-
$('body').trigger('update_checkout');
|
319 |
-
jQuery('form.checkout').unblock();
|
320 |
-
});
|
321 |
-
|
322 |
-
});
|
323 |
-
});
|
324 |
-
</script>
|
325 |
-
<?php
|
326 |
-
} */
|
327 |
-
|
328 |
-
// =========================================== add apply button ==========================================
|
329 |
-
|
330 |
-
/* if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
|
331 |
-
?>
|
332 |
-
<script type="text/javascript">
|
333 |
-
jQuery(document).ready(function () {
|
334 |
-
jQuery("#billing_<?php echo $btn['cow']; ?>_field").append('<span id="billing_<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply', 'woocommerce-checkout-manager'); ?></span>');
|
335 |
-
});
|
336 |
-
|
337 |
-
jQuery(document).ready(function ($) {
|
338 |
-
|
339 |
-
<?php if (!empty($saved['wooccm_addamount453userf'])) { ?>
|
340 |
-
jQuery('input#billing_<?php echo $btn['cow']; ?>').val('<?php echo $saved['wooccm_addamount453userf']; ?>');
|
341 |
-
<?php } ?>
|
342 |
-
|
343 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field #billing_<?php echo $btn['cow']; ?>_applynow').click(function () {
|
344 |
-
|
345 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
346 |
-
|
347 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
348 |
-
data = {
|
349 |
-
action: 'remove_tax_wccm',
|
350 |
-
add_amount_faj: jQuery('input#billing_<?php echo $btn['cow']; ?>').val()
|
351 |
-
};
|
352 |
-
|
353 |
-
jQuery.post(ajaxurl, data, function (response) {
|
354 |
-
$('body').trigger('update_checkout');
|
355 |
-
jQuery('form.checkout').unblock();
|
356 |
-
});
|
357 |
-
|
358 |
-
});
|
359 |
-
|
360 |
-
});
|
361 |
-
</script>
|
362 |
-
<?php
|
363 |
-
} */
|
364 |
-
|
365 |
-
// =====================================================
|
366 |
-
}
|
367 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/templates/functions/shipping_functions.php
DELETED
@@ -1,371 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
-
*/
|
5 |
-
// Exit if accessed directly
|
6 |
-
if (!defined('ABSPATH'))
|
7 |
-
exit;
|
8 |
-
|
9 |
-
function wooccm_shipping_hide_required() {
|
10 |
-
|
11 |
-
global $woocommerce;
|
12 |
-
|
13 |
-
$options = get_option('wccs_settings2');
|
14 |
-
|
15 |
-
$billing = array(
|
16 |
-
'address_1',
|
17 |
-
'address_2',
|
18 |
-
'city',
|
19 |
-
'state',
|
20 |
-
'postcode'
|
21 |
-
);
|
22 |
-
|
23 |
-
if (!empty($options['shipping_buttons'])) {
|
24 |
-
echo '
|
25 |
-
<style>
|
26 |
-
';
|
27 |
-
foreach ($options['shipping_buttons'] as $btn) {
|
28 |
-
if (in_array($btn['cow'], $billing) && empty($btn['checkbox'])) {
|
29 |
-
echo '
|
30 |
-
p#shipping_' . $btn['cow'] . '_field .required{
|
31 |
-
display:none;
|
32 |
-
}';
|
33 |
-
}
|
34 |
-
}
|
35 |
-
echo '
|
36 |
-
</style>';
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
function wooccm_shipping_scripts() {
|
41 |
-
|
42 |
-
global $woocommerce;
|
43 |
-
|
44 |
-
$options = get_option('wccs_settings2');
|
45 |
-
|
46 |
-
if (WC()->cart->needs_shipping_address() !== true)
|
47 |
-
return;
|
48 |
-
|
49 |
-
$saved = WC()->session->get('wooccm_retain', array());
|
50 |
-
|
51 |
-
// Check if we have any buttons
|
52 |
-
if (empty($options['shipping_buttons']))
|
53 |
-
return;
|
54 |
-
|
55 |
-
foreach ($options['shipping_buttons'] as $btn) {
|
56 |
-
|
57 |
-
if ($btn['type'] == 'datepicker') {
|
58 |
-
echo '
|
59 |
-
<script type="text/javascript">
|
60 |
-
jQuery(document).ready(function() {
|
61 |
-
var today = new Date();
|
62 |
-
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
63 |
-
jQuery("input#shipping_' . $btn['cow'] . '").datepicker({
|
64 |
-
';
|
65 |
-
// Default date format
|
66 |
-
if (empty($btn['format_date']))
|
67 |
-
$btn['format_date'] = apply_filters('wooccm_datepicker_default_date_format', 'dd-mm-yy');
|
68 |
-
if (!empty($btn['format_date'])) {
|
69 |
-
echo 'dateFormat : "' . str_replace(' ', '', $btn['format_date']) . '",';
|
70 |
-
}
|
71 |
-
if (!empty($btn['single_yy'])) {
|
72 |
-
echo 'minDate: new Date( ' . $btn['single_yy'] . ', ' . $btn['single_mm'] . ' - 1, ' . $btn['single_dd'] . '),';
|
73 |
-
}
|
74 |
-
if (!empty($btn['min_before'])) {
|
75 |
-
echo 'minDate: ' . $btn['min_before'] . ',';
|
76 |
-
}
|
77 |
-
if (!empty($btn['single_max_yy'])) {
|
78 |
-
echo 'maxDate: new Date( ' . $btn['single_max_yy'] . ', ' . $btn['single_max_mm'] . ' - 1, ' . $btn['single_max_dd'] . '),';
|
79 |
-
}
|
80 |
-
if (!empty($btn['max_after'])) {
|
81 |
-
echo 'maxDate: ' . $btn['max_after'] . ',';
|
82 |
-
}
|
83 |
-
if (!empty($btn['days_disabler'])) {
|
84 |
-
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
85 |
-
if (!empty($btn['days_disabler0'])) {
|
86 |
-
echo 'day == 0';
|
87 |
-
} else {
|
88 |
-
echo 'day == "x"';
|
89 |
-
}
|
90 |
-
if (!empty($btn['days_disabler1'])) {
|
91 |
-
echo ' || day == 1';
|
92 |
-
}
|
93 |
-
if (!empty($btn['days_disabler2'])) {
|
94 |
-
echo ' || day == 2';
|
95 |
-
}
|
96 |
-
if (!empty($btn['days_disabler3'])) {
|
97 |
-
echo ' || day == 3';
|
98 |
-
}
|
99 |
-
if (!empty($btn['days_disabler4'])) {
|
100 |
-
echo ' || day == 4';
|
101 |
-
}
|
102 |
-
if (!empty($btn['days_disabler5'])) {
|
103 |
-
echo ' || day == 5';
|
104 |
-
}
|
105 |
-
if (!empty($btn['days_disabler6'])) {
|
106 |
-
echo '|| day == 6';
|
107 |
-
}
|
108 |
-
echo ')]; }';
|
109 |
-
}
|
110 |
-
do_action('wooccm_js_datepicker_shipping_args', $btn);
|
111 |
-
echo '
|
112 |
-
});
|
113 |
-
}
|
114 |
-
});
|
115 |
-
</script>
|
116 |
-
';
|
117 |
-
}
|
118 |
-
|
119 |
-
if ($btn['type'] == 'time') {
|
120 |
-
$args = '
|
121 |
-
showPeriod: true,';
|
122 |
-
if (!empty($btn['start_hour'])) {
|
123 |
-
$args .= '
|
124 |
-
hours: { starts: ' . $btn['start_hour'] . ', ends: ' . $btn['end_hour'] . ' },';
|
125 |
-
}
|
126 |
-
if (!empty($btn['interval_min'])) {
|
127 |
-
$args .= '
|
128 |
-
minutes: {interval: ' . $btn['interval_min'] . ', manual: [' . $btn['manual_min'] . '] },';
|
129 |
-
}
|
130 |
-
$args .= '
|
131 |
-
showLeadingZero: true';
|
132 |
-
$args = apply_filters('wooccm_timepicker_jquery_args', $args, $btn);
|
133 |
-
echo '
|
134 |
-
<!-- Shipping section: TimePicker -->
|
135 |
-
<script type="text/javascript">
|
136 |
-
jQuery(document).ready(function() {
|
137 |
-
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
138 |
-
jQuery("#shipping_' . $btn['cow'] . '_field input#shipping_' . $btn['cow'] . '").timepicker({
|
139 |
-
';
|
140 |
-
echo $args;
|
141 |
-
echo '
|
142 |
-
});
|
143 |
-
}
|
144 |
-
});
|
145 |
-
</script>
|
146 |
-
';
|
147 |
-
}
|
148 |
-
|
149 |
-
if ($btn['type'] == 'password') {
|
150 |
-
echo '
|
151 |
-
<script type="text/javascript">
|
152 |
-
jQuery(document).ready(function() {
|
153 |
-
jQuery("p#shipping_' . $btn['cow'] . '_field").css("display");
|
154 |
-
});
|
155 |
-
</script>
|
156 |
-
';
|
157 |
-
}
|
158 |
-
|
159 |
-
/*if ($btn['type'] == 'colorpicker') {
|
160 |
-
switch ($btn['colorpickertype']) {
|
161 |
-
|
162 |
-
case 'farbtastic':
|
163 |
-
?>
|
164 |
-
<script type="text/javascript">
|
165 |
-
jQuery(document).ready(function ($) {
|
166 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
167 |
-
if (jQuery.isFunction(jQuery.fn.farbtastic)) {
|
168 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#shipping_<?php echo $btn['cow']; ?>_colorpicker");
|
169 |
-
jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
170 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
|
171 |
-
});
|
172 |
-
}
|
173 |
-
});
|
174 |
-
</script>
|
175 |
-
<?php
|
176 |
-
break;
|
177 |
-
|
178 |
-
case 'iris':
|
179 |
-
?>
|
180 |
-
<script type="text/javascript">
|
181 |
-
jQuery(document).ready(function ($) {
|
182 |
-
|
183 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#fff');
|
184 |
-
$('#<?php echo $btn['cow']; ?>_colorpicker').css('background', '<?php echo $btn['colorpickerd']; ?>');
|
185 |
-
|
186 |
-
var options = {
|
187 |
-
wccmclass: "shipping_<?php echo $btn['cow']; ?>_colorpickerdiv",
|
188 |
-
palettes: true,
|
189 |
-
color: "",
|
190 |
-
hide: false,
|
191 |
-
change: function (event, ui) {
|
192 |
-
$('#shipping_<?php echo $btn['cow']; ?>_colorpicker').css('color', '#000');
|
193 |
-
$('#shipping_<?php echo $btn['cow']; ?>_colorpicker').css('background', ui.color.toString());
|
194 |
-
}
|
195 |
-
};
|
196 |
-
|
197 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpicker').iris(options);
|
198 |
-
jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
199 |
-
jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
200 |
-
jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
|
201 |
-
});
|
202 |
-
|
203 |
-
});
|
204 |
-
</script>
|
205 |
-
<?php
|
206 |
-
break;
|
207 |
-
}
|
208 |
-
}*/
|
209 |
-
|
210 |
-
// ============================== radio button & checkbox ===========================================
|
211 |
-
|
212 |
-
/* if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
|
213 |
-
?>
|
214 |
-
<script type="text/javascript">
|
215 |
-
jQuery(document).ready(function ($) {
|
216 |
-
|
217 |
-
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
218 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
219 |
-
<?php } ?>
|
220 |
-
|
221 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function () {
|
222 |
-
|
223 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
224 |
-
|
225 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
226 |
-
data = {
|
227 |
-
action: 'remove_tax_wccm',
|
228 |
-
tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
|
229 |
-
};
|
230 |
-
|
231 |
-
jQuery.post(ajaxurl, data, function (response) {
|
232 |
-
$('body').trigger('update_checkout');
|
233 |
-
jQuery('form.checkout').unblock();
|
234 |
-
});
|
235 |
-
|
236 |
-
});
|
237 |
-
});
|
238 |
-
</script>
|
239 |
-
<?php
|
240 |
-
} */
|
241 |
-
|
242 |
-
/* if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
243 |
-
?>
|
244 |
-
<script type="text/javascript">
|
245 |
-
jQuery(document).ready(function ($) {
|
246 |
-
|
247 |
-
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
248 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
249 |
-
<?php } ?>
|
250 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function () {
|
251 |
-
|
252 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
253 |
-
|
254 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
255 |
-
data = {
|
256 |
-
action: 'remove_tax_wccm',
|
257 |
-
add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
|
258 |
-
};
|
259 |
-
|
260 |
-
jQuery.post(ajaxurl, data, function (response) {
|
261 |
-
$('body').trigger('update_checkout');
|
262 |
-
jQuery('form.checkout').unblock();
|
263 |
-
});
|
264 |
-
|
265 |
-
});
|
266 |
-
});
|
267 |
-
</script>
|
268 |
-
<?php
|
269 |
-
} */
|
270 |
-
|
271 |
-
// =========================================== select options =========================================
|
272 |
-
|
273 |
-
/* if ($btn['type'] == 'wooccmselect' && !empty($btn['tax_remove'])) {
|
274 |
-
?>
|
275 |
-
<script type="text/javascript">
|
276 |
-
jQuery(document).ready(function ($) {
|
277 |
-
|
278 |
-
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
279 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_tax_save_method']; ?>');
|
280 |
-
<?php } ?>
|
281 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function () {
|
282 |
-
|
283 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
284 |
-
|
285 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
286 |
-
data = {
|
287 |
-
action: 'remove_tax_wccm',
|
288 |
-
tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
|
289 |
-
};
|
290 |
-
|
291 |
-
jQuery.post(ajaxurl, data, function (response) {
|
292 |
-
$('body').trigger('update_checkout');
|
293 |
-
jQuery('form.checkout').unblock();
|
294 |
-
});
|
295 |
-
|
296 |
-
});
|
297 |
-
});
|
298 |
-
</script>
|
299 |
-
<?php
|
300 |
-
} */
|
301 |
-
|
302 |
-
/* if ($btn['type'] == 'wooccmselect' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
303 |
-
?>
|
304 |
-
<script type="text/javascript">
|
305 |
-
jQuery(document).ready(function ($) {
|
306 |
-
|
307 |
-
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
308 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_addamount453user']; ?>');
|
309 |
-
<?php } ?>
|
310 |
-
|
311 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function () {
|
312 |
-
|
313 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
314 |
-
|
315 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
316 |
-
data = {
|
317 |
-
action: 'remove_tax_wccm',
|
318 |
-
add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
|
319 |
-
};
|
320 |
-
|
321 |
-
jQuery.post(ajaxurl, data, function (response) {
|
322 |
-
$('body').trigger('update_checkout');
|
323 |
-
jQuery('form.checkout').unblock();
|
324 |
-
});
|
325 |
-
|
326 |
-
});
|
327 |
-
});
|
328 |
-
</script>
|
329 |
-
<?php
|
330 |
-
} */
|
331 |
-
|
332 |
-
// =========================================== add apply button ==========================================
|
333 |
-
|
334 |
-
/* if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
|
335 |
-
?>
|
336 |
-
<script type="text/javascript">
|
337 |
-
jQuery(document).ready(function () {
|
338 |
-
jQuery("#shipping_<?php echo $btn['cow']; ?>_field").append('<span id="shipping_<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply', 'woocommerce-checkout-manager'); ?></span>');
|
339 |
-
});
|
340 |
-
|
341 |
-
jQuery(document).ready(function ($) {
|
342 |
-
|
343 |
-
<?php if (!empty($saved['wooccm_addamount453userf'])) { ?>
|
344 |
-
jQuery('input#shipping_<?php echo $btn['cow']; ?>').val('<?php echo $saved['wooccm_addamount453userf']; ?>');
|
345 |
-
<?php } ?>
|
346 |
-
|
347 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field #shipping_<?php echo $btn['cow']; ?>_applynow').click(function () {
|
348 |
-
|
349 |
-
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
350 |
-
|
351 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
352 |
-
data = {
|
353 |
-
action: 'remove_tax_wccm',
|
354 |
-
add_amount_faj: jQuery('input#shipping_<?php echo $btn['cow']; ?>').val()
|
355 |
-
};
|
356 |
-
|
357 |
-
jQuery.post(ajaxurl, data, function (response) {
|
358 |
-
$('body').trigger('update_checkout');
|
359 |
-
jQuery('form.checkout').unblock();
|
360 |
-
});
|
361 |
-
|
362 |
-
});
|
363 |
-
|
364 |
-
});
|
365 |
-
</script>
|
366 |
-
<?php
|
367 |
-
} */
|
368 |
-
|
369 |
-
// =====================================================
|
370 |
-
}
|
371 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new/fields_conditional.php
CHANGED
@@ -6,143 +6,18 @@ if (!class_exists('WOOCCM_Fields_Conditional')) {
|
|
6 |
protected static $instance;
|
7 |
protected static $i = 0;
|
8 |
|
9 |
-
function
|
10 |
if (!empty($field['conditional_parent_use']) && !empty($field['conditional_tie']) && !empty($field['chosen_valt']) && ($field['conditional_tie'] != $field['cow'])) {
|
11 |
$field['class'][] = 'wooccm-conditional-child';
|
12 |
$field['custom_attributes']['data-conditional-parent'] = $field['conditional_tie'];
|
13 |
$field['custom_attributes']['data-conditional-parent-value'] = $field['chosen_valt'];
|
14 |
}
|
15 |
return $field;
|
16 |
-
}
|
17 |
-
|
18 |
-
/*
|
19 |
-
*
|
20 |
-
* function add_conditional_interaction($fields, $name, $key, $prefix = '') {
|
21 |
-
|
22 |
-
if ($options = get_option($name)) {
|
23 |
-
|
24 |
-
if (array_key_exists($key, $options)) {
|
25 |
-
|
26 |
-
if ($fields = $options[$key]) {
|
27 |
-
|
28 |
-
foreach ($fields as $id => $field) {
|
29 |
-
|
30 |
-
if (!empty($field['cow']) && empty($field['disabled'])) {
|
31 |
-
|
32 |
-
if (!empty($field['conditional_tie']) && empty($field['conditional_parent']) && !empty($field['conditional_parent_use'])) :
|
33 |
-
?>
|
34 |
-
<style type="text/css">
|
35 |
-
#billing_<?php echo esc_attr($field['cow']); ?>_field.<?php echo esc_attr($field['conditional_tie']); ?> {
|
36 |
-
display: none;
|
37 |
-
}
|
38 |
-
</style>
|
39 |
-
<?php endif; ?>
|
40 |
-
|
41 |
-
<script>
|
42 |
-
(function ($) {
|
43 |
-
<?php
|
44 |
-
if ($field['type'] == 'checkbox_wccm') :
|
45 |
-
if (!empty($field['conditional_parent']) && !empty($field['conditional_parent_use']) && !empty($field['chosen_valt'])) :
|
46 |
-
?>
|
47 |
-
$("#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie']; ?> input[name=billing_<?php echo $field['cow']; ?>]").on('click', function (e) {
|
48 |
-
<?php
|
49 |
-
foreach ($options['billing_buttons'] as $field3) :
|
50 |
-
if (empty($field3['conditional_parent']) && !empty($field3['conditional_parent_use']) && !empty($field3['conditional_tie'])) :
|
51 |
-
?>
|
52 |
-
if ($('#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie']; ?> input[name=billing_<?php echo $field['cow']; ?>]:checked').val() === '<?php echo $field3['chosen_valt']; ?>') {
|
53 |
-
$("#billing_<?php echo $field3['cow'] . '_field.' . $field['conditional_tie']; ?>").fadeIn();
|
54 |
-
}
|
55 |
-
if ($('#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie']; ?> input[name=billing_<?php echo $field['cow']; ?>]:checked').val() !== '<?php echo $field3['chosen_valt']; ?>') {
|
56 |
-
$("#billing_<?php echo $field3['cow'] . '_field.' . $field['conditional_tie']; ?>").fadeOut();
|
57 |
-
}
|
58 |
-
<?php
|
59 |
-
endif;
|
60 |
-
endforeach;
|
61 |
-
?>
|
62 |
-
});
|
63 |
-
<?php
|
64 |
-
endif;
|
65 |
-
endif;
|
66 |
-
?>
|
67 |
-
<?php
|
68 |
-
if ($field['type'] == 'wooccmselect') :
|
69 |
-
if (!empty($field['conditional_parent']) && !empty($field['conditional_parent_use']) && !empty($field['chosen_valt'])) :
|
70 |
-
?>
|
71 |
-
$("#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie']; ?> select").on('change', function () {
|
72 |
-
<?php
|
73 |
-
foreach ($options['billing_buttons'] as $field3) :
|
74 |
-
if (empty($field3['conditional_parent']) && !empty($field3['conditional_parent_use']) && !empty($field3['conditional_tie'])) :
|
75 |
-
?>
|
76 |
-
if ($('#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie'] . ' #billing_' . $field['cow']; ?> option:selected').val() === '<?php echo $field3['chosen_valt']; ?>') {
|
77 |
-
$("#billing_<?php echo $field3['cow'] . '_field.' . $field['conditional_tie']; ?>").fadeIn();
|
78 |
-
}
|
79 |
-
if ($('#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie'] . ' #billing_' . $field['cow']; ?> option:selected').val() !== '<?php echo $field3['chosen_valt']; ?>') {
|
80 |
-
$("#billing_<?php echo $field3['cow'] . '_field.' . $field['conditional_tie']; ?>").fadeOut();
|
81 |
-
}
|
82 |
-
<?php
|
83 |
-
endif;
|
84 |
-
endforeach;
|
85 |
-
?>
|
86 |
-
});
|
87 |
-
<?php
|
88 |
-
endif;
|
89 |
-
endif;
|
90 |
-
?>
|
91 |
-
|
92 |
-
<?php
|
93 |
-
if ($field['type'] == 'wooccmradio') :
|
94 |
-
if (!empty($field['conditional_parent']) && !empty($field['conditional_parent_use']) && !empty($field['chosen_valt'])) :
|
95 |
-
?>
|
96 |
-
$("#billing_<?php echo '' . $field['cow'] . '_field.' . $field['conditional_tie']; ?> input").on('click', function (e) {
|
97 |
-
<?php
|
98 |
-
foreach ($options['billing_buttons'] as $field3) :
|
99 |
-
if (empty($field3['conditional_parent']) && !empty($field3['conditional_parent_use']) && !empty($field3['conditional_tie'])) :
|
100 |
-
?>
|
101 |
-
if ($('#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie']; ?> input[name=billing_<?php echo $field['cow']; ?>]:checked').val() === '<?php echo $field3['chosen_valt']; ?>') {
|
102 |
-
$("#billing_<?php echo $field3['cow'] . '_field.' . $field['conditional_tie']; ?>").fadeIn();
|
103 |
-
}
|
104 |
-
|
105 |
-
if ($('#billing_<?php echo $field['cow'] . '_field.' . $field['conditional_tie']; ?> input[name=billing_<?php echo $field['cow']; ?>]:checked').val() !== '<?php echo $field3['chosen_valt']; ?>') {
|
106 |
-
$("#billing_<?php echo $field3['cow'] . '_field.' . $field['conditional_tie']; ?>").fadeOut();
|
107 |
-
}
|
108 |
-
<?php
|
109 |
-
endif;
|
110 |
-
endforeach;
|
111 |
-
?>
|
112 |
-
});
|
113 |
-
<?php
|
114 |
-
endif;
|
115 |
-
endif;
|
116 |
-
?>
|
117 |
-
})(jQuery);
|
118 |
-
</script>
|
119 |
-
<?php
|
120 |
-
}
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
function add_checkout_additional_conditional($fields) {
|
128 |
-
$this->add_conditional_interaction($fields, 'wccs_settings', 'buttons');
|
129 |
-
}
|
130 |
-
|
131 |
-
function add_checkout_shipping_conditional($fields) {
|
132 |
-
$this->add_conditional_interaction($fields, 'wccs_settings2', 'shipping_buttons', 'shipping_');
|
133 |
-
}
|
134 |
-
|
135 |
-
function add_checkout_billing_conditional($fields) {
|
136 |
-
$this->add_conditional_interaction($fields, 'wccs_settings3', 'billing_buttons', 'billing_');
|
137 |
-
}*/
|
138 |
|
139 |
function init() {
|
140 |
-
// Add field
|
141 |
-
add_filter('wooccm_checkout_field_filter', array($this, '
|
142 |
-
|
143 |
-
//add_action('woocommerce_after_checkout_form', array($this, 'add_checkout_additional_conditional'));
|
144 |
-
//add_action('woocommerce_after_checkout_form', array($this, 'add_checkout_shipping_conditional'));
|
145 |
-
//add_action('woocommerce_after_checkout_form', array($this, 'add_checkout_billing_conditional'));
|
146 |
}
|
147 |
|
148 |
public static function instance() {
|
6 |
protected static $instance;
|
7 |
protected static $i = 0;
|
8 |
|
9 |
+
function add_field_attributes($field, $key) {
|
10 |
if (!empty($field['conditional_parent_use']) && !empty($field['conditional_tie']) && !empty($field['chosen_valt']) && ($field['conditional_tie'] != $field['cow'])) {
|
11 |
$field['class'][] = 'wooccm-conditional-child';
|
12 |
$field['custom_attributes']['data-conditional-parent'] = $field['conditional_tie'];
|
13 |
$field['custom_attributes']['data-conditional-parent-value'] = $field['chosen_valt'];
|
14 |
}
|
15 |
return $field;
|
16 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
function init() {
|
19 |
+
// Add field attributes
|
20 |
+
add_filter('wooccm_checkout_field_filter', array($this, 'add_field_attributes'), 10, 2);
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
public static function instance() {
|
new/fields_display.php
CHANGED
@@ -14,11 +14,13 @@ if (!class_exists('WOOCCM_Fields_Display')) {
|
|
14 |
|
15 |
$user_role = array_shift($user_roles);
|
16 |
|
17 |
-
if (!empty($field['user_role']) && (!empty($field['role_options']) || !empty($field['role_options2']))) {
|
18 |
|
19 |
$rolekeys = explode('||', $field['role_options']);
|
20 |
|
21 |
$rolekeys2 = explode('||', $field['role_options2']);
|
|
|
|
|
22 |
|
23 |
if (!empty($field['role_options']) && !in_array($user_role, $rolekeys)) {
|
24 |
$field['disabled'] = true;
|
@@ -28,7 +30,7 @@ if (!class_exists('WOOCCM_Fields_Display')) {
|
|
28 |
$field['disabled'] = true;
|
29 |
}
|
30 |
}
|
31 |
-
|
32 |
return $field;
|
33 |
}
|
34 |
|
14 |
|
15 |
$user_role = array_shift($user_roles);
|
16 |
|
17 |
+
if (/* !empty($field['user_role']) && */(!empty($field['role_options']) || !empty($field['role_options2']))) {
|
18 |
|
19 |
$rolekeys = explode('||', $field['role_options']);
|
20 |
|
21 |
$rolekeys2 = explode('||', $field['role_options2']);
|
22 |
+
|
23 |
+
//error_log(json_encode($rolekeys));
|
24 |
|
25 |
if (!empty($field['role_options']) && !in_array($user_role, $rolekeys)) {
|
26 |
$field['disabled'] = true;
|
30 |
$field['disabled'] = true;
|
31 |
}
|
32 |
}
|
33 |
+
|
34 |
return $field;
|
35 |
}
|
36 |
|
new/fields_filters.php
CHANGED
@@ -11,23 +11,6 @@ if (!defined('ABSPATH'))
|
|
11 |
|
12 |
function wooccm_checkout_field_upload_handler($field = '', $key, $args, $value) {
|
13 |
|
14 |
-
global $current_user;
|
15 |
-
|
16 |
-
$user_roles = $current_user->roles;
|
17 |
-
|
18 |
-
$user_role = array_shift($user_roles);
|
19 |
-
|
20 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
21 |
-
$rolekeys = explode('||', $args['role_options']);
|
22 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
23 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
24 |
-
return;
|
25 |
-
}
|
26 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
$upload_name = (!empty($args['placeholder']) ? esc_attr($args['placeholder']) : __('Upload Files', 'woocommerce-checkout-manager') );
|
32 |
|
33 |
if ($args['wooccm_required']) {
|
@@ -88,253 +71,9 @@ function wooccm_checkout_field_upload_handler($field = '', $key, $args, $value)
|
|
88 |
|
89 |
add_filter('woocommerce_form_field_wooccmupload', 'wooccm_checkout_field_upload_handler', 10, 4);
|
90 |
|
91 |
-
// Text Input
|
92 |
-
function wooccm_checkout_field_text_handler($field = '', $key, $args, $value) {
|
93 |
-
|
94 |
-
global $current_user;
|
95 |
-
|
96 |
-
$user_roles = $current_user->roles;
|
97 |
-
$user_role = array_shift($user_roles);
|
98 |
-
|
99 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
100 |
-
$rolekeys = explode('||', $args['role_options']);
|
101 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
102 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
103 |
-
return;
|
104 |
-
}
|
105 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
106 |
-
return;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
if (!empty($args['clear']))
|
111 |
-
$after = '<div class="clear"></div>';
|
112 |
-
else
|
113 |
-
$after = '';
|
114 |
-
|
115 |
-
$required = false;
|
116 |
-
if ($args['wooccm_required']) {
|
117 |
-
$args['class'][] = 'validate-required';
|
118 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
119 |
-
}
|
120 |
-
|
121 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
122 |
-
|
123 |
-
if (is_string($args['label_class'])) {
|
124 |
-
$args['label_class'] = array($args['label_class']);
|
125 |
-
}
|
126 |
-
|
127 |
-
if (is_null($value)) {
|
128 |
-
$value = $args['default'];
|
129 |
-
}
|
130 |
-
|
131 |
-
// Custom attribute handling
|
132 |
-
$custom_attributes = array();
|
133 |
-
|
134 |
-
if (!empty($args['custom_attributes']) && is_array($args['custom_attributes'])) {
|
135 |
-
foreach ($args['custom_attributes'] as $attribute => $attribute_value) {
|
136 |
-
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
if (!empty($args['validate'])) {
|
141 |
-
foreach ($args['validate'] as $validate) {
|
142 |
-
$args['class'][] = 'validate-' . $validate;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">';
|
147 |
-
|
148 |
-
if ($args['label'] || $required) {
|
149 |
-
$field .= '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>';
|
150 |
-
}
|
151 |
-
|
152 |
-
$field .= '<input type="text" class="input-text ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '" ' . $args['maxlength'] . ' value="' . esc_attr($value) . '" ' . implode(' ', $custom_attributes) . ' />';
|
153 |
-
|
154 |
-
if ($args['description']) {
|
155 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
156 |
-
}
|
157 |
-
|
158 |
-
$field .= '</p>' . $after;
|
159 |
-
|
160 |
-
return $field;
|
161 |
-
}
|
162 |
-
|
163 |
-
add_filter('woocommerce_form_field_wooccmtext', 'wooccm_checkout_field_text_handler', 10, 4);
|
164 |
-
|
165 |
-
/* Textarea
|
166 |
-
function wooccm_checkout_field_textarea_handler($field = '', $key, $args, $value) {
|
167 |
-
|
168 |
-
global $current_user;
|
169 |
-
|
170 |
-
$user_roles = $current_user->roles;
|
171 |
-
$user_role = array_shift($user_roles);
|
172 |
-
|
173 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
174 |
-
$rolekeys = explode('||', $args['role_options']);
|
175 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
176 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
177 |
-
return;
|
178 |
-
}
|
179 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
180 |
-
return;
|
181 |
-
}
|
182 |
-
}
|
183 |
-
|
184 |
-
if (!empty($args['clear']))
|
185 |
-
$after = '<div class="clear"></div>';
|
186 |
-
else
|
187 |
-
$after = '';
|
188 |
-
|
189 |
-
if ($args['wooccm_required']) {
|
190 |
-
$args['class'][] = 'validate-required';
|
191 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
192 |
-
} else {
|
193 |
-
$required = '';
|
194 |
-
}
|
195 |
-
|
196 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
197 |
-
|
198 |
-
if (is_string($args['label_class'])) {
|
199 |
-
$args['label_class'] = array($args['label_class']);
|
200 |
-
}
|
201 |
-
|
202 |
-
if (is_null($value)) {
|
203 |
-
$value = $args['default'];
|
204 |
-
}
|
205 |
-
|
206 |
-
// Custom attribute handling
|
207 |
-
$custom_attributes = array();
|
208 |
-
|
209 |
-
if (!empty($args['custom_attributes']) && is_array($args['custom_attributes'])) {
|
210 |
-
foreach ($args['custom_attributes'] as $attribute => $attribute_value) {
|
211 |
-
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
if (!empty($args['validate'])) {
|
216 |
-
foreach ($args['validate'] as $validate) {
|
217 |
-
$args['class'][] = 'validate-' . $validate;
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">';
|
222 |
-
|
223 |
-
if ($args['label']) {
|
224 |
-
$field .= '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>';
|
225 |
-
}
|
226 |
-
|
227 |
-
// WordPress Filters to override default row and column counts
|
228 |
-
$rows = apply_filters('wooccm_checkout_field_texarea_rows', 2, $key, $args);
|
229 |
-
$columns = apply_filters('wooccm_checkout_field_texarea_columns', 5, $key, $args);
|
230 |
-
|
231 |
-
$field .= '<textarea name="' . esc_attr($key) . '" class="input-text ' . esc_attr(implode(' ', $args['input_class'])) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '" ' . $args['maxlength'] . ' ' . ( empty($args['custom_attributes']['rows']) ? ' rows="' . $rows . '"' : '' ) . ( empty($args['custom_attributes']['cols']) ? ' cols="' . $columns . '"' : '' ) . implode(' ', $custom_attributes) . '>' . esc_textarea($value) . '</textarea>';
|
232 |
-
|
233 |
-
if ($args['description']) {
|
234 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
235 |
-
}
|
236 |
-
|
237 |
-
$field .= '</p>' . $after;
|
238 |
-
|
239 |
-
return $field;
|
240 |
-
}
|
241 |
-
|
242 |
-
add_filter('woocommerce_form_field_wooccmtextarea', 'wooccm_checkout_field_textarea_handler', 10, 4); */
|
243 |
-
|
244 |
-
// Password
|
245 |
-
function wooccm_checkout_field_password_handler($field = '', $key, $args, $value) {
|
246 |
-
|
247 |
-
global $current_user;
|
248 |
-
|
249 |
-
$user_roles = $current_user->roles;
|
250 |
-
$user_role = array_shift($user_roles);
|
251 |
-
|
252 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
253 |
-
$rolekeys = explode('||', $args['role_options']);
|
254 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
255 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
256 |
-
return;
|
257 |
-
}
|
258 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
259 |
-
return;
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
if (!empty($args['clear']))
|
264 |
-
$after = '<div class="clear"></div>';
|
265 |
-
else
|
266 |
-
$after = '';
|
267 |
-
|
268 |
-
if ($args['wooccm_required']) {
|
269 |
-
$args['class'][] = 'validate-required';
|
270 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
271 |
-
} else {
|
272 |
-
$required = '';
|
273 |
-
}
|
274 |
-
|
275 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
276 |
-
|
277 |
-
if (is_string($args['label_class'])) {
|
278 |
-
$args['label_class'] = array($args['label_class']);
|
279 |
-
}
|
280 |
-
|
281 |
-
if (is_null($value)) {
|
282 |
-
$value = $args['default'];
|
283 |
-
}
|
284 |
-
|
285 |
-
// Custom attribute handling
|
286 |
-
$custom_attributes = array();
|
287 |
-
|
288 |
-
if (!empty($args['custom_attributes']) && is_array($args['custom_attributes'])) {
|
289 |
-
foreach ($args['custom_attributes'] as $attribute => $attribute_value) {
|
290 |
-
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
|
291 |
-
}
|
292 |
-
}
|
293 |
-
|
294 |
-
if (!empty($args['validate'])) {
|
295 |
-
foreach ($args['validate'] as $validate) {
|
296 |
-
$args['class'][] = 'validate-' . $validate;
|
297 |
-
}
|
298 |
-
}
|
299 |
-
|
300 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">';
|
301 |
-
|
302 |
-
if ($args['label']) {
|
303 |
-
$field .= '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>';
|
304 |
-
}
|
305 |
-
|
306 |
-
$field .= '<input type="password" class="input-text ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '" value="' . esc_attr($value) . '" ' . implode(' ', $custom_attributes) . ' />';
|
307 |
-
|
308 |
-
if ($args['description']) {
|
309 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
310 |
-
}
|
311 |
-
|
312 |
-
$field .= '</p>' . $after;
|
313 |
-
|
314 |
-
return $field;
|
315 |
-
}
|
316 |
-
|
317 |
-
add_filter('woocommerce_form_field_wooccmpassword', 'wooccm_checkout_field_password_handler', 10, 4);
|
318 |
-
|
319 |
// Radio Buttons
|
320 |
function wooccm_checkout_field_radio_handler($field = '', $key, $args, $value) {
|
321 |
|
322 |
-
global $current_user;
|
323 |
-
|
324 |
-
$user_roles = $current_user->roles;
|
325 |
-
$user_role = array_shift($user_roles);
|
326 |
-
|
327 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
328 |
-
$rolekeys = explode('||', $args['role_options']);
|
329 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
330 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
331 |
-
return;
|
332 |
-
}
|
333 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
334 |
-
return;
|
335 |
-
}
|
336 |
-
}
|
337 |
-
|
338 |
if (!empty($args['clear']))
|
339 |
$after = '<div class="clear"></div>';
|
340 |
else
|
@@ -366,396 +105,6 @@ function wooccm_checkout_field_radio_handler($field = '', $key, $args, $value) {
|
|
366 |
|
367 |
add_filter('woocommerce_form_field_wooccmradio', 'wooccm_checkout_field_radio_handler', 10, 4);
|
368 |
|
369 |
-
/* Select Options
|
370 |
-
function wooccm_checkout_field_select_handler($field = '', $key, $args, $value) {
|
371 |
-
|
372 |
-
global $current_user;
|
373 |
-
|
374 |
-
$user_roles = $current_user->roles;
|
375 |
-
$user_role = array_shift($user_roles);
|
376 |
-
|
377 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
378 |
-
$rolekeys = explode('||', $args['role_options']);
|
379 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
380 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
381 |
-
return;
|
382 |
-
}
|
383 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
384 |
-
return;
|
385 |
-
}
|
386 |
-
}
|
387 |
-
|
388 |
-
if (!empty($args['clear']))
|
389 |
-
$after = '<div class="clear"></div>';
|
390 |
-
else
|
391 |
-
$after = '';
|
392 |
-
|
393 |
-
if ($args['wooccm_required']) {
|
394 |
-
$args['class'][] = 'validate-required';
|
395 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
396 |
-
} else {
|
397 |
-
$required = '';
|
398 |
-
}
|
399 |
-
|
400 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
401 |
-
|
402 |
-
$options = '';
|
403 |
-
|
404 |
-
if (!empty($args['options'])) {
|
405 |
-
//$options .= ( $args['default'] ? '<option value="">' . $args['default'] . '</option>' : '' );
|
406 |
-
|
407 |
-
var_dump($value);
|
408 |
-
|
409 |
-
foreach (explode('||', $args['options']) as $option_key => $option_text) {
|
410 |
-
$options .= '<option value="' . $option_text . '" ' . selected($value, $option_text, false) . '>' . wooccm_wpml_string(esc_attr($option_text)) . '</option>';
|
411 |
-
}
|
412 |
-
}
|
413 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($key) . '_field">';
|
414 |
-
|
415 |
-
if ($args['label'])
|
416 |
-
$field .= '<label for="' . esc_attr($key) . '" class="' . implode(' ', $args['label_class']) . '">' . $args['label'] . $required . '</label>';
|
417 |
-
|
418 |
-
$field .= '
|
419 |
-
<select class="' . esc_attr($args['fancy']) . '" data-placeholder="' . (!empty($args['default']) ? __($args['default'], 'woocommerce-checkout-manager') : '' ) . '" name="' . esc_attr($key) . '" id="' . esc_attr($key) . '" >
|
420 |
-
' . $options . '
|
421 |
-
</select>
|
422 |
-
</p>' . $after;
|
423 |
-
|
424 |
-
return $field;
|
425 |
-
}
|
426 |
-
|
427 |
-
add_filter('woocommerce_form_field_wooccmselect', 'wooccm_checkout_field_select_handler', 10, 4); */
|
428 |
-
|
429 |
-
/* Check Box
|
430 |
-
function wooccm_checkout_field_checkbox_handler($field = '', $key, $args, $value) {
|
431 |
-
|
432 |
-
global $current_user;
|
433 |
-
|
434 |
-
$user_roles = $current_user->roles;
|
435 |
-
$user_role = array_shift($user_roles);
|
436 |
-
|
437 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
438 |
-
$rolekeys = explode('||', $args['role_options']);
|
439 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
440 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
441 |
-
return;
|
442 |
-
}
|
443 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
444 |
-
return;
|
445 |
-
}
|
446 |
-
}
|
447 |
-
|
448 |
-
$args['options'] = explode('||', $args['options']);
|
449 |
-
|
450 |
-
if (!empty($args['clear']))
|
451 |
-
$after = '<div class="clear"></div>';
|
452 |
-
else
|
453 |
-
$after = '';
|
454 |
-
|
455 |
-
if ($args['wooccm_required']) {
|
456 |
-
$args['class'][] = 'validate-required';
|
457 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
458 |
-
} else {
|
459 |
-
$required = '';
|
460 |
-
}
|
461 |
-
|
462 |
-
$field = '
|
463 |
-
<p class="form-row ' . implode(' ', $args['class']) . '" id="' . $key . '_field">
|
464 |
-
<label for="' . $key . '_checkbox" class="woocommerce-form__label woocommerce-form__label-for-checkbox ' . implode(' ', $args['label_class']) . '">
|
465 |
-
<input type="checkbox" id="' . $key . '_checkbox" name="' . $key . '" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" value="1" />
|
466 |
-
<span>' . $args['label'] . '</span>' . $required . '
|
467 |
-
</label>
|
468 |
-
</p>' . $after;
|
469 |
-
|
470 |
-
return $field;
|
471 |
-
}
|
472 |
-
|
473 |
-
add_filter('woocommerce_form_field_checkbox_wccm', 'wooccm_checkout_field_checkbox_handler', 10, 4);*/
|
474 |
-
|
475 |
-
/* State
|
476 |
-
function wooccm_checkout_field_state_handler($field = '', $key, $args, $value) {
|
477 |
-
|
478 |
-
global $current_user;
|
479 |
-
|
480 |
-
$user_roles = $current_user->roles;
|
481 |
-
$user_role = array_shift($user_roles);
|
482 |
-
|
483 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
484 |
-
$rolekeys = explode('||', $args['role_options']);
|
485 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
486 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
487 |
-
return;
|
488 |
-
}
|
489 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
490 |
-
return;
|
491 |
-
}
|
492 |
-
}
|
493 |
-
|
494 |
-
if (!empty($args['clear']))
|
495 |
-
$after = '<div class="clear"></div>';
|
496 |
-
else
|
497 |
-
$after = '';
|
498 |
-
|
499 |
-
$args['class'][] = 'address-field';
|
500 |
-
|
501 |
-
$country_key = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
|
502 |
-
$current_cc = WC()->checkout->get_value($country_key);
|
503 |
-
$states = WC()->countries->get_states($current_cc);
|
504 |
-
|
505 |
-
if ($args['wooccm_required']) {
|
506 |
-
if (!empty($states)) {
|
507 |
-
if (!in_array('validate-required', $args['class']))
|
508 |
-
$args['class'][] = 'validate-required';
|
509 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
510 |
-
} else {
|
511 |
-
$args['class'][] = 'woocommerce-validated';
|
512 |
-
}
|
513 |
-
} else {
|
514 |
-
$required = '';
|
515 |
-
$args['class'][] = 'woocommerce-validated';
|
516 |
-
}
|
517 |
-
|
518 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
519 |
-
|
520 |
-
if (is_string($args['label_class'])) {
|
521 |
-
$args['label_class'] = array($args['label_class']);
|
522 |
-
}
|
523 |
-
|
524 |
-
if (is_null($value)) {
|
525 |
-
$value = $args['default'];
|
526 |
-
}
|
527 |
-
|
528 |
-
// Custom attribute handling
|
529 |
-
$custom_attributes = array();
|
530 |
-
|
531 |
-
if (!empty($args['custom_attributes']) && is_array($args['custom_attributes'])) {
|
532 |
-
foreach ($args['custom_attributes'] as $attribute => $attribute_value) {
|
533 |
-
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
|
534 |
-
}
|
535 |
-
}
|
536 |
-
|
537 |
-
if (!empty($states) && !empty($args['validate'])) {
|
538 |
-
foreach ($args['validate'] as $validate) {
|
539 |
-
$args['class'][] = 'validate-' . $validate;
|
540 |
-
}
|
541 |
-
}
|
542 |
-
|
543 |
-
if (is_array($states) && empty($states)) {
|
544 |
-
|
545 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field" style="display: none">';
|
546 |
-
|
547 |
-
if ($args['label']) {
|
548 |
-
$field .= '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>';
|
549 |
-
}
|
550 |
-
$field .= '<input type="hidden" class="hidden" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" value="" ' . implode(' ', $custom_attributes) . ' placeholder="' . esc_attr($args['placeholder']) . '" />';
|
551 |
-
|
552 |
-
if ($args['description']) {
|
553 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
554 |
-
}
|
555 |
-
|
556 |
-
$field .= '</p>' . $after;
|
557 |
-
} elseif (is_array($states)) {
|
558 |
-
|
559 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">';
|
560 |
-
|
561 |
-
if ($args['label'])
|
562 |
-
$field .= '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>';
|
563 |
-
$field .= '<select name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" class="state_select ' . esc_attr(implode(' ', $args['input_class'])) . '" ' . implode(' ', $custom_attributes) . ' placeholder="' . esc_attr($args['placeholder']) . '">
|
564 |
-
<option value="">' . __('Select a state…', 'woocommerce-checkout-manager') . '</option>';
|
565 |
-
|
566 |
-
foreach ($states as $ckey => $cvalue) {
|
567 |
-
$field .= '<option value="' . esc_attr($ckey) . '" ' . selected($value, $ckey, false) . '>' . (!empty($cvalue) ? __($cvalue, 'woocommerce-checkout-manager') : '' ) . '</option>';
|
568 |
-
}
|
569 |
-
|
570 |
-
$field .= '</select>';
|
571 |
-
|
572 |
-
if ($args['description']) {
|
573 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
574 |
-
}
|
575 |
-
|
576 |
-
$field .= '</p>' . $after;
|
577 |
-
} else {
|
578 |
-
|
579 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">';
|
580 |
-
|
581 |
-
if ($args['label']) {
|
582 |
-
$field .= '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>';
|
583 |
-
}
|
584 |
-
$field .= '<input type="text" class="input-text ' . esc_attr(implode(' ', $args['input_class'])) . '" value="' . esc_attr($value) . '" placeholder="' . esc_attr($args['placeholder']) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" ' . implode(' ', $custom_attributes) . ' />';
|
585 |
-
|
586 |
-
if ($args['description']) {
|
587 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
588 |
-
}
|
589 |
-
|
590 |
-
$field .= '</p>' . $after;
|
591 |
-
}
|
592 |
-
|
593 |
-
return $field;
|
594 |
-
}
|
595 |
-
|
596 |
-
add_filter('woocommerce_form_field_wooccmstate', 'wooccm_checkout_field_state_handler', 10, 4);
|
597 |
-
*/
|
598 |
-
/* Country
|
599 |
-
function wooccm_checkout_field_country_handler($field = '', $key, $args, $value) {
|
600 |
-
|
601 |
-
global $current_user;
|
602 |
-
|
603 |
-
$user_roles = $current_user->roles;
|
604 |
-
$user_role = array_shift($user_roles);
|
605 |
-
|
606 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
607 |
-
$rolekeys = explode('||', $args['role_options']);
|
608 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
609 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
610 |
-
return;
|
611 |
-
}
|
612 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
613 |
-
return;
|
614 |
-
}
|
615 |
-
}
|
616 |
-
|
617 |
-
if (!empty($args['clear']))
|
618 |
-
$after = '<div class="clear"></div>';
|
619 |
-
else
|
620 |
-
$after = '';
|
621 |
-
|
622 |
-
$args['class'][] = 'address-field';
|
623 |
-
|
624 |
-
if ($args['wooccm_required']) {
|
625 |
-
$args['class'][] = 'validate-required';
|
626 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
627 |
-
} else {
|
628 |
-
$required = '';
|
629 |
-
}
|
630 |
-
|
631 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
632 |
-
|
633 |
-
if (is_string($args['label_class'])) {
|
634 |
-
$args['label_class'] = array($args['label_class']);
|
635 |
-
}
|
636 |
-
|
637 |
-
if (is_null($value)) {
|
638 |
-
$value = $args['default'];
|
639 |
-
}
|
640 |
-
|
641 |
-
// Custom attribute handling
|
642 |
-
$custom_attributes = array();
|
643 |
-
|
644 |
-
if (!empty($args['custom_attributes']) && is_array($args['custom_attributes'])) {
|
645 |
-
foreach ($args['custom_attributes'] as $attribute => $attribute_value) {
|
646 |
-
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
|
647 |
-
}
|
648 |
-
}
|
649 |
-
|
650 |
-
if (!empty($args['validate'])) {
|
651 |
-
foreach ($args['validate'] as $validate) {
|
652 |
-
$args['class'][] = 'validate-' . $validate;
|
653 |
-
}
|
654 |
-
}
|
655 |
-
|
656 |
-
$countries = $key == 'shipping_country' ? WC()->countries->get_shipping_countries() : WC()->countries->get_allowed_countries();
|
657 |
-
|
658 |
-
if (sizeof($countries) == 1) {
|
659 |
-
|
660 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">';
|
661 |
-
|
662 |
-
if ($args['label']) {
|
663 |
-
$field .= '<label class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . '</label>';
|
664 |
-
}
|
665 |
-
|
666 |
-
$field .= '<strong>' . current(array_values($countries)) . '</strong>';
|
667 |
-
|
668 |
-
$field .= '<input type="hidden" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" value="' . current(array_keys($countries)) . '" ' . implode(' ', $custom_attributes) . ' class="country_to_state" />';
|
669 |
-
|
670 |
-
if ($args['description']) {
|
671 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
672 |
-
}
|
673 |
-
|
674 |
-
$field .= '</p>' . $after;
|
675 |
-
} else {
|
676 |
-
|
677 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($args['id']) . '_field">'
|
678 |
-
. '<label for="' . esc_attr($args['id']) . '" class="' . esc_attr(implode(' ', $args['label_class'])) . '">' . $args['label'] . $required . '</label>'
|
679 |
-
. '<select name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" class="country_to_state country_select ' . esc_attr(implode(' ', $args['input_class'])) . '" ' . implode(' ', $custom_attributes) . '>'
|
680 |
-
. '<option value="">' . __('Select a country…', 'woocommerce-checkout-manager') . '</option>';
|
681 |
-
|
682 |
-
foreach ($countries as $ckey => $cvalue) {
|
683 |
-
$field .= '<option value="' . esc_attr($ckey) . '" ' . selected($value, $ckey, false) . '>' . (!empty($cvalue) ? __($cvalue, 'woocommerce-checkout-manager') : '' ) . '</option>';
|
684 |
-
}
|
685 |
-
|
686 |
-
$field .= '</select>';
|
687 |
-
|
688 |
-
$field .= '<noscript><input type="submit" name="woocommerce_checkout_update_totals" value="' . __('Update country', 'woocommerce-checkout-manager') . '" /></noscript>';
|
689 |
-
|
690 |
-
if ($args['description']) {
|
691 |
-
$field .= '<span class="description">' . esc_attr($args['description']) . '</span>';
|
692 |
-
}
|
693 |
-
|
694 |
-
$field .= '</p>' . $after;
|
695 |
-
}
|
696 |
-
|
697 |
-
return $field;
|
698 |
-
}
|
699 |
-
|
700 |
-
add_filter('woocommerce_form_field_wooccmcountry', 'wooccm_checkout_field_country_handler', 10, 4);
|
701 |
-
*/
|
702 |
-
|
703 |
-
// Multi-Select
|
704 |
-
function wooccm_checkout_field_multiselect_handler($field = '', $key, $args, $value) {
|
705 |
-
|
706 |
-
global $current_user;
|
707 |
-
|
708 |
-
$user_roles = $current_user->roles;
|
709 |
-
$user_role = array_shift($user_roles);
|
710 |
-
|
711 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
712 |
-
$rolekeys = explode('||', $args['role_options']);
|
713 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
714 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
715 |
-
return;
|
716 |
-
}
|
717 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
718 |
-
return;
|
719 |
-
}
|
720 |
-
}
|
721 |
-
|
722 |
-
if (!empty($args['clear']))
|
723 |
-
$after = '<div class="clear"></div>';
|
724 |
-
else
|
725 |
-
$after = '';
|
726 |
-
|
727 |
-
if ($args['wooccm_required']) {
|
728 |
-
$args['class'][] = 'validate-required';
|
729 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
730 |
-
} else {
|
731 |
-
$required = '';
|
732 |
-
}
|
733 |
-
|
734 |
-
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint($args['maxlength']) . '"' : '';
|
735 |
-
|
736 |
-
$options = '';
|
737 |
-
|
738 |
-
if (!empty($args['options'])) {
|
739 |
-
foreach ($args['options'] as $option_key => $option_text) {
|
740 |
-
$options .= '<option value="' . wooccm_wpml_string(esc_attr($option_text)) . '" ' . selected($value, $option_key, false) . '>' . wooccm_wpml_string(esc_attr($option_text)) . '</option>';
|
741 |
-
}
|
742 |
-
}
|
743 |
-
|
744 |
-
$field = '<p class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($key) . '_field">';
|
745 |
-
|
746 |
-
if ($args['label'])
|
747 |
-
$field .= '<label for="' . esc_attr($key) . '" class="' . implode(' ', $args['label_class']) . '">' . $args['label'] . $required . '</label>';
|
748 |
-
|
749 |
-
$field .= '<select data-placeholder="' . __('Select some options', 'woocommerce-checkout-manager') . '" multiple="multiple" name="' . esc_attr($key) . '[]" id="' . esc_attr($key) . '" class="checkout_chosen_select select">
|
750 |
-
' . $options . '
|
751 |
-
</select>
|
752 |
-
</p>' . $after;
|
753 |
-
|
754 |
-
return $field;
|
755 |
-
}
|
756 |
-
|
757 |
-
add_filter('woocommerce_form_field_multiselect', 'wooccm_checkout_field_multiselect_handler', 10, 4);
|
758 |
-
|
759 |
// Multi-Checkbox
|
760 |
function wooccm_checkout_field_multicheckbox_handler($field = '', $key, $args, $value) {
|
761 |
|
@@ -794,158 +143,77 @@ function wooccm_checkout_field_multicheckbox_handler($field = '', $key, $args, $
|
|
794 |
|
795 |
add_filter('woocommerce_form_field_multicheckbox', 'wooccm_checkout_field_multicheckbox_handler', 10, 4);
|
796 |
|
797 |
-
//
|
798 |
-
|
|
|
799 |
|
800 |
-
|
801 |
|
802 |
-
|
803 |
-
$user_role = array_shift($user_roles);
|
804 |
|
805 |
-
|
806 |
-
$rolekeys = explode('||', $args['role_options']);
|
807 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
808 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
809 |
-
return;
|
810 |
-
}
|
811 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
812 |
-
return;
|
813 |
-
}
|
814 |
-
}
|
815 |
|
816 |
-
|
817 |
-
|
818 |
-
else
|
819 |
-
$after = '';
|
820 |
|
821 |
-
|
822 |
-
|
823 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
824 |
-
} else {
|
825 |
-
$required = '';
|
826 |
-
}
|
827 |
|
828 |
-
|
829 |
-
$value = $args['color'];
|
830 |
-
//}
|
831 |
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
<input type="text" class="input-text" maxlength="7" size="6" name="' . $key . '" id="' . $key . '_colorpicker" placeholder="' . $args['placeholder'] . '" value="' . $value . '" />
|
836 |
-
<span class="wooccmcolorpicker_container" class="spec_shootd"></span>
|
837 |
-
</p>' . $after;
|
838 |
|
839 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
840 |
}
|
841 |
|
842 |
add_filter('woocommerce_form_field_colorpicker', 'wooccm_checkout_field_colorpicker_handler', 10, 4);
|
843 |
|
844 |
-
//
|
|
|
845 |
function wooccm_checkout_field_datepicker_handler($field = '', $key, $args, $value) {
|
846 |
|
847 |
-
|
848 |
-
|
849 |
-
$user_roles = $current_user->roles;
|
850 |
-
$user_role = array_shift($user_roles);
|
851 |
|
852 |
-
|
853 |
-
$rolekeys = explode('||', $args['role_options']);
|
854 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
855 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
856 |
-
return;
|
857 |
-
}
|
858 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
859 |
-
return;
|
860 |
-
}
|
861 |
-
}
|
862 |
-
|
863 |
-
if (!empty($args['clear']))
|
864 |
-
$after = '<div class="clear"></div>';
|
865 |
-
else
|
866 |
-
$after = '';
|
867 |
-
|
868 |
-
if ($args['wooccm_required']) {
|
869 |
-
$args['class'][] = 'validate-required';
|
870 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
871 |
-
} else {
|
872 |
-
$required = '';
|
873 |
-
}
|
874 |
|
875 |
-
$
|
876 |
-
<label for="' . $key . '" class="' . implode(' ', $args['label_class']) . '">' . $args['label'] . $required . '</label>
|
877 |
-
<input type="text" class="input-text" name="' . $key . '" id="' . $key . '" placeholder="' . $args['placeholder'] . '" value="' . $value . '" />
|
878 |
-
</p>' . $after;
|
879 |
|
880 |
-
return
|
881 |
}
|
882 |
|
883 |
add_filter('woocommerce_form_field_datepicker', 'wooccm_checkout_field_datepicker_handler', 10, 4);
|
884 |
|
885 |
-
//
|
|
|
886 |
function wooccm_checkout_field_timepicker_handler($field = '', $key, $args, $value) {
|
887 |
|
888 |
-
|
889 |
-
|
890 |
-
$user_roles = $current_user->roles;
|
891 |
-
$user_role = array_shift($user_roles);
|
892 |
-
|
893 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
894 |
-
$rolekeys = explode('||', $args['role_options']);
|
895 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
896 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
897 |
-
return;
|
898 |
-
}
|
899 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
900 |
-
return;
|
901 |
-
}
|
902 |
-
}
|
903 |
-
|
904 |
-
if (!empty($args['clear']))
|
905 |
-
$after = '<div class="clear"></div>';
|
906 |
-
else
|
907 |
-
$after = '';
|
908 |
|
909 |
-
|
910 |
-
$args['class'][] = 'validate-required';
|
911 |
-
$required = ' <abbr class="required" title="' . esc_attr__('required', 'woocommerce') . '">*</abbr>';
|
912 |
-
} else {
|
913 |
-
$required = '';
|
914 |
-
}
|
915 |
|
916 |
-
$
|
917 |
-
<label for="' . $key . '" class="' . implode(' ', $args['label_class']) . '">' . $args['label'] . $required . '</label>
|
918 |
-
<input type="text" class="input-text" name="' . $key . '" id="' . $key . '" placeholder="' . $args['placeholder'] . '" value="' . $value . '" />
|
919 |
-
</p>' . $after;
|
920 |
|
921 |
-
return
|
922 |
}
|
923 |
|
924 |
-
add_filter('
|
925 |
|
926 |
// Heading
|
|
|
927 |
function wooccm_checkout_field_heading_handler($field = '', $key, $args, $value) {
|
928 |
|
929 |
-
global $current_user;
|
930 |
-
|
931 |
-
$user_roles = $current_user->roles;
|
932 |
-
$user_role = array_shift($user_roles);
|
933 |
-
|
934 |
-
if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
|
935 |
-
$rolekeys = explode('||', $args['role_options']);
|
936 |
-
$rolekeys2 = explode('||', $args['role_options2']);
|
937 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
938 |
-
return;
|
939 |
-
}
|
940 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
941 |
-
return;
|
942 |
-
}
|
943 |
-
}
|
944 |
-
|
945 |
$field = '<h3 class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($key) . '_field">' . $args['label'] . '</h3>';
|
946 |
|
947 |
return $field;
|
948 |
}
|
949 |
|
950 |
add_filter('woocommerce_form_field_heading', 'wooccm_checkout_field_heading_handler', 10, 4);
|
951 |
-
?>
|
11 |
|
12 |
function wooccm_checkout_field_upload_handler($field = '', $key, $args, $value) {
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
$upload_name = (!empty($args['placeholder']) ? esc_attr($args['placeholder']) : __('Upload Files', 'woocommerce-checkout-manager') );
|
15 |
|
16 |
if ($args['wooccm_required']) {
|
71 |
|
72 |
add_filter('woocommerce_form_field_wooccmupload', 'wooccm_checkout_field_upload_handler', 10, 4);
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
// Radio Buttons
|
75 |
function wooccm_checkout_field_radio_handler($field = '', $key, $args, $value) {
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
if (!empty($args['clear']))
|
78 |
$after = '<div class="clear"></div>';
|
79 |
else
|
105 |
|
106 |
add_filter('woocommerce_form_field_wooccmradio', 'wooccm_checkout_field_radio_handler', 10, 4);
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
// Multi-Checkbox
|
109 |
function wooccm_checkout_field_multicheckbox_handler($field = '', $key, $args, $value) {
|
110 |
|
143 |
|
144 |
add_filter('woocommerce_form_field_multicheckbox', 'wooccm_checkout_field_multicheckbox_handler', 10, 4);
|
145 |
|
146 |
+
// Multiselect
|
147 |
+
// -----------------------------------------------------------------------------
|
148 |
+
function wooccm_checkout_field_multiselect_handler($field = '', $key, $args, $value) {
|
149 |
|
150 |
+
$args['type'] = 'select';
|
151 |
|
152 |
+
ob_start();
|
|
|
153 |
|
154 |
+
woocommerce_form_field($key, $args, $value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
+
$field = str_replace('<select ', ' <select multiple="multiple" ', ob_get_clean());
|
157 |
+
$field = str_replace('name="' . esc_attr($key) . '"', 'name="' . esc_attr($key) . '[]"', $field);
|
|
|
|
|
158 |
|
159 |
+
return $field;
|
160 |
+
}
|
|
|
|
|
|
|
|
|
161 |
|
162 |
+
add_filter('woocommerce_form_field_multiselect', 'wooccm_checkout_field_multiselect_handler', 10, 4);
|
|
|
|
|
163 |
|
164 |
+
// Colorpicker
|
165 |
+
// -----------------------------------------------------------------------------
|
166 |
+
function wooccm_checkout_field_colorpicker_handler($field = '', $key, $args, $value) {
|
|
|
|
|
|
|
167 |
|
168 |
+
$args['type'] = 'text';
|
169 |
+
$args['maxlength'] = 7;
|
170 |
+
|
171 |
+
ob_start();
|
172 |
+
|
173 |
+
woocommerce_form_field($key, $args, $value);
|
174 |
+
|
175 |
+
return str_replace('</p>', ' <span class="wooccmcolorpicker_container" class="spec_shootd"></span></p>', ob_get_clean());
|
176 |
}
|
177 |
|
178 |
add_filter('woocommerce_form_field_colorpicker', 'wooccm_checkout_field_colorpicker_handler', 10, 4);
|
179 |
|
180 |
+
// Datepicker
|
181 |
+
// -----------------------------------------------------------------------------
|
182 |
function wooccm_checkout_field_datepicker_handler($field = '', $key, $args, $value) {
|
183 |
|
184 |
+
$args['type'] = 'text';
|
|
|
|
|
|
|
185 |
|
186 |
+
ob_start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
+
woocommerce_form_field($key, $args, $value);
|
|
|
|
|
|
|
189 |
|
190 |
+
return ob_get_clean();
|
191 |
}
|
192 |
|
193 |
add_filter('woocommerce_form_field_datepicker', 'wooccm_checkout_field_datepicker_handler', 10, 4);
|
194 |
|
195 |
+
// Timepicker
|
196 |
+
// -----------------------------------------------------------------------------
|
197 |
function wooccm_checkout_field_timepicker_handler($field = '', $key, $args, $value) {
|
198 |
|
199 |
+
$args['type'] = 'text';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
+
ob_start();
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
+
woocommerce_form_field($key, $args, $value);
|
|
|
|
|
|
|
204 |
|
205 |
+
return ob_get_clean();
|
206 |
}
|
207 |
|
208 |
+
add_filter('woocommerce_form_field_timepicker', 'wooccm_checkout_field_timepicker_handler', 10, 4);
|
209 |
|
210 |
// Heading
|
211 |
+
// -----------------------------------------------------------------------------
|
212 |
function wooccm_checkout_field_heading_handler($field = '', $key, $args, $value) {
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
$field = '<h3 class="form-row ' . esc_attr(implode(' ', $args['class'])) . '" id="' . esc_attr($key) . '_field">' . $args['label'] . '</h3>';
|
215 |
|
216 |
return $field;
|
217 |
}
|
218 |
|
219 |
add_filter('woocommerce_form_field_heading', 'wooccm_checkout_field_heading_handler', 10, 4);
|
|
new/fields_handler.php
CHANGED
@@ -46,6 +46,13 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
|
|
46 |
$field['class'][] = 'wooccm-clearfix';
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
return $field;
|
50 |
}
|
51 |
|
@@ -71,14 +78,17 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
|
|
71 |
return $fields;
|
72 |
}
|
73 |
|
74 |
-
function woocommerce_checkout_address_2_field($option) {
|
75 |
-
|
76 |
-
}
|
77 |
|
78 |
function remove_fields_priority($fields) {
|
79 |
|
80 |
foreach ($fields as $key => $field) {
|
|
|
|
|
81 |
unset($fields[$key]['priority']);
|
|
|
82 |
}
|
83 |
|
84 |
return $fields;
|
@@ -114,10 +124,10 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
|
|
114 |
|
115 |
// Fix address_2 field
|
116 |
// -----------------------------------------------------------------------
|
117 |
-
add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
118 |
-
|
119 |
// Fix address fields priority
|
120 |
add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
|
|
121 |
|
122 |
// Fix required country notice when shipping address is activated
|
123 |
// -----------------------------------------------------------------------
|
46 |
$field['class'][] = 'wooccm-clearfix';
|
47 |
}
|
48 |
|
49 |
+
// Required
|
50 |
+
// -----------------------------------------------------------------------
|
51 |
+
|
52 |
+
if (isset($field['required'])) {
|
53 |
+
$field['custom_attributes']['data-required'] = (int) $field['required'];
|
54 |
+
}
|
55 |
+
|
56 |
return $field;
|
57 |
}
|
58 |
|
78 |
return $fields;
|
79 |
}
|
80 |
|
81 |
+
//function woocommerce_checkout_address_2_field($option) {
|
82 |
+
// return 'required';
|
83 |
+
//}
|
84 |
|
85 |
function remove_fields_priority($fields) {
|
86 |
|
87 |
foreach ($fields as $key => $field) {
|
88 |
+
unset($fields[$key]['label']);
|
89 |
+
unset($fields[$key]['placeholder']);
|
90 |
unset($fields[$key]['priority']);
|
91 |
+
unset($fields[$key]['required']);
|
92 |
}
|
93 |
|
94 |
return $fields;
|
124 |
|
125 |
// Fix address_2 field
|
126 |
// -----------------------------------------------------------------------
|
127 |
+
//add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
|
|
128 |
// Fix address fields priority
|
129 |
add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
130 |
+
add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
131 |
|
132 |
// Fix required country notice when shipping address is activated
|
133 |
// -----------------------------------------------------------------------
|
new/fields_init.php
CHANGED
@@ -25,25 +25,23 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
25 |
return array_merge(array_keys(WC()->countries->get_default_address_fields()), $defaults);
|
26 |
}
|
27 |
|
28 |
-
public static function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
return array(
|
31 |
-
'text',
|
32 |
-
'textarea',
|
33 |
-
'password',
|
34 |
-
'select',
|
35 |
-
'multiselect',
|
36 |
-
'radio',
|
37 |
-
'checkbox',
|
38 |
'multicheckbox',
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'country',
|
43 |
-
'state',
|
44 |
-
//'heading',
|
45 |
-
//'button' => __('Button', 'woocommerce-checkout-manager'),
|
46 |
-
'file'
|
47 |
);
|
48 |
}
|
49 |
|
@@ -72,6 +70,8 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
72 |
static function get_field_args() {
|
73 |
|
74 |
$args = array(
|
|
|
|
|
75 |
// Defaults
|
76 |
// -------------------------------------------------------------------
|
77 |
'disabled' => false,
|
@@ -97,7 +97,7 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
97 |
'extra_class' => null,
|
98 |
// Display
|
99 |
// -------------------------------------------------------------------
|
100 |
-
'user_role' => null,
|
101 |
'role_options' => array(),
|
102 |
'role_options2' => array(),
|
103 |
'more_content' => null,
|
@@ -114,6 +114,7 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
114 |
'min_before' => null,
|
115 |
'max_after' => null,
|
116 |
'format_date' => null,
|
|
|
117 |
'single_dd' => null,
|
118 |
'single_max_dd' => null,
|
119 |
'single_max_mm' => null,
|
@@ -142,6 +143,8 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
142 |
'listable' => null,
|
143 |
'sortable' => null,
|
144 |
'filterable' => null,
|
|
|
|
|
145 |
//
|
146 |
// Email
|
147 |
// -------------------------------------------------------------------
|
@@ -153,19 +156,19 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
153 |
return $args;
|
154 |
}
|
155 |
|
156 |
-
public static function get_billing_fields() {
|
157 |
-
return self::get_fields('wccs_settings3', 'billing', self::get_default_address_fields());
|
158 |
}
|
159 |
|
160 |
-
public static function get_shipping_fields() {
|
161 |
-
return self::get_fields('wccs_settings2', 'shipping', self::get_default_address_fields());
|
162 |
}
|
163 |
|
164 |
-
public static function get_additional_fields() {
|
165 |
-
return self::get_fields('wccs_settings', '', self::get_default_address_fields());
|
166 |
}
|
167 |
|
168 |
-
protected static function get_fields($name, $prefix = 'additional', $defaults = array()) {
|
169 |
|
170 |
if ($fields = get_option($name, $prefix, $defaults)) {
|
171 |
|
@@ -185,10 +188,10 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
185 |
|
186 |
$key = sprintf("%s_%s", $prefix, $field['cow']);
|
187 |
|
188 |
-
if (
|
189 |
-
$fields[$id] = self::
|
190 |
} else {
|
191 |
-
$fields[$id] = self::
|
192 |
}
|
193 |
}
|
194 |
|
@@ -203,7 +206,23 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
203 |
return $fields;
|
204 |
}
|
205 |
|
206 |
-
protected static function new_panel_compatibility($field, $key) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
if ($field['type'] == 'wooccmtext') {
|
209 |
$field['type'] = 'text';
|
@@ -223,16 +242,16 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
223 |
if ($field['type'] == 'checkbox_wccm') {
|
224 |
$field['type'] = 'checkbox';
|
225 |
}
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
if ($field['type'] == 'colorpicker') {
|
231 |
$field['default'] = @$field['colorpickerd'];
|
232 |
} else {
|
233 |
$field['default'] = @$field['force_title2'];
|
234 |
}
|
235 |
|
|
|
236 |
if (!empty($field['role_options']) && !is_array($field['role_options'])) {
|
237 |
if (strpos($field['role_options'], '||') !== false) {
|
238 |
$field['role_options'] = explode('||', $field['role_options']);
|
@@ -249,6 +268,7 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
249 |
}
|
250 |
}
|
251 |
|
|
|
252 |
if (!empty($field['days_disabler'])) {
|
253 |
|
254 |
$field['days_disabler'] = array();
|
@@ -261,35 +281,58 @@ if (!class_exists('WOOCCM_Fields')) {
|
|
261 |
}
|
262 |
}
|
263 |
|
264 |
-
|
265 |
-
$field['
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
$field['
|
|
|
|
|
|
|
|
|
271 |
|
272 |
return $field;
|
273 |
}
|
274 |
|
275 |
protected static function old_panel_compatibility($field) {
|
276 |
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
-
|
280 |
-
|
|
|
|
|
281 |
}
|
|
|
|
|
282 |
|
283 |
-
|
|
|
284 |
|
285 |
-
|
286 |
-
$field['days_disabler' . strval($day_index)] = 1;
|
287 |
-
}
|
288 |
|
289 |
-
|
290 |
-
|
|
|
291 |
}
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
return $field;
|
294 |
}
|
295 |
|
25 |
return array_merge(array_keys(WC()->countries->get_default_address_fields()), $defaults);
|
26 |
}
|
27 |
|
28 |
+
public static function get_fields_conditional_types() {
|
29 |
+
|
30 |
+
$fields = self::get_fields_types();
|
31 |
+
|
32 |
+
unset($fields['heading']);
|
33 |
+
unset($fields['button']);
|
34 |
+
|
35 |
+
return array_keys($fields);
|
36 |
+
}
|
37 |
+
|
38 |
+
public static function get_fields_option_types() {
|
39 |
|
40 |
return array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
'multicheckbox',
|
42 |
+
'multiselect',
|
43 |
+
'wooccmselect',
|
44 |
+
'select'
|
|
|
|
|
|
|
|
|
|
|
45 |
);
|
46 |
}
|
47 |
|
70 |
static function get_field_args() {
|
71 |
|
72 |
$args = array(
|
73 |
+
'id' => null,
|
74 |
+
'cow' => null,
|
75 |
// Defaults
|
76 |
// -------------------------------------------------------------------
|
77 |
'disabled' => false,
|
97 |
'extra_class' => null,
|
98 |
// Display
|
99 |
// -------------------------------------------------------------------
|
100 |
+
//'user_role' => null,
|
101 |
'role_options' => array(),
|
102 |
'role_options2' => array(),
|
103 |
'more_content' => null,
|
114 |
'min_before' => null,
|
115 |
'max_after' => null,
|
116 |
'format_date' => null,
|
117 |
+
'date_limit' => null,
|
118 |
'single_dd' => null,
|
119 |
'single_max_dd' => null,
|
120 |
'single_max_mm' => null,
|
143 |
'listable' => null,
|
144 |
'sortable' => null,
|
145 |
'filterable' => null,
|
146 |
+
'single_min_date' => null,
|
147 |
+
'single_max_date' => null,
|
148 |
//
|
149 |
// Email
|
150 |
// -------------------------------------------------------------------
|
156 |
return $args;
|
157 |
}
|
158 |
|
159 |
+
public static function get_billing_fields($new = false) {
|
160 |
+
return self::get_fields('wccs_settings3', 'billing', self::get_default_address_fields(), $new);
|
161 |
}
|
162 |
|
163 |
+
public static function get_shipping_fields($new = false) {
|
164 |
+
return self::get_fields('wccs_settings2', 'shipping', self::get_default_address_fields(), $new);
|
165 |
}
|
166 |
|
167 |
+
public static function get_additional_fields($new = false) {
|
168 |
+
return self::get_fields('wccs_settings', '', self::get_default_address_fields(), $new);
|
169 |
}
|
170 |
|
171 |
+
protected static function get_fields($name, $prefix = 'additional', $defaults = array(), $new) {
|
172 |
|
173 |
if ($fields = get_option($name, $prefix, $defaults)) {
|
174 |
|
188 |
|
189 |
$key = sprintf("%s_%s", $prefix, $field['cow']);
|
190 |
|
191 |
+
if ($new === 'new') {
|
192 |
+
$fields[$id] = self::new_panel_compatibility($field, $key, $id);
|
193 |
} else {
|
194 |
+
$fields[$id] = self::old_panel_compatibility($field, $key, $id);
|
195 |
}
|
196 |
}
|
197 |
|
206 |
return $fields;
|
207 |
}
|
208 |
|
209 |
+
protected static function new_panel_compatibility($field, $key, $id) {
|
210 |
+
|
211 |
+
$field = wp_parse_args($field, self::get_field_args());
|
212 |
+
|
213 |
+
$field['id'] = $id;
|
214 |
+
$field['key'] = $key;
|
215 |
+
$field['name'] = @$field['cow'];
|
216 |
+
|
217 |
+
// General
|
218 |
+
$field['placeholder'] = @$field['placeholder'];
|
219 |
+
$field['clear'] = @$field['clear_row'];
|
220 |
+
$field['required'] = @$field['checkbox'];
|
221 |
+
$field['conditional'] = @$field['conditional_parent_use'];
|
222 |
+
$field['conditional_tie'] = @$field['conditional_parent_slug'];
|
223 |
+
$field['conditional_value'] = @$field['chosen_valt'];
|
224 |
+
$field['add_amount_name'] = @$field['fee_name'];
|
225 |
+
$field['add_amount_tax'] = !@$field['tax_remove'];
|
226 |
|
227 |
if ($field['type'] == 'wooccmtext') {
|
228 |
$field['type'] = 'text';
|
242 |
if ($field['type'] == 'checkbox_wccm') {
|
243 |
$field['type'] = 'checkbox';
|
244 |
}
|
245 |
+
if ($field['type'] == 'time') {
|
246 |
+
$field['type'] = 'timepicker';
|
247 |
+
}
|
|
|
248 |
if ($field['type'] == 'colorpicker') {
|
249 |
$field['default'] = @$field['colorpickerd'];
|
250 |
} else {
|
251 |
$field['default'] = @$field['force_title2'];
|
252 |
}
|
253 |
|
254 |
+
// Roles
|
255 |
if (!empty($field['role_options']) && !is_array($field['role_options'])) {
|
256 |
if (strpos($field['role_options'], '||') !== false) {
|
257 |
$field['role_options'] = explode('||', $field['role_options']);
|
268 |
}
|
269 |
}
|
270 |
|
271 |
+
// Days
|
272 |
if (!empty($field['days_disabler'])) {
|
273 |
|
274 |
$field['days_disabler'] = array();
|
281 |
}
|
282 |
}
|
283 |
|
284 |
+
// Dates
|
285 |
+
if (!empty($field['single_yy']) && !empty($field['single_mm']) && !empty($field['single_dd'])) {
|
286 |
+
$field['single_min_date'] = $field['single_yy'] . '-' . $field['single_mm'] . '-' . $field['single_dd'];
|
287 |
+
} else {
|
288 |
+
$field['single_min_date'] = '';
|
289 |
+
}
|
290 |
+
if (!empty($field['single_max_yy']) && !empty($field['single_max_mm']) && !empty($field['single_max_dd'])) {
|
291 |
+
$field['single_max_date'] = $field['single_max_yy'] . '-' . $field['single_max_mm'] . '-' . $field['single_max_dd'];
|
292 |
+
} else {
|
293 |
+
$field['single_max_date'] = '';
|
294 |
+
}
|
295 |
|
296 |
return $field;
|
297 |
}
|
298 |
|
299 |
protected static function old_panel_compatibility($field) {
|
300 |
|
301 |
+
// Display
|
302 |
+
foreach ($field as $i => $key) {
|
303 |
+
if (is_array($field[$i]) && in_array('key', array('single_p', 'single_p_cat', 'single_px', 'single_px_cat'))) {
|
304 |
+
$field[$i] = implode('||', $field[$i]);
|
305 |
+
}
|
306 |
+
}
|
307 |
|
308 |
+
// Days
|
309 |
+
if (is_array(@$field['days_disabler'])) {
|
310 |
+
foreach ($field['days_disabler'] as $day_index => $day) {
|
311 |
+
$field['days_disabler' . strval($day_index)] = 1;
|
312 |
}
|
313 |
+
$field['days_disabler'] = 1;
|
314 |
+
}
|
315 |
|
316 |
+
// Dates
|
317 |
+
if (!empty($field['single_min_date'])) {
|
318 |
|
319 |
+
$min = explode('-', $field['single_min_date']);
|
|
|
|
|
320 |
|
321 |
+
$field['single_yy'] = $min[0];
|
322 |
+
$field['single_mm'] = $min[1];
|
323 |
+
$field['single_dd'] = $min[2];
|
324 |
}
|
325 |
|
326 |
+
if (!empty($field['single_max_date'])) {
|
327 |
+
|
328 |
+
$max = explode('-', $field['single_max_date']);
|
329 |
+
|
330 |
+
$field['single_max_yy'] = $max[0];
|
331 |
+
$field['single_max_mm'] = $max[1];
|
332 |
+
$field['single_max_dd'] = $max[2];
|
333 |
+
}
|
334 |
+
|
335 |
+
|
336 |
return $field;
|
337 |
}
|
338 |
|
new/fields_register.php
CHANGED
@@ -12,7 +12,6 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
12 |
$fields[$key] = wp_parse_args($custom_field, (array) @$fields[$key]);
|
13 |
|
14 |
//$fields[$key]['key'] = $key;
|
15 |
-
|
16 |
// Class
|
17 |
// -----------------------------------------------------------------------
|
18 |
if (!is_array(@$fields[$key]['class'])) {
|
@@ -62,6 +61,9 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
62 |
if ($fields[$key]['type'] == 'wooccmtext') {
|
63 |
$fields[$key]['type'] = 'text';
|
64 |
}
|
|
|
|
|
|
|
65 |
if ($fields[$key]['type'] == 'wooccmstate') {
|
66 |
$fields[$key]['type'] = 'state';
|
67 |
}
|
@@ -77,6 +79,9 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
77 |
if ($fields[$key]['type'] == 'checkbox_wccm') {
|
78 |
$fields[$key]['type'] = 'checkbox';
|
79 |
}
|
|
|
|
|
|
|
80 |
|
81 |
// Required
|
82 |
// -----------------------------------------------------------------------
|
12 |
$fields[$key] = wp_parse_args($custom_field, (array) @$fields[$key]);
|
13 |
|
14 |
//$fields[$key]['key'] = $key;
|
|
|
15 |
// Class
|
16 |
// -----------------------------------------------------------------------
|
17 |
if (!is_array(@$fields[$key]['class'])) {
|
61 |
if ($fields[$key]['type'] == 'wooccmtext') {
|
62 |
$fields[$key]['type'] = 'text';
|
63 |
}
|
64 |
+
if ($fields[$key]['type'] == 'wooccmpassword') {
|
65 |
+
$fields[$key]['type'] = 'password';
|
66 |
+
}
|
67 |
if ($fields[$key]['type'] == 'wooccmstate') {
|
68 |
$fields[$key]['type'] = 'state';
|
69 |
}
|
79 |
if ($fields[$key]['type'] == 'checkbox_wccm') {
|
80 |
$fields[$key]['type'] = 'checkbox';
|
81 |
}
|
82 |
+
if ($fields[$key]['type'] == 'time') {
|
83 |
+
$fields[$key]['type'] = 'timepicker';
|
84 |
+
}
|
85 |
|
86 |
// Required
|
87 |
// -----------------------------------------------------------------------
|
new/install.php
CHANGED
@@ -24,7 +24,7 @@ if (!class_exists('WOOCCM_Install')) {
|
|
24 |
'clear_row' => '',
|
25 |
'options' => '',
|
26 |
'options_array' => '',
|
27 |
-
'user_role' => '',
|
28 |
'role_options' => '',
|
29 |
'role_options2' => '',
|
30 |
'required' => '',
|
24 |
'clear_row' => '',
|
25 |
'options' => '',
|
26 |
'options_array' => '',
|
27 |
+
//'user_role' => '',
|
28 |
'role_options' => '',
|
29 |
'role_options2' => '',
|
30 |
'required' => '',
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
|
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 5.2.3
|
7 |
-
Stable tag: 4.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -137,6 +137,11 @@ Example:
|
|
137 |
|
138 |
== Changelog ==
|
139 |
|
|
|
|
|
|
|
|
|
|
|
140 |
= 4.4.8 =
|
141 |
* Improvement: backward compatibility with new panel
|
142 |
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 5.2.3
|
7 |
+
Stable tag: 4.4.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
137 |
|
138 |
== Changelog ==
|
139 |
|
140 |
+
= 4.4.9 =
|
141 |
+
* Improvement: unnecessary files removed
|
142 |
+
* Improvement: woocommerce checkout address fields required
|
143 |
+
* Improvement: woocommerce checkout address fields names
|
144 |
+
|
145 |
= 4.4.8 =
|
146 |
* Improvement: backward compatibility with new panel
|
147 |
|
woocommerce-checkout-manager.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Checkout Manager
|
4 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
5 |
-
* Version: 4.4.
|
6 |
* Author: QuadLayers
|
7 |
* Author URI: https://www.quadlayers.com
|
8 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
@@ -16,7 +16,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
|
|
16 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
17 |
}
|
18 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
19 |
-
define('WOOCCM_PLUGIN_VERSION', '4.4.
|
20 |
}
|
21 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
22 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
@@ -197,10 +197,12 @@ if (!class_exists('WOOCCM')) {
|
|
197 |
wp_localize_script('wooccm-admin', 'wooccm', array(
|
198 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
199 |
'nonce' => wp_create_nonce('wooccm_admin'),
|
200 |
-
'
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
|
|
204 |
'icons' => array(
|
205 |
'interactive' => site_url('wp-includes/images/media/interactive.png'),
|
206 |
'spreadsheet' => site_url('wp-includes/images/media/spreadsheet.png'),
|
@@ -208,6 +210,10 @@ if (!class_exists('WOOCCM')) {
|
|
208 |
'audio' => site_url('wp-includes/images/media/audio.png'),
|
209 |
'text' => site_url('wp-includes/images/media/text.png'),
|
210 |
'video' => site_url('wp-includes/images/media/video.png')
|
|
|
|
|
|
|
|
|
211 |
)
|
212 |
));
|
213 |
|
@@ -231,10 +237,12 @@ if (!class_exists('WOOCCM')) {
|
|
231 |
'text' => site_url('wp-includes/images/media/text.png'),
|
232 |
'video' => site_url('wp-includes/images/media/video.png')
|
233 |
),
|
234 |
-
'
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
238 |
));
|
239 |
}
|
240 |
|
@@ -244,12 +252,12 @@ if (!class_exists('WOOCCM')) {
|
|
244 |
|
245 |
//1326
|
246 |
// only for panel
|
247 |
-
wp_enqueue_media();
|
248 |
wp_enqueue_style('wooccm-admin');
|
249 |
-
wp_enqueue_script('wooccm-modal');
|
250 |
// 1326
|
251 |
// only for orders
|
252 |
wp_enqueue_script('wooccm-admin');
|
|
|
253 |
// only for backend maybe orders
|
254 |
wp_enqueue_script('wooccm-order-upload');
|
255 |
}
|
@@ -290,8 +298,6 @@ if (!class_exists('WOOCCM')) {
|
|
290 |
|
291 |
if (is_checkout()) {
|
292 |
|
293 |
-
wp_enqueue_script('wooccm-checkout');
|
294 |
-
|
295 |
// UI
|
296 |
// ---------------------------------------------------------------------
|
297 |
wp_enqueue_style('jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), WC_VERSION);
|
@@ -331,6 +337,8 @@ if (!class_exists('WOOCCM')) {
|
|
331 |
// Dashicons
|
332 |
// ---------------------------------------------------------------------
|
333 |
wp_enqueue_style('dashicons');
|
|
|
|
|
334 |
}
|
335 |
}
|
336 |
|
@@ -357,9 +365,9 @@ if (!class_exists('WOOCCM')) {
|
|
357 |
//1326
|
358 |
//include( WOOCCM_PLUGIN_DIR . 'includes/classes/field_filters.php' );
|
359 |
// @mod - We need to load the templates conditionally
|
360 |
-
include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/add_functions.php' );
|
361 |
-
include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/billing_functions.php' );
|
362 |
-
include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/shipping_functions.php' );
|
363 |
//1326
|
364 |
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/add_wooccmupload.php' );
|
365 |
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/billing_wooccmupload.php' );
|
@@ -382,6 +390,8 @@ if (!class_exists('WOOCCM')) {
|
|
382 |
include( WOOCCM_PLUGIN_DIR . 'new/fields_conditional.php' );
|
383 |
include( WOOCCM_PLUGIN_DIR . 'new/fields_handler.php' );
|
384 |
include( WOOCCM_PLUGIN_DIR . 'new/fields_filters.php' );
|
|
|
|
|
385 |
//include( WOOCCM_PLUGIN_DIR . 'new/premium/fields_amount.php' );
|
386 |
}
|
387 |
|
@@ -438,8 +448,8 @@ add_action('woocommerce_checkout_before_customer_details', 'wooccm_checkout_text
|
|
438 |
add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_billing', 15);
|
439 |
add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_shipping', 1);
|
440 |
add_action('wp_head', 'wooccm_display_front');
|
441 |
-
add_action('wp_head', 'wooccm_billing_hide_required');
|
442 |
-
add_action('wp_head', 'wooccm_shipping_hide_required');
|
443 |
// @mod - wooccm_run_color_inner does not exist
|
444 |
// add_action( 'wooccm_run_color_innerpicker', 'wooccm_run_color_inner' ); run color inside options page (proto)
|
445 |
//add_action('woocommerce_before_checkout_form', 'wooccm_override_this');
|
@@ -457,11 +467,11 @@ add_action('woocommerce_checkout_process', 'wooccm_billing_custom_checkout_proce
|
|
457 |
add_action('woocommerce_checkout_process', 'wooccm_shipping_custom_checkout_process');
|
458 |
|
459 |
//1326
|
460 |
-
add_action('woocommerce_before_checkout_form', 'wooccm_billing_scripts');
|
461 |
//add_action('woocommerce_before_checkout_form', 'wooccm_billing_override_this');
|
462 |
-
add_action('woocommerce_before_checkout_form', 'wooccm_shipping_scripts');
|
463 |
//add_action('woocommerce_before_checkout_form', 'wooccm_shipping_override_this');
|
464 |
-
add_action('woocommerce_before_checkout_form', 'wooccm_scripts');
|
465 |
//add_action('woocommerce_before_checkout_form', 'wooccm_upload_scripts');
|
466 |
|
467 |
add_action('woocommerce_checkout_fields', 'wooccm_order_notes');
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Checkout Manager
|
4 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
5 |
+
* Version: 4.4.9
|
6 |
* Author: QuadLayers
|
7 |
* Author URI: https://www.quadlayers.com
|
8 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
16 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
17 |
}
|
18 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
19 |
+
define('WOOCCM_PLUGIN_VERSION', '4.4.9');
|
20 |
}
|
21 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
22 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
197 |
wp_localize_script('wooccm-admin', 'wooccm', array(
|
198 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
199 |
'nonce' => wp_create_nonce('wooccm_admin'),
|
200 |
+
'message' => array(
|
201 |
+
'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
|
202 |
+
'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
|
203 |
+
'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
|
204 |
+
'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
|
205 |
+
),
|
206 |
'icons' => array(
|
207 |
'interactive' => site_url('wp-includes/images/media/interactive.png'),
|
208 |
'spreadsheet' => site_url('wp-includes/images/media/spreadsheet.png'),
|
210 |
'audio' => site_url('wp-includes/images/media/audio.png'),
|
211 |
'text' => site_url('wp-includes/images/media/text.png'),
|
212 |
'video' => site_url('wp-includes/images/media/video.png')
|
213 |
+
),
|
214 |
+
'fields' => array(
|
215 |
+
'args' => WOOCCM_Fields::get_field_args(),
|
216 |
+
'option' => WOOCCM_Fields::get_fields_option_types(),
|
217 |
)
|
218 |
));
|
219 |
|
237 |
'text' => site_url('wp-includes/images/media/text.png'),
|
238 |
'video' => site_url('wp-includes/images/media/video.png')
|
239 |
),
|
240 |
+
'message' => array(
|
241 |
+
'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
|
242 |
+
'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
|
243 |
+
'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
|
244 |
+
'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
|
245 |
+
)
|
246 |
));
|
247 |
}
|
248 |
|
252 |
|
253 |
//1326
|
254 |
// only for panel
|
255 |
+
wp_enqueue_media();
|
256 |
wp_enqueue_style('wooccm-admin');
|
|
|
257 |
// 1326
|
258 |
// only for orders
|
259 |
wp_enqueue_script('wooccm-admin');
|
260 |
+
wp_enqueue_script('wooccm-modal');
|
261 |
// only for backend maybe orders
|
262 |
wp_enqueue_script('wooccm-order-upload');
|
263 |
}
|
298 |
|
299 |
if (is_checkout()) {
|
300 |
|
|
|
|
|
301 |
// UI
|
302 |
// ---------------------------------------------------------------------
|
303 |
wp_enqueue_style('jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), WC_VERSION);
|
337 |
// Dashicons
|
338 |
// ---------------------------------------------------------------------
|
339 |
wp_enqueue_style('dashicons');
|
340 |
+
|
341 |
+
wp_enqueue_script('wooccm-checkout');
|
342 |
}
|
343 |
}
|
344 |
|
365 |
//1326
|
366 |
//include( WOOCCM_PLUGIN_DIR . 'includes/classes/field_filters.php' );
|
367 |
// @mod - We need to load the templates conditionally
|
368 |
+
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/add_functions.php' );
|
369 |
+
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/billing_functions.php' );
|
370 |
+
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/shipping_functions.php' );
|
371 |
//1326
|
372 |
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/add_wooccmupload.php' );
|
373 |
//include( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/billing_wooccmupload.php' );
|
390 |
include( WOOCCM_PLUGIN_DIR . 'new/fields_conditional.php' );
|
391 |
include( WOOCCM_PLUGIN_DIR . 'new/fields_handler.php' );
|
392 |
include( WOOCCM_PLUGIN_DIR . 'new/fields_filters.php' );
|
393 |
+
//include( WOOCCM_PLUGIN_DIR . 'new/premium/fields_datepicker.php' );
|
394 |
+
//include( WOOCCM_PLUGIN_DIR . 'new/premium/fields_timepicker.php' );
|
395 |
//include( WOOCCM_PLUGIN_DIR . 'new/premium/fields_amount.php' );
|
396 |
}
|
397 |
|
448 |
add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_billing', 15);
|
449 |
add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_shipping', 1);
|
450 |
add_action('wp_head', 'wooccm_display_front');
|
451 |
+
//add_action('wp_head', 'wooccm_billing_hide_required');
|
452 |
+
//add_action('wp_head', 'wooccm_shipping_hide_required');
|
453 |
// @mod - wooccm_run_color_inner does not exist
|
454 |
// add_action( 'wooccm_run_color_innerpicker', 'wooccm_run_color_inner' ); run color inside options page (proto)
|
455 |
//add_action('woocommerce_before_checkout_form', 'wooccm_override_this');
|
467 |
add_action('woocommerce_checkout_process', 'wooccm_shipping_custom_checkout_process');
|
468 |
|
469 |
//1326
|
470 |
+
//add_action('woocommerce_before_checkout_form', 'wooccm_billing_scripts');
|
471 |
//add_action('woocommerce_before_checkout_form', 'wooccm_billing_override_this');
|
472 |
+
//add_action('woocommerce_before_checkout_form', 'wooccm_shipping_scripts');
|
473 |
//add_action('woocommerce_before_checkout_form', 'wooccm_shipping_override_this');
|
474 |
+
//add_action('woocommerce_before_checkout_form', 'wooccm_scripts');
|
475 |
//add_action('woocommerce_before_checkout_form', 'wooccm_upload_scripts');
|
476 |
|
477 |
add_action('woocommerce_checkout_fields', 'wooccm_order_notes');
|