WooCommerce Checkout Manager - Version 4.5.4

Version Description

  • Improvement: woocommerce order fields rebuilt
  • Fix: woocommerce conditional fields required
Download this release

Release Info

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

Code changes from version 4.5.3 to 4.5.4

assets/css/wooccm.css CHANGED
@@ -6,6 +6,9 @@
6
  .woocommerce form .wooccm-clearfix:after {
7
  clear: both;
8
  }
 
 
 
9
  .button.fileinput-button {
10
  position: relative;
11
  overflow: hidden!important;
6
  .woocommerce form .wooccm-clearfix:after {
7
  clear: both;
8
  }
9
+ .woocommerce form .wooccm-conditional-child {
10
+ display: none;
11
+ }
12
  .button.fileinput-button {
13
  position: relative;
14
  overflow: hidden!important;
assets/css/wooccm.css.map CHANGED
@@ -1 +1 @@
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"}
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;;AAXN,YAAa,KAeX;EACE,aAAA;;AAMF,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-checkout.js CHANGED
@@ -282,17 +282,21 @@
282
  $('.wooccm-conditional-child').each(function (i, field) {
283
 
284
  var $field = $(field),
285
- $parent = $('#' + $field.find('[data-conditional-parent]').data('conditional-parent')),
286
  show_if_value = $field.find('[data-conditional-parent-value]').data('conditional-parent-value');
287
 
288
  if ($parent.length) {
289
 
290
  $parent.on('wooccm_change change keyup', function (e) {
291
 
292
- // e.target not working because of select2
293
- var $this = $(e.currentTarget).find('input,select,textarea').first(),
294
  value = $this.val();
295
 
 
 
 
 
 
296
  if ($this.prop('type') == 'checkbox') {
297
  value = $this.is(':checked');
298
  }
@@ -304,6 +308,7 @@
304
  }
305
 
306
  $this.off('wooccm_change');
 
307
  $this.off('keyup');
308
 
309
  });
282
  $('.wooccm-conditional-child').each(function (i, field) {
283
 
284
  var $field = $(field),
285
+ $parent = $('#' + $field.find('[data-conditional-parent]').data('conditional-parent') + '_field'),
286
  show_if_value = $field.find('[data-conditional-parent-value]').data('conditional-parent-value');
287
 
288
  if ($parent.length) {
289
 
290
  $parent.on('wooccm_change change keyup', function (e) {
291
 
292
+ var $this = $(e.target),
 
293
  value = $this.val();
294
 
295
+ // fix for select2 search
296
+ if ($this.hasClass('select2-selection')) {
297
+ return;
298
+ }
299
+
300
  if ($this.prop('type') == 'checkbox') {
301
  value = $this.is(':checked');
302
  }
308
  }
309
 
310
  $this.off('wooccm_change');
311
+ $this.off('change');
312
  $this.off('keyup');
313
 
314
  });
assets/js/wooccm-checkout.min.js CHANGED
@@ -1 +1 @@
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_upload.icons.spreadsheet;p="spreadsheet"}else{if(k.match("application/x.*")){m=wooccm_upload.icons.archive;p="application"}else{if(k.match("audio.*")){m=wooccm_upload.icons.audio;p="audio"}else{if(k.match("text.*")){m=wooccm_upload.icons.text;p="text"}else{if(k.match("video.*")){m=wooccm_upload.icons.video;p="video"}else{m=wooccm_upload.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('&nbsp;<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('&nbsp;<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_upload.limit.max_files){alert("Exeeds max files limit of "+wooccm_upload.limit.max_files);return false}if(p.size>wooccm_upload.limit.max_file_size){alert("Exeeds max file size of "+wooccm_upload.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_upload.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_upload.limit.max_files){console.log("Exeeds max files limit of "+wooccm_upload.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_upload.limit.max_file_size){console.log("Exeeds max file size of "+wooccm_upload.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_upload.nonce);e.ajax({async:false,url:wooccm_upload.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("#"+j.find("[data-conditional-parent]").data("conditional-parent")),k=j.find("[data-conditional-parent-value]").data("conditional-parent-value");if(l.length){l.on("wooccm_change change keyup",function(o){var n=e(o.currentTarget).find("input,select,textarea").first(),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()}n.off("wooccm_change");n.off("keyup")});l.find("select:first").trigger("wooccm_change");l.find("textarea:first").trigger("wooccm_change");l.find("input[type=button]:first").trigger("wooccm_change");l.find("input[type=radio]:checked:first").trigger("wooccm_change");l.find("input[type=checkbox]:checked:first").trigger("wooccm_change");l.find("input[type=color]:first").trigger("wooccm_change");l.find("input[type=date]:first").trigger("wooccm_change");l.find("input[type=datetime-local]:first").trigger("wooccm_change");l.find("input[type=email]:first").trigger("wooccm_change");l.find("input[type=file]:first").trigger("wooccm_change");l.find("input[type=hidden]:first").trigger("wooccm_change");l.find("input[type=image]:first").trigger("wooccm_change");l.find("input[type=month]:first").trigger("wooccm_change");l.find("input[type=number]:first").trigger("wooccm_change");l.find("input[type=password]:first").trigger("wooccm_change");l.find("input[type=range]:first").trigger("wooccm_change");l.find("input[type=reset]:first").trigger("wooccm_change");l.find("input[type=search]:first").trigger("wooccm_change");l.find("input[type=submit]:first").trigger("wooccm_change");l.find("input[type=tel]:first").trigger("wooccm_change");l.find("input[type=text]:first").trigger("wooccm_change");l.find("input[type=time]:first").trigger("wooccm_change");l.find("input[type=url]:first").trigger("wooccm_change");l.find("input[type=week]:first").trigger("wooccm_change")}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);
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_upload.icons.spreadsheet;p="spreadsheet"}else{if(k.match("application/x.*")){m=wooccm_upload.icons.archive;p="application"}else{if(k.match("audio.*")){m=wooccm_upload.icons.audio;p="audio"}else{if(k.match("text.*")){m=wooccm_upload.icons.text;p="text"}else{if(k.match("video.*")){m=wooccm_upload.icons.video;p="video"}else{m=wooccm_upload.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('&nbsp;<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('&nbsp;<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_upload.limit.max_files){alert("Exeeds max files limit of "+wooccm_upload.limit.max_files);return false}if(p.size>wooccm_upload.limit.max_file_size){alert("Exeeds max file size of "+wooccm_upload.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_upload.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_upload.limit.max_files){console.log("Exeeds max files limit of "+wooccm_upload.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_upload.limit.max_file_size){console.log("Exeeds max file size of "+wooccm_upload.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_upload.nonce);e.ajax({async:false,url:wooccm_upload.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("#"+j.find("[data-conditional-parent]").data("conditional-parent")+"_field"),k=j.find("[data-conditional-parent-value]").data("conditional-parent-value");if(l.length){l.on("wooccm_change change keyup",function(o){var n=e(o.target),i=n.val();if(n.hasClass("select2-selection")){return}if(n.prop("type")=="checkbox"){i=n.is(":checked")}if(k==i||(e.isArray(i)&&i.indexOf(k)>-1)){j.fadeIn()}else{j.fadeOut()}n.off("wooccm_change");n.off("change");n.off("keyup")});l.find("select:first").trigger("wooccm_change");l.find("textarea:first").trigger("wooccm_change");l.find("input[type=button]:first").trigger("wooccm_change");l.find("input[type=radio]:checked:first").trigger("wooccm_change");l.find("input[type=checkbox]:checked:first").trigger("wooccm_change");l.find("input[type=color]:first").trigger("wooccm_change");l.find("input[type=date]:first").trigger("wooccm_change");l.find("input[type=datetime-local]:first").trigger("wooccm_change");l.find("input[type=email]:first").trigger("wooccm_change");l.find("input[type=file]:first").trigger("wooccm_change");l.find("input[type=hidden]:first").trigger("wooccm_change");l.find("input[type=image]:first").trigger("wooccm_change");l.find("input[type=month]:first").trigger("wooccm_change");l.find("input[type=number]:first").trigger("wooccm_change");l.find("input[type=password]:first").trigger("wooccm_change");l.find("input[type=range]:first").trigger("wooccm_change");l.find("input[type=reset]:first").trigger("wooccm_change");l.find("input[type=search]:first").trigger("wooccm_change");l.find("input[type=submit]:first").trigger("wooccm_change");l.find("input[type=tel]:first").trigger("wooccm_change");l.find("input[type=text]:first").trigger("wooccm_change");l.find("input[type=time]:first").trigger("wooccm_change");l.find("input[type=url]:first").trigger("wooccm_change");l.find("input[type=week]:first").trigger("wooccm_change")}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/less/wooccm.less CHANGED
@@ -13,6 +13,10 @@
13
  }
14
  }
15
 
 
 
 
 
16
  }
17
 
18
  .button {
13
  }
14
  }
15
 
16
+ .wooccm-conditional-child {
17
+ display: none;
18
+ }
19
+
20
  }
21
 
22
  .button {
includes/admin.php CHANGED
@@ -14,9 +14,9 @@ if (is_admin()) {
14
  //1326
15
  //add_action('admin_notices', 'wooccm_admin_notices');
16
  // Add fields to the Edit Order screen
17
- add_action('woocommerce_admin_order_data_after_order_details', 'wooccm_admin_edit_order_additional_details');
18
- add_action('woocommerce_admin_order_data_after_billing_address', 'wooccm_admin_edit_order_billing_details');
19
- add_action('woocommerce_admin_order_data_after_shipping_address', 'wooccm_admin_edit_order_shipping_details');
20
  }
21
 
22
  // Display admin notice on screen load
@@ -1071,372 +1071,372 @@ function wooccm_admin_updater_notice() {
1071
  }
1072
  }
1073
 
1074
- // Additional details
1075
- function wooccm_admin_edit_order_additional_details($order) {
1076
-
1077
- global $post;
1078
-
1079
- if (version_compare(wooccm_get_woo_version(), '2.7', '>=')) {
1080
- $order_id = ( method_exists($order, 'get_id') ? $order->get_id() : $order->id );
1081
- } else {
1082
- $order_id = ( isset($order->id) ? $order->id : 0 );
1083
- }
1084
-
1085
- $options = get_option('wccs_settings');
1086
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
1087
- if (!empty($buttons)) {
1088
- echo '
1089
- <p>&nbsp;</p>
1090
- <h4>' . __('Additional Details', 'woocommerce-checkout-manager') . '</h4>';
1091
- foreach ($buttons as $btn) {
1092
-
1093
- if (
1094
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
1095
- !empty($btn['label']) &&
1096
- $btn['type'] !== 'heading' &&
1097
- $btn['type'] !== 'multiselect' &&
1098
- $btn['type'] !== 'wooccmupload' &&
1099
- $btn['type'] !== 'multicheckbox'
1100
- ) {
1101
- echo '
1102
- <p id="additional_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1103
- <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $btn['cow'], __('Generic', 'woocommerce-checkout-manager')) . '">
1104
- ' . wooccm_wpml_string(trim($btn['label'])) . ':</strong><br />' . nl2br(get_post_meta($order_id, $btn['cow'], true)) . '
1105
- </p>
1106
- <!-- .form-field-type-... -->';
1107
- } elseif (
1108
- !empty($btn['label']) &&
1109
- $btn['type'] !== 'wooccmupload' &&
1110
- $btn['type'] !== 'multiselect' &&
1111
- $btn['type'] !== 'multicheckbox' &&
1112
- $btn['type'] == 'heading'
1113
- ) {
1114
- echo '
1115
- <h4>' . wooccm_wpml_string(trim($btn['label'])) . '</h4>';
1116
- } elseif (
1117
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
1118
- !empty($btn['label']) &&
1119
- $btn['type'] !== 'heading' &&
1120
- $btn['type'] !== 'wooccmupload' &&
1121
- (
1122
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1123
- )
1124
- ) {
1125
- $value = get_post_meta($order_id, $btn['cow'], true);
1126
- $strings = maybe_unserialize($value);
1127
- echo '
1128
- <p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1129
- <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $btn['cow'], __('Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager')) . '">' . wooccm_wpml_string(trim($btn['label'])) . ':</strong> ';
1130
- if (!empty($strings)) {
1131
- if (is_array($strings)) {
1132
- $iww = 0;
1133
- $len = count($strings);
1134
- foreach ($strings as $key) {
1135
- if ($iww == $len - 1) {
1136
- echo '' . wooccm_wpml_string($key);
1137
- } else {
1138
- echo '' . wooccm_wpml_string($key) . ', ';
1139
- }
1140
- $iww++;
1141
- }
1142
- }
1143
- } else {
1144
- echo '-';
1145
- }
1146
- echo '
1147
- </p>
1148
- <!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1149
- } elseif (
1150
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
1151
- $btn['type'] == 'wooccmupload'
1152
- ) {
1153
- $attachments = get_post_meta($order_id, $btn['cow'], true);
1154
- if (!empty($attachments)) {
1155
- // Check for delimiter
1156
- if (strstr($attachments, '||') !== false)
1157
- $attachments = explode('||', $attachments);
1158
- else if (strstr($attachments, ',') !== false)
1159
- $attachments = explode(',', $attachments);
1160
- else if (is_numeric($attachments))
1161
- $attachments = array($attachments);
1162
- }
1163
- echo '
1164
- <p class="form-field form-field-wide form-field-type-wooccmupload">
1165
- <strong>' . wooccm_wpml_string(trim($btn['label'])) . ':</strong>';
1166
- if (empty($attachments)) {
1167
- echo '<br />';
1168
- echo '-';
1169
- }
1170
- echo '
1171
- </p>' . "\n";
1172
- if (!empty($attachments)) {
1173
- echo '<ul>' . "\n";
1174
- foreach ($attachments as $attachment) {
1175
- $attachment_url = wp_get_attachment_url($attachment);
1176
- if (!empty($attachment_url))
1177
- echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename($attachment_url) . '</a></li>' . "\n";
1178
- }
1179
- echo '</ul>';
1180
- }
1181
- echo '
1182
- <!-- .form-field-type-wooccmupload -->';
1183
- }
1184
- }
1185
- }
1186
- }
1187
 
1188
  // Billing details
1189
- function wooccm_admin_edit_order_billing_details($order) {
1190
-
1191
- global $post;
1192
-
1193
- $order_id = ( isset($post->ID) ? $post->ID : false );
1194
-
1195
- $options = get_option('wccs_settings3');
1196
- $buttons = ( isset($options['billing_buttons']) ? $options['billing_buttons'] : false );
1197
- if (!empty($buttons)) {
1198
- $fields = array(
1199
- 'country',
1200
- 'first_name',
1201
- 'last_name',
1202
- 'company',
1203
- 'address_1',
1204
- 'address_2',
1205
- 'city',
1206
- 'state',
1207
- 'postcode',
1208
- 'email',
1209
- 'phone'
1210
- );
1211
- foreach ($buttons as $btn) {
1212
-
1213
- if (!in_array($btn['cow'], $fields)) {
1214
- if (
1215
- ( get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true) !== '' ) &&
1216
- !empty($btn['label']) &&
1217
- $btn['type'] !== 'heading' &&
1218
- $btn['type'] !== 'multiselect' &&
1219
- $btn['type'] !== 'wooccmupload' &&
1220
- $btn['type'] !== 'multicheckbox'
1221
- ) {
1222
- echo '
1223
- <p id="billing_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1224
- <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_billing_%s', $btn['cow']), __('Generic', 'woocommerce-checkout-manager')) . '">
1225
- ' . wooccm_wpml_string(trim($btn['label'])) . ':</strong><br />' . nl2br(get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true)) . '
1226
- </p>
1227
- <!-- .form-field-type-... -->';
1228
- } elseif (
1229
- !empty($btn['label']) &&
1230
- $btn['type'] !== 'wooccmupload' &&
1231
- $btn['type'] !== 'multiselect' &&
1232
- $btn['type'] !== 'multicheckbox' &&
1233
- $btn['type'] == 'heading'
1234
- ) {
1235
- echo '
1236
- <h4>' . wooccm_wpml_string(trim($btn['label'])) . '</h4>';
1237
- } elseif (
1238
- ( get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true) !== '' ) &&
1239
- !empty($btn['label']) &&
1240
- $btn['type'] !== 'heading' &&
1241
- $btn['type'] !== 'wooccmupload' &&
1242
- (
1243
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1244
- )
1245
- ) {
1246
- $value = get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true);
1247
- $strings = maybe_unserialize($value);
1248
-
1249
- echo '
1250
- <p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1251
- <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_billing_%s', $btn['cow']), __('Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager')) . '">' . wooccm_wpml_string(trim($btn['label'])) . ':</strong> ';
1252
- if (!empty($strings)) {
1253
- if (is_array($strings)) {
1254
- $iww = 0;
1255
- $len = count($strings);
1256
- foreach ($strings as $key) {
1257
- if ($iww == $len - 1) {
1258
- echo wooccm_wpml_string($key);
1259
- } else {
1260
- echo wooccm_wpml_string($key) . ', ';
1261
- }
1262
- $iww++;
1263
- }
1264
- } else {
1265
- echo $strings;
1266
- }
1267
- } else {
1268
- echo '-';
1269
- }
1270
- echo '
1271
- </p>
1272
- <!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1273
- } elseif (
1274
- ( get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true) !== '' ) &&
1275
- $btn['type'] == 'wooccmupload'
1276
- ) {
1277
- $attachments = get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true);
1278
- if (!empty($attachments)) {
1279
- // Check for delimiter
1280
- if (strstr($attachments, '||') !== false)
1281
- $attachments = explode('||', $attachments);
1282
- else if (strstr($attachments, ',') !== false)
1283
- $attachments = explode(',', $attachments);
1284
- else if (is_numeric($attachments))
1285
- $attachments = array($attachments);
1286
- }
1287
- $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
1288
- echo '
1289
- <p class="form-field form-field-wide form-field-type-wooccmupload">
1290
- <strong>' . wooccm_wpml_string(trim($btn['label'])) . ':</strong>';
1291
- if (empty($attachments)) {
1292
- echo '<br />';
1293
- echo '-';
1294
- }
1295
- echo '
1296
- </p>' . "\n";
1297
- if (!empty($attachments)) {
1298
- echo '<ul>' . "\n";
1299
- foreach ($attachments as $attachment) {
1300
- $attachment_url = wp_get_attachment_url($attachment);
1301
- if (!empty($attachment_url))
1302
- echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename($attachment_url) . '</a></li>' . "\n";
1303
- }
1304
- echo '</ul>';
1305
- }
1306
- echo '
1307
- <!-- .form-field-type-wooccmupload -->';
1308
- }
1309
- }
1310
- }
1311
- }
1312
- }
1313
 
1314
  // Shipping details
1315
- function wooccm_admin_edit_order_shipping_details($order) {
1316
-
1317
- global $post;
1318
-
1319
- $order_id = ( isset($post->ID) ? $post->ID : false );
1320
-
1321
- $options = get_option('wccs_settings2');
1322
- $buttons = ( isset($options['shipping_buttons']) ? $options['shipping_buttons'] : false );
1323
- if (!empty($buttons)) {
1324
- $fields = array(
1325
- 'country',
1326
- 'first_name',
1327
- 'last_name',
1328
- 'company',
1329
- 'address_1',
1330
- 'address_2',
1331
- 'city',
1332
- 'state',
1333
- 'postcode'
1334
- );
1335
- foreach ($buttons as $btn) {
1336
-
1337
- if (!in_array($btn['cow'], $fields)) {
1338
- if (
1339
- ( get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true) !== '' ) &&
1340
- !empty($btn['label']) &&
1341
- $btn['type'] !== 'wooccmupload' &&
1342
- $btn['type'] !== 'heading' &&
1343
- $btn['type'] !== 'multiselect' &&
1344
- $btn['type'] !== 'multicheckbox'
1345
- ) {
1346
- echo '
1347
- <p id="shipping_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1348
- <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_shipping_%s', $btn['cow']), __('Generic', 'woocommerce-checkout-manager')) . '">
1349
- ' . wooccm_wpml_string(trim($btn['label'])) . ':</strong><br />' . nl2br(get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true)) . '
1350
- </p>
1351
- <!-- .form-field-type-... -->';
1352
- } elseif (
1353
- !empty($btn['label']) &&
1354
- $btn['type'] !== 'multiselect' &&
1355
- $btn['type'] !== 'multicheckbox' &&
1356
- $btn['type'] == 'heading'
1357
- ) {
1358
- echo '
1359
- <h4>' . wooccm_wpml_string(trim($btn['label'])) . '</h4>';
1360
- } elseif (
1361
- ( get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true) !== '' ) &&
1362
- !empty($btn['label']) &&
1363
- $btn['type'] !== 'heading' &&
1364
- $btn['type'] !== 'wooccmupload' &&
1365
- (
1366
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1367
- )
1368
- ) {
1369
- $value = get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true);
1370
- $strings = maybe_unserialize($value);
1371
- echo '
1372
- <p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1373
- <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_shipping_%s', $btn['cow']), __('Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager')) . '">' . wooccm_wpml_string(trim($btn['label'])) . ':</strong> ';
1374
- if (!empty($strings)) {
1375
- if (is_array($strings)) {
1376
- $iww = 0;
1377
- $len = count($strings);
1378
- foreach ($strings as $key) {
1379
- if ($iww == $len - 1) {
1380
- echo wooccm_wpml_string($key);
1381
- } else {
1382
- echo wooccm_wpml_string($key) . ', ';
1383
- }
1384
- $iww++;
1385
- }
1386
- } else {
1387
- echo $strings;
1388
- }
1389
- } else {
1390
- echo '-';
1391
- }
1392
- echo '
1393
- </p>
1394
- <!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1395
- } elseif (
1396
- ( get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true) !== '' ) &&
1397
- $btn['type'] == 'wooccmupload'
1398
- ) {
1399
- $attachments = get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true);
1400
- if (!empty($attachments)) {
1401
- // Check for delimiter
1402
- if (strstr($attachments, '||') !== false)
1403
- $attachments = explode('||', $attachments);
1404
- else if (strstr($attachments, ',') !== false)
1405
- $attachments = explode(',', $attachments);
1406
- else if (is_numeric($attachments))
1407
- $attachments = array($attachments);
1408
- }
1409
- $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
1410
- echo '
1411
- <p class="form-field form-field-wide form-field-type-wooccmupload">
1412
- <strong>' . wooccm_wpml_string(trim($btn['label'])) . ':</strong>';
1413
- echo '
1414
- </p>' . "\n";
1415
- if (!empty($attachments) && is_array($attachments)) {
1416
- echo '<ul>' . "\n";
1417
- foreach ($attachments as $attachment) {
1418
- $attachment_url = wp_get_attachment_url($attachment);
1419
- if (!empty($attachment_url))
1420
- echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename($attachment_url) . '</a></li>' . "\n";
1421
- }
1422
- echo '</ul>';
1423
- } else {
1424
- echo '<br />';
1425
- echo '-';
1426
- }
1427
- echo '
1428
- <!-- .form-field-type-wooccmupload -->';
1429
- }
1430
- }
1431
- }
1432
- }
1433
- }
1434
-
1435
- function wooccm_js_str($s) {
1436
- return '"' . addcslashes($s, "\0..\37\"\\") . '"';
1437
- }
1438
-
1439
- function wooccm_js_array($array) {
1440
- $temp = array_map('wooccm_js_str', $array);
1441
- return '[' . implode(',', $temp) . ']';
1442
- }
14
  //1326
15
  //add_action('admin_notices', 'wooccm_admin_notices');
16
  // Add fields to the Edit Order screen
17
+ //add_action('woocommerce_admin_order_data_after_billing_address', 'wooccm_admin_edit_order_billing_details');
18
+ //add_action('woocommerce_admin_order_data_after_shipping_address', 'wooccm_admin_edit_order_shipping_details');
19
+ //add_action('woocommerce_admin_order_data_after_order_details', 'wooccm_admin_edit_order_additional_details');
20
  }
21
 
22
  // Display admin notice on screen load
1071
  }
1072
  }
1073
 
1074
+ //// Additional details
1075
+ //function wooccm_admin_edit_order_additional_details($order) {
1076
+ //
1077
+ // global $post;
1078
+ //
1079
+ // if (version_compare(wooccm_get_woo_version(), '2.7', '>=')) {
1080
+ // $order_id = ( method_exists($order, 'get_id') ? $order->get_id() : $order->id );
1081
+ // } else {
1082
+ // $order_id = ( isset($order->id) ? $order->id : 0 );
1083
+ // }
1084
+ //
1085
+ // $options = get_option('wccs_settings');
1086
+ // $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
1087
+ // if (!empty($buttons)) {
1088
+ // echo '
1089
+ //<p>&nbsp;</p>
1090
+ //<h4>' . __('Additional Details', 'woocommerce-checkout-manager') . '</h4>';
1091
+ // foreach ($buttons as $btn) {
1092
+ //
1093
+ // if (
1094
+ // ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
1095
+ // !empty($btn['label']) &&
1096
+ // $btn['type'] !== 'heading' &&
1097
+ // $btn['type'] !== 'multiselect' &&
1098
+ // $btn['type'] !== 'wooccmupload' &&
1099
+ // $btn['type'] !== 'multicheckbox'
1100
+ // ) {
1101
+ // echo '
1102
+ //<p id="additional_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1103
+ // <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $btn['cow'], __('Generic', 'woocommerce-checkout-manager')) . '">
1104
+ // ' . wooccm_wpml_string(trim($btn['label'])) . ':</strong><br />' . nl2br(get_post_meta($order_id, $btn['cow'], true)) . '
1105
+ //</p>
1106
+ //<!-- .form-field-type-... -->';
1107
+ // } elseif (
1108
+ // !empty($btn['label']) &&
1109
+ // $btn['type'] !== 'wooccmupload' &&
1110
+ // $btn['type'] !== 'multiselect' &&
1111
+ // $btn['type'] !== 'multicheckbox' &&
1112
+ // $btn['type'] == 'heading'
1113
+ // ) {
1114
+ // echo '
1115
+ //<h4>' . wooccm_wpml_string(trim($btn['label'])) . '</h4>';
1116
+ // } elseif (
1117
+ // ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
1118
+ // !empty($btn['label']) &&
1119
+ // $btn['type'] !== 'heading' &&
1120
+ // $btn['type'] !== 'wooccmupload' &&
1121
+ // (
1122
+ // $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1123
+ // )
1124
+ // ) {
1125
+ // $value = get_post_meta($order_id, $btn['cow'], true);
1126
+ // $strings = maybe_unserialize($value);
1127
+ // echo '
1128
+ //<p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1129
+ // <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $btn['cow'], __('Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager')) . '">' . wooccm_wpml_string(trim($btn['label'])) . ':</strong> ';
1130
+ // if (!empty($strings)) {
1131
+ // if (is_array($strings)) {
1132
+ // $iww = 0;
1133
+ // $len = count($strings);
1134
+ // foreach ($strings as $key) {
1135
+ // if ($iww == $len - 1) {
1136
+ // echo '' . wooccm_wpml_string($key);
1137
+ // } else {
1138
+ // echo '' . wooccm_wpml_string($key) . ', ';
1139
+ // }
1140
+ // $iww++;
1141
+ // }
1142
+ // }
1143
+ // } else {
1144
+ // echo '-';
1145
+ // }
1146
+ // echo '
1147
+ //</p>
1148
+ //<!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1149
+ // } elseif (
1150
+ // ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
1151
+ // $btn['type'] == 'wooccmupload'
1152
+ // ) {
1153
+ // $attachments = get_post_meta($order_id, $btn['cow'], true);
1154
+ // if (!empty($attachments)) {
1155
+ // // Check for delimiter
1156
+ // if (strstr($attachments, '||') !== false)
1157
+ // $attachments = explode('||', $attachments);
1158
+ // else if (strstr($attachments, ',') !== false)
1159
+ // $attachments = explode(',', $attachments);
1160
+ // else if (is_numeric($attachments))
1161
+ // $attachments = array($attachments);
1162
+ // }
1163
+ // echo '
1164
+ //<p class="form-field form-field-wide form-field-type-wooccmupload">
1165
+ // <strong>' . wooccm_wpml_string(trim($btn['label'])) . ':</strong>';
1166
+ // if (empty($attachments)) {
1167
+ // echo '<br />';
1168
+ // echo '-';
1169
+ // }
1170
+ // echo '
1171
+ //</p>' . "\n";
1172
+ // if (!empty($attachments)) {
1173
+ // echo '<ul>' . "\n";
1174
+ // foreach ($attachments as $attachment) {
1175
+ // $attachment_url = wp_get_attachment_url($attachment);
1176
+ // if (!empty($attachment_url))
1177
+ // echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename($attachment_url) . '</a></li>' . "\n";
1178
+ // }
1179
+ // echo '</ul>';
1180
+ // }
1181
+ // echo '
1182
+ //<!-- .form-field-type-wooccmupload -->';
1183
+ // }
1184
+ // }
1185
+ // }
1186
+ //}
1187
 
1188
  // Billing details
1189
+ //function wooccm_admin_edit_order_billing_details($order) {
1190
+ //
1191
+ // global $post;
1192
+ //
1193
+ // $order_id = ( isset($post->ID) ? $post->ID : false );
1194
+ //
1195
+ // $options = get_option('wccs_settings3');
1196
+ // $buttons = ( isset($options['billing_buttons']) ? $options['billing_buttons'] : false );
1197
+ // if (!empty($buttons)) {
1198
+ // $fields = array(
1199
+ // 'country',
1200
+ // 'first_name',
1201
+ // 'last_name',
1202
+ // 'company',
1203
+ // 'address_1',
1204
+ // 'address_2',
1205
+ // 'city',
1206
+ // 'state',
1207
+ // 'postcode',
1208
+ // 'email',
1209
+ // 'phone'
1210
+ // );
1211
+ // foreach ($buttons as $btn) {
1212
+ //
1213
+ // if (!in_array($btn['cow'], $fields)) {
1214
+ // if (
1215
+ // ( get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true) !== '' ) &&
1216
+ // !empty($btn['label']) &&
1217
+ // $btn['type'] !== 'heading' &&
1218
+ // $btn['type'] !== 'multiselect' &&
1219
+ // $btn['type'] !== 'wooccmupload' &&
1220
+ // $btn['type'] !== 'multicheckbox'
1221
+ // ) {
1222
+ // echo '
1223
+ //<p id="billing_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1224
+ // <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_billing_%s', $btn['cow']), __('Generic', 'woocommerce-checkout-manager')) . '">
1225
+ // ' . wooccm_wpml_string(trim($btn['label'])) . ':</strong><br />' . nl2br(get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true)) . '
1226
+ //</p>
1227
+ //<!-- .form-field-type-... -->';
1228
+ // } elseif (
1229
+ // !empty($btn['label']) &&
1230
+ // $btn['type'] !== 'wooccmupload' &&
1231
+ // $btn['type'] !== 'multiselect' &&
1232
+ // $btn['type'] !== 'multicheckbox' &&
1233
+ // $btn['type'] == 'heading'
1234
+ // ) {
1235
+ // echo '
1236
+ //<h4>' . wooccm_wpml_string(trim($btn['label'])) . '</h4>';
1237
+ // } elseif (
1238
+ // ( get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true) !== '' ) &&
1239
+ // !empty($btn['label']) &&
1240
+ // $btn['type'] !== 'heading' &&
1241
+ // $btn['type'] !== 'wooccmupload' &&
1242
+ // (
1243
+ // $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1244
+ // )
1245
+ // ) {
1246
+ // $value = get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true);
1247
+ // $strings = maybe_unserialize($value);
1248
+ //
1249
+ // echo '
1250
+ //<p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1251
+ // <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_billing_%s', $btn['cow']), __('Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager')) . '">' . wooccm_wpml_string(trim($btn['label'])) . ':</strong> ';
1252
+ // if (!empty($strings)) {
1253
+ // if (is_array($strings)) {
1254
+ // $iww = 0;
1255
+ // $len = count($strings);
1256
+ // foreach ($strings as $key) {
1257
+ // if ($iww == $len - 1) {
1258
+ // echo wooccm_wpml_string($key);
1259
+ // } else {
1260
+ // echo wooccm_wpml_string($key) . ', ';
1261
+ // }
1262
+ // $iww++;
1263
+ // }
1264
+ // } else {
1265
+ // echo $strings;
1266
+ // }
1267
+ // } else {
1268
+ // echo '-';
1269
+ // }
1270
+ // echo '
1271
+ //</p>
1272
+ //<!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1273
+ // } elseif (
1274
+ // ( get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true) !== '' ) &&
1275
+ // $btn['type'] == 'wooccmupload'
1276
+ // ) {
1277
+ // $attachments = get_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), true);
1278
+ // if (!empty($attachments)) {
1279
+ // // Check for delimiter
1280
+ // if (strstr($attachments, '||') !== false)
1281
+ // $attachments = explode('||', $attachments);
1282
+ // else if (strstr($attachments, ',') !== false)
1283
+ // $attachments = explode(',', $attachments);
1284
+ // else if (is_numeric($attachments))
1285
+ // $attachments = array($attachments);
1286
+ // }
1287
+ // $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
1288
+ // echo '
1289
+ //<p class="form-field form-field-wide form-field-type-wooccmupload">
1290
+ // <strong>' . wooccm_wpml_string(trim($btn['label'])) . ':</strong>';
1291
+ // if (empty($attachments)) {
1292
+ // echo '<br />';
1293
+ // echo '-';
1294
+ // }
1295
+ // echo '
1296
+ //</p>' . "\n";
1297
+ // if (!empty($attachments)) {
1298
+ // echo '<ul>' . "\n";
1299
+ // foreach ($attachments as $attachment) {
1300
+ // $attachment_url = wp_get_attachment_url($attachment);
1301
+ // if (!empty($attachment_url))
1302
+ // echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename($attachment_url) . '</a></li>' . "\n";
1303
+ // }
1304
+ // echo '</ul>';
1305
+ // }
1306
+ // echo '
1307
+ //<!-- .form-field-type-wooccmupload -->';
1308
+ // }
1309
+ // }
1310
+ // }
1311
+ // }
1312
+ //}
1313
 
1314
  // Shipping details
1315
+ //function wooccm_admin_edit_order_shipping_details($order) {
1316
+ //
1317
+ // global $post;
1318
+ //
1319
+ // $order_id = ( isset($post->ID) ? $post->ID : false );
1320
+ //
1321
+ // $options = get_option('wccs_settings2');
1322
+ // $buttons = ( isset($options['shipping_buttons']) ? $options['shipping_buttons'] : false );
1323
+ // if (!empty($buttons)) {
1324
+ // $fields = array(
1325
+ // 'country',
1326
+ // 'first_name',
1327
+ // 'last_name',
1328
+ // 'company',
1329
+ // 'address_1',
1330
+ // 'address_2',
1331
+ // 'city',
1332
+ // 'state',
1333
+ // 'postcode'
1334
+ // );
1335
+ // foreach ($buttons as $btn) {
1336
+ //
1337
+ // if (!in_array($btn['cow'], $fields)) {
1338
+ // if (
1339
+ // ( get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true) !== '' ) &&
1340
+ // !empty($btn['label']) &&
1341
+ // $btn['type'] !== 'wooccmupload' &&
1342
+ // $btn['type'] !== 'heading' &&
1343
+ // $btn['type'] !== 'multiselect' &&
1344
+ // $btn['type'] !== 'multicheckbox'
1345
+ // ) {
1346
+ // echo '
1347
+ //<p id="shipping_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1348
+ // <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_shipping_%s', $btn['cow']), __('Generic', 'woocommerce-checkout-manager')) . '">
1349
+ // ' . wooccm_wpml_string(trim($btn['label'])) . ':</strong><br />' . nl2br(get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true)) . '
1350
+ //</p>
1351
+ //<!-- .form-field-type-... -->';
1352
+ // } elseif (
1353
+ // !empty($btn['label']) &&
1354
+ // $btn['type'] !== 'multiselect' &&
1355
+ // $btn['type'] !== 'multicheckbox' &&
1356
+ // $btn['type'] == 'heading'
1357
+ // ) {
1358
+ // echo '
1359
+ //<h4>' . wooccm_wpml_string(trim($btn['label'])) . '</h4>';
1360
+ // } elseif (
1361
+ // ( get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true) !== '' ) &&
1362
+ // !empty($btn['label']) &&
1363
+ // $btn['type'] !== 'heading' &&
1364
+ // $btn['type'] !== 'wooccmupload' &&
1365
+ // (
1366
+ // $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1367
+ // )
1368
+ // ) {
1369
+ // $value = get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true);
1370
+ // $strings = maybe_unserialize($value);
1371
+ // echo '
1372
+ //<p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1373
+ // <strong title="' . sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_shipping_%s', $btn['cow']), __('Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager')) . '">' . wooccm_wpml_string(trim($btn['label'])) . ':</strong> ';
1374
+ // if (!empty($strings)) {
1375
+ // if (is_array($strings)) {
1376
+ // $iww = 0;
1377
+ // $len = count($strings);
1378
+ // foreach ($strings as $key) {
1379
+ // if ($iww == $len - 1) {
1380
+ // echo wooccm_wpml_string($key);
1381
+ // } else {
1382
+ // echo wooccm_wpml_string($key) . ', ';
1383
+ // }
1384
+ // $iww++;
1385
+ // }
1386
+ // } else {
1387
+ // echo $strings;
1388
+ // }
1389
+ // } else {
1390
+ // echo '-';
1391
+ // }
1392
+ // echo '
1393
+ //</p>
1394
+ //<!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1395
+ // } elseif (
1396
+ // ( get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true) !== '' ) &&
1397
+ // $btn['type'] == 'wooccmupload'
1398
+ // ) {
1399
+ // $attachments = get_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), true);
1400
+ // if (!empty($attachments)) {
1401
+ // // Check for delimiter
1402
+ // if (strstr($attachments, '||') !== false)
1403
+ // $attachments = explode('||', $attachments);
1404
+ // else if (strstr($attachments, ',') !== false)
1405
+ // $attachments = explode(',', $attachments);
1406
+ // else if (is_numeric($attachments))
1407
+ // $attachments = array($attachments);
1408
+ // }
1409
+ // $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
1410
+ // echo '
1411
+ //<p class="form-field form-field-wide form-field-type-wooccmupload">
1412
+ // <strong>' . wooccm_wpml_string(trim($btn['label'])) . ':</strong>';
1413
+ // echo '
1414
+ //</p>' . "\n";
1415
+ // if (!empty($attachments) && is_array($attachments)) {
1416
+ // echo '<ul>' . "\n";
1417
+ // foreach ($attachments as $attachment) {
1418
+ // $attachment_url = wp_get_attachment_url($attachment);
1419
+ // if (!empty($attachment_url))
1420
+ // echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename($attachment_url) . '</a></li>' . "\n";
1421
+ // }
1422
+ // echo '</ul>';
1423
+ // } else {
1424
+ // echo '<br />';
1425
+ // echo '-';
1426
+ // }
1427
+ // echo '
1428
+ //<!-- .form-field-type-wooccmupload -->';
1429
+ // }
1430
+ // }
1431
+ // }
1432
+ // }
1433
+ //}
1434
+
1435
+ //function wooccm_js_str($s) {
1436
+ // return '"' . addcslashes($s, "\0..\37\"\\") . '"';
1437
+ //}
1438
+ //
1439
+ //function wooccm_js_array($array) {
1440
+ // $temp = array_map('wooccm_js_str', $array);
1441
+ // return '[' . implode(',', $temp) . ']';
1442
+ //}
includes/classes/main.php CHANGED
@@ -9,155 +9,6 @@
9
  if (!defined('ABSPATH'))
10
  exit;
11
 
12
- if (wooccm_validator_changename()) {
13
-
14
- function wooccm_before_checkout() {
15
-
16
- $options = get_option('wccs_settings');
17
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
18
-
19
- // Check if the buttons exist
20
- if (empty($buttons))
21
- return;
22
-
23
- foreach ($buttons as $btn) {
24
- $label = ( isset($btn['label']) ) ? $btn['label'] : '';
25
- ob_start();
26
- }
27
- }
28
-
29
- function wooccm_after_checkout() {
30
-
31
- $options = get_option('wccs_settings');
32
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
33
-
34
- // Check if the buttons exist
35
- if (empty($buttons))
36
- return;
37
-
38
- foreach ($buttons as $btn) {
39
- if ($btn['type'] == 'changename') {
40
- $content = ob_get_clean();
41
- echo str_replace($btn['changenamep'], $btn['changename'], $content);
42
- }
43
- }
44
- }
45
-
46
- }
47
-
48
- // -----------------------------------------------------------
49
- // -----------------------------------------------------------
50
- // -----------------------------------------------------------
51
- // -----------------------------------------------------------
52
-
53
- function wooccm_validator_changename() {
54
-
55
- $options = get_option('wccs_settings');
56
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
57
-
58
- if (!empty($buttons)) {
59
- foreach ($buttons as $btn) {
60
- if (!empty($btn['type'])) {
61
- if ($btn['type'] == 'changename' && !empty($btn['label'])) {
62
- return true;
63
- }
64
- }
65
- }
66
- }
67
- }
68
-
69
- if (wooccm_validator_changename()) {
70
-
71
- // @mod - This function isn't referenced anywhere
72
- function wooccm_string_replacer($order) {
73
-
74
- $options = get_option('wccs_settings');
75
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
76
- ?>
77
- <header>
78
- <h2><?php _e('Customer details', 'woocommerce-checkout-manager'); ?></h2>
79
- </header>
80
-
81
- <dl class="customer_details">
82
- <?php
83
- if ($order->billing_email) {
84
- echo '<dt>' . __('E-mail:', 'woocommerce-checkout-manager') . '</dt>';
85
- echo '<dd>' . $order->billing_email . '</dd>';
86
- }
87
- if ($order->billing_phone) {
88
- echo '<dt>' . __('Telephone:', 'woocommerce-checkout-manager') . '</dt>';
89
- echo '<dd>' . $order->billing_phone . '</dd>';
90
- }
91
- ?>
92
- </dl>
93
-
94
- <?php if (get_option('woocommerce_ship_to_billing_address_only') == 'no') { ?>
95
-
96
- <div class="col2-set addresses">
97
-
98
- <div class="col-1">
99
-
100
- <?php } ?>
101
-
102
- <header class="title">
103
- <h3><?php _e('Billing Address', 'woocommerce-checkout-manager'); ?></h3>
104
- </header>
105
-
106
- <address>
107
- <p><?php if (!$order->get_formatted_billing_address())
108
- _e('N/A', 'woocommerce-checkout-manager');
109
- else
110
- echo $order->get_formatted_billing_address();
111
- ?></p>
112
- </address>
113
-
114
- <?php if (get_option('woocommerce_ship_to_billing_address_only') == 'no') { ?>
115
-
116
- </div>
117
- <!-- .col-1 -->
118
-
119
- <div class="col-2">
120
-
121
- <header class="title">
122
- <h3><?php _e('Shipping Address', 'woocommerce-checkout-manager'); ?></h3>
123
- </header>
124
-
125
- <address>
126
- <p><?php if (!$order->get_formatted_shipping_address())
127
- _e('N/A', 'woocommerce-checkout-manager');
128
- else
129
- echo $order->get_formatted_shipping_address();
130
- ?></p>
131
- </address>
132
-
133
- </div>
134
- <!-- .col-2 -->
135
-
136
- </div>
137
- <!-- .col2-set -->
138
-
139
- <?php } ?>
140
-
141
- <div class="clear"></div>
142
-
143
- <script type="text/javascript">
144
- var array = [];
145
- <?php foreach ($buttons as $btn) { ?>
146
- array.push("<?php echo $btn['changenamep']; ?>", "<?php echo $btn['changename']; ?>")
147
- <?php } ?>
148
- b(array);
149
- function b(array) {
150
- for (var i = 0; i < (array.length - 1); i = i + 2) {
151
- document.body.innerHTML = document.body.innerHTML.replace(array[i], array[i + 1])
152
- }
153
- }
154
- </script>
155
-
156
- <?php
157
- }
158
-
159
- }
160
-
161
  if (wooccm_enable_auto_complete()) {
162
 
163
  function wooccm_retain_field_values() {
@@ -391,131 +242,6 @@ function wooccm_enable_auto_complete() {
391
  }
392
  }
393
 
394
- /*function wooccm_remove_tax_wccm() {
395
-
396
- $saved['wooccm_addamount453userf'] = sanitize_text_field($_POST['add_amount_faj']);
397
- $saved['wooccm_tax_save_method'] = sanitize_text_field($_POST['tax_remove_aj']);
398
- $saved['wooccm_addamount453user'] = sanitize_text_field($_POST['add_amount_aj']);
399
- WC()->session->set('wooccm_retain', $saved);
400
-
401
- die();
402
- }*/
403
-
404
- //add_action('wp_ajax_remove_tax_wccm', 'wooccm_remove_tax_wccm');
405
- //add_action('wp_ajax_nopriv_remove_tax_wccm', 'wooccm_remove_tax_wccm');
406
-
407
- /*function wooccm_custom_user_charge_man($cart) {
408
-
409
- global $woocommerce, $wpdb;
410
-
411
- $options = get_option('wccs_settings');
412
- $options2 = get_option('wccs_settings2');
413
- $options3 = get_option('wccs_settings3');
414
-
415
- $saved = WC()->session->get('wooccm_retain', array());
416
-
417
- if (!empty($options['buttons'])) {
418
- foreach ($options['buttons'] as $btn) {
419
-
420
- if (!empty($btn['add_amount']) && !empty($btn['add_amount_field']) && !empty($btn['label']) && !empty($btn['fee_name'])) {
421
- if ($saved['wooccm_addamount453user'] == $btn['chosen_valt']) {
422
- $woocommerce->cart->add_fee($btn['fee_name'], $btn['add_amount_field'], false, '');
423
- }
424
- }
425
-
426
- if (!empty($btn['add_amount']) && empty($btn['add_amount_field']) && !empty($btn['label']) && !empty($btn['fee_name'])) {
427
- if (!empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf'])) {
428
- $woocommerce->cart->add_fee($btn['fee_name'], $saved['wooccm_addamount453userf'], false, '');
429
- }
430
- }
431
- }
432
- }
433
-
434
- if (!empty($options3['billing_buttons'])) {
435
- foreach ($options3['billing_buttons'] as $btn) {
436
-
437
- if (!empty($btn['add_amount']) && !empty($btn['add_amount_field']) && !empty($btn['label']) && !empty($btn['fee_name'])) {
438
-
439
- error_log('test amount');
440
-
441
- // if (!empty($saved['wooccm_addamount453user']) && $saved['wooccm_addamount453user'] == $btn['chosen_valt']) {
442
- $woocommerce->cart->add_fee($btn['fee_name'], $btn['add_amount_field'], false, '');
443
- //}
444
- }
445
-
446
- if (!empty($btn['add_amount']) && empty($btn['add_amount_field']) && !empty($btn['label']) && !empty($btn['fee_name'])) {
447
- if (!empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf'])) {
448
- $woocommerce->cart->add_fee($btn['fee_name'], $saved['wooccm_addamount453userf'], false, '');
449
- }
450
- }
451
- }
452
- }
453
-
454
- if (!empty($options2['shipping_buttons'])) {
455
- foreach ($options2['shipping_buttons'] as $btn) {
456
-
457
- if (!empty($btn['add_amount']) && !empty($btn['add_amount_field']) && !empty($btn['label']) && !empty($btn['fee_name'])) {
458
- if ($saved['wooccm_addamount453user'] == $btn['chosen_valt']) {
459
- $woocommerce->cart->add_fee($btn['fee_name'], $btn['add_amount_field'], false, '');
460
- }
461
- }
462
-
463
- if (!empty($btn['add_amount']) && empty($btn['add_amount_field']) && !empty($btn['label']) && !empty($btn['fee_name'])) {
464
- if (!empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf'])) {
465
- $woocommerce->cart->add_fee($btn['fee_name'], $saved['wooccm_addamount453userf'], false, '');
466
- }
467
- }
468
- }
469
- }
470
- }*/
471
-
472
- //add_action('woocommerce_cart_calculate_fees', 'wooccm_custom_user_charge_man');
473
-
474
- /*function wooccm_remove_tax_for_exempt($cart) {
475
-
476
- global $woocommerce, $wpdb;
477
-
478
- $options = get_option('wccs_settings');
479
- $options2 = get_option('wccs_settings2');
480
- $options3 = get_option('wccs_settings3');
481
-
482
- $saved = WC()->session->get('wooccm_retain', array());
483
-
484
- if (!empty($options['buttons'])) {
485
- foreach ($options['buttons'] as $btn) {
486
- if (!empty($btn['tax_remove'])) {
487
- if ($saved['wooccm_tax_save_method'] == $btn['chosen_valt']) {
488
- $cart->remove_taxes();
489
- }
490
- }
491
- }
492
- }
493
-
494
- if (!empty($options3['billing_buttons'])) {
495
- foreach ($options3['billing_buttons'] as $btn) {
496
- if (!empty($btn['tax_remove'])) {
497
- if ($saved['wooccm_tax_save_method'] == $btn['chosen_valt']) {
498
- $cart->remove_taxes();
499
- }
500
- }
501
- }
502
- }
503
-
504
- if (!empty($options2['shipping_buttons'])) {
505
- foreach ($options2['shipping_buttons'] as $btn) {
506
- if (!empty($btn['tax_remove'])) {
507
- if ($saved['wooccm_tax_save_method'] == $btn['chosen_valt']) {
508
- $cart->remove_taxes();
509
- }
510
- }
511
- }
512
- }
513
-
514
- return $cart;
515
- }*/
516
-
517
- //add_action('woocommerce_calculate_totals', 'wooccm_remove_tax_for_exempt');
518
-
519
  function wooccm_state_default_switch() {
520
 
521
  $options = get_option('wccs_settings');
@@ -966,5 +692,4 @@ function wooccm_remove_notices_conditional($posted) {
966
  WC()->session->set('wc_notices', $notice);
967
  }
968
 
969
- add_action('woocommerce_after_checkout_validation', 'wooccm_remove_notices_conditional');
970
- ?>
9
  if (!defined('ABSPATH'))
10
  exit;
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  if (wooccm_enable_auto_complete()) {
13
 
14
  function wooccm_retain_field_values() {
242
  }
243
  }
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  function wooccm_state_default_switch() {
246
 
247
  $options = get_option('wccs_settings');
692
  WC()->session->set('wc_notices', $notice);
693
  }
694
 
695
+ add_action('woocommerce_after_checkout_validation', 'wooccm_remove_notices_conditional');
 
includes/formatting.php CHANGED
@@ -13,63 +13,6 @@ function wooccm_mul_array( $val, $array ) {
13
 
14
  }
15
 
16
- /*function wooccm_mul_array2( $val ) {
17
-
18
- global $wpdb;
19
-
20
- foreach( $wpdb->last_result as $item => $tru ) {
21
- if( isset($tru->meta_key) && $tru->meta_key == $val ) {
22
- return true;
23
- }
24
- }
25
- return false;
26
-
27
- }
28
-
29
- function wooccm_get_value_by_key( $array, $key ) {
30
-
31
- if( !empty( $array ) ) {
32
- foreach( $array as $k => $each ){
33
- if( $k == $key ) {
34
- return $each;
35
- }
36
- if( is_array( $each ) ) {
37
- if( $return = wooccm_get_value_by_key( $each,$key ) ) {
38
- return $return;
39
- }
40
- }
41
- }
42
- }
43
-
44
- }
45
-
46
- function wooccm_does_existw( $array ) {
47
-
48
- if( empty( $array ) )
49
- return;
50
-
51
- if( !is_array( $array ) )
52
- return;
53
-
54
- foreach( $array as $sub ) {
55
- if( wooccm_mul_array2( wooccm_get_value_by_key( $sub, 'cow' ) ) ) {
56
- return true;
57
- }
58
- }
59
-
60
- }*/
61
-
62
- function wooccm_clean( $string ) {
63
-
64
- $trim_length = 200; //desired length of text to display
65
- $string = str_replace('-', '', $string); // Replaces all spaces with hyphens.
66
- $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
67
- // $string = preg_replace('/\s+/', '', strip_tags($string)); // removes html and spaces
68
- // $string = preg_replace('/\d/', '', $string); // Replaces multiple hyphens with single one.
69
- return rtrim( substr( $string, 0, $trim_length ) );
70
-
71
- }
72
-
73
  function wooccm_wpml_string( $input = '' ) {
74
 
75
  if( function_exists( 'icl_t' ) ) {
@@ -78,17 +21,4 @@ function wooccm_wpml_string( $input = '' ) {
78
  return $input;
79
  }
80
 
81
- }
82
-
83
- // Sort Checkout fields based on order
84
- function wooccm_sort_fields( $a, $b ) {
85
-
86
- if( !isset( $a['order'] ) || !isset( $b['order'] ) )
87
- return 0;
88
-
89
- if( $a['order'] == $b['order'] )
90
- return 0;
91
- return ( $a['order'] < $b['order'] ) ? -1 : 1;
92
-
93
- }
94
- ?>
13
 
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  function wooccm_wpml_string( $input = '' ) {
17
 
18
  if( function_exists( 'icl_t' ) ) {
21
  return $input;
22
  }
23
 
24
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions.php CHANGED
@@ -27,5 +27,4 @@ function wooccm_get_woo_version() {
27
  }
28
  return $version;
29
 
30
- }
31
- ?>
27
  }
28
  return $version;
29
 
30
+ }
 
includes/template.php DELETED
@@ -1,442 +0,0 @@
1
- <?php
2
- // @mod - Change to thank you page to catch all Order Status
3
- // add_action( 'woocommerce_order_status_completed', 'wooccm_update_attachment_ids' );
4
- // Checkout - Order Received
5
- function wooccm_order_received_checkout_details($order) {
6
-
7
- if (version_compare(wooccm_get_woo_version(), '2.7', '>='))
8
- $order_id = ( method_exists($order, 'get_id') ? $order->get_id() : $order->id );
9
- else
10
- $order_id = ( isset($order->id) ? $order->id : 0 );
11
-
12
- $shipping = array(
13
- 'country',
14
- 'first_name',
15
- 'last_name',
16
- 'company',
17
- 'address_1',
18
- 'address_2',
19
- 'city',
20
- 'state',
21
- 'postcode'
22
- );
23
- $billing = array(
24
- 'country',
25
- 'first_name',
26
- 'last_name',
27
- 'company',
28
- 'address_1',
29
- 'address_2',
30
- 'city',
31
- 'state',
32
- 'postcode',
33
- 'email',
34
- 'phone'
35
- );
36
-
37
- $names = array(
38
- 'billing',
39
- 'shipping'
40
- );
41
- $inc = 3;
42
-
43
- $show_table = apply_filters('wooccm_order_received_checkout_show_table', ( defined('WOOCOMMERCE_VERSION') && version_compare(WOOCOMMERCE_VERSION, '2.3', '>=')));
44
- $print_table = apply_filters('wooccm_order_received_checkout_print_table', true);
45
-
46
- // Check if above WooCommerce 2.3+
47
- if ($show_table) {
48
-
49
- if ($print_table) {
50
- echo '<table class="wccs_custom_fields shop_table">';
51
- }
52
-
53
- foreach ($names as $name) {
54
-
55
- $array = ( $name == 'billing' ) ? $billing : $shipping;
56
-
57
- $options = get_option('wccs_settings' . $inc);
58
- if (!empty($options[sprintf('%s_buttons', $name)])) {
59
- foreach ($options[sprintf('%s_buttons', $name)] as $btn) {
60
-
61
- if (!in_array($btn['cow'], $array)) {
62
- if (
63
- ( get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true) !== '' ) &&
64
- !empty($btn['label']) &&
65
- empty($btn['deny_receipt']) &&
66
- $btn['type'] !== 'heading' &&
67
- $btn['type'] !== 'wooccmupload' &&
68
- $btn['type'] !== 'multiselect' &&
69
- $btn['type'] !== 'multicheckbox'
70
- ) {
71
- echo '
72
- <tr>
73
- <th>' . wooccm_wpml_string($btn['label']) . ':</th>
74
- <td>' . nl2br(get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true)) . '</td>
75
- </tr>';
76
- } elseif (
77
- !empty($btn['label']) &&
78
- empty($btn['deny_receipt']) &&
79
- $btn['type'] !== 'multiselect' &&
80
- $btn['type'] !== 'multicheckbox' &&
81
- $btn['type'] == 'heading'
82
- ) {
83
- echo '
84
- <tr>
85
- <th colspan="2">' . wooccm_wpml_string($btn['label']) . '</th>
86
- </tr>';
87
- } elseif (
88
- ( get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true) !== '') &&
89
- $btn['type'] !== 'wooccmupload' &&
90
- !empty($btn['label']) &&
91
- empty($btn['deny_receipt']) &&
92
- $btn['type'] !== 'heading' &&
93
- (
94
- ( $btn['type'] == 'multiselect' ) || ( $btn['type'] == 'multicheckbox' )
95
- )
96
- ) {
97
- $value = get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true);
98
- $strings = maybe_unserialize($value);
99
- echo '
100
- <tr>
101
- <th>' . wooccm_wpml_string($btn['label']) . ':</th>
102
- <td data-title="' . wooccm_wpml_string($btn['label']) . '">';
103
- if (!empty($strings)) {
104
- if (is_array($strings)) {
105
- foreach ($strings as $key) {
106
- echo wooccm_wpml_string($key) . ', ';
107
- }
108
- } else {
109
- echo $strings;
110
- }
111
- } else {
112
- echo '-';
113
- }
114
- echo '
115
- </td>
116
- </tr>';
117
- } elseif ($btn['type'] == 'wooccmupload') {
118
- $info = get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true);
119
- if (!empty($info)) {
120
- // Check for delimiter
121
- if (strstr($info, '||') !== false)
122
- $info = explode('||', $info);
123
- else if (strstr($info, ',') !== false)
124
- $info = explode(',', $info);
125
- else if (is_numeric($info))
126
- $info = array($info);
127
- if (is_array($info)) {
128
- $num_files = count($info);
129
- if (!empty($num_files))
130
- $info = sprintf(_n('%s file', '%s files', $num_files, 'woocommerce-checkout-manager'), number_format_i18n($num_files));
131
- else
132
- $info = '-';
133
- } else {
134
- $info = '-';
135
- }
136
- } else {
137
- $info = '-';
138
- }
139
-
140
- $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
141
- echo '
142
- <tr>
143
- <th>' . wooccm_wpml_string(trim($btn['label'])) . ':</th>
144
- <td>' . $info . '</td>
145
- </tr>';
146
- }
147
- }
148
- }
149
- }
150
- $inc--;
151
- }
152
-
153
- $options = get_option('wccs_settings');
154
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
155
- if (!empty($buttons)) {
156
- foreach ($buttons as $btn) {
157
-
158
- if (
159
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
160
- !empty($btn['label']) &&
161
- empty($btn['deny_receipt']) &&
162
- $btn['type'] !== 'heading' &&
163
- $btn['type'] !== 'wooccmupload' &&
164
- $btn['type'] !== 'multiselect' &&
165
- $btn['type'] !== 'multicheckbox'
166
- ) {
167
- $value = get_post_meta($order_id, $btn['cow'], true);
168
- if ($value == '1')
169
- $value = __('Yes', 'woocommerce-checkout-manager');
170
- else if ($value == '0')
171
- $value = __('No', 'woocommerce-checkout-manager');
172
- echo '
173
- <tr>
174
- <th>' . wooccm_wpml_string($btn['label']) . ':</th>
175
- <td data-title="' . wooccm_wpml_string($btn['label']) . '">' . nl2br($value) . '</td>
176
- </tr>';
177
- } elseif (
178
- !empty($btn['label']) &&
179
- empty($btn['deny_receipt']) &&
180
- $btn['type'] !== 'wooccmupload' &&
181
- $btn['type'] !== 'multiselect' &&
182
- $btn['type'] !== 'multicheckbox' &&
183
- $btn['type'] == 'heading'
184
- ) {
185
- echo '
186
- <tr>
187
- <th colspan="2">' . wooccm_wpml_string($btn['label']) . '</th>
188
- </tr>';
189
- } elseif (
190
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
191
- !empty($btn['label']) &&
192
- empty($btn['deny_receipt']) &&
193
- $btn['type'] !== 'heading' &&
194
- $btn['type'] !== 'wooccmupload' &&
195
- (
196
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
197
- )
198
- ) {
199
- $value = get_post_meta($order_id, $btn['cow'], true);
200
- $strings = maybe_unserialize($value);
201
- echo '
202
- <tr>
203
- <th>' . wooccm_wpml_string($btn['label']) . ':</th>
204
- <td data-title="' . wooccm_wpml_string($btn['label']) . '">';
205
- if (!empty($strings)) {
206
- if (is_array($strings)) {
207
- foreach ($strings as $key) {
208
- echo wooccm_wpml_string($key) . ', ';
209
- }
210
- } else {
211
- echo $strings;
212
- }
213
- } else {
214
- echo '-';
215
- }
216
- echo '
217
- </td>
218
- </tr>';
219
- } elseif ($btn['type'] == 'wooccmupload') {
220
- $info = get_post_meta($order_id, $btn['cow'], true);
221
- if (!empty($info)) {
222
- // Check for delimiter
223
- if (strstr($info, '||') !== false)
224
- $info = explode('||', $info);
225
- else if (strstr($info, ',') !== false)
226
- $info = explode(',', $info);
227
- else if (is_numeric($info))
228
- $info = array($info);
229
- if (is_array($info)) {
230
- $num_files = count($info);
231
- if (!empty($num_files))
232
- $info = sprintf(_n('%s file', '%s files', $num_files, 'woocommerce-checkout-manager'), number_format_i18n($num_files));
233
- else
234
- $info = '-';
235
- } else {
236
- $info = '-';
237
- }
238
- } else {
239
- $info = '-';
240
- }
241
-
242
- $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
243
- echo '
244
- <tr>
245
- <th>' . wooccm_wpml_string(trim($btn['label'])) . ':</th>
246
- <td data-title="' . wooccm_wpml_string(trim($btn['label'])) . '">' . $info . '</td>
247
- </tr>';
248
- }
249
- }
250
- }
251
-
252
- if ($print_table) {
253
- echo '</table>';
254
- echo '<!-- .wccs_custom_fields -->';
255
- }
256
- } else {
257
-
258
- // @mod - Legacy support below WooCommerce 2.3
259
- echo '<div class="wccs_custom_fields">';
260
-
261
- foreach ($names as $name) {
262
-
263
- $array = ( $name == 'billing' ) ? $billing : $shipping;
264
-
265
- $options = get_option('wccs_settings' . $inc);
266
- if (!empty($options[sprintf('%s_buttons', $name)])) {
267
- foreach ($options[sprintf('%s_buttons', $name)] as $btn) {
268
-
269
- if (!in_array($btn['cow'], $array)) {
270
- if (
271
- ( get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true) !== '' ) &&
272
- !empty($btn['label']) &&
273
- empty($btn['deny_receipt']) &&
274
- $btn['type'] !== 'heading' &&
275
- $btn['type'] !== 'multiselect' &&
276
- $btn['type'] !== 'wooccmupload' &&
277
- $btn['type'] !== 'multicheckbox'
278
- ) {
279
- echo '
280
- <dt>' . wooccm_wpml_string($btn['label']) . ':</dt>
281
- <dd>' . nl2br(get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true)) . '</dd>';
282
- } elseif (
283
- !empty($btn['label']) &&
284
- empty($btn['deny_receipt']) &&
285
- $btn['type'] !== 'multiselect' &&
286
- $btn['type'] !== 'multicheckbox' &&
287
- $btn['type'] == 'heading'
288
- ) {
289
- echo '
290
- <h2>' . wooccm_wpml_string($btn['label']) . '</h2>';
291
- } elseif (
292
- ( get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true) !== '' ) &&
293
- !empty($btn['label']) &&
294
- empty($btn['deny_receipt']) &&
295
- $btn['type'] !== 'heading' &&
296
- (
297
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
298
- )
299
- ) {
300
- $value = get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true);
301
- $strings = maybe_unserialize($value);
302
- echo '
303
- <dt>' . wooccm_wpml_string($btn['label']) . ':</dt>
304
- <dd>';
305
- if (!empty($strings)) {
306
- if (is_array($strings)) {
307
- foreach ($strings as $key) {
308
- echo wooccm_wpml_string($key) . ', ';
309
- }
310
- } else {
311
- echo $strings;
312
- }
313
- } else {
314
- echo '-';
315
- }
316
- echo '
317
- </dd>';
318
- } elseif ($btn['type'] == 'wooccmupload') {
319
- $info = get_post_meta($order_id, sprintf('_%s_%s', $name, $btn['cow']), true);
320
- if (!empty($info)) {
321
- // Check for delimiter
322
- if (strstr($info, '||') !== false)
323
- $info = explode('||', $info);
324
- else if (strstr($info, ',') !== false)
325
- $info = explode(',', $info);
326
- else if (is_numeric($info))
327
- $info = array($info);
328
- if (is_array($info)) {
329
- $num_files = count($info);
330
- if (!empty($num_files))
331
- $info = sprintf(_n('%s file', '%s files', $num_files, 'woocommerce-checkout-manager'), number_format_i18n($num_files));
332
- else
333
- $info = '-';
334
- } else {
335
- $info = '-';
336
- }
337
- } else {
338
- $info = '-';
339
- }
340
-
341
- $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
342
- echo '
343
- <dt>' . wooccm_wpml_string(trim($btn['label'])) . ':</dt>
344
- <dd>' . $info . '</dd>';
345
- }
346
- }
347
- }
348
- }
349
- $inc--;
350
- }
351
-
352
- $options = get_option('wccs_settings');
353
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
354
- if (!empty($buttons)) {
355
- foreach ($buttons as $btn) {
356
-
357
- if (
358
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
359
- !empty($btn['label']) &&
360
- empty($btn['deny_receipt']) &&
361
- $btn['type'] !== 'heading' &&
362
- $btn['type'] !== 'multicheckbox' &&
363
- (
364
- $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'multiselect'
365
- )
366
- ) {
367
- echo '
368
- <dt>' . wooccm_wpml_string($btn['label']) . ':</dt>
369
- <dd>' . nl2br(get_post_meta($order_id, $btn['cow'], true)) . '</dd>';
370
- } elseif (
371
- !empty($btn['label']) &&
372
- empty($btn['deny_receipt']) &&
373
- $btn['type'] !== 'wooccmupload' &&
374
- $btn['type'] !== 'multiselect' &&
375
- $btn['type'] !== 'multicheckbox' &&
376
- $btn['type'] == 'heading'
377
- ) {
378
- echo '
379
- <h2>' . wooccm_wpml_string($btn['label']) . '</h2>';
380
- } elseif (
381
- ( get_post_meta($order_id, $btn['cow'], true) !== '' ) &&
382
- !empty($btn['label']) &&
383
- empty($btn['deny_receipt']) &&
384
- $btn['type'] !== 'heading' &&
385
- $btn['type'] !== 'wooccmupload' &&
386
- (
387
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
388
- )
389
- ) {
390
- $value = get_post_meta($order_id, $btn['cow'], true);
391
- $strings = maybe_unserialize($value);
392
- echo '
393
- <dt>' . wooccm_wpml_string($btn['label']) . ':</dt>
394
- <dd>';
395
- if (!empty($strings)) {
396
- if (is_array($strings)) {
397
- foreach ($strings as $key) {
398
- echo wooccm_wpml_string($key) . ', ';
399
- }
400
- } else {
401
- echo $strings;
402
- }
403
- } else {
404
- echo '-';
405
- }
406
- echo '
407
- </dd>';
408
- } elseif ($btn['type'] == 'wooccmupload') {
409
- $info = get_post_meta($order_id, $btn['cow'], true);
410
- if (!empty($info)) {
411
- // Check for delimiter
412
- if (strstr($info, '||') !== false)
413
- $info = explode('||', $info);
414
- else if (strstr($info, ',') !== false)
415
- $info = explode(',', $info);
416
- else if (is_numeric($info))
417
- $info = array($info);
418
- if (is_array($info)) {
419
- $num_files = count($info);
420
- if (!empty($num_files))
421
- $info = sprintf(_n('%s file', '%s files', $num_files, 'woocommerce-checkout-manager'), number_format_i18n($num_files));
422
- else
423
- $info = '-';
424
- } else {
425
- $info = '-';
426
- }
427
- } else {
428
- $info = '-';
429
- }
430
-
431
- $btn['label'] = (!empty($btn['force_title2']) ? $btn['force_title2'] : $btn['label'] );
432
- echo '
433
- <dt>' . wooccm_wpml_string(trim($btn['label'])) . ':</dt>
434
- <dd>' . $info . '</dd>';
435
- }
436
- }
437
- }
438
- echo '</div>';
439
- echo '<!-- .wccs_custom_fields -->';
440
- }
441
- }
442
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/templates/functions/required/add_required.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
-
3
- function wooccm_custom_checkout_process() {
4
-
5
- global $woocommerce;
6
-
7
- $options = get_option('wccs_settings');
8
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : array() );
9
-
10
- // Check if we have any buttons
11
- if (empty($buttons))
12
- return;
13
-
14
- $categoryarraycm = array();
15
- $productsarraycm = array();
16
-
17
- foreach ($buttons as $btn) {
18
-
19
- foreach ($woocommerce->cart->cart_contents as $key => $values) {
20
- $multiproductsx = ( isset($btn['single_p']) ? $btn['single_p'] : '' );
21
- $show_field_single = ( isset($btn['single_px']) ? $btn['single_px'] : '' );
22
- $multiproductsx_cat = ( isset($btn['single_p_cat']) ? $btn['single_p_cat'] : '' );
23
- $show_field_single_cat = ( isset($btn['single_px_cat']) ? $btn['single_px_cat'] : '' );
24
-
25
- $productsarraycm[] = $values['product_id'];
26
-
27
- // Products
28
- // hide field
29
- // show field without more
30
- // -----------------------------------------------------------------------
31
- if (!empty($btn['single_px']) && empty($btn['more_content'])) {
32
-
33
- $show_field_array = explode('||', $show_field_single);
34
-
35
- if (in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2 )) {
36
-
37
- if (!empty($btn['checkbox']) && !empty($btn['label']) && ( $btn['type'] !== 'changename' )) {
38
-
39
- if (empty($_POST[$btn['cow']])) {
40
- $message = sprintf(__('%s is a required field.', 'woocommerce'), '<strong>' . wooccm_wpml_string($btn['label']) . '</strong>');
41
- wc_add_notice($message, 'error');
42
- }
43
- }
44
- }
45
- }
46
-
47
- // Products
48
- // hide field
49
- // show field with more
50
- // -------------------------------------------------------------------------
51
-
52
- //error_log('test 1');
53
- if (!empty($btn['single_px']) && !empty($btn['more_content'])) {
54
-
55
- //error_log('test 2');
56
- $show_field_array = explode('||', $show_field_single);
57
-
58
- //error_log('test 3');
59
- if (array_intersect($productsarraycm, $show_field_array)) {
60
-
61
- //error_log('test 4');
62
- if (!empty($btn['checkbox']) && !empty($btn['label']) && ( $btn['type'] !== 'changename' )) {
63
-
64
- //error_log('test 5');
65
- if (empty($_POST[$btn['cow']])) {
66
- $message = sprintf(__('%s is a required field.', 'woocommerce'), '<strong>' . wooccm_wpml_string($btn['label']) . '</strong>');
67
- wc_add_notice($message, 'error');
68
- }
69
- }
70
- }
71
- }
72
-
73
- // Category
74
- // hide field
75
- // with more
76
- // show field without more
77
- // -----------------------------------------------------------------------
78
- $terms = get_the_terms($values['product_id'], 'product_cat');
79
-
80
- if (!empty($terms)) {
81
-
82
- foreach ($terms as $term) {
83
-
84
- $categoryarraycm[] = $term->slug;
85
-
86
- // without more
87
- // show field without more
88
- if (!empty($btn['single_px_cat']) && empty($btn['more_content'])) {
89
-
90
- $show_field_array_cat = explode('||', $show_field_single_cat);
91
-
92
- if (in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2 )) {
93
-
94
- if (!empty($btn['checkbox']) && !empty($btn['label']) && ( $btn['type'] !== 'changename' )) {
95
-
96
- if (empty($_POST[$btn['cow']])) {
97
-
98
- $message = sprintf(__('%s is a required field.', 'woocommerce'), '<strong>' . wooccm_wpml_string($btn['label']) . '</strong>');
99
-
100
- wc_add_notice($message, 'error');
101
- }
102
- }
103
- }
104
- }
105
- }
106
- }
107
- }
108
-
109
- // Category
110
- // hide field
111
- // with more
112
- // show field with more
113
- // -------------------------------------------------------------------------
114
-
115
- if (!empty($btn['single_px_cat']) && !empty($btn['more_content'])) {
116
-
117
- $show_field_array_cat = explode('||', $show_field_single_cat);
118
-
119
- if (array_intersect($categoryarraycm, $show_field_array_cat)) {
120
-
121
- if (!empty($btn['checkbox']) && !empty($btn['label']) && ( $btn['type'] !== 'changename' )) {
122
- if (empty($_POST[$btn['cow']])) {
123
- $message = sprintf(__('%s is a required field.', 'woocommerce'), '<strong>' . wooccm_wpml_string($btn['label']) . '</strong>');
124
- wc_add_notice($message, 'error');
125
- }
126
- }
127
- }
128
- }
129
-
130
- $categoryarraycm = array();
131
- $productsarraycm = array();
132
- }
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/templates/functions/required/billing_required.php DELETED
@@ -1,185 +0,0 @@
1
- <?php
2
- function wooccm_billing_custom_checkout_process() {
3
-
4
- global $woocommerce;
5
-
6
- $options = get_option( 'wccs_settings3' );
7
- $buttons = ( isset( $options['buttons'] ) ? $options['billing_buttons'] : array() );
8
-
9
- // Check if we have any buttons
10
- if( empty( $buttons ) )
11
- return;
12
-
13
- $categoryarraycm = array();
14
- $productsarraycm = array();
15
-
16
- foreach( $buttons as $btn ) {
17
-
18
- $btn['checkbox'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : false );
19
- if( $btn['checkbox'] === 'true' ) {
20
- // without checkbox
21
- if(
22
- empty( $btn['single_px_cat'] ) &&
23
- empty( $btn['single_p_cat'] ) &&
24
- empty( $btn['single_px'] ) &&
25
- empty( $btn['single_p'] ) &&
26
- empty( $btn['disabled'] ) &&
27
- !empty( $btn['label'] ) &&
28
- $btn['type'] !== 'changename' &&
29
- $btn['type'] !== 'heading'
30
- ) {
31
- if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
32
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
33
- wc_add_notice( $message, 'error' );
34
- }
35
- }
36
-
37
- // checkbox
38
- if(
39
- empty( $btn['single_px_cat'] ) &&
40
- empty( $btn['single_p_cat'] ) &&
41
- empty( $btn['single_px'] ) &&
42
- empty( $btn['single_p'] ) &&
43
- $btn['type'] == 'checkbox' &&
44
- !empty( $btn['label'] ) &&
45
- $btn['type'] !== 'changename' &&
46
- $btn['type'] !== 'heading'
47
- ) {
48
- if(
49
- ( sanitize_text_field( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) == $btn['check_2'] ) &&
50
- ( !empty( $btn['checkbox'] ) )
51
- ) {
52
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
53
- wc_add_notice( $message, 'error');
54
- }
55
- }
56
- }
57
-
58
- foreach( $woocommerce->cart->cart_contents as $key => $values ) {
59
-
60
- $multiproductsx = ( isset( $btn['single_p'] ) ? $btn['single_p'] : '' );
61
- $show_field_single = ( isset( $btn['single_px'] ) ? $btn['single_px'] : '' );
62
- $multiproductsx_cat = ( isset( $btn['single_p_cat'] ) ? $btn['single_p_cat'] : '' );
63
- $show_field_single_cat = ( isset( $btn['single_px_cat'] ) ? $btn['single_px_cat'] : '' );
64
-
65
- $productsarraycm[] = $values['product_id'];
66
-
67
- // Products
68
- // hide field
69
-
70
- // show field without more
71
- if(
72
- !empty( $btn['single_px'] ) &&
73
- empty( $btn['more_content'] )
74
- ) {
75
- $show_field_array = explode( '||', $show_field_single );
76
- if(
77
- in_array( $values['product_id'], $show_field_array ) &&
78
- ( count( $woocommerce->cart->cart_contents ) < 2 )
79
- ) {
80
- if(
81
- !empty( $btn['checkbox'] ) &&
82
- !empty( $btn['label'] ) &&
83
- ( $btn['type'] !== 'changename' )
84
- ) {
85
- if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
86
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
87
- wc_add_notice( $message, 'error' );
88
- }
89
- }
90
- }
91
- }
92
-
93
- // Category
94
- // hide field
95
- $terms = get_the_terms( $values['product_id'], 'product_cat' );
96
- if( !empty( $terms ) ) {
97
- foreach( $terms as $term ) {
98
-
99
- $categoryarraycm[] = $term->slug;
100
-
101
- // without more
102
-
103
- // show field without more
104
- if(
105
- !empty( $btn['single_px_cat'] ) &&
106
- empty( $btn['more_content'] )
107
- ) {
108
- $show_field_array_cat = explode( '||' , $show_field_single_cat );
109
- if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
110
- if(
111
- !empty( $btn['checkbox'] ) &&
112
- !empty( $btn['label'] ) &&
113
- ( $btn['type'] !== 'changename' )
114
- ) {
115
- if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
116
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
117
- wc_add_notice( $message, 'error' );
118
- }
119
- }
120
- }
121
- }
122
-
123
- }
124
- }
125
-
126
- }
127
- // end cart
128
-
129
- // ===========================================================================================
130
-
131
- // Products
132
- // hide field
133
-
134
- // show field with more
135
- if(
136
- !empty( $btn['single_px'] ) &&
137
- !empty( $btn['more_content'] )
138
- ) {
139
- $show_field_array = explode( '||', $show_field_single );
140
- if( array_intersect( $productsarraycm, $show_field_array ) ) {
141
- if(
142
- !empty( $btn['checkbox'] ) &&
143
- !empty( $btn['label'] ) &&
144
- ( $btn['type'] !== 'changename' )
145
- ) {
146
- if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
147
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
148
- wc_add_notice( $message, 'error' );
149
- }
150
- }
151
- }
152
- }
153
-
154
- // Category
155
- // hide field
156
-
157
- // with more
158
-
159
- // show field with more
160
- if(
161
- !empty( $btn['single_px_cat'] ) &&
162
- !empty( $btn['more_content'] )
163
- ) {
164
- $show_field_array_cat = explode( '||', $show_field_single_cat );
165
- if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
166
- if(
167
- !empty( $btn['checkbox'] ) &&
168
- !empty( $btn['label'] ) &&
169
- ( $btn['type'] !== 'changename' )
170
- ) {
171
- if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
172
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
173
- wc_add_notice( $message, 'error' );
174
- }
175
- }
176
- }
177
- }
178
-
179
- $categoryarraycm = array();
180
- $productsarraycm = array();
181
-
182
- }
183
-
184
- }
185
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/templates/functions/required/shipping_required.php DELETED
@@ -1,156 +0,0 @@
1
- <?php
2
- function wooccm_shipping_custom_checkout_process() {
3
-
4
- global $woocommerce;
5
-
6
- $options = get_option( 'wccs_settings2' );
7
- $buttons = ( isset( $options['buttons'] ) ? $options['shipping_buttons'] : array() );
8
-
9
- // Check if we have any buttons
10
- if( empty( $buttons ) )
11
- return;
12
-
13
- $ship_to_another_address = ( isset( $_POST['ship_to_different_address'] ) ? sanitize_text_field( $_POST['ship_to_different_address'] ) : false );
14
- if( WC()->cart->needs_shipping_address() === false && empty( $ship_to_another_address ) )
15
- return false;
16
-
17
- $categoryarraycm = array();
18
- $productsarraycm = array();
19
-
20
- foreach( $buttons as $btn ) {
21
-
22
- $btn['checkbox'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : false );
23
- if( $btn['checkbox'] === 'true' ) {
24
- // without checkbox
25
- if(
26
- empty( $btn['single_px_cat'] ) &&
27
- empty( $btn['single_p_cat'] ) &&
28
- empty( $btn['single_px'] ) &&
29
- empty( $btn['single_p'] ) &&
30
- empty( $btn['disabled'] ) &&
31
- !empty( $btn['label'] ) &&
32
- $btn['type'] !== 'changename' &&
33
- $btn['type'] !== 'heading'
34
- ) {
35
- if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
36
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
37
- wc_add_notice( $message, 'error' );
38
- }
39
- }
40
-
41
- // checkbox
42
- if(
43
- empty( $btn['single_px_cat'] ) &&
44
- empty( $btn['single_p_cat'] ) &&
45
- empty( $btn['single_px'] ) &&
46
- empty( $btn['single_p'] ) &&
47
- $btn['type'] == 'checkbox' &&
48
- !empty( $btn['label'] ) &&
49
- $btn['type'] !== 'changename' &&
50
- $btn['type'] !== 'heading'
51
- ) {
52
- if( ( sanitize_text_field( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) == $btn['check_2'] ) && ( !empty( $btn['checkbox'] ) ) ) {
53
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
54
- wc_add_notice( $message, 'error');
55
- }
56
- }
57
-
58
- }
59
-
60
- foreach( $woocommerce->cart->cart_contents as $key => $values ) {
61
-
62
- $multiproductsx = ( isset( $btn['single_p'] ) ? $btn['single_p'] : '' );
63
- $show_field_single = ( isset( $btn['single_px'] ) ? $btn['single_px'] : '' );
64
- $multiproductsx_cat = ( isset( $btn['single_p_cat'] ) ? $btn['single_p_cat'] : '' );
65
- $show_field_single_cat = ( isset( $btn['single_px_cat'] ) ? $btn['single_px_cat'] : '' );
66
-
67
- $productsarraycm[] = $values['product_id'];
68
-
69
- // Products
70
- // hide field
71
-
72
- // show field without more
73
- if( !empty( $btn['single_px'] ) && empty( $btn['more_content'] ) ) {
74
- $show_field_array = explode( '||', $show_field_single );
75
- if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2) ) {
76
- if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
77
- if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
78
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
79
- wc_add_notice( $message, 'error' );
80
- }
81
- }
82
- }
83
- }
84
-
85
- // Category
86
- // hide field
87
- $terms = get_the_terms( $values['product_id'], 'product_cat' );
88
- if( !empty( $terms ) ) {
89
- foreach( $terms as $term ) {
90
-
91
- $categoryarraycm[] = $term->slug;
92
-
93
- // without more
94
-
95
- // show field without more
96
- if( !empty( $btn['single_px_cat'] ) && empty( $btn['more_content'] ) ) {
97
- $show_field_array_cat = explode( '||', $show_field_single_cat );
98
- if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
99
- if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
100
- if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
101
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
102
- wc_add_notice( $message, 'error' );
103
- }
104
- }
105
- }
106
- }
107
-
108
- }
109
- }
110
-
111
- }
112
- // end cart
113
-
114
- // ===========================================================================================
115
-
116
- // Products
117
- // hide field
118
-
119
- // show field with more
120
- if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
121
- $show_field_array = explode( '||', $show_field_single );
122
- if(array_intersect( $productsarraycm, $show_field_array ) ){
123
- if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
124
- if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
125
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
126
- wc_add_notice( $message, 'error' );
127
- }
128
- }
129
- }
130
- }
131
-
132
- // Category
133
- // hide field
134
-
135
- // with more
136
-
137
- // show field with more
138
- if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
139
- $show_field_array_cat = explode( '||', $show_field_single_cat );
140
- if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
141
- if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
142
- if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
143
- $message = sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
144
- wc_add_notice( $message, 'error' );
145
- }
146
- }
147
- }
148
- }
149
-
150
- $categoryarraycm = array();
151
- $productsarraycm = array();
152
-
153
- }
154
-
155
- }
156
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
new/class-wooccm-admin.php CHANGED
@@ -13,25 +13,8 @@ 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
-
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
-
34
-
35
  if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
