Version Description
- Fix: woocommerce checkout new admin panel reset option
Download this release
Release Info
| Developer | quadlayers |
| Plugin | |
| Version | 4.5.3 |
| Comparing to | |
| See all releases | |
Code changes from version 4.5.2 to 4.5.3
- assets/css/wooccm.css +3 -3
- assets/css/wooccm.css.map +1 -1
- assets/js/wooccm-admin.js +0 -70
- assets/js/wooccm-admin.min.js +1 -1
- assets/js/{wooccm-modal.js → wooccm-field.js} +121 -8
- assets/js/wooccm-field.min.js +1 -0
- assets/js/wooccm-modal.min.js +0 -1
- assets/less/wooccm.less +2 -2
- includes/admin.php +4 -4
- includes/install.php +5 -7
- new/class-wooccm-admin.php +6 -3
- new/controller/class-field-controller.php +52 -5
- new/model/class-wooccm-field-old.php +19 -5
- new/model/class-wooccm-field.php +15 -0
- new/view/backend/pages/modals/parts/panel-general.php +6 -2
- new/view/backend/pages/parts/actions.php +2 -2
- new/view/frontend/fields/additional.php +14 -11
- new/view/frontend/fields/register.php +14 -46
- readme.txt +4 -1
- woocommerce-checkout-manager.php +2 -2
assets/css/wooccm.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
-
.woocommerce form .
|
| 2 |
-
.woocommerce form .
|
| 3 |
content: '';
|
| 4 |
display: table;
|
| 5 |
}
|
| 6 |
-
.woocommerce form .
|
| 7 |
clear: both;
|
| 8 |
}
|
| 9 |
.button.fileinput-button {
|
| 1 |
+
.woocommerce form .wooccm-clearfix:before,
|
| 2 |
+
.woocommerce form .wooccm-clearfix:after {
|
| 3 |
content: '';
|
| 4 |
display: table;
|
| 5 |
}
|
| 6 |
+
.woocommerce form .wooccm-clearfix:after {
|
| 7 |
clear: both;
|
| 8 |
}
|
| 9 |
.button.fileinput-button {
|
assets/css/wooccm.css.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"sources":["../less/wooccm.less"],"names":[],"mappings":"AAKI,YALS,
|
| 1 |
+
{"version":3,"sources":["../less/wooccm.less"],"names":[],"mappings":"AAKI,YALS,KAEX,iBAGG;AACC,YANO,KAEX,iBAIK;EACD,SAAQ,EAAR;EACA,cAAA;;AAEF,YAVS,KAEX,iBAQG;EACC,WAAA;;AAOJ,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAMN;EACE,cAAA;EACA,UAAA;EACA,aAAA;EACA,eAAA;EACA,mBAAA;EACA,sBAAA;;AANF,kBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EAEA,kBAAA;;AAhBJ,kBAQE,mBAWE;EACE,UAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;EACA,eAAA;EACA,iBAAA;;AAnCN,kBAQE,mBA8BE;EACE,WAAA;EACA,gBAAA;;AAxCN,kBAQE,mBAmCE;EACE,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,gBAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;EACA,gBAAA;;AAnDN,kBAQE,mBAmCE,mCAUE;EACE,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,QAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;;AAEA,kBAtDN,mBAmCE,mCAUE,MASG;EACC,MAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EAEA,gBAAA;EACA,YAAA;EACA,WAAA","file":"wooccm.css"}
|
assets/js/wooccm-admin.js
CHANGED
|
@@ -225,74 +225,4 @@
|
|
| 225 |
|
| 226 |
});
|
| 227 |
|
| 228 |
-
$(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
|
| 229 |
-
e.preventDefault();
|
| 230 |
-
|
| 231 |
-
var $link = $(this),
|
| 232 |
-
$tr = $link.closest('tr'),
|
| 233 |
-
$toggle = $link.find('.woocommerce-input-toggle');
|
| 234 |
-
|
| 235 |
-
$.ajax({
|
| 236 |
-
url: wooccm_admin.ajax_url,
|
| 237 |
-
data: {
|
| 238 |
-
action: 'wooccm_toggle_field_attribute',
|
| 239 |
-
nonce: wooccm_admin.nonce,
|
| 240 |
-
field_attr: $(this).data('field_attr'),
|
| 241 |
-
field_id: $tr.data('field_id')
|
| 242 |
-
},
|
| 243 |
-
dataType: 'json',
|
| 244 |
-
type: 'POST',
|
| 245 |
-
beforeSend: function (response) {
|
| 246 |
-
$toggle.addClass('woocommerce-input-toggle--loading');
|
| 247 |
-
},
|
| 248 |
-
success: function (response) {
|
| 249 |
-
|
| 250 |
-
if (true === response.data) {
|
| 251 |
-
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
| 252 |
-
$toggle.addClass('woocommerce-input-toggle--enabled');
|
| 253 |
-
$toggle.removeClass('woocommerce-input-toggle--loading');
|
| 254 |
-
} else if (true !== response.data) {
|
| 255 |
-
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
| 256 |
-
$toggle.addClass('woocommerce-input-toggle--disabled');
|
| 257 |
-
$toggle.removeClass('woocommerce-input-toggle--loading');
|
| 258 |
-
} //else if ('needs_setup' === response.data) {
|
| 259 |
-
//window.location.href = $link.attr('href');
|
| 260 |
-
//}
|
| 261 |
-
}
|
| 262 |
-
|
| 263 |
-
});
|
| 264 |
-
|
| 265 |
-
return false;
|
| 266 |
-
});
|
| 267 |
-
|
| 268 |
-
$(document).on('change', '.wooccm-field-change-attribute', function (e) {
|
| 269 |
-
e.preventDefault();
|
| 270 |
-
|
| 271 |
-
var $change = $(this),
|
| 272 |
-
$tr = $change.closest('tr');
|
| 273 |
-
|
| 274 |
-
$.ajax({
|
| 275 |
-
url: wooccm_admin.ajax_url,
|
| 276 |
-
data: {
|
| 277 |
-
action: 'wooccm_change_field_attribute',
|
| 278 |
-
nonce: wooccm_admin.nonce,
|
| 279 |
-
field_attr: $change.data('field_attr'),
|
| 280 |
-
field_value: $change.val(),
|
| 281 |
-
field_id: $tr.data('field_id'),
|
| 282 |
-
},
|
| 283 |
-
dataType: 'json',
|
| 284 |
-
type: 'POST',
|
| 285 |
-
beforeSend: function (response) {
|
| 286 |
-
$change.prop('disabled', true);
|
| 287 |
-
},
|
| 288 |
-
success: function (response) {
|
| 289 |
-
console.log(response.data);
|
| 290 |
-
},
|
| 291 |
-
complete: function (response) {
|
| 292 |
-
$change.prop('disabled', false);
|
| 293 |
-
},
|
| 294 |
-
});
|
| 295 |
-
return false;
|
| 296 |
-
});
|
| 297 |
-
|
| 298 |
})(jQuery);
|
| 225 |
|
| 226 |
});
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
})(jQuery);
|
assets/js/wooccm-admin.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
(function(b){b.fn.serializeArrayAll=function(){var f={};var e=this.serializeArray();b.each(e,function(){if(f[this.name]!==undefined){if(!f[this.name].push){f[this.name]=[f[this.name]]}f[this.name].push(this.value||"")}else{f[this.name]=this.value||""}});var d=b("input[type=radio],input[type=checkbox]",this);b.each(d,function(){if(!f.hasOwnProperty(this.name)){f[this.name]=""}});return f};function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-tab-panels",function(i,h){var g=b(i.target),f=g.find("ul.wc-tabs"),d=f.find('a[href="'+h+'"]');f.show();f.find("a").click(function(k){k.preventDefault();var j=b(this).closest("div.panel-wrap");f.find("li",j).removeClass("active");b(this).parent().addClass("active");b("div.panel",j).hide();b(b(this).attr("href")).show()});if(d.length&&b(d.attr("href")).length){d.click()}else{f.find("li.active").find("a").click()}});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-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)})}}})})
|
| 1 |
+
(function(b){b.fn.serializeArrayAll=function(){var f={};var e=this.serializeArray();b.each(e,function(){if(f[this.name]!==undefined){if(!f[this.name].push){f[this.name]=[f[this.name]]}f[this.name].push(this.value||"")}else{f[this.name]=this.value||""}});var d=b("input[type=radio],input[type=checkbox]",this);b.each(d,function(){if(!f.hasOwnProperty(this.name)){f[this.name]=""}});return f};function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-tab-panels",function(i,h){var g=b(i.target),f=g.find("ul.wc-tabs"),d=f.find('a[href="'+h+'"]');f.show();f.find("a").click(function(k){k.preventDefault();var j=b(this).closest("div.panel-wrap");f.find("li",j).removeClass("active");b(this).parent().addClass("active");b("div.panel",j).hide();b(b(this).attr("href")).show()});if(d.length&&b(d.attr("href")).length){d.click()}else{f.find("li.active").find("a").click()}});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-select").filter(":not(.enhanced)").each(function(){var e=b.extend({minimumResultsForSearch:10,allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder")},a());b(this).selectWoo(e).addClass("enhanced")});b(".wooccm-product-search").filter(":not(.enhanced)").each(function(){var g={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):"3",escapeMarkup:function(h){return h},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(h){return{term:h.term,action:b(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:b(this).select2("val")||0,exclude:b(this).data("exclude"),include:b(this).data("include"),limit:b(this).data("limit"),display_stock:b(this).data("display_stock")}},processResults:function(i){var h=[];if(i){b.each(i,function(k,j){h.push({id:k,text:j})})}return{results:h}},cache:true}};g=b.extend(g,a());b(this).selectWoo(g).addClass("enhanced");if(b(this).data("sortable")){var f=b(this);var e=b(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){b(e.find(".select2-selection__choice").get().reverse()).each(function(){var i=b(this).data("data").id;var h=f.find('option[value="'+i+'"]')[0];f.prepend(h)})}})}else{if(b(this).prop("multiple")){b(this).on("change",function(){var h=b(this).children();h.sort(function(j,i){var l=j.text.toLowerCase();var k=i.text.toLowerCase();if(l>k){return 1}if(l<k){return -1}return 0});b(this).html(h)})}}})})})(jQuery);
|
assets/js/{wooccm-modal.js → wooccm-field.js}
RENAMED
|
@@ -24,7 +24,7 @@
|
|
| 24 |
};
|
| 25 |
|
| 26 |
var Field = Backbone.Model.extend({
|
| 27 |
-
defaults:
|
| 28 |
});
|
| 29 |
|
| 30 |
var FieldView = Backbone.View.extend({
|
|
@@ -79,10 +79,10 @@
|
|
| 79 |
}
|
| 80 |
|
| 81 |
$.ajax({
|
| 82 |
-
url:
|
| 83 |
data: {
|
| 84 |
action: 'wooccm_load_field',
|
| 85 |
-
nonce:
|
| 86 |
field_id: this.model.attributes.id
|
| 87 |
},
|
| 88 |
dataType: 'json',
|
|
@@ -205,10 +205,10 @@
|
|
| 205 |
//console.log(modal.model.attributes);
|
| 206 |
|
| 207 |
$.ajax({
|
| 208 |
-
url:
|
| 209 |
data: {
|
| 210 |
action: 'wooccm_save_field',
|
| 211 |
-
nonce:
|
| 212 |
field_id: modal.model.attributes.id,
|
| 213 |
field_data: modal.model.attributes//$form.serializeArrayAll()
|
| 214 |
},
|
|
@@ -272,6 +272,48 @@
|
|
| 272 |
new FieldModal(e);
|
| 273 |
});
|
| 274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
$('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
|
| 276 |
e.preventDefault();
|
| 277 |
|
|
@@ -285,17 +327,17 @@
|
|
| 285 |
$field = $button.closest('[data-field_id]'),
|
| 286 |
field_id = $field.data('field_id');
|
| 287 |
|
| 288 |
-
var c = confirm(
|
| 289 |
|
| 290 |
if (!c) {
|
| 291 |
return false;
|
| 292 |
}
|
| 293 |
|
| 294 |
$.ajax({
|
| 295 |
-
url:
|
| 296 |
data: {
|
| 297 |
action: 'wooccm_delete_field',
|
| 298 |
-
nonce:
|
| 299 |
field_id: field_id,
|
| 300 |
},
|
| 301 |
dataType: 'json',
|
|
@@ -322,5 +364,76 @@
|
|
| 322 |
return false;
|
| 323 |
});
|
| 324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
|
| 326 |
})(jQuery);
|
| 24 |
};
|
| 25 |
|
| 26 |
var Field = Backbone.Model.extend({
|
| 27 |
+
defaults: wooccm_field.args
|
| 28 |
});
|
| 29 |
|
| 30 |
var FieldView = Backbone.View.extend({
|
| 79 |
}
|
| 80 |
|
| 81 |
$.ajax({
|
| 82 |
+
url: wooccm_field.ajax_url,
|
| 83 |
data: {
|
| 84 |
action: 'wooccm_load_field',
|
| 85 |
+
nonce: wooccm_field.nonce,
|
| 86 |
field_id: this.model.attributes.id
|
| 87 |
},
|
| 88 |
dataType: 'json',
|
| 205 |
//console.log(modal.model.attributes);
|
| 206 |
|
| 207 |
$.ajax({
|
| 208 |
+
url: wooccm_field.ajax_url,
|
| 209 |
data: {
|
| 210 |
action: 'wooccm_save_field',
|
| 211 |
+
nonce: wooccm_field.nonce,
|
| 212 |
field_id: modal.model.attributes.id,
|
| 213 |
field_data: modal.model.attributes//$form.serializeArrayAll()
|
| 214 |
},
|
| 272 |
new FieldModal(e);
|
| 273 |
});
|
| 274 |
|
| 275 |
+
|
| 276 |
+
$('#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset').on('click', function (e) {
|
| 277 |
+
e.preventDefault();
|
| 278 |
+
|
| 279 |
+
var $button = $(e.target);
|
| 280 |
+
|
| 281 |
+
var c = confirm(wooccm_field.message.reset);
|
| 282 |
+
|
| 283 |
+
if (!c) {
|
| 284 |
+
return false;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
$.ajax({
|
| 288 |
+
url: wooccm_field.ajax_url,
|
| 289 |
+
data: {
|
| 290 |
+
action: 'wooccm_reset_fields',
|
| 291 |
+
nonce: wooccm_field.nonce
|
| 292 |
+
},
|
| 293 |
+
dataType: 'json',
|
| 294 |
+
type: 'POST',
|
| 295 |
+
beforeSend: function () {
|
| 296 |
+
},
|
| 297 |
+
complete: function () {
|
| 298 |
+
//$('table.form-table').trigger('wooccm-panel-reload');
|
| 299 |
+
},
|
| 300 |
+
error: function () {
|
| 301 |
+
alert('Error!');
|
| 302 |
+
},
|
| 303 |
+
success: function (response) {
|
| 304 |
+
if (response.success) {
|
| 305 |
+
|
| 306 |
+
location.reload();
|
| 307 |
+
|
| 308 |
+
} else {
|
| 309 |
+
alert(response.data);
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
});
|
| 313 |
+
|
| 314 |
+
return false;
|
| 315 |
+
});
|
| 316 |
+
|
| 317 |
$('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
|
| 318 |
e.preventDefault();
|
| 319 |
|
| 327 |
$field = $button.closest('[data-field_id]'),
|
| 328 |
field_id = $field.data('field_id');
|
| 329 |
|
| 330 |
+
var c = confirm(wooccm_field.message.remove);
|
| 331 |
|
| 332 |
if (!c) {
|
| 333 |
return false;
|
| 334 |
}
|
| 335 |
|
| 336 |
$.ajax({
|
| 337 |
+
url: wooccm_field.ajax_url,
|
| 338 |
data: {
|
| 339 |
action: 'wooccm_delete_field',
|
| 340 |
+
nonce: wooccm_field.nonce,
|
| 341 |
field_id: field_id,
|
| 342 |
},
|
| 343 |
dataType: 'json',
|
| 364 |
return false;
|
| 365 |
});
|
| 366 |
|
| 367 |
+
$(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
|
| 368 |
+
e.preventDefault();
|
| 369 |
+
|
| 370 |
+
var $link = $(this),
|
| 371 |
+
$tr = $link.closest('tr'),
|
| 372 |
+
$toggle = $link.find('.woocommerce-input-toggle');
|
| 373 |
+
|
| 374 |
+
$.ajax({
|
| 375 |
+
url: wooccm_field.ajax_url,
|
| 376 |
+
data: {
|
| 377 |
+
action: 'wooccm_toggle_field_attribute',
|
| 378 |
+
nonce: wooccm_field.nonce,
|
| 379 |
+
field_attr: $(this).data('field_attr'),
|
| 380 |
+
field_id: $tr.data('field_id')
|
| 381 |
+
},
|
| 382 |
+
dataType: 'json',
|
| 383 |
+
type: 'POST',
|
| 384 |
+
beforeSend: function (response) {
|
| 385 |
+
$toggle.addClass('woocommerce-input-toggle--loading');
|
| 386 |
+
},
|
| 387 |
+
success: function (response) {
|
| 388 |
+
|
| 389 |
+
if (true === response.data) {
|
| 390 |
+
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
| 391 |
+
$toggle.addClass('woocommerce-input-toggle--enabled');
|
| 392 |
+
$toggle.removeClass('woocommerce-input-toggle--loading');
|
| 393 |
+
} else if (true !== response.data) {
|
| 394 |
+
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
| 395 |
+
$toggle.addClass('woocommerce-input-toggle--disabled');
|
| 396 |
+
$toggle.removeClass('woocommerce-input-toggle--loading');
|
| 397 |
+
} //else if ('needs_setup' === response.data) {
|
| 398 |
+
//window.location.href = $link.attr('href');
|
| 399 |
+
//}
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
});
|
| 403 |
+
|
| 404 |
+
return false;
|
| 405 |
+
});
|
| 406 |
+
|
| 407 |
+
$(document).on('change', '.wooccm-field-change-attribute', function (e) {
|
| 408 |
+
e.preventDefault();
|
| 409 |
+
|
| 410 |
+
var $change = $(this),
|
| 411 |
+
$tr = $change.closest('tr');
|
| 412 |
+
|
| 413 |
+
$.ajax({
|
| 414 |
+
url: wooccm_field.ajax_url,
|
| 415 |
+
data: {
|
| 416 |
+
action: 'wooccm_change_field_attribute',
|
| 417 |
+
nonce: wooccm_field.nonce,
|
| 418 |
+
field_attr: $change.data('field_attr'),
|
| 419 |
+
field_value: $change.val(),
|
| 420 |
+
field_id: $tr.data('field_id'),
|
| 421 |
+
},
|
| 422 |
+
dataType: 'json',
|
| 423 |
+
type: 'POST',
|
| 424 |
+
beforeSend: function (response) {
|
| 425 |
+
$change.prop('disabled', true);
|
| 426 |
+
},
|
| 427 |
+
success: function (response) {
|
| 428 |
+
console.log(response.data);
|
| 429 |
+
},
|
| 430 |
+
complete: function (response) {
|
| 431 |
+
$change.prop('disabled', false);
|
| 432 |
+
},
|
| 433 |
+
});
|
| 434 |
+
return false;
|
| 435 |
+
});
|
| 436 |
+
|
| 437 |
+
|
| 438 |
|
| 439 |
})(jQuery);
|
assets/js/wooccm-field.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 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_field.args});var i=Backbone.View.extend({events:{"click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","change input":"change","change textarea":"change","change select":"change","change .media-modal-change":"render","submit .media-modal-form":"save",},templates:{},initialize:function(){_.bindAll(this,"open","edit","change","load","render","close","save");this.init();this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-window")},render:function(){var k=this;var j=this.$el.find("ul.wc-tabs li.active a").attr("href");k.$el.html(k.templates.window(k.model.attributes));_.delay(function(){k.$el.trigger("wooccm-enhanced-select");k.$el.trigger("wooccm-tab-panels",j);k.$el.trigger("init_tooltips")},100)},load:function(){var j=this;if(j.model.attributes.id==undefined){j.render();return}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_field.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(k){if(k.success){j.model.set(k.data);j.render()}else{alert(k.data)}}})},edit:function(n){n.preventDefault();var l=this,m=e(n.target),k=parseInt(e(".wc_gateways tr[data-field_id]").length-1),j=parseInt(l.model.get("id"));g++;if(b){clearTimeout(b)}b=setTimeout(function(){if(m.hasClass("media-modal-next")){j=Math.min(j+g,k)}else{j=Math.max(j-g,0)}l.model.set({id:j});g=0;l.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();if(m.target.type==="checkbox"){l=k.prop("checked")===true?1:0}this.model.attributes[j]=l;this.model.changed[j]=l},close:function(j){j.preventDefault();this.undelegateEvents();e(document).off("focusin");e("body").removeClass("modal-open");this.remove()},save:function(m){m.preventDefault();var l=this,k=l.$el.find("#wooccm_modal"),j=k.find(".attachment-details");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_id:l.model.attributes.id,field_data:l.model.attributes},dataType:"json",type:"POST",beforeSend:function(){j.addClass("save-waiting");c(k)},complete:function(){j.addClass("save-complete");j.removeClass("save-waiting");f(k)},error:function(){alert("Error!")},success:function(n){if(n.success){if(n.data.id!=l.model.attributes.id){location.reload();return}}else{alert(n.data)}}});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_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",function(j){j.preventDefault();new a(j)});e("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",function(k){k.preventDefault();var j=e(k.target);var l=confirm(wooccm_field.message.reset);if(!l){return false}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_reset_fields",nonce:wooccm_field.nonce},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(m){if(m.success){location.reload()}else{alert(m.data)}}});return false});e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",function(j){j.preventDefault();new a(j)});e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",function(m){m.preventDefault();var l=e(m.target),k=l.closest("[data-field_id]"),j=k.data("field_id");var n=confirm(wooccm_field.message.remove);if(!n){return false}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:j,},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(o){if(o.success){k.remove()}else{alert(o.data)}}});return false});e(document).on("click",".wooccm-field-toggle-attribute",function(m){m.preventDefault();var j=e(this),l=j.closest("tr"),k=j.find(".woocommerce-input-toggle");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:e(this).data("field_attr"),field_id:l.data("field_id")},dataType:"json",type:"POST",beforeSend:function(n){k.addClass("woocommerce-input-toggle--loading")},success:function(n){if(true===n.data){k.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");k.addClass("woocommerce-input-toggle--enabled");k.removeClass("woocommerce-input-toggle--loading")}else{if(true!==n.data){k.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");k.addClass("woocommerce-input-toggle--disabled");k.removeClass("woocommerce-input-toggle--loading")}}}});return false});e(document).on("change",".wooccm-field-change-attribute",function(l){l.preventDefault();var j=e(this),k=j.closest("tr");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:j.data("field_attr"),field_value:j.val(),field_id:k.data("field_id"),},dataType:"json",type:"POST",beforeSend:function(m){j.prop("disabled",true)},success:function(m){console.log(m.data)},complete:function(m){j.prop("disabled",false)},});return false})})(jQuery);
|
assets/js/wooccm-modal.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 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_admin.field.args});var i=Backbone.View.extend({events:{"click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","change input":"change","change textarea":"change","change select":"change","change .media-modal-change":"render","submit .media-modal-form":"save",},templates:{},initialize:function(){_.bindAll(this,"open","edit","change","load","render","close","save");this.init();this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-window")},render:function(){var k=this;var j=this.$el.find("ul.wc-tabs li.active a").attr("href");k.$el.html(k.templates.window(k.model.attributes));_.delay(function(){k.$el.trigger("wooccm-enhanced-select");k.$el.trigger("wooccm-tab-panels",j);k.$el.trigger("init_tooltips")},100)},load:function(){var j=this;if(j.model.attributes.id==undefined){j.render();return}e.ajax({url:wooccm_admin.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_admin.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(k){if(k.success){j.model.set(k.data);j.render()}else{alert(k.data)}}})},edit:function(n){n.preventDefault();var l=this,m=e(n.target),k=parseInt(e(".wc_gateways tr[data-field_id]").length-1),j=parseInt(l.model.get("id"));g++;if(b){clearTimeout(b)}b=setTimeout(function(){if(m.hasClass("media-modal-next")){j=Math.min(j+g,k)}else{j=Math.max(j-g,0)}l.model.set({id:j});g=0;l.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();if(m.target.type==="checkbox"){l=k.prop("checked")===true?1:0}this.model.attributes[j]=l;this.model.changed[j]=l},close:function(j){j.preventDefault();this.undelegateEvents();e(document).off("focusin");e("body").removeClass("modal-open");this.remove()},save:function(m){m.preventDefault();var l=this,k=l.$el.find("#wooccm_modal"),j=k.find(".attachment-details");e.ajax({url:wooccm_admin.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_admin.nonce,field_id:l.model.attributes.id,field_data:l.model.attributes},dataType:"json",type:"POST",beforeSend:function(){j.addClass("save-waiting");c(k)},complete:function(){j.addClass("save-complete");j.removeClass("save-waiting");f(k)},error:function(){alert("Error!")},success:function(n){if(n.success){if(n.data.id!=l.model.attributes.id){location.reload();return}}else{alert(n.data)}}});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_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",function(j){j.preventDefault();new a(j)});e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",function(j){j.preventDefault();new a(j)});e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",function(m){m.preventDefault();var l=e(m.target),k=l.closest("[data-field_id]"),j=k.data("field_id");var n=confirm(wooccm_admin.message.remove);if(!n){return false}e.ajax({url:wooccm_admin.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_admin.nonce,field_id:j,},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(o){if(o.success){k.remove()}else{alert(o.data)}}});return false})})(jQuery);
|
|
|
assets/less/wooccm.less
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
.woocommerce form
|
| 2 |
|
| 3 |
-
|
| 4 |
//float: none;
|
| 5 |
//clear:both;
|
| 6 |
&:before,
|
| 1 |
+
.woocommerce form {
|
| 2 |
|
| 3 |
+
.wooccm-clearfix {
|
| 4 |
//float: none;
|
| 5 |
//clear:both;
|
| 6 |
&:before,
|
includes/admin.php
CHANGED
|
@@ -408,7 +408,7 @@ function wooccm_options_page() {
|
|
| 408 |
),
|
| 409 |
);
|
| 410 |
|
| 411 |
-
|
| 412 |
'country' => __('Country', 'woocommerce-checkout-manager'),
|
| 413 |
'first_name' => __('First Name', 'woocommerce-checkout-manager'),
|
| 414 |
'last_name' => __('Last Name', 'woocommerce-checkout-manager'),
|
|
@@ -557,10 +557,10 @@ function wooccm_options_page() {
|
|
| 557 |
}
|
| 558 |
|
| 559 |
$bill++;
|
| 560 |
-
}
|
| 561 |
add_option('wccs_settings', $defaults);
|
| 562 |
-
add_option('wccs_settings2', $defaults2);
|
| 563 |
-
add_option('wccs_settings3', $defaults3);
|
| 564 |
|
| 565 |
// @mod - Change this to add_query_arg()
|
| 566 |
echo '
|
| 408 |
),
|
| 409 |
);
|
| 410 |
|
| 411 |
+
/*$shipping = array(
|
| 412 |
'country' => __('Country', 'woocommerce-checkout-manager'),
|
| 413 |
'first_name' => __('First Name', 'woocommerce-checkout-manager'),
|
| 414 |
'last_name' => __('Last Name', 'woocommerce-checkout-manager'),
|
| 557 |
}
|
| 558 |
|
| 559 |
$bill++;
|
| 560 |
+
}*/
|
| 561 |
add_option('wccs_settings', $defaults);
|
| 562 |
+
//add_option('wccs_settings2', $defaults2);
|
| 563 |
+
//add_option('wccs_settings3', $defaults3);
|
| 564 |
|
| 565 |
// @mod - Change this to add_query_arg()
|
| 566 |
echo '
|
includes/install.php
CHANGED
|
@@ -33,7 +33,7 @@ function wooccm_install() {
|
|
| 33 |
if (empty($options['checkness']['shipping_method_t'])) {
|
| 34 |
$options['checkness']['shipping_method_t'] = '1';
|
| 35 |
}
|
| 36 |
-
if (empty($options2['shipping_buttons'])) {
|
| 37 |
$shipping = array(
|
| 38 |
'country' => 'Country',
|
| 39 |
'first_name' => 'First Name',
|
|
@@ -241,11 +241,9 @@ function wooccm_install() {
|
|
| 241 |
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type'];
|
| 242 |
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type'];
|
| 243 |
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type'];
|
| 244 |
-
}
|
| 245 |
|
| 246 |
update_option('wccs_settings', $options);
|
| 247 |
-
update_option('wccs_settings2', $options2);
|
| 248 |
-
update_option('wccs_settings3', $options3);
|
| 249 |
-
}
|
| 250 |
-
|
| 251 |
-
?>
|
| 33 |
if (empty($options['checkness']['shipping_method_t'])) {
|
| 34 |
$options['checkness']['shipping_method_t'] = '1';
|
| 35 |
}
|
| 36 |
+
/*if (empty($options2['shipping_buttons'])) {
|
| 37 |
$shipping = array(
|
| 38 |
'country' => 'Country',
|
| 39 |
'first_name' => 'First Name',
|
| 241 |
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type'];
|
| 242 |
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type'];
|
| 243 |
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type'];
|
| 244 |
+
}*/
|
| 245 |
|
| 246 |
update_option('wccs_settings', $options);
|
| 247 |
+
//update_option('wccs_settings2', $options2);
|
| 248 |
+
//update_option('wccs_settings3', $options3);
|
| 249 |
+
}
|
|
|
|
|
|
new/class-wooccm-admin.php
CHANGED
|
@@ -13,18 +13,21 @@ if (!class_exists('WOOCCM_Field_Admin')) {
|
|
| 13 |
|
| 14 |
wp_register_style('wooccm-admin', plugins_url('assets/css/wooccm-admin.css', WOOCCM_PLUGIN_FILE), array('media-views', /* 'woocommerce_admin_marketplace_styles' */), WOOCCM_PLUGIN_VERSION, 'all');
|
| 15 |
|
| 16 |
-
wp_register_script('wooccm-modal', plugins_url('assets/js/wooccm-modal.js', WOOCCM_PLUGIN_FILE), array('jquery', 'jquery-ui-datepicker', 'backbone'), WOOCCM_PLUGIN_VERSION, true);
|
| 17 |
|
| 18 |
wp_register_script('wooccm-admin', plugins_url('assets/js/wooccm-admin.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
'ajax_url' => admin_url('admin-ajax.php?section=' . $current_section),
|
| 22 |
'nonce' => wp_create_nonce('wooccm_admin'),
|
| 23 |
'field' => array(
|
| 24 |
'args' => WOOCCM()->field->billing->get_args(),
|
| 25 |
),
|
| 26 |
'message' => array(
|
| 27 |
-
'remove' => esc_html__('Are you sure you want to remove this field?', 'woocommerce-checkout-manager')
|
|
|
|
| 28 |
)
|
| 29 |
));
|
| 30 |
|
| 13 |
|
| 14 |
wp_register_style('wooccm-admin', plugins_url('assets/css/wooccm-admin.css', WOOCCM_PLUGIN_FILE), array('media-views', /* 'woocommerce_admin_marketplace_styles' */), WOOCCM_PLUGIN_VERSION, 'all');
|
| 15 |
|
|
|
|
| 16 |
|
| 17 |
wp_register_script('wooccm-admin', plugins_url('assets/js/wooccm-admin.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
|
| 18 |
|
| 19 |
+
|
| 20 |
+
wp_register_script('wooccm-field', plugins_url('assets/js/wooccm-field.js', WOOCCM_PLUGIN_FILE), array('jquery', 'jquery-ui-datepicker', 'backbone'), WOOCCM_PLUGIN_VERSION, true);
|
| 21 |
+
|
| 22 |
+
wp_localize_script('wooccm-field', 'wooccm_admin', array(
|
| 23 |
'ajax_url' => admin_url('admin-ajax.php?section=' . $current_section),
|
| 24 |
'nonce' => wp_create_nonce('wooccm_admin'),
|
| 25 |
'field' => array(
|
| 26 |
'args' => WOOCCM()->field->billing->get_args(),
|
| 27 |
),
|
| 28 |
'message' => array(
|
| 29 |
+
'remove' => esc_html__('Are you sure you want to remove this field?', 'woocommerce-checkout-manager'),
|
| 30 |
+
'reset' => esc_html__('Are you sure you want to reset this fields?', 'woocommerce-checkout-manager')
|
| 31 |
)
|
| 32 |
));
|
| 33 |
|
new/controller/class-field-controller.php
CHANGED
|
@@ -6,6 +6,28 @@ class WOOCCM_Field_Controller {
|
|
| 6 |
public $shipping;
|
| 7 |
public $additional;
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
public function get_product_categories() {
|
| 10 |
|
| 11 |
$args = array(
|
|
@@ -70,7 +92,7 @@ class WOOCCM_Field_Controller {
|
|
| 70 |
|
| 71 |
public function ajax_toggle_field_attribute() {
|
| 72 |
|
| 73 |
-
if (current_user_can('manage_woocommerce') && check_ajax_referer('
|
| 74 |
|
| 75 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 76 |
$attr = wc_clean(wp_unslash($_REQUEST['field_attr']));
|
|
@@ -85,7 +107,7 @@ class WOOCCM_Field_Controller {
|
|
| 85 |
|
| 86 |
public function ajax_change_field_attribute() {
|
| 87 |
|
| 88 |
-
if (current_user_can('manage_woocommerce') && check_ajax_referer('
|
| 89 |
|
| 90 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 91 |
$attr = wc_clean(wp_unslash($_REQUEST['field_attr']));
|
|
@@ -103,7 +125,7 @@ class WOOCCM_Field_Controller {
|
|
| 103 |
|
| 104 |
public function ajax_save_field() {
|
| 105 |
|
| 106 |
-
if (current_user_can('manage_woocommerce') && check_ajax_referer('
|
| 107 |
|
| 108 |
$field_data = $_REQUEST['field_data'];
|
| 109 |
|
|
@@ -129,7 +151,7 @@ class WOOCCM_Field_Controller {
|
|
| 129 |
|
| 130 |
public function ajax_delete_field() {
|
| 131 |
|
| 132 |
-
if (current_user_can('manage_woocommerce') && check_ajax_referer('
|
| 133 |
|
| 134 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 135 |
|
|
@@ -142,9 +164,29 @@ class WOOCCM_Field_Controller {
|
|
| 142 |
wp_send_json_error(esc_html__('Unknow error', 'woocommerce-checkout-manager'));
|
| 143 |
}
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
public function ajax_load_field() {
|
| 146 |
|
| 147 |
-
if (current_user_can('manage_woocommerce') && check_ajax_referer('
|
| 148 |
|
| 149 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 150 |
|
|
@@ -300,6 +342,7 @@ class WOOCCM_Field_Controller {
|
|
| 300 |
$types = WOOCCM()->field->billing->get_types();
|
| 301 |
$conditionals = WOOCCM()->field->billing->get_conditional_types();
|
| 302 |
$multiple = WOOCCM()->field->billing->get_multiple_types();
|
|
|
|
| 303 |
$product_categories = $this->get_product_categories();
|
| 304 |
|
| 305 |
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/billing.php');
|
|
@@ -317,6 +360,7 @@ class WOOCCM_Field_Controller {
|
|
| 317 |
$types = WOOCCM()->field->shipping->get_types();
|
| 318 |
$conditionals = WOOCCM()->field->shipping->get_conditional_types();
|
| 319 |
$multiple = WOOCCM()->field->shipping->get_multiple_types();
|
|
|
|
| 320 |
$product_categories = $this->get_product_categories();
|
| 321 |
|
| 322 |
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/shipping.php');
|
|
@@ -334,6 +378,7 @@ class WOOCCM_Field_Controller {
|
|
| 334 |
$types = WOOCCM()->field->additional->get_types();
|
| 335 |
$conditionals = WOOCCM()->field->additional->get_conditional_types();
|
| 336 |
$multiple = WOOCCM()->field->additional->get_multiple_types();
|
|
|
|
| 337 |
$product_categories = $this->get_product_categories();
|
| 338 |
|
| 339 |
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/additional.php');
|
|
@@ -363,10 +408,12 @@ class WOOCCM_Field_Controller {
|
|
| 363 |
}
|
| 364 |
|
| 365 |
function init() {
|
|
|
|
| 366 |
add_action('wp_ajax_wooccm_select_search_products', array($this, 'ajax_select_search_products'));
|
| 367 |
add_action('wp_ajax_wooccm_load_field', array($this, 'ajax_load_field'));
|
| 368 |
add_action('wp_ajax_wooccm_save_field', array($this, 'ajax_save_field'));
|
| 369 |
add_action('wp_ajax_wooccm_delete_field', array($this, 'ajax_delete_field'));
|
|
|
|
| 370 |
add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
|
| 371 |
add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
|
| 372 |
|
| 6 |
public $shipping;
|
| 7 |
public $additional;
|
| 8 |
|
| 9 |
+
function enqueue_scripts() {
|
| 10 |
+
|
| 11 |
+
global $current_section;
|
| 12 |
+
|
| 13 |
+
wp_register_script('wooccm-field', plugins_url('assets/js/wooccm-field.js', WOOCCM_PLUGIN_FILE), array('jquery', 'jquery-ui-datepicker', 'backbone'), WOOCCM_PLUGIN_VERSION, true);
|
| 14 |
+
|
| 15 |
+
wp_localize_script('wooccm-field', 'wooccm_field', array(
|
| 16 |
+
'ajax_url' => admin_url('admin-ajax.php?section=' . $current_section),
|
| 17 |
+
'nonce' => wp_create_nonce('wooccm_field'),
|
| 18 |
+
'args' => WOOCCM()->field->billing->get_args(),
|
| 19 |
+
'message' => array(
|
| 20 |
+
'remove' => esc_html__('Are you sure you want to remove this field?', 'woocommerce-checkout-manager'),
|
| 21 |
+
'reset' => esc_html__('Are you sure you want to reset this fields?', 'woocommerce-checkout-manager')
|
| 22 |
+
)
|
| 23 |
+
));
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
|
| 27 |
+
wp_enqueue_script('wooccm-field');
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
public function get_product_categories() {
|
| 32 |
|
| 33 |
$args = array(
|
| 92 |
|
| 93 |
public function ajax_toggle_field_attribute() {
|
| 94 |
|
| 95 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_id']) && isset($_REQUEST['field_attr'])) {
|
| 96 |
|
| 97 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 98 |
$attr = wc_clean(wp_unslash($_REQUEST['field_attr']));
|
| 107 |
|
| 108 |
public function ajax_change_field_attribute() {
|
| 109 |
|
| 110 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_id']) && isset($_REQUEST['field_attr']) && isset($_REQUEST['field_value'])) {
|
| 111 |
|
| 112 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 113 |
$attr = wc_clean(wp_unslash($_REQUEST['field_attr']));
|
| 125 |
|
| 126 |
public function ajax_save_field() {
|
| 127 |
|
| 128 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_data'])) {
|
| 129 |
|
| 130 |
$field_data = $_REQUEST['field_data'];
|
| 131 |
|
| 151 |
|
| 152 |
public function ajax_delete_field() {
|
| 153 |
|
| 154 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_id'])) {
|
| 155 |
|
| 156 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 157 |
|
| 164 |
wp_send_json_error(esc_html__('Unknow error', 'woocommerce-checkout-manager'));
|
| 165 |
}
|
| 166 |
|
| 167 |
+
public function ajax_reset_fields() {
|
| 168 |
+
|
| 169 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce')) {
|
| 170 |
+
|
| 171 |
+
if (array_key_exists('section', $_REQUEST)) {
|
| 172 |
+
|
| 173 |
+
$section = wc_clean(wp_unslash($_REQUEST['section']));
|
| 174 |
+
|
| 175 |
+
if (isset(WOOCCM()->field->$section)) {
|
| 176 |
+
|
| 177 |
+
WOOCCM()->field->$section->delete_fields();
|
| 178 |
+
|
| 179 |
+
wp_send_json_success();
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
wp_send_json_error(esc_html__('Unknow error', 'woocommerce-checkout-manager'));
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
public function ajax_load_field() {
|
| 188 |
|
| 189 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_id'])) {
|
| 190 |
|
| 191 |
$field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
|
| 192 |
|
| 342 |
$types = WOOCCM()->field->billing->get_types();
|
| 343 |
$conditionals = WOOCCM()->field->billing->get_conditional_types();
|
| 344 |
$multiple = WOOCCM()->field->billing->get_multiple_types();
|
| 345 |
+
$template = WOOCCM()->field->billing->get_template_types();
|
| 346 |
$product_categories = $this->get_product_categories();
|
| 347 |
|
| 348 |
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/billing.php');
|
| 360 |
$types = WOOCCM()->field->shipping->get_types();
|
| 361 |
$conditionals = WOOCCM()->field->shipping->get_conditional_types();
|
| 362 |
$multiple = WOOCCM()->field->shipping->get_multiple_types();
|
| 363 |
+
$template = WOOCCM()->field->billing->get_template_types();
|
| 364 |
$product_categories = $this->get_product_categories();
|
| 365 |
|
| 366 |
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/shipping.php');
|
| 378 |
$types = WOOCCM()->field->additional->get_types();
|
| 379 |
$conditionals = WOOCCM()->field->additional->get_conditional_types();
|
| 380 |
$multiple = WOOCCM()->field->additional->get_multiple_types();
|
| 381 |
+
$template = WOOCCM()->field->billing->get_template_types();
|
| 382 |
$product_categories = $this->get_product_categories();
|
| 383 |
|
| 384 |
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/additional.php');
|
| 408 |
}
|
| 409 |
|
| 410 |
function init() {
|
| 411 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
| 412 |
add_action('wp_ajax_wooccm_select_search_products', array($this, 'ajax_select_search_products'));
|
| 413 |
add_action('wp_ajax_wooccm_load_field', array($this, 'ajax_load_field'));
|
| 414 |
add_action('wp_ajax_wooccm_save_field', array($this, 'ajax_save_field'));
|
| 415 |
add_action('wp_ajax_wooccm_delete_field', array($this, 'ajax_delete_field'));
|
| 416 |
+
add_action('wp_ajax_wooccm_reset_fields', array($this, 'ajax_reset_fields'));
|
| 417 |
add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
|
| 418 |
add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
|
| 419 |
|
new/model/class-wooccm-field-old.php
CHANGED
|
@@ -248,10 +248,16 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
| 248 |
}
|
| 249 |
|
| 250 |
function get_old_type($type = '') {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
|
| 252 |
$replace = array_filter($this->old_to_old_types);
|
| 253 |
|
| 254 |
-
$
|
|
|
|
|
|
|
| 255 |
|
| 256 |
return $type;
|
| 257 |
}
|
|
@@ -273,6 +279,10 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
| 273 |
}
|
| 274 |
}
|
| 275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
if (!isset($field['order'])) {
|
| 277 |
$field['order'] = $field_id + 1;
|
| 278 |
}
|
|
@@ -338,6 +348,10 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
| 338 |
|
| 339 |
$field = wp_parse_args($field, array_fill_keys($this->old_args, null));
|
| 340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
$field['type'] = $this->get_old_type($field['type']);
|
| 342 |
|
| 343 |
$field['role_option'] = $this->array_to_string($field['role_option']);
|
|
@@ -394,7 +408,9 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
| 394 |
|
| 395 |
protected function get_fields_old() {
|
| 396 |
|
| 397 |
-
|
|
|
|
|
|
|
| 398 |
|
| 399 |
foreach ($fields as $field_id => $field) {
|
| 400 |
|
|
@@ -421,7 +437,7 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
| 421 |
|
| 422 |
public function get_field($field_id) {
|
| 423 |
|
| 424 |
-
if ($fields = $this->
|
| 425 |
|
| 426 |
if (array_key_exists($field_id, $fields)) {
|
| 427 |
|
|
@@ -437,8 +453,6 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
| 437 |
|
| 438 |
public function update_fields($fields) {
|
| 439 |
|
| 440 |
-
//error_log(json_encode($fields));
|
| 441 |
-
|
| 442 |
if (is_array($fields)) {
|
| 443 |
|
| 444 |
// save in old format
|
| 248 |
}
|
| 249 |
|
| 250 |
function get_old_type($type = '') {
|
| 251 |
+
|
| 252 |
+
if(!$type) {
|
| 253 |
+
return 'wooccmtext';
|
| 254 |
+
}
|
| 255 |
|
| 256 |
$replace = array_filter($this->old_to_old_types);
|
| 257 |
|
| 258 |
+
if ($old = $this->replace_value($type, $replace)) {
|
| 259 |
+
return $old;
|
| 260 |
+
}
|
| 261 |
|
| 262 |
return $type;
|
| 263 |
}
|
| 279 |
}
|
| 280 |
}
|
| 281 |
|
| 282 |
+
if (!isset($field['position'])) {
|
| 283 |
+
$field['position'] = $this->array_to_string(array_intersect($field['class'], array('form-row-wide', 'form-row-first', 'form-row-last')));
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
if (!isset($field['order'])) {
|
| 287 |
$field['order'] = $field_id + 1;
|
| 288 |
}
|
| 348 |
|
| 349 |
$field = wp_parse_args($field, array_fill_keys($this->old_args, null));
|
| 350 |
|
| 351 |
+
if (!is_numeric($field['order'])) {
|
| 352 |
+
$field['order'] = $field_id + 1;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
$field['type'] = $this->get_old_type($field['type']);
|
| 356 |
|
| 357 |
$field['role_option'] = $this->array_to_string($field['role_option']);
|
| 408 |
|
| 409 |
protected function get_fields_old() {
|
| 410 |
|
| 411 |
+
$defaults = $this->get_default_fields();
|
| 412 |
+
|
| 413 |
+
if ($fields = $this->get_option($defaults)) {
|
| 414 |
|
| 415 |
foreach ($fields as $field_id => $field) {
|
| 416 |
|
| 437 |
|
| 438 |
public function get_field($field_id) {
|
| 439 |
|
| 440 |
+
if ($fields = $this->get_fields()) {
|
| 441 |
|
| 442 |
if (array_key_exists($field_id, $fields)) {
|
| 443 |
|
| 453 |
|
| 454 |
public function update_fields($fields) {
|
| 455 |
|
|
|
|
|
|
|
| 456 |
if (is_array($fields)) {
|
| 457 |
|
| 458 |
// save in old format
|
new/model/class-wooccm-field.php
CHANGED
|
@@ -59,6 +59,14 @@ class WOOCCM_Field {
|
|
| 59 |
);
|
| 60 |
}
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
public function get_types() {
|
| 63 |
|
| 64 |
return apply_filters('wooccm_fields_fields_types', array(
|
|
@@ -142,4 +150,11 @@ class WOOCCM_Field {
|
|
| 142 |
return $this->defaults;
|
| 143 |
}
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
}
|
| 59 |
);
|
| 60 |
}
|
| 61 |
|
| 62 |
+
public function get_template_types() {
|
| 63 |
+
|
| 64 |
+
return array(
|
| 65 |
+
'button',
|
| 66 |
+
'heading',
|
| 67 |
+
);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
public function get_types() {
|
| 71 |
|
| 72 |
return apply_filters('wooccm_fields_fields_types', array(
|
| 150 |
return $this->defaults;
|
| 151 |
}
|
| 152 |
|
| 153 |
+
public function delete_fields() {
|
| 154 |
+
|
| 155 |
+
delete_option($this->option_name);
|
| 156 |
+
|
| 157 |
+
return false;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
}
|
new/view/backend/pages/modals/parts/panel-general.php
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('You can\'t change the slug of default fields.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 7 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly">
|
| 8 |
<# } else { #>
|
| 9 |
-
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Currently is not possible to change the name of the fields.', 'woocommerce-checkout-manager'); ?><?php //esc_html_e('To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager');
|
| 10 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly" <?php /* if (empty($options['checkness']['abbreviation'])) { ?>readonly="readonly"<?php } */ ?>>
|
| 11 |
<# } #>
|
| 12 |
</p>
|
|
@@ -43,13 +43,16 @@
|
|
| 43 |
<label><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></label>
|
| 44 |
<input class="short" type="text" name="label" placeholder="<?php esc_html_e('My Field Name', 'woocommerce-checkout-manager'); ?>" value="{{data.label}}">
|
| 45 |
<span span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Label text of the checkout field.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 46 |
-
</p>
|
|
|
|
| 47 |
<p class="form-field">
|
| 48 |
<label><?php esc_html_e('Placeholder', 'woocommerce-checkout-manager'); ?></label>
|
| 49 |
<input class="short" type="text" name="placeholder" placeholder="<?php esc_html_e('Example red', 'woocommerce-checkout-manager'); ?>" value="{{data.placeholder}}">
|
| 50 |
<span span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Placeholder text of the checkout field.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 51 |
</p>
|
|
|
|
| 52 |
</div>
|
|
|
|
| 53 |
<div class="options_group">
|
| 54 |
<p class="form-field">
|
| 55 |
<label><?php esc_html_e('Default', 'woocommerce-checkout-manager'); ?></label>
|
|
@@ -62,6 +65,7 @@
|
|
| 62 |
</p>
|
| 63 |
<# } #>
|
| 64 |
</div>
|
|
|
|
| 65 |
<div class="options_group">
|
| 66 |
<p class="form-field">
|
| 67 |
<label><?php esc_html_e('Extra class', 'woocommerce-checkout-manager'); ?></label>
|
| 6 |
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('You can\'t change the slug of default fields.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 7 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly">
|
| 8 |
<# } else { #>
|
| 9 |
+
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Currently is not possible to change the name of the fields.', 'woocommerce-checkout-manager'); ?><?php //esc_html_e('To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 10 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly" <?php /* if (empty($options['checkness']['abbreviation'])) { ?>readonly="readonly"<?php } */ ?>>
|
| 11 |
<# } #>
|
| 12 |
</p>
|
| 43 |
<label><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></label>
|
| 44 |
<input class="short" type="text" name="label" placeholder="<?php esc_html_e('My Field Name', 'woocommerce-checkout-manager'); ?>" value="{{data.label}}">
|
| 45 |
<span span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Label text of the checkout field.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 46 |
+
</p>
|
| 47 |
+
<# if ( !_.contains(<?php echo json_encode($template); ?>, data.type)) { #>
|
| 48 |
<p class="form-field">
|
| 49 |
<label><?php esc_html_e('Placeholder', 'woocommerce-checkout-manager'); ?></label>
|
| 50 |
<input class="short" type="text" name="placeholder" placeholder="<?php esc_html_e('Example red', 'woocommerce-checkout-manager'); ?>" value="{{data.placeholder}}">
|
| 51 |
<span span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Placeholder text of the checkout field.', 'woocommerce-checkout-manager'); ?>"></span>
|
| 52 |
</p>
|
| 53 |
+
<# } #>
|
| 54 |
</div>
|
| 55 |
+
<# if ( !_.contains(<?php echo json_encode($template); ?>, data.type)) { #>
|
| 56 |
<div class="options_group">
|
| 57 |
<p class="form-field">
|
| 58 |
<label><?php esc_html_e('Default', 'woocommerce-checkout-manager'); ?></label>
|
| 65 |
</p>
|
| 66 |
<# } #>
|
| 67 |
</div>
|
| 68 |
+
<# } #>
|
| 69 |
<div class="options_group">
|
| 70 |
<p class="form-field">
|
| 71 |
<label><?php esc_html_e('Extra class', 'woocommerce-checkout-manager'); ?></label>
|
new/view/backend/pages/parts/actions.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<div id="<?php printf('wooccm_%s_settings-actions', $current_section); ?>">
|
| 2 |
<p>
|
| 3 |
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_add', $current_section); ?>" class="button button-primary"><?php esc_html_e('+ Add New Field', 'woocommerce-checkout-manager') ?></a>
|
| 4 |
-
<!--<a href="javascript:;" id="<?php printf('wooccm_%s_settings_import', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Import', 'woocommerce-checkout-manager') ?></a
|
| 5 |
-
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_reset', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Reset', 'woocommerce-checkout-manager') ?></a
|
| 6 |
</p>
|
| 7 |
</div>
|
| 1 |
<div id="<?php printf('wooccm_%s_settings-actions', $current_section); ?>">
|
| 2 |
<p>
|
| 3 |
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_add', $current_section); ?>" class="button button-primary"><?php esc_html_e('+ Add New Field', 'woocommerce-checkout-manager') ?></a>
|
| 4 |
+
<!--<a href="javascript:;" id="<?php printf('wooccm_%s_settings_import', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Import', 'woocommerce-checkout-manager') ?></a>-->
|
| 5 |
+
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_reset', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Reset', 'woocommerce-checkout-manager') ?></a>
|
| 6 |
</p>
|
| 7 |
</div>
|
new/view/frontend/fields/additional.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
if (!class_exists('WOOCCM_Fields_Additional')) {
|
| 4 |
|
| 5 |
class WOOCCM_Fields_Additional extends WOOCCM_Fields_Register {
|
|
@@ -26,13 +25,13 @@ if (!class_exists('WOOCCM_Fields_Additional')) {
|
|
| 26 |
|
| 27 |
foreach ($fields as $field_id => $field) {
|
| 28 |
|
| 29 |
-
if (!empty($field['cow']) && empty($field['deny_checkout'])) {
|
| 30 |
|
| 31 |
//$key = sprintf("%s_%s", $prefix, $field['cow']);
|
| 32 |
|
| 33 |
$field = $this->add_checkout_field_filter($fields, $field, 'additional');
|
| 34 |
|
| 35 |
-
if (!empty($field['required']) && !empty($field['cow']) && empty($field['deny_checkout']) && empty($field['disabled'])) {
|
| 36 |
|
| 37 |
if (empty($_POST[$field['cow']])) {
|
| 38 |
$message = sprintf(__('%s is a required field.', 'woocommerce-checkout-manager'), '<strong>' . wooccm_wpml_string($field['label']) . '</strong>');
|
|
@@ -45,19 +44,23 @@ if (!class_exists('WOOCCM_Fields_Additional')) {
|
|
| 45 |
}
|
| 46 |
|
| 47 |
function add_checkout_additional_fields($checkout) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
foreach ($fields as $field_id => $field) {
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
woocommerce_form_field($field['cow'], $field, $checkout->get_value($field['cow']));
|
| 58 |
}
|
| 59 |
}
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
}
|
| 62 |
|
| 63 |
function init() {
|
| 1 |
<?php
|
|
|
|
| 2 |
if (!class_exists('WOOCCM_Fields_Additional')) {
|
| 3 |
|
| 4 |
class WOOCCM_Fields_Additional extends WOOCCM_Fields_Register {
|
| 25 |
|
| 26 |
foreach ($fields as $field_id => $field) {
|
| 27 |
|
| 28 |
+
if (!empty($field['cow']) /* && empty($field['deny_checkout']) */) {
|
| 29 |
|
| 30 |
//$key = sprintf("%s_%s", $prefix, $field['cow']);
|
| 31 |
|
| 32 |
$field = $this->add_checkout_field_filter($fields, $field, 'additional');
|
| 33 |
|
| 34 |
+
if (!empty($field['required']) && !empty($field['cow']) /* && empty($field['deny_checkout']) */ && empty($field['disabled'])) {
|
| 35 |
|
| 36 |
if (empty($_POST[$field['cow']])) {
|
| 37 |
$message = sprintf(__('%s is a required field.', 'woocommerce-checkout-manager'), '<strong>' . wooccm_wpml_string($field['label']) . '</strong>');
|
| 44 |
}
|
| 45 |
|
| 46 |
function add_checkout_additional_fields($checkout) {
|
| 47 |
+
?>
|
| 48 |
+
<div class="wooccm-clearfix"></div>
|
| 49 |
+
<div class="wooccm-additional-fields">
|
| 50 |
+
<?php
|
| 51 |
+
if ($custom_fields = apply_filters('wooccm_additional_fields', WOOCCM()->field->additional->get_fields('old'))) {
|
| 52 |
|
| 53 |
+
foreach ($custom_fields as $field_id => $custom_field) {
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
if (!empty($custom_field['cow']) /* && empty($field['deny_checkout']) */ && empty($custom_field['disabled'])) {
|
| 56 |
|
| 57 |
+
woocommerce_form_field($custom_field['cow'], $custom_field, $checkout->get_value($custom_field['cow']));
|
| 58 |
+
}
|
|
|
|
| 59 |
}
|
| 60 |
}
|
| 61 |
+
?>
|
| 62 |
+
</div>
|
| 63 |
+
<?php
|
| 64 |
}
|
| 65 |
|
| 66 |
function init() {
|
new/view/frontend/fields/register.php
CHANGED
|
@@ -15,7 +15,7 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
| 15 |
// Conditonal
|
| 16 |
// -----------------------------------------------------------------------
|
| 17 |
|
| 18 |
-
$fields[$key]['conditional_tie'] = sprintf("%
|
| 19 |
|
| 20 |
// Class
|
| 21 |
// -----------------------------------------------------------------------
|
|
@@ -142,68 +142,36 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
| 142 |
return apply_filters('wooccm_checkout_field_filter', $fields[$key], $key);
|
| 143 |
}
|
| 144 |
|
| 145 |
-
// function add_checkout_fields_filter($fields, $name, $key, $prefix = '') {
|
| 146 |
-
//
|
| 147 |
-
// if ($options = get_option($name)) {
|
| 148 |
-
//
|
| 149 |
-
// if (array_key_exists($key, $options)) {
|
| 150 |
-
//
|
| 151 |
-
// if ($custom_fields = $options[$key]) {
|
| 152 |
-
//
|
| 153 |
-
// foreach ($custom_fields as $id => $custom_field) {
|
| 154 |
-
//
|
| 155 |
-
// if (!empty($custom_field['cow']) && empty($custom_field['deny_checkout'])) {
|
| 156 |
-
//
|
| 157 |
-
// $key = sprintf("%s%s", $prefix, $custom_field['cow']);
|
| 158 |
-
//
|
| 159 |
-
// // Remove disabled fields
|
| 160 |
-
// //if (!empty($custom_field['disabled'])) {
|
| 161 |
-
// //unset($fields[$key]);
|
| 162 |
-
// //} else {
|
| 163 |
-
// $fields[$key] = $this->add_checkout_field_filter($fields, $custom_field, $prefix);
|
| 164 |
-
// //}
|
| 165 |
-
// }
|
| 166 |
-
// }
|
| 167 |
-
// }
|
| 168 |
-
// }
|
| 169 |
-
//
|
| 170 |
-
//// Resort the fields by order
|
| 171 |
-
// $fields[] = uasort($fields, 'wooccm_sort_fields');
|
| 172 |
-
//
|
| 173 |
-
// if ($fields[0]) {
|
| 174 |
-
// unset($fields[0]);
|
| 175 |
-
// }
|
| 176 |
-
// }
|
| 177 |
-
//
|
| 178 |
-
// return $fields;
|
| 179 |
-
// }
|
| 180 |
-
|
| 181 |
function add_checkout_fields_filter($fields, $prefix = '') {
|
| 182 |
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
if (!empty($
|
| 188 |
|
| 189 |
-
$key = sprintf("%s_%s", $prefix, $
|
| 190 |
|
| 191 |
-
$
|
| 192 |
}
|
| 193 |
}
|
|
|
|
|
|
|
| 194 |
}
|
| 195 |
|
| 196 |
return $fields;
|
| 197 |
}
|
| 198 |
|
| 199 |
-
function add_checkout_shipping_fields($fields) {
|
| 200 |
-
return $this->add_checkout_fields_filter($fields, 'shipping');
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
function add_checkout_billing_fields($fields) {
|
| 204 |
return $this->add_checkout_fields_filter($fields, 'billing');
|
| 205 |
}
|
| 206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
function add_checkout_additional_fields($fields) {
|
| 208 |
return $this->add_checkout_fields_filter($fields, 'additional');
|
| 209 |
}
|
| 15 |
// Conditonal
|
| 16 |
// -----------------------------------------------------------------------
|
| 17 |
|
| 18 |
+
$fields[$key]['conditional_tie'] = sprintf("%s_field", @$fields[$key]['conditional_tie']);
|
| 19 |
|
| 20 |
// Class
|
| 21 |
// -----------------------------------------------------------------------
|
| 142 |
return apply_filters('wooccm_checkout_field_filter', $fields[$key], $key);
|
| 143 |
}
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
function add_checkout_fields_filter($fields, $prefix = '') {
|
| 146 |
|
| 147 |
+
$frontend_fields = array();
|
| 148 |
|
| 149 |
+
if ($custom_fields = WOOCCM()->field->$prefix->get_fields('old')) {
|
| 150 |
+
|
| 151 |
+
foreach ($custom_fields as $field_id => $custom_field) {
|
| 152 |
|
| 153 |
+
if (!empty($custom_field['cow']) && empty($custom_field['disabled'])) {
|
| 154 |
|
| 155 |
+
$key = sprintf("%s_%s", $prefix, $custom_field['cow']);
|
| 156 |
|
| 157 |
+
$frontend_fields[$key] = $this->add_checkout_field_filter($fields, $custom_field, $prefix);
|
| 158 |
}
|
| 159 |
}
|
| 160 |
+
|
| 161 |
+
return $frontend_fields;
|
| 162 |
}
|
| 163 |
|
| 164 |
return $fields;
|
| 165 |
}
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
function add_checkout_billing_fields($fields) {
|
| 168 |
return $this->add_checkout_fields_filter($fields, 'billing');
|
| 169 |
}
|
| 170 |
|
| 171 |
+
function add_checkout_shipping_fields($fields) {
|
| 172 |
+
return $this->add_checkout_fields_filter($fields, 'shipping');
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
function add_checkout_additional_fields($fields) {
|
| 176 |
return $this->add_checkout_fields_filter($fields, 'additional');
|
| 177 |
}
|
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.5.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -137,6 +137,9 @@ Example:
|
|
| 137 |
|
| 138 |
== Changelog ==
|
| 139 |
|
|
|
|
|
|
|
|
|
|
| 140 |
= 4.5.2 =
|
| 141 |
* Fix: undefined index
|
| 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.5.3
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 137 |
|
| 138 |
== Changelog ==
|
| 139 |
|
| 140 |
+
= 4.5.3 =
|
| 141 |
+
* Fix: woocommerce checkout new admin panel reset option
|
| 142 |
+
|
| 143 |
= 4.5.2 =
|
| 144 |
* Fix: undefined index
|
| 145 |
|
woocommerce-checkout-manager.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/**
|
| 4 |
* Plugin Name: WooCommerce Checkout Manager
|
| 5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
| 6 |
-
* Version: 4.5.
|
| 7 |
* Author: QuadLayers
|
| 8 |
* Author URI: https://www.quadlayers.com
|
| 9 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
|
@@ -17,7 +17,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
|
|
| 17 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
| 18 |
}
|
| 19 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
| 20 |
-
define('WOOCCM_PLUGIN_VERSION', '4.5.
|
| 21 |
}
|
| 22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
| 23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
| 3 |
/**
|
| 4 |
* Plugin Name: WooCommerce Checkout Manager
|
| 5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
| 6 |
+
* Version: 4.5.3
|
| 7 |
* Author: QuadLayers
|
| 8 |
* Author URI: https://www.quadlayers.com
|
| 9 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
| 17 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
| 18 |
}
|
| 19 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
| 20 |
+
define('WOOCCM_PLUGIN_VERSION', '4.5.3');
|
| 21 |
}
|
| 22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
| 23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