36
  wp_enqueue_style('wooccm-admin');
37
  wp_enqueue_script('wooccm-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-admin', plugins_url('assets/js/wooccm-admin.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
19
  wp_enqueue_style('wooccm-admin');
20
  wp_enqueue_script('wooccm-admin');
new/class-wooccm.php CHANGED
@@ -23,8 +23,7 @@ final class WOOCCM {
23
 
24
  load_plugin_textdomain('woocommerce-checkout-manager', false, dirname(plugin_basename(__FILE__)) . '/languages/');
25
 
26
-
27
- $this->field = new WOOCCM_Field_Controller();
28
  }
29
 
30
  function includes() {
@@ -32,12 +31,12 @@ final class WOOCCM {
32
  // New
33
  // -----------------------------------------------------------------------
34
  include_once( WOOCCM_PLUGIN_DIR . 'new/class-wooccm-install.php' );
35
- include_once( WOOCCM_PLUGIN_DIR . 'new/class-wooccm-notices.php' );
36
  include_once( WOOCCM_PLUGIN_DIR . 'new/class-wooccm-admin.php' );
37
- include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-field-controller.php' );
38
- include_once( WOOCCM_PLUGIN_DIR . 'new/controller/upload.php' );
39
- include_once( WOOCCM_PLUGIN_DIR . 'new/controller/order.php' );
40
- include_once( WOOCCM_PLUGIN_DIR . 'new/controller/checkout.php' );
41
  }
42
 
43
  function includes_old() {
@@ -49,16 +48,13 @@ final class WOOCCM {
49
  include_once( WOOCCM_PLUGIN_DIR . 'includes/email.php' );
50
  include_once( WOOCCM_PLUGIN_DIR . 'includes/formatting.php' );
51
  include_once( WOOCCM_PLUGIN_DIR . 'includes/admin.php' );
52
- include_once( WOOCCM_PLUGIN_DIR . 'includes/template.php' );
53
  include_once( WOOCCM_PLUGIN_DIR . 'includes/export.php' );
54
  include_once( WOOCCM_PLUGIN_DIR . 'includes/classes/main.php' );
55
- include_once( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/required/add_required.php' );
56
- include_once( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/required/billing_required.php' );
57
- include_once( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/required/shipping_required.php' );
58
  }
59
 
60
  public function register_scripts() {
61
-
62
  // Frontend
63
  // -----------------------------------------------------------------------
64
 
23
 
24
  load_plugin_textdomain('woocommerce-checkout-manager', false, dirname(plugin_basename(__FILE__)) . '/languages/');
25
 
26
+ $this->field = WOOCCM_Field_Controller::instance();
 
27
  }
28
 
29
  function includes() {
31
  // New
32
  // -----------------------------------------------------------------------
33
  include_once( WOOCCM_PLUGIN_DIR . 'new/class-wooccm-install.php' );
34
+ include_once( WOOCCM_PLUGIN_DIR . 'new/class-wooccm-notices.php' );
35
  include_once( WOOCCM_PLUGIN_DIR . 'new/class-wooccm-admin.php' );
36
+ include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-field-controller.php' );
37
+ include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-upload-handler.php' );
38
+ include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-order-controller.php' );
39
+ include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-checkout-controller.php' );
40
  }
41
 
42
  function includes_old() {
48
  include_once( WOOCCM_PLUGIN_DIR . 'includes/email.php' );
49
  include_once( WOOCCM_PLUGIN_DIR . 'includes/formatting.php' );
50
  include_once( WOOCCM_PLUGIN_DIR . 'includes/admin.php' );
51
+ //include_once( WOOCCM_PLUGIN_DIR . 'includes/template.php' );
52
  include_once( WOOCCM_PLUGIN_DIR . 'includes/export.php' );
53
  include_once( WOOCCM_PLUGIN_DIR . 'includes/classes/main.php' );
 
 
 
54
  }
55
 
56
  public function register_scripts() {
57
+
58
  // Frontend
59
  // -----------------------------------------------------------------------
60
 
new/controller/{checkout.php → class-wooccm-checkout-controller.php} RENAMED
File without changes
new/controller/{class-field-controller.php → class-wooccm-field-controller.php} RENAMED
@@ -2,10 +2,23 @@
2
 
3
  class WOOCCM_Field_Controller {
4
 
 
5
  public $billing;
6
  public $shipping;
7
  public $additional;
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  function enqueue_scripts() {
10
 
11
  global $current_section;
@@ -22,7 +35,6 @@ class WOOCCM_Field_Controller {
22
  )
23
  ));
24
 
25
-
26
  if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
27
  wp_enqueue_script('wooccm-field');
28
  }
@@ -289,7 +301,7 @@ class WOOCCM_Field_Controller {
289
  }
290
  }
291
 
292
- function save_section_billing() {
293
 
294
  global $current_section;
295
 
@@ -297,8 +309,6 @@ class WOOCCM_Field_Controller {
297
 
298
  $section = wc_clean(wp_unslash($current_section));
299
 
300
- //error_log($current_section);
301
-
302
  if (array_key_exists('field_order', $_POST)) {
303
 
304
  $field_order = wc_clean(wp_unslash($_POST['field_order']));
@@ -328,6 +338,88 @@ class WOOCCM_Field_Controller {
328
  }
329
  }
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  // Admin
332
  // ---------------------------------------------------------------------------
333
 
@@ -396,15 +488,13 @@ class WOOCCM_Field_Controller {
396
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/register.php' );
397
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/additional.php' );
398
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/display.php' );
399
- //include_once( WOOCCM_PLUGIN_DIR . 'includes/templates/functions/additional_display.php' );
400
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/conditional.php' );
401
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/handler.php' );
402
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/filters.php' );
403
 
404
- //$this->field = new WOOCCM_Field();
405
- $this->billing = new WOOCCM_Field_Billing();
406
- $this->shipping = new WOOCCM_Field_Shipping();
407
- $this->additional = new WOOCCM_Field_Additional();
408
  }
409
 
410
  function init() {
@@ -417,15 +507,15 @@ class WOOCCM_Field_Controller {
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
 
 
 
 
 
 
420
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_billing'), 99);
421
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_shipping'), 99);
422
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_additional'), 99);
423
- add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_section_billing'));
424
- }
425
-
426
- public function __construct() {
427
- $this->includes();
428
- $this->init();
429
  }
430
 
431
  }
2
 
3
  class WOOCCM_Field_Controller {
4
 
5
+ protected static $_instance;
6
  public $billing;
7
  public $shipping;
8
  public $additional;
9
 
10
+ public function __construct() {
11
+ $this->includes();
12
+ $this->init();
13
+ }
14
+
15
+ public static function instance() {
16
+ if (is_null(self::$_instance)) {
17
+ self::$_instance = new self();
18
+ }
19
+ return self::$_instance;
20
+ }
21
+
22
  function enqueue_scripts() {
23
 
24
  global $current_section;
35
  )
36
  ));
37
 
 
38
  if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
39
  wp_enqueue_script('wooccm-field');
40
  }
301
  }
302
  }
303
 
304
+ function save_field_order() {
305
 
306
  global $current_section;
307
 
309
 
310
  $section = wc_clean(wp_unslash($current_section));
311
 
 
 
312
  if (array_key_exists('field_order', $_POST)) {
313
 
314
  $field_order = wc_clean(wp_unslash($_POST['field_order']));
338
  }
339
  }
340
 
341
+ // Admin Order
342
+ // ---------------------------------------------------------------------------
343
+
344
+ function add_order_billing_data($order) {
345
+
346
+ if ($fields = WOOCCM()->field->billing->get_fields('old')) {
347
+
348
+ $defaults = WOOCCM()->field->billing->get_defaults();
349
+
350
+ foreach ($fields as $field_id => $field) {
351
+
352
+ if (!in_array($field['cow'], $defaults)) {
353
+
354
+ if ($value = get_post_meta($order->get_id(), sprintf('_billing_%s', $field['cow']), true)) {
355
+ ?>
356
+ <p id="billing_<?php echo esc_attr($field['cow']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
357
+ <strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_billing_%s', $field['cow']), __('Generic', 'woocommerce-checkout-manager'))); ?>">
358
+ <?php echo esc_attr(wooccm_wpml_string(trim($field['label']))); ?>:
359
+ </strong>
360
+ <br />
361
+ <?php echo esc_html($value); ?>
362
+ </p>
363
+ <?php
364
+ }
365
+ }
366
+ }
367
+ }
368
+ }
369
+
370
+ function add_order_shipping_data($order) {
371
+
372
+ if ($fields = WOOCCM()->field->shipping->get_fields('old')) {
373
+
374
+ $defaults = WOOCCM()->field->shipping->get_defaults();
375
+
376
+ foreach ($fields as $field_id => $field) {
377
+
378
+ if (!in_array($field['cow'], $defaults)) {
379
+
380
+ if ($value = get_post_meta($order->get_id(), sprintf('_shipping_%s', $field['cow']), true)) {
381
+ ?>
382
+ <p id="shipping_<?php echo esc_attr($field['cow']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
383
+ <strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_shipping_%s', $field['cow']), __('Generic', 'woocommerce-checkout-manager'))); ?>">
384
+ <?php echo esc_attr(wooccm_wpml_string(trim($field['label']))); ?>:
385
+ </strong>
386
+ <br/>
387
+ <?php echo esc_html($value); ?>
388
+ </p>
389
+ <?php
390
+ }
391
+ }
392
+ }
393
+ }
394
+ }
395
+
396
+ function add_order_additional_data($order) {
397
+
398
+ if ($fields = WOOCCM()->field->additional->get_fields('old')) {
399
+
400
+ $defaults = WOOCCM()->field->additional->get_defaults();
401
+
402
+ foreach ($fields as $field_id => $field) {
403
+
404
+ if (!in_array($field['cow'], $defaults)) {
405
+
406
+ $value = get_post_meta($order->get_id(), sprintf('_%s_%s', 'additional', $field['cow']), true) ? $value : get_post_meta($order->get_id(), sprintf('%s', $field['cow']), true);
407
+ if ($value) {
408
+ ?>
409
+ <p id="additional_<?php echo esc_attr($field['cow']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
410
+ <strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_%s', $field['cow']), __('Generic', 'woocommerce-checkout-manager'))); ?>">
411
+ <?php echo esc_attr(wooccm_wpml_string(trim($field['label']))); ?>:
412
+ </strong>
413
+ <br/>
414
+ <?php echo esc_html($value); ?>
415
+ </p>
416
+ <?php
417
+ }
418
+ }
419
+ }
420
+ }
421
+ }
422
+
423
  // Admin
424
  // ---------------------------------------------------------------------------
425
 
488
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/register.php' );
489
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/additional.php' );
490
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/display.php' );
 
491
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/conditional.php' );
492
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/handler.php' );
493
  include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/fields/filters.php' );
494
 
495
+ $this->billing = WOOCCM_Field_Billing::instance();
496
+ $this->shipping = WOOCCM_Field_Shipping::instance();
497
+ $this->additional = WOOCCM_Field_Additional::instance();
 
498
  }
499
 
500
  function init() {
507
  add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
508
  add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
509
 
510
+
511
+ add_action('woocommerce_admin_order_data_after_billing_address', array($this, 'add_order_billing_data'));
512
+ add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'add_order_shipping_data'));
513
+ add_action('woocommerce_admin_order_data_after_order_details', array($this, 'add_order_additional_data'));
514
+
515
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_billing'), 99);
516
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_shipping'), 99);
517
  add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_additional'), 99);
518
+ add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_field_order'));
 
 
 
 
 
519
  }
520
 
521
  }
new/controller/{order.php → class-wooccm-order-controller.php} RENAMED
File without changes
new/controller/{upload.php → class-wooccm-upload-handler.php} RENAMED
File without changes
new/model/class-wooccm-field-additional.php CHANGED
@@ -4,9 +4,17 @@ if (!class_exists('WOOCCM_Field_Additional')) {
4
 
5
  class WOOCCM_Field_Additional extends WOOCCM_Field_Compatibility {
6
 
 
7
  protected $prefix = 'additional';
8
  protected $option_name = 'wccs_settings';
9
 
 
 
 
 
 
 
 
10
  }
11
 
12
  }
4
 
5
  class WOOCCM_Field_Additional extends WOOCCM_Field_Compatibility {
6
 
7
+ protected static $_instance;
8
  protected $prefix = 'additional';
9
  protected $option_name = 'wccs_settings';
10
 
11
+ public static function instance() {
12
+ if (is_null(self::$_instance)) {
13
+ self::$_instance = new self();
14
+ }
15
+ return self::$_instance;
16
+ }
17
+
18
  }
19
 
20
  }
new/model/class-wooccm-field-billing.php CHANGED
@@ -4,6 +4,7 @@ if (!class_exists('WOOCCM_Field_Billing')) {
4
 
5
  class WOOCCM_Field_Billing extends WOOCCM_Field_Compatibility {
6
 
 
7
  protected $prefix = 'billing';
8
  protected $option_name = 'wccs_settings3';
9
  protected $defaults = array(
@@ -20,6 +21,13 @@ if (!class_exists('WOOCCM_Field_Billing')) {
20
  'phone'
21
  );
22
 
 
 
 
 
 
 
 
23
  }
24
 
25
  }
4
 
5
  class WOOCCM_Field_Billing extends WOOCCM_Field_Compatibility {
6
 
7
+ protected static $_instance;
8
  protected $prefix = 'billing';
9
  protected $option_name = 'wccs_settings3';
10
  protected $defaults = array(
21
  'phone'
22
  );
23
 
24
+ public static function instance() {
25
+ if (is_null(self::$_instance)) {
26
+ self::$_instance = new self();
27
+ }
28
+ return self::$_instance;
29
+ }
30
+
31
  }
32
 
33
  }
new/model/class-wooccm-field-old.php CHANGED
@@ -248,8 +248,8 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
248
  }
249
 
250
  function get_old_type($type = '') {
251
-
252
- if(!$type) {
253
  return 'wooccmtext';
254
  }
255
 
@@ -279,9 +279,11 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
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;
248
  }
249
 
250
  function get_old_type($type = '') {
251
+
252
+ if (!$type) {
253
  return 'wooccmtext';
254
  }
255
 
279
  }
280
  }
281
 
282
+ //if (empty($field['position']) && isset($field['class'])) {
283
+ if ($position = $this->array_to_string(array_intersect((array) $field['class'], array('form-row-wide', 'form-row-first', 'form-row-last')))) {
284
+ $field['position'] = $position;
285
  }
286
+ //}
287
 
288
  if (!isset($field['order'])) {
289
  $field['order'] = $field_id + 1;
new/model/class-wooccm-field-shipping.php CHANGED
@@ -4,6 +4,7 @@ if (!class_exists('WOOCCM_Field_Shipping')) {
4
 
5
  class WOOCCM_Field_Shipping extends WOOCCM_Field_Compatibility {
6
 
 
7
  protected $prefix = 'shipping';
8
  protected $option_name = 'wccs_settings2';
9
  protected $defaults = array(
@@ -18,6 +19,13 @@ if (!class_exists('WOOCCM_Field_Shipping')) {
18
  'postcode',
19
  );
20
 
 
 
 
 
 
 
 
21
  }
22
 
23
  }
4
 
5
  class WOOCCM_Field_Shipping extends WOOCCM_Field_Compatibility {
6
 
7
+ protected static $_instance;
8
  protected $prefix = 'shipping';
9
  protected $option_name = 'wccs_settings2';
10
  protected $defaults = array(
19
  'postcode',
20
  );
21
 
22
+ public static function instance() {
23
+ if (is_null(self::$_instance)) {
24
+ self::$_instance = new self();
25
+ }
26
+ return self::$_instance;
27
+ }
28
+
29
  }
30
 
31
  }
new/model/class-wooccm-field.php CHANGED
@@ -102,10 +102,11 @@ class WOOCCM_Field {
102
  'label' => null,
103
  'placeholder' => null,
104
  'default' => null,
105
- 'position' => null,
106
  'clear' => null,
107
  'options' => null,
108
  'required' => null,
 
109
  // Display
110
  // -------------------------------------------------------------------
111
  'show_role' => null,
102
  'label' => null,
103
  'placeholder' => null,
104
  'default' => null,
105
+ 'position' => 'form-row-wide',
106
  'clear' => null,
107
  'options' => null,
108
  'required' => null,
109
+ 'class' => null,
110
  // Display
111
  // -------------------------------------------------------------------
112
  'show_role' => null,
new/view/frontend/checkout.php CHANGED
@@ -86,8 +86,15 @@ if (!class_exists('WOOCCM_Checkout')) {
86
  }
87
  }
88
 
 
 
 
 
89
  function init() {
90
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
 
 
 
91
  }
92
 
93
  public static function instance() {
86
  }
87
  }
88
 
89
+ function add_thankyou_fields($order) {
90
+ wc_get_template('templates/checkout/thankyou-fields.php', array('order' => $order), '', WOOCCM_PLUGIN_DIR);
91
+ }
92
+
93
  function init() {
94
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
95
+ add_action('woocommerce_order_details_after_order_table', array($this, 'add_thankyou_fields'), -10);
96
+ //add_action('woocommerce_view_order', array($this, 'add_thankyou_fields'), 11);
97
+ //add_action('woocommerce_thankyou', array($this, 'add_thankyou_fields'), 11);
98
  }
99
 
100
  public static function instance() {
new/view/frontend/fields/conditional.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  if (!class_exists('WOOCCM_Fields_Conditional')) {
3
 
4
  class WOOCCM_Fields_Conditional {
@@ -6,6 +7,29 @@ if (!class_exists('WOOCCM_Fields_Conditional')) {
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';
@@ -13,11 +37,12 @@ if (!class_exists('WOOCCM_Fields_Conditional')) {
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() {
1
  <?php
2
+
3
  if (!class_exists('WOOCCM_Fields_Conditional')) {
4
 
5
  class WOOCCM_Fields_Conditional {
7
  protected static $instance;
8
  protected static $i = 0;
9
 
10
+ function remove_required($fields) {
11
+
12
+ if (array_key_exists('woocommerce-process-checkout-nonce', $_REQUEST)) {
13
+
14
+ foreach ($fields as $key => $type) {
15
+
16
+ foreach ($type as $field_id => $field) {
17
+
18
+ // Remove required
19
+ // -------------------------------------------------------------------
20
+ if (!empty($field['conditional_parent_use']) && !empty($field['conditional_tie']) && !empty($field['chosen_valt']) && ($field['conditional_tie'] != $field['cow'])) {
21
+ if (empty($_POST[$field['conditional_tie']]) || $_POST[$field['conditional_tie']] != $field['chosen_valt']) {
22
+ $field['required'] = false;
23
+ unset($fields[$key][$field_id]);
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ return $fields;
31
+ }
32
+
33
  function add_field_attributes($field, $key) {
34
  if (!empty($field['conditional_parent_use']) && !empty($field['conditional_tie']) && !empty($field['chosen_valt']) && ($field['conditional_tie'] != $field['cow'])) {
35
  $field['class'][] = 'wooccm-conditional-child';
37
  $field['custom_attributes']['data-conditional-parent-value'] = $field['chosen_valt'];
38
  }
39
  return $field;
40
+ }
41
 
42
  function init() {
43
  // Add field attributes
44
  add_filter('wooccm_checkout_field_filter', array($this, 'add_field_attributes'), 10, 2);
45
+ add_action('woocommerce_checkout_fields', array($this, 'remove_required'));
46
  }
47
 
48
  public static function instance() {
new/view/frontend/fields/handler.php CHANGED
@@ -60,12 +60,12 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
60
 
61
  foreach ($fields as $key => $type) {
62
 
63
- foreach ($type as $id => $field) {
64
 
65
  // Remove disabled
66
  // -------------------------------------------------------------------
67
  if (!empty($field['disabled'])) {
68
- unset($fields[$key][$id]);
69
  }
70
  }
71
  }
60
 
61
  foreach ($fields as $key => $type) {
62
 
63
+ foreach ($type as $field_id => $field) {
64
 
65
  // Remove disabled
66
  // -------------------------------------------------------------------
67
  if (!empty($field['disabled'])) {
68
+ unset($fields[$key][$field_id]);
69
  }
70
  }
71
  }
new/view/frontend/fields/register.php CHANGED
@@ -14,9 +14,9 @@ if (!class_exists('WOOCCM_Fields_Register')) {
14
 
15
  // Conditonal
16
  // -----------------------------------------------------------------------
17
-
18
- $fields[$key]['conditional_tie'] = sprintf("%s_field", @$fields[$key]['conditional_tie']);
19
-
20
  // Class
21
  // -----------------------------------------------------------------------
22
  if (!is_array(@$fields[$key]['class'])) {
@@ -147,7 +147,7 @@ if (!class_exists('WOOCCM_Fields_Register')) {
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'])) {
14
 
15
  // Conditonal
16
  // -----------------------------------------------------------------------
17
+ if (!empty($fields[$key]['conditional_parent_use']) && !empty($fields[$key]['conditional_tie']) && !empty($fields[$key]['chosen_valt']) && ($fields[$key]['conditional_tie'] != $fields[$key]['cow'])) {
18
+ $fields[$key]['conditional_tie'] = sprintf("%s_%s", $prefix, @$fields[$key]['conditional_tie']);
19
+ }
20
  // Class
21
  // -----------------------------------------------------------------------
22
  if (!is_array(@$fields[$key]['class'])) {
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'])) {
new/view/frontend/order.php CHANGED
@@ -15,7 +15,6 @@ if (!class_exists('WOOCCM_Order')) {
15
  wp_enqueue_style('wooccm');
16
  wp_enqueue_style('dashicons');
17
  wp_enqueue_script('wooccm-order-upload');
18
- //wp_enqueue_style('wooccm-button-style', plugins_url('assets/old/edit-order-uploads-button_style.css', WOOCCM_PLUGIN_FILE), false, WOOCCM_PLUGIN_VERSION, 'all');
19
  }
20
  }
21
 
15
  wp_enqueue_style('wooccm');
16
  wp_enqueue_style('dashicons');
17
  wp_enqueue_script('wooccm-order-upload');
 
18
  }
19
  }
20
 
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.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -137,6 +137,10 @@ Example:
137
 
138
  == Changelog ==
139
 
 
 
 
 
140
  = 4.5.3 =
141
  * Fix: woocommerce checkout new admin panel reset option
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.4
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.4 =
141
+ * Improvement: woocommerce order fields rebuilt
142
+ * Fix: woocommerce conditional fields required
143
+
144
  = 4.5.3 =
145
  * Fix: woocommerce checkout new admin panel reset option
146
 
templates/checkout/thankyou-fields.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h2 class="woocommerce-order-details__title"><?php esc_html_e('Order extra', 'woocommerce-checkout-manager'); ?></h2>
2
+
3
+ <?php //if ($fields = WOOCCM()->field->shipping->get_fields() + WOOCCM()->field->additional->get_fields()): ?>
4
+ <table class="woocommerce-table woocommerce-table--order-details shop_table order_details">
5
+ <tbody>
6
+ <?php foreach (WOOCCM()->field->billing->get_fields() as $field_id => $field) : ?>
7
+ <?php if (!in_array($field['name'], WOOCCM()->field->billing->get_defaults())) : ?>
8
+ <?php if ($value = get_post_meta($order->get_id(), sprintf('_%s_%s', 'billing', $field['name']), true)): ?>
9
+ <tr id="tr-<?php echo esc_attr($field['key']); ?>" class="woocommerce-table__line-item order_item">
10
+ <th class="woocommerce-table__product-name product-name">
11
+ <?php echo esc_html($field['label']); ?>
12
+ </th>
13
+ <td class="woocommerce-table__product-total product-total">
14
+ <?php echo esc_html($value); ?>
15
+ </td>
16
+ </tr>
17
+ <?php endif; ?>
18
+ <?php endif; ?>
19
+ <?php endforeach; ?>
20
+ <?php foreach (WOOCCM()->field->shipping->get_fields() as $field_id => $field) : ?>
21
+ <?php if (!in_array($field['name'], WOOCCM()->field->billing->get_defaults())) : ?>
22
+ <?php if ($value = get_post_meta($order->get_id(), sprintf('_%s_%s', 'shipping', $field['name']), true)): ?>
23
+ <tr id="tr-<?php echo esc_attr($field['key']); ?>" class="woocommerce-table__line-item order_item">
24
+ <th class="woocommerce-table__product-name product-name">
25
+ <?php echo esc_html($field['label']); ?>
26
+ </th>
27
+ <td class="woocommerce-table__product-total product-total">
28
+ <?php echo esc_html($value); ?>
29
+ </td>
30
+ </tr>
31
+ <?php endif; ?>
32
+ <?php endif; ?>
33
+ <?php endforeach; ?>
34
+ <?php foreach (WOOCCM()->field->additional->get_fields() as $field_id => $field) : ?>
35
+ <?php if (!in_array($field['name'], WOOCCM()->field->billing->get_defaults())) : ?>
36
+ <?php
37
+ $value = get_post_meta($order->get_id(), sprintf('_%s_%s', 'additional', $field['name']), true) ? $value : get_post_meta($order->get_id(), sprintf('%s', $field['name']), true);
38
+ if ($value):
39
+ ?>
40
+ <tr id="tr-<?php echo esc_attr($field['key']); ?>" class="woocommerce-table__line-item order_item">
41
+ <th class="woocommerce-table__product-name product-name">
42
+ <?php echo esc_html($field['label']); ?>
43
+ </th>
44
+ <td class="woocommerce-table__product-total product-total">
45
+ <?php echo esc_html($value); ?>
46
+ </td>
47
+ </tr>
48
+ <?php endif; ?>
49
+ <?php endif; ?>
50
+ <?php endforeach; ?>
51
+ </tbody>
52
+ </table>
53
+ <?php
54
+ //endif; ?>
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.3
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.3');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
@@ -69,7 +69,7 @@ add_action('woocommerce_checkout_update_order_meta', 'wooccm_custom_checkout_fie
69
  add_action('woocommerce_checkout_process', 'wooccm_custom_checkout_field_process');
70
  add_action('woocommerce_checkout_update_user_meta', 'wooccm_custom_checkout_field_update_user_meta', 10, 2);
71
  // Checkout - Order Received
72
- add_action('woocommerce_order_details_after_customer_details', 'wooccm_order_received_checkout_details');
73
  add_action('woocommerce_checkout_after_customer_details', 'wooccm_checkout_text_after');
74
  add_action('woocommerce_checkout_before_customer_details', 'wooccm_checkout_text_before');
75
  add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_billing', 15);
@@ -82,28 +82,10 @@ add_filter('wc_customer_order_csv_export_order_headers', 'wooccm_csv_export_modi
82
 
83
  add_filter('default_checkout_billing_state', 'wooccm_state_default_switch');
84
 
85
- add_action('woocommerce_checkout_process', 'wooccm_custom_checkout_process');
86
- add_action('woocommerce_checkout_process', 'wooccm_billing_custom_checkout_process');
87
- add_action('woocommerce_checkout_process', 'wooccm_shipping_custom_checkout_process');
88
-
89
  add_action('woocommerce_checkout_fields', 'wooccm_order_notes');
90
  add_filter('parse_query', 'wooccm_query_list');
91
  add_action('restrict_manage_posts', 'woooccm_restrict_manage_posts');
92
 
93
- if (wooccm_validator_changename()) {
94
-
95
- add_action('woocommerce_before_cart', 'wooccm_before_checkout');
96
- add_action('woocommerce_admin_order_data_after_order_details', 'wooccm_before_checkout');
97
- add_action('woocommerce_before_my_account', 'wooccm_before_checkout');
98
- add_action('woocommerce_email_header', 'wooccm_before_checkout');
99
- add_action('woocommerce_before_checkout_form', 'wooccm_before_checkout');
100
- add_action('woocommerce_after_cart', 'wooccm_after_checkout');
101
- add_action('woocommerce_admin_order_data_after_shipping_address', 'wooccm_after_checkout');
102
- add_action('woocommerce_after_my_account', 'wooccm_after_checkout');
103
- add_action('woocommerce_email_footer', 'wooccm_after_checkout');
104
- add_action('woocommerce_after_checkout_form', 'wooccm_after_checkout');
105
- }
106
-
107
  if (wooccm_enable_auto_complete()) {
108
  add_action('woocommerce_before_checkout_form', 'wooccm_retain_field_values');
109
  }
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
+ * Version: 4.5.4
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.4');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
69
  add_action('woocommerce_checkout_process', 'wooccm_custom_checkout_field_process');
70
  add_action('woocommerce_checkout_update_user_meta', 'wooccm_custom_checkout_field_update_user_meta', 10, 2);
71
  // Checkout - Order Received
72
+ //add_action('woocommerce_order_details_after_customer_details', 'wooccm_order_received_checkout_details');
73
  add_action('woocommerce_checkout_after_customer_details', 'wooccm_checkout_text_after');
74
  add_action('woocommerce_checkout_before_customer_details', 'wooccm_checkout_text_before');
75
  add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_billing', 15);
82
 
83
  add_filter('default_checkout_billing_state', 'wooccm_state_default_switch');
84
 
 
 
 
 
85
  add_action('woocommerce_checkout_fields', 'wooccm_order_notes');
86
  add_filter('parse_query', 'wooccm_query_list');
87
  add_action('restrict_manage_posts', 'woooccm_restrict_manage_posts');
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  if (wooccm_enable_auto_complete()) {
90
  add_action('woocommerce_before_checkout_form', 'wooccm_retain_field_values');
91
  }