WooCommerce Checkout Manager - Version 4.5.7

Version Description

  • Fix: woocommerce default label and placeholder i18n
Download this release

Release Info

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

Code changes from version 4.5.5 to 4.5.7

Files changed (52) hide show
  1. assets/js/wooccm-field.js +2 -2
  2. assets/js/wooccm-field.min.js +1 -1
  3. assets/js/wooccm-order-upload.js +2 -2
  4. assets/js/wooccm-order-upload.min.js +1 -1
  5. changelog.txt +25 -0
  6. includes/admin.php +135 -136
  7. includes/checkout.php +0 -338
  8. includes/classes/main.php +167 -390
  9. includes/email.php +0 -380
  10. includes/export.php +31 -30
  11. includes/functions.php +0 -16
  12. includes/templates/admin/woocheckout-billing.php +2 -0
  13. new/class-wooccm-admin.php +61 -42
  14. new/class-wooccm.php +40 -15
  15. new/controller/class-wooccm-checkout-advanced-controller.php +110 -0
  16. new/controller/class-wooccm-checkout-controller.php +337 -61
  17. new/controller/class-wooccm-field-controller.php +139 -154
  18. new/controller/class-wooccm-field-upload.php +182 -0
  19. new/controller/class-wooccm-order-controller.php +249 -30
  20. new/controller/class-wooccm-upload-handler.php +0 -123
  21. new/model/class-wooccm-field-billing.php +1 -0
  22. new/model/class-wooccm-field-old.php +103 -21
  23. new/model/class-wooccm-field.php +68 -25
  24. new/view/backend/order.php +0 -66
  25. new/view/backend/pages/advanced.php +12 -29
  26. new/view/backend/pages/billing.php +1 -0
  27. new/view/backend/pages/checkout.php +7 -0
  28. new/view/backend/pages/general.php +0 -133
  29. new/view/backend/pages/modals/edit.php +1 -1
  30. new/view/backend/pages/modals/parts/edit-info.php +1 -1
  31. new/view/backend/pages/modals/parts/panel-advanced.php +3 -3
  32. new/view/backend/pages/modals/parts/panel-amount.php +4 -4
  33. new/view/backend/pages/modals/parts/panel-conditional.php +1 -1
  34. new/view/backend/pages/modals/parts/panel-display.php +2 -2
  35. new/view/backend/pages/modals/parts/panel-general.php +44 -1
  36. new/view/backend/pages/order.php +8 -0
  37. new/view/backend/pages/orders.php +0 -8
  38. new/view/backend/pages/parts/actions.php +9 -4
  39. new/view/backend/pages/parts/header.php +8 -3
  40. new/view/backend/pages/parts/loop.php +14 -16
  41. new/view/frontend/checkout.php +0 -112
  42. new/view/frontend/{fields/additional.php → class-wooccm-fields-additional.php} +47 -17
  43. new/view/frontend/{fields/conditional.php → class-wooccm-fields-conditional.php} +0 -0
  44. new/view/frontend/{fields/display.php → class-wooccm-fields-display.php} +0 -0
  45. new/view/frontend/{fields/handler.php → class-wooccm-fields-handler.php} +0 -0
  46. new/view/frontend/{fields/register.php → class-wooccm-fields-register.php} +14 -2
  47. new/view/frontend/{fields/filters.php → filters.php} +52 -2
  48. new/view/frontend/order.php +0 -65
  49. readme.txt +10 -1
  50. templates/{checkout/thankyou-fields.php → order/order-custom-fields.php} +4 -4
  51. templates/order/{order-uploads.php → order-upload-files.php} +2 -0
  52. woocommerce-checkout-manager.php +6 -30
assets/js/wooccm-field.js CHANGED
@@ -98,7 +98,7 @@
98
  },
99
  success: function (response) {
100
  if (response.success) {
101
- //console.log(response.data);
102
  //console.log(this.model.attributes);
103
  modal.model.set(response.data);
104
  modal.render();
@@ -202,7 +202,7 @@
202
 
203
  //console.log($form.serializeArrayAll());
204
  //console.log($form.serialize());
205
- //console.log(modal.model.attributes);
206
 
207
  $.ajax({
208
  url: wooccm_field.ajax_url,
98
  },
99
  success: function (response) {
100
  if (response.success) {
101
+ console.log(response.data);
102
  //console.log(this.model.attributes);
103
  modal.model.set(response.data);
104
  modal.render();
202
 
203
  //console.log($form.serializeArrayAll());
204
  //console.log($form.serialize());
205
+ console.log(modal.model.attributes);
206
 
207
  $.ajax({
208
  url: wooccm_field.ajax_url,
assets/js/wooccm-field.min.js CHANGED
@@ -1 +1 @@
1
- (function(e){var g=0,b;var d=function(j){return j.is(".processing")||j.parents(".processing").length};var c=function(j){if(!d(j)){j.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var f=function(j){j.removeClass("processing").unblock()};var h=Backbone.Model.extend({defaults:wooccm_field.args});var i=Backbone.View.extend({events:{"click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","change input":"change","change textarea":"change","change select":"change","change .media-modal-change":"render","submit .media-modal-form":"save",},templates:{},initialize:function(){_.bindAll(this,"open","edit","change","load","render","close","save");this.init();this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-window")},render:function(){var k=this;var j=this.$el.find("ul.wc-tabs li.active a").attr("href");k.$el.html(k.templates.window(k.model.attributes));_.delay(function(){k.$el.trigger("wooccm-enhanced-select");k.$el.trigger("wooccm-tab-panels",j);k.$el.trigger("init_tooltips")},100)},load:function(){var j=this;if(j.model.attributes.id==undefined){j.render();return}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_field.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(k){if(k.success){j.model.set(k.data);j.render()}else{alert(k.data)}}})},edit:function(n){n.preventDefault();var l=this,m=e(n.target),k=parseInt(e(".wc_gateways tr[data-field_id]").length-1),j=parseInt(l.model.get("id"));g++;if(b){clearTimeout(b)}b=setTimeout(function(){if(m.hasClass("media-modal-next")){j=Math.min(j+g,k)}else{j=Math.max(j-g,0)}l.model.set({id:j});g=0;l.load()},300)},open:function(j){this.load();e("body").addClass("modal-open").append(this.$el)},change:function(m){m.preventDefault();var k=e(m.target),j=k.attr("name"),l=k.val();if(m.target.type==="checkbox"){l=k.prop("checked")===true?1:0}this.model.attributes[j]=l;this.model.changed[j]=l},close:function(j){j.preventDefault();this.undelegateEvents();e(document).off("focusin");e("body").removeClass("modal-open");this.remove()},save:function(m){m.preventDefault();var l=this,k=l.$el.find("#wooccm_modal"),j=k.find(".attachment-details");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_id:l.model.attributes.id,field_data:l.model.attributes},dataType:"json",type:"POST",beforeSend:function(){j.addClass("save-waiting");c(k)},complete:function(){j.addClass("save-complete");j.removeClass("save-waiting");f(k)},error:function(){alert("Error!")},success:function(n){if(n.success){if(n.data.id!=l.model.attributes.id){location.reload();return}}else{alert(n.data)}}});return false}});var a=Backbone.View.extend({initialize:function(m){var l=e(m.target),k=l.closest("[data-field_id]").data("field_id");var j=new h();j.set({id:k});new i({model:j})},});e("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",function(j){j.preventDefault();new a(j)});e("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",function(k){k.preventDefault();var j=e(k.target);var l=confirm(wooccm_field.message.reset);if(!l){return false}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_reset_fields",nonce:wooccm_field.nonce},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(m){if(m.success){location.reload()}else{alert(m.data)}}});return false});e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",function(j){j.preventDefault();new a(j)});e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",function(m){m.preventDefault();var l=e(m.target),k=l.closest("[data-field_id]"),j=k.data("field_id");var n=confirm(wooccm_field.message.remove);if(!n){return false}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:j,},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(o){if(o.success){k.remove()}else{alert(o.data)}}});return false});e(document).on("click",".wooccm-field-toggle-attribute",function(m){m.preventDefault();var j=e(this),l=j.closest("tr"),k=j.find(".woocommerce-input-toggle");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:e(this).data("field_attr"),field_id:l.data("field_id")},dataType:"json",type:"POST",beforeSend:function(n){k.addClass("woocommerce-input-toggle--loading")},success:function(n){if(true===n.data){k.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");k.addClass("woocommerce-input-toggle--enabled");k.removeClass("woocommerce-input-toggle--loading")}else{if(true!==n.data){k.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");k.addClass("woocommerce-input-toggle--disabled");k.removeClass("woocommerce-input-toggle--loading")}}}});return false});e(document).on("change",".wooccm-field-change-attribute",function(l){l.preventDefault();var j=e(this),k=j.closest("tr");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:j.data("field_attr"),field_value:j.val(),field_id:k.data("field_id"),},dataType:"json",type:"POST",beforeSend:function(m){j.prop("disabled",true)},success:function(m){console.log(m.data)},complete:function(m){j.prop("disabled",false)},});return false})})(jQuery);
1
+ (function(e){var g=0,b;var d=function(j){return j.is(".processing")||j.parents(".processing").length};var c=function(j){if(!d(j)){j.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var f=function(j){j.removeClass("processing").unblock()};var h=Backbone.Model.extend({defaults:wooccm_field.args});var i=Backbone.View.extend({events:{"click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","change input":"change","change textarea":"change","change select":"change","change .media-modal-change":"render","submit .media-modal-form":"save",},templates:{},initialize:function(){_.bindAll(this,"open","edit","change","load","render","close","save");this.init();this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-window")},render:function(){var k=this;var j=this.$el.find("ul.wc-tabs li.active a").attr("href");k.$el.html(k.templates.window(k.model.attributes));_.delay(function(){k.$el.trigger("wooccm-enhanced-select");k.$el.trigger("wooccm-tab-panels",j);k.$el.trigger("init_tooltips")},100)},load:function(){var j=this;if(j.model.attributes.id==undefined){j.render();return}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_field.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(k){if(k.success){console.log(k.data);j.model.set(k.data);j.render()}else{alert(k.data)}}})},edit:function(n){n.preventDefault();var l=this,m=e(n.target),k=parseInt(e(".wc_gateways tr[data-field_id]").length-1),j=parseInt(l.model.get("id"));g++;if(b){clearTimeout(b)}b=setTimeout(function(){if(m.hasClass("media-modal-next")){j=Math.min(j+g,k)}else{j=Math.max(j-g,0)}l.model.set({id:j});g=0;l.load()},300)},open:function(j){this.load();e("body").addClass("modal-open").append(this.$el)},change:function(m){m.preventDefault();var k=e(m.target),j=k.attr("name"),l=k.val();if(m.target.type==="checkbox"){l=k.prop("checked")===true?1:0}this.model.attributes[j]=l;this.model.changed[j]=l},close:function(j){j.preventDefault();this.undelegateEvents();e(document).off("focusin");e("body").removeClass("modal-open");this.remove()},save:function(m){m.preventDefault();var l=this,k=l.$el.find("#wooccm_modal"),j=k.find(".attachment-details");console.log(l.model.attributes);e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_id:l.model.attributes.id,field_data:l.model.attributes},dataType:"json",type:"POST",beforeSend:function(){j.addClass("save-waiting");c(k)},complete:function(){j.addClass("save-complete");j.removeClass("save-waiting");f(k)},error:function(){alert("Error!")},success:function(n){if(n.success){if(n.data.id!=l.model.attributes.id){location.reload();return}}else{alert(n.data)}}});return false}});var a=Backbone.View.extend({initialize:function(m){var l=e(m.target),k=l.closest("[data-field_id]").data("field_id");var j=new h();j.set({id:k});new i({model:j})},});e("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",function(j){j.preventDefault();new a(j)});e("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",function(k){k.preventDefault();var j=e(k.target);var l=confirm(wooccm_field.message.reset);if(!l){return false}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_reset_fields",nonce:wooccm_field.nonce},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(m){if(m.success){location.reload()}else{alert(m.data)}}});return false});e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",function(j){j.preventDefault();new a(j)});e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",function(m){m.preventDefault();var l=e(m.target),k=l.closest("[data-field_id]"),j=k.data("field_id");var n=confirm(wooccm_field.message.remove);if(!n){return false}e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:j,},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(o){if(o.success){k.remove()}else{alert(o.data)}}});return false});e(document).on("click",".wooccm-field-toggle-attribute",function(m){m.preventDefault();var j=e(this),l=j.closest("tr"),k=j.find(".woocommerce-input-toggle");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:e(this).data("field_attr"),field_id:l.data("field_id")},dataType:"json",type:"POST",beforeSend:function(n){k.addClass("woocommerce-input-toggle--loading")},success:function(n){if(true===n.data){k.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");k.addClass("woocommerce-input-toggle--enabled");k.removeClass("woocommerce-input-toggle--loading")}else{if(true!==n.data){k.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");k.addClass("woocommerce-input-toggle--disabled");k.removeClass("woocommerce-input-toggle--loading")}}}});return false});e(document).on("change",".wooccm-field-change-attribute",function(l){l.preventDefault();var j=e(this),k=j.closest("tr");e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:j.data("field_attr"),field_value:j.val(),field_id:k.data("field_id"),},dataType:"json",type:"POST",beforeSend:function(m){j.prop("disabled",true)},success:function(m){console.log(m.data)},complete:function(m){j.prop("disabled",false)},});return false})})(jQuery);
assets/js/wooccm-order-upload.js CHANGED
@@ -37,7 +37,7 @@
37
  $(document).on('click', '#wooccm_order_attachment_update', function (e) {
38
 
39
  $.ajax({
40
- url: wooccm_upload.ajaxurl,
41
  type: 'POST',
42
  cache: false,
43
  data: {
@@ -104,7 +104,7 @@
104
  data.append('order_id', order_id);
105
 
106
  $.ajax({
107
- url: wooccm_upload.ajaxurl,
108
  type: 'POST',
109
  cache: false,
110
  data: data,
37
  $(document).on('click', '#wooccm_order_attachment_update', function (e) {
38
 
39
  $.ajax({
40
+ url: wooccm_upload.ajax_url,
41
  type: 'POST',
42
  cache: false,
43
  data: {
104
  data.append('order_id', order_id);
105
 
106
  $.ajax({
107
+ url: wooccm_upload.ajax_url,
108
  type: 'POST',
109
  cache: false,
110
  data: data,
assets/js/wooccm-order-upload.min.js CHANGED
@@ -1 +1 @@
1
- (function(b){var c=function(e){return e.is(".processing")||e.parents(".processing").length};var d=function(e){if(!c(e)){e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(e){e.removeClass("processing").unblock()};b(document).ready(function(e){e(document).on("click",".wooccm_delete_attachment",function(h){var g=e(this).closest("tr"),f=e(this).data("attachment_id");g.hide();e("#wooccm_order_attachment_update").prop("disabled",false);e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(f,""))});e(document).on("click","#wooccm_order_attachment_update",function(f){e.ajax({url:wooccm_upload.ajaxurl,type:"POST",cache:false,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(g){e(".wccm_results").html(wooccm_upload.message.saving)},success:function(g){if(g.success){e(".wccm_results").html(wooccm_upload.message.deleted);e("#wooccm_order_attachment_update").prop("disabled",true)}else{e(".wccm_results").html(g.data)}}})});e(document).on("change","#wooccm_order_attachment_upload",function(m){var l=false,n=e(this).data("order_id");if(window.FormData){l=new FormData()}var k=0,g=this.files.length,h,f,j;for(;k<g;k++){j=this.files[k];if(l){l.append("wooccm_order_attachment_upload[]",j)}}if(l){l.append("action","wooccm_order_attachment_upload");l.append("nonce",wooccm_upload.nonce);l.append("order_id",n);e.ajax({url:wooccm_upload.ajaxurl,type:"POST",cache:false,data:l,processData:false,contentType:false,beforeSend:function(i){e(".wccm_results").html(wooccm_upload.message.uploading);d(e("#wooccm_order_attachment_inner"))},success:function(i){if(i.success){e("#wooccm_order_attachment_inner").fadeOut();e("#wooccm_order_attachment_inner").replaceWith(e(i.data).fadeIn());e(".wccm_results").html(wooccm_upload.message.success)}else{e(".wccm_results").html(i.data)}a(e("#wooccm_order_attachment_inner"))}})}})})})(jQuery);
1
+ (function(b){var c=function(e){return e.is(".processing")||e.parents(".processing").length};var d=function(e){if(!c(e)){e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(e){e.removeClass("processing").unblock()};b(document).ready(function(e){e(document).on("click",".wooccm_delete_attachment",function(h){var g=e(this).closest("tr"),f=e(this).data("attachment_id");g.hide();e("#wooccm_order_attachment_update").prop("disabled",false);e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(f,""))});e(document).on("click","#wooccm_order_attachment_update",function(f){e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:false,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(g){e(".wccm_results").html(wooccm_upload.message.saving)},success:function(g){if(g.success){e(".wccm_results").html(wooccm_upload.message.deleted);e("#wooccm_order_attachment_update").prop("disabled",true)}else{e(".wccm_results").html(g.data)}}})});e(document).on("change","#wooccm_order_attachment_upload",function(m){var l=false,n=e(this).data("order_id");if(window.FormData){l=new FormData()}var k=0,g=this.files.length,h,f,j;for(;k<g;k++){j=this.files[k];if(l){l.append("wooccm_order_attachment_upload[]",j)}}if(l){l.append("action","wooccm_order_attachment_upload");l.append("nonce",wooccm_upload.nonce);l.append("order_id",n);e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:false,data:l,processData:false,contentType:false,beforeSend:function(i){e(".wccm_results").html(wooccm_upload.message.uploading);d(e("#wooccm_order_attachment_inner"))},success:function(i){if(i.success){e("#wooccm_order_attachment_inner").fadeOut();e("#wooccm_order_attachment_inner").replaceWith(e(i.data).fadeIn());e(".wccm_results").html(wooccm_upload.message.success)}else{e(".wccm_results").html(i.data)}a(e("#wooccm_order_attachment_inner"))}})}})})})(jQuery);
changelog.txt ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Fifteen ( 15 ) fields types included: Text Input, Text Area, Password, Radio Button, Check Box, Select Options, Date Picker, Time Picker, Color Picker, Heading, Multi-Select, Multi-Checkbox, Country, State, File Picker.
2
+
3
+ Compatible with WPML, WooCommerce Print Invoice & Delivery Note, Store Exporter Deluxe, WooCommerce Order/Customer CSV Export.
4
+
5
+ Sort Orders by Field Name.
6
+ Export Orders by Field Name.
7
+
8
+ Create fields to remove tax
9
+ Create fields to add additional amount
10
+ Display Payment Method and Shipping Method used by customer.
11
+ Disable any added field from Checkout details page and Order Receipt.
12
+
13
+ DatePicker: Change the default format (dd-mm-yy), Set Minimum Date and Maximum Date, Disable days in the week (Sun – Sat).
14
+ TimePicker: Includes restriction of both start and end hours, set the minutes interval and manually input labels.
15
+ Display Order Time.
16
+
17
+ Re-position the added fields: Before Shipping Form, After Shipping Form, Before Billing Form, After Billing Form or After Order Notes
18
+
19
+ = 4.4.0 Beta =
20
+ * Improvement: woocommerce order upload rebuilt
21
+ * Improvement: woocommerce checkout upload rebuilt
22
+ * Improvement: woocommerce order admin upload rebuilt
23
+ * Improvement: woocommerce register fields rebuilt
24
+ * Improvement: woocommerce register fields rebuilt
25
+ * Fix: woocommerce checkout additional fields required
includes/admin.php CHANGED
@@ -78,8 +78,8 @@ function wooccm_admin_notice_print() {
78
  function wooccm_admin_menu() {
79
 
80
  add_menu_page('WooCheckout', 'WooCheckout', 'manage_options', 'woocommerce-checkout-manager', 'wooccm_options_page', 'dashicons-businessman', 57);
81
- // @mod - Remove until exports are fixed...
82
- // add_submenu_page( 'woocommerce-checkout-manager', 'Export', 'Export', 'manage_options', 'wooccm-advance-export', 'wooccm_advance_export' );
83
  }
84
 
85
  add_action('admin_menu', 'wooccm_admin_menu');
@@ -182,16 +182,16 @@ function wooccm_admin_woocheckout_actions() {
182
  $action = ( function_exists('woo_get_action') ? woo_get_action() : false );
183
  switch ($action) {
184
 
185
- // Reset the Run the updater notice
186
- case 'wooccm_reset_update_notice':
187
- // We need to verify the nonce.
188
- if (!empty($_GET) && check_admin_referer('wooccm_reset_update_notice')) {
189
- delete_option(WOOCCM_PREFIX . '_update_notice');
190
- $url = add_query_arg(array('action' => null, '_wpnonce' => null));
191
- wp_redirect($url);
192
- exit();
193
- }
194
- break;
195
 
196
  case 'wooccm_nuke_options':
197
  // We need to verify the nonce.
@@ -408,19 +408,19 @@ function wooccm_options_page() {
408
  ),
409
  );
410
 
411
- /*$shipping = array(
412
- 'country' => __('Country', 'woocommerce-checkout-manager'),
413
- 'first_name' => __('First Name', 'woocommerce-checkout-manager'),
414
- 'last_name' => __('Last Name', 'woocommerce-checkout-manager'),
415
- 'company' => __('Company Name', 'woocommerce-checkout-manager'),
416
- 'address_1' => __('Address', 'woocommerce-checkout-manager'),
417
- 'address_2' => '',
418
- 'city' => __('Town/ City', 'woocommerce-checkout-manager'),
419
- 'state' => __('State', 'woocommerce-checkout-manager'),
420
- 'postcode' => __('Zip', 'woocommerce-checkout-manager')
421
- );
422
- $ship = 0;
423
- foreach ($shipping as $name => $value) {
424
 
425
  $defaults2['shipping_buttons'][$ship]['label'] = (!empty($value) ? __($value, 'woocommerce-checkout-manager') : false );
426
  $defaults2['shipping_buttons'][$ship]['cow'] = $name;
@@ -430,66 +430,66 @@ function wooccm_options_page() {
430
 
431
  switch ($name) {
432
 
433
- case 'country':
434
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
435
- $defaults2['shipping_buttons'][$ship]['type'] = 'wooccmcountry';
436
- break;
437
-
438
- case 'first_name':
439
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-first';
440
- break;
441
-
442
- case 'last_name':
443
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-last';
444
- $defaults2['shipping_buttons'][$ship]['clear_row'] = true;
445
- break;
446
-
447
- case 'company':
448
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
449
- break;
450
-
451
- case 'address_1':
452
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
453
- $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
454
- break;
455
-
456
- case 'address_2':
457
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
458
- $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
459
- $defaults2['shipping_buttons'][$ship]['required'] = false;
460
- break;
461
-
462
- case 'city':
463
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
464
- $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
465
- break;
466
-
467
- case 'state':
468
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
469
- $defaults2['shipping_buttons'][$ship]['type'] = 'wooccmstate';
470
- break;
471
  }
472
 
473
  $ship++;
474
- }
475
 
476
- $billing = array(
477
- 'country' => __('Country', 'woocommerce-checkout-manager'),
478
- 'first_name' => __('First Name', 'woocommerce-checkout-manager'),
479
- 'last_name' => __('Last Name', 'woocommerce-checkout-manager'),
480
- 'company' => __('Company Name', 'woocommerce-checkout-manager'),
481
- 'address_1' => __('Address', 'woocommerce-checkout-manager'),
482
- 'address_2' => '',
483
- 'city' => __('Town/ City', 'woocommerce-checkout-manager'),
484
- 'state' => __('State', 'woocommerce-checkout-manager'),
485
- 'postcode' => __('Zip', 'woocommerce-checkout-manager'),
486
- 'email' => __('Email Address', 'woocommerce-checkout-manager'),
487
- 'phone' => __('Phone', 'woocommerce-checkout-manager')
488
- );
489
 
490
- $bill = 0;
491
 
492
- foreach ($billing as $name => $value) {
493
 
494
  $defaults3['billing_buttons'][$bill]['label'] = (!empty($value) ? __($value, 'woocommerce-checkout-manager') : false );
495
  $defaults3['billing_buttons'][$bill]['cow'] = $name;
@@ -499,69 +499,68 @@ function wooccm_options_page() {
499
 
500
  switch ($name) {
501
 
502
- case 'country':
503
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
504
- $defaults3['billing_buttons'][$bill]['type'] = 'wooccmcountry';
505
- break;
506
-
507
- case 'first_name':
508
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
509
- break;
510
-
511
- case 'last_name':
512
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
513
- $defaults3['billing_buttons'][$bill]['clear_row'] = true;
514
- break;
515
-
516
- case 'company':
517
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
518
- break;
519
-
520
- case 'address_1':
521
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
522
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
523
- break;
524
-
525
- case 'address_2':
526
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
527
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
528
- $defaults3['billing_buttons'][$bill]['checkbox'] = false;
529
-
530
- break;
531
-
532
- case 'city':
533
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
534
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
535
- break;
536
-
537
- case 'state':
538
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
539
- $defaults3['billing_buttons'][$bill]['type'] = 'wooccmstate';
540
-
541
- break;
542
-
543
- case 'postcode':
544
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
545
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Postcode / Zip', 'woocommerce-checkout-manager');
546
- $defaults3['billing_buttons'][$bill]['clear_row'] = true;
547
- break;
548
-
549
- case 'email':
550
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
551
- break;
552
-
553
- case 'phone':
554
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
555
- $defaults3['billing_buttons'][$bill]['clear_row'] = true;
556
- break;
557
  }
558
 
559
  $bill++;
560
- }*/
561
  add_option('wccs_settings', $defaults);
562
  //add_option('wccs_settings2', $defaults2);
563
  //add_option('wccs_settings3', $defaults3);
564
-
565
  // @mod - Change this to add_query_arg()
566
  echo '
567
  <script type="text/javascript">window.location.href="' . admin_url('admin.php?page=woocommerce-checkout-manager') . '";</script>';
78
  function wooccm_admin_menu() {
79
 
80
  add_menu_page('WooCheckout', 'WooCheckout', 'manage_options', 'woocommerce-checkout-manager', 'wooccm_options_page', 'dashicons-businessman', 57);
81
+
82
+ //add_submenu_page('woocommerce-checkout-manager', 'Export', 'Export', 'manage_options', 'wooccm-advance-export', 'wooccm_advance_export');
83
  }
84
 
85
  add_action('admin_menu', 'wooccm_admin_menu');
182
  $action = ( function_exists('woo_get_action') ? woo_get_action() : false );
183
  switch ($action) {
184
 
185
+ // // Reset the Run the updater notice
186
+ // case 'wooccm_reset_update_notice':
187
+ // // We need to verify the nonce.
188
+ // if (!empty($_GET) && check_admin_referer('wooccm_reset_update_notice')) {
189
+ // delete_option(WOOCCM_PREFIX . '_update_notice');
190
+ // $url = add_query_arg(array('action' => null, '_wpnonce' => null));
191
+ // wp_redirect($url);
192
+ // exit();
193
+ // }
194
+ // break;
195
 
196
  case 'wooccm_nuke_options':
197
  // We need to verify the nonce.
408
  ),
409
  );
410
 
411
+ /* $shipping = array(
412
+ 'country' => __('Country', 'woocommerce-checkout-manager'),
413
+ 'first_name' => __('First Name', 'woocommerce-checkout-manager'),
414
+ 'last_name' => __('Last Name', 'woocommerce-checkout-manager'),
415
+ 'company' => __('Company Name', 'woocommerce-checkout-manager'),
416
+ 'address_1' => __('Address', 'woocommerce-checkout-manager'),
417
+ 'address_2' => '',
418
+ 'city' => __('Town/ City', 'woocommerce-checkout-manager'),
419
+ 'state' => __('State', 'woocommerce-checkout-manager'),
420
+ 'postcode' => __('Zip', 'woocommerce-checkout-manager')
421
+ );
422
+ $ship = 0;
423
+ foreach ($shipping as $name => $value) {
424
 
425
  $defaults2['shipping_buttons'][$ship]['label'] = (!empty($value) ? __($value, 'woocommerce-checkout-manager') : false );
426
  $defaults2['shipping_buttons'][$ship]['cow'] = $name;
430
 
431
  switch ($name) {
432
 
433
+ case 'country':
434
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
435
+ $defaults2['shipping_buttons'][$ship]['type'] = 'wooccmcountry';
436
+ break;
437
+
438
+ case 'first_name':
439
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-first';
440
+ break;
441
+
442
+ case 'last_name':
443
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-last';
444
+ $defaults2['shipping_buttons'][$ship]['clear_row'] = true;
445
+ break;
446
+
447
+ case 'company':
448
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
449
+ break;
450
+
451
+ case 'address_1':
452
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
453
+ $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
454
+ break;
455
+
456
+ case 'address_2':
457
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
458
+ $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
459
+ $defaults2['shipping_buttons'][$ship]['required'] = false;
460
+ break;
461
+
462
+ case 'city':
463
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
464
+ $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
465
+ break;
466
+
467
+ case 'state':
468
+ $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
469
+ $defaults2['shipping_buttons'][$ship]['type'] = 'wooccmstate';
470
+ break;
471
  }
472
 
473
  $ship++;
474
+ }
475
 
476
+ $billing = array(
477
+ 'country' => __('Country', 'woocommerce-checkout-manager'),
478
+ 'first_name' => __('First Name', 'woocommerce-checkout-manager'),
479
+ 'last_name' => __('Last Name', 'woocommerce-checkout-manager'),
480
+ 'company' => __('Company Name', 'woocommerce-checkout-manager'),
481
+ 'address_1' => __('Address', 'woocommerce-checkout-manager'),
482
+ 'address_2' => '',
483
+ 'city' => __('Town/ City', 'woocommerce-checkout-manager'),
484
+ 'state' => __('State', 'woocommerce-checkout-manager'),
485
+ 'postcode' => __('Zip', 'woocommerce-checkout-manager'),
486
+ 'email' => __('Email Address', 'woocommerce-checkout-manager'),
487
+ 'phone' => __('Phone', 'woocommerce-checkout-manager')
488
+ );
489
 
490
+ $bill = 0;
491
 
492
+ foreach ($billing as $name => $value) {
493
 
494
  $defaults3['billing_buttons'][$bill]['label'] = (!empty($value) ? __($value, 'woocommerce-checkout-manager') : false );
495
  $defaults3['billing_buttons'][$bill]['cow'] = $name;
499
 
500
  switch ($name) {
501
 
502
+ case 'country':
503
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
504
+ $defaults3['billing_buttons'][$bill]['type'] = 'wooccmcountry';
505
+ break;
506
+
507
+ case 'first_name':
508
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
509
+ break;
510
+
511
+ case 'last_name':
512
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
513
+ $defaults3['billing_buttons'][$bill]['clear_row'] = true;
514
+ break;
515
+
516
+ case 'company':
517
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
518
+ break;
519
+
520
+ case 'address_1':
521
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
522
+ $defaults3['billing_buttons'][$bill]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
523
+ break;
524
+
525
+ case 'address_2':
526
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
527
+ $defaults3['billing_buttons'][$bill]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
528
+ $defaults3['billing_buttons'][$bill]['checkbox'] = false;
529
+
530
+ break;
531
+
532
+ case 'city':
533
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
534
+ $defaults3['billing_buttons'][$bill]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
535
+ break;
536
+
537
+ case 'state':
538
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
539
+ $defaults3['billing_buttons'][$bill]['type'] = 'wooccmstate';
540
+
541
+ break;
542
+
543
+ case 'postcode':
544
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
545
+ $defaults3['billing_buttons'][$bill]['placeholder'] = __('Postcode / Zip', 'woocommerce-checkout-manager');
546
+ $defaults3['billing_buttons'][$bill]['clear_row'] = true;
547
+ break;
548
+
549
+ case 'email':
550
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
551
+ break;
552
+
553
+ case 'phone':
554
+ $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
555
+ $defaults3['billing_buttons'][$bill]['clear_row'] = true;
556
+ break;
557
  }
558
 
559
  $bill++;
560
+ } */
561
  add_option('wccs_settings', $defaults);
562
  //add_option('wccs_settings2', $defaults2);
563
  //add_option('wccs_settings3', $defaults3);
 
564
  // @mod - Change this to add_query_arg()
565
  echo '
566
  <script type="text/javascript">window.location.href="' . admin_url('admin.php?page=woocommerce-checkout-manager') . '";</script>';
includes/checkout.php DELETED
@@ -1,338 +0,0 @@
1
- <?php
2
-
3
- function wooccm_autocreate_account($fields) {
4
-
5
- $options = get_option('wccs_settings');
6
-
7
- if (!empty($options['checkness']['auto_create_wccm_account'])) {
8
- ?>
9
- <script type="text/javascript">
10
-
11
- jQuery(document).ready(function () {
12
- jQuery("input#createaccount").prop("checked", "checked");
13
- });
14
-
15
- </script>
16
-
17
- <style type="text/css">
18
- .create-account {
19
- display:none;
20
- }
21
- </style>
22
-
23
- <?php
24
-
25
- }
26
- }
27
-
28
- function wooccm_display_front() {
29
-
30
- global $woocommerce;
31
-
32
- if (!is_checkout())
33
- return;
34
-
35
- echo '
36
- <script type="text/javascript">
37
- var ajaxurl = "' . admin_url("admin-ajax.php") . '";
38
- var ajaxnonce = "' . wp_create_nonce("wccs_ajax_nonce") . '";
39
- </script>';
40
-
41
- $options = get_option('wccs_settings');
42
-
43
- // Hide Ship to a different address? heading
44
- if (!empty($options['checkness']['additional_info'])) {
45
- echo '
46
- <style type="text/css">
47
- .woocommerce-shipping-fields h3:first-child {
48
- display: none;
49
- }
50
- </style>
51
- ';
52
- }
53
-
54
- // Force show Billing fields
55
- if (!empty($options['checkness']['show_shipping_fields'])) {
56
- echo '
57
- <style type="text/css">
58
- .woocommerce-shipping-fields .shipping_address {
59
- display: block !important;
60
- }
61
- </style>
62
- ';
63
- }
64
-
65
- // Custom CSS
66
- echo '
67
- <style type="text/css">';
68
- if (!empty($options['checkness']['custom_css_w'])) {
69
- echo esc_textarea($options['checkness']['custom_css_w']);
70
- }
71
- echo '
72
-
73
- @media screen and (max-width: 685px) {
74
- .woocommerce .checkout .container .wooccm-btn {
75
- padding: 1% 6%;
76
- }
77
- }
78
-
79
- @media screen and (max-width: 685px) {
80
- .woocommerce .checkout .container .wooccm-btn {
81
- padding: 1% 8%;
82
- }
83
- }
84
-
85
- .container .wooccm-btn {
86
- padding: 1.7% 6.7%;
87
- }
88
-
89
- </style>
90
- ';
91
- }
92
-
93
- function wooccm_checkout_text_after() {
94
-
95
- $options = get_option('wccs_settings');
96
-
97
- if (!empty($options['checkness']['text2'])) {
98
- if (( isset($options['checkness']['checkbox3']) && $options['checkness']['checkbox3'] == true ) || ( isset($options['checkness']['checkbox4']) && $options['checkness']['checkbox4'] == true )) {
99
- if (isset($options['checkness']['checkbox4']) && $options['checkness']['checkbox4'] == true) {
100
- echo $options['checkness']['text2'];
101
- }
102
- }
103
- }
104
-
105
- if (!empty($options['checkness']['text1'])) {
106
- if ($options['checkness']['checkbox1'] == true || $options['checkness']['checkbox2'] == true) {
107
- if (isset($options['checkness']['checkbox2']) && $options['checkness']['checkbox2'] == true) {
108
- echo $options['checkness']['text1'];
109
- }
110
- }
111
- }
112
- }
113
-
114
- function wooccm_checkout_text_before() {
115
-
116
- $options = get_option('wccs_settings');
117
-
118
- if (!empty($options['checkness']['text2'])) {
119
- if (( isset($options['checkness']['checkbox3']) && $options['checkness']['checkbox3'] == true ) || ( isset($options['checkness']['checkbox4']) && $options['checkness']['checkbox4'] == true )) {
120
- if (isset($options['checkness']['checkbox3']) && $options['checkness']['checkbox3'] == true) {
121
- echo $options['checkness']['text2'];
122
- }
123
- }
124
- }
125
-
126
- if (!empty($options['checkness']['text1'])) {
127
- if ($options['checkness']['checkbox1'] == true || $options['checkness']['checkbox2'] == true) {
128
- if (isset($options['checkness']['checkbox1']) && $options['checkness']['checkbox1'] == true) {
129
- echo $options['checkness']['text1'];
130
- }
131
- }
132
- }
133
- }
134
-
135
- // We are overriding the default Order Post meta values with our own secret sauce
136
- function wooccm_custom_checkout_field_update_order_meta($order_id) {
137
-
138
- // Additional section
139
- $options = get_option('wccs_settings');
140
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
141
- if (!empty($buttons)) {
142
- foreach ($buttons as $btn) {
143
- if ($btn['type'] == 'wooccmtextarea') {
144
- if (!empty($_POST[$btn['cow']])) {
145
- update_post_meta($order_id, $btn['cow'], wp_kses($_POST[$btn['cow']], false));
146
- }
147
- } else if ($btn['type'] !== 'multiselect' && $btn['type'] !== 'multicheckbox') {
148
- if (!empty($_POST[$btn['cow']])) {
149
- update_post_meta($order_id, $btn['cow'], sanitize_text_field($_POST[$btn['cow']]));
150
- }
151
- } elseif ($btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox') {
152
- if (!empty($_POST[$btn['cow']])) {
153
- update_post_meta($order_id, $btn['cow'], maybe_serialize(array_map('sanitize_text_field', $_POST[$btn['cow']])));
154
- }
155
- }
156
- }
157
- }
158
-
159
- // Shipping section
160
- $options = get_option('wccs_settings2');
161
- $buttons = ( isset($options['shipping_buttons']) ? $options['shipping_buttons'] : false );
162
- if (!empty($buttons)) {
163
- foreach ($buttons as $btn) {
164
- if ($btn['type'] == 'wooccmtextarea') {
165
- if (!empty($_POST[sprintf('shipping_%s', $btn['cow'])])) {
166
- update_post_meta($order_id, sprintf('_shipping_%s', $btn['cow']), wp_kses($_POST[sprintf('shipping_%s', $btn['cow'])], false));
167
- }
168
- }
169
- }
170
- }
171
-
172
- // Billing section
173
- $options = get_option('wccs_settings3');
174
- $buttons = ( isset($options['billing_buttons']) ? $options['billing_buttons'] : false );
175
- if (!empty($buttons)) {
176
- foreach ($buttons as $btn) {
177
- if ($btn['type'] == 'wooccmtextarea') {
178
- if (!empty($_POST[sprintf('billing_%s', $btn['cow'])])) {
179
- update_post_meta($order_id, sprintf('_billing_%s', $btn['cow']), wp_kses($_POST[sprintf('billing_%s', $btn['cow'])], false));
180
- }
181
- }
182
- }
183
- }
184
- }
185
-
186
- function wooccm_custom_checkout_field_update_user_meta($user_id = 0, $posted) {
187
-
188
- if (empty($user_id))
189
- return;
190
-
191
- // Additional section
192
- $options = get_option('wccs_settings');
193
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
194
- if (!empty($buttons)) {
195
- foreach ($buttons as $btn) {
196
- if ($btn['type'] == 'wooccmtextarea') {
197
- if (!empty($_POST[$btn['cow']])) {
198
- update_user_meta($user_id, $btn['cow'], wp_kses($_POST[$btn['cow']], false));
199
- }
200
- }
201
- }
202
- }
203
-
204
- // Shipping section
205
- $options = get_option('wccs_settings2');
206
- $buttons = ( isset($options['shipping_buttons']) ? $options['shipping_buttons'] : false );
207
- if (!empty($buttons)) {
208
- foreach ($buttons as $btn) {
209
- if ($btn['type'] == 'wooccmtextarea') {
210
- if (!empty($_POST[sprintf('shipping_%s', $btn['cow'])])) {
211
- update_user_meta($user_id, sprintf('shipping_%s', $btn['cow']), wp_kses($_POST[sprintf('shipping_%s', $btn['cow'])], false));
212
- }
213
- }
214
- }
215
- }
216
-
217
- // Billing section
218
- $options = get_option('wccs_settings3');
219
- $buttons = ( isset($options['billing_buttons']) ? $options['billing_buttons'] : false );
220
- if (!empty($buttons)) {
221
- foreach ($buttons as $btn) {
222
- if ($btn['type'] == 'wooccmtextarea') {
223
- if (!empty($_POST[sprintf('billing_%s', $btn['cow'])])) {
224
- update_user_meta($user_id, sprintf('billing_%s', $btn['cow']), wp_kses($_POST[sprintf('billing_%s', $btn['cow'])], false));
225
- }
226
- }
227
- }
228
- }
229
- }
230
-
231
- function wooccm_custom_checkout_field_process() {
232
-
233
- global $woocommerce;
234
-
235
- $options = get_option('wccs_settings');
236
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
237
- if (!empty($buttons)) {
238
- foreach ($buttons as $btn) {
239
- if (isset($btn['checkbox']) && $btn['checkbox'] === 'true') {
240
- // without checkbox
241
- if (
242
- empty($btn['single_px_cat']) &&
243
- empty($btn['single_p_cat']) &&
244
- empty($btn['single_px']) &&
245
- empty($btn['single_p']) &&
246
- !empty($btn['label']) &&
247
- $btn['type'] !== 'wooccmupload' &&
248
- $btn['type'] !== 'changename' &&
249
- $btn['type'] !== 'heading'
250
- ) {
251
- if (empty($_POST[$btn['cow']])) {
252
- $message = sprintf(__('%s is a required field.', 'woocommerce'), '<strong>' . wooccm_wpml_string($btn['label']) . '</strong>');
253
- wc_add_notice($message, 'error');
254
- }
255
- }
256
- // checkbox
257
- if (
258
- empty($btn['single_px_cat']) &&
259
- empty($btn['single_p_cat']) &&
260
- empty($btn['single_px']) &&
261
- empty($btn['single_p']) &&
262
- !empty($btn['label']) &&
263
- $btn['type'] == 'checkbox' &&
264
- $btn['type'] !== 'changename' &&
265
- $btn['type'] !== 'wooccmupload' &&
266
- $btn['type'] !== 'heading'
267
- ) {
268
- if (
269
- ( sanitize_text_field($_POST[$btn['cow']]) == $btn['check_2'] ) &&
270
- (!empty($btn['checkbox'])
271
- )) {
272
- $message = sprintf(__('%s is a required field.', 'woocommerce'), '<strong>' . wooccm_wpml_string($btn['label']) . '</strong>');
273
- wc_add_notice($message, 'error');
274
- }
275
- }
276
- }
277
- }
278
- }
279
- }
280
-
281
- function wooccm_remove_fields_filter_billing($fields = array()) {
282
-
283
- global $woocommerce;
284
-
285
- // Check if the cart is not empty
286
- if (empty($woocommerce->cart->cart_contents))
287
- return $fields;
288
-
289
- $options = get_option('wccs_settings');
290
-
291
- foreach ($woocommerce->cart->cart_contents as $key => $values) {
292
-
293
- $multiCategoriesx = ( isset($options['checkness']['productssave']) ? $options['checkness']['productssave'] : '' );
294
- $multiCategoriesArrayx = explode(',', $multiCategoriesx);
295
-
296
- if (in_array($values['product_id'], $multiCategoriesArrayx) && ( $woocommerce->cart->cart_contents_count < 2 )) {
297
- unset($fields['billing']['billing_address_1']);
298
- unset($fields['billing']['billing_address_2']);
299
- unset($fields['billing']['billing_phone']);
300
- unset($fields['billing']['billing_country']);
301
- unset($fields['billing']['billing_city']);
302
- unset($fields['billing']['billing_postcode']);
303
- unset($fields['billing']['billing_state']);
304
- break;
305
- }
306
- }
307
-
308
- return $fields;
309
- }
310
-
311
- function wooccm_remove_fields_filter_shipping($fields = array()) {
312
-
313
- global $woocommerce;
314
-
315
- // Check if the cart is not empty
316
- if (empty($woocommerce->cart->cart_contents))
317
- return $fields;
318
-
319
- $options = get_option('wccs_settings');
320
-
321
- foreach ($woocommerce->cart->cart_contents as $key => $values) {
322
-
323
- $multiCategoriesx = ( isset($options['checkness']['productssave']) ? $options['checkness']['productssave'] : '' );
324
- $multiCategoriesArrayx = explode(',', $multiCategoriesx);
325
- $_product = $values['data'];
326
-
327
- if (
328
- ( $woocommerce->cart->cart_contents_count > 1 ) &&
329
- ( $_product->needs_shipping() )
330
- ) {
331
- remove_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter', 15);
332
- break;
333
- }
334
- }
335
-
336
- return $fields;
337
- }
338
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/classes/main.php CHANGED
@@ -9,247 +9,16 @@
9
  if (!defined('ABSPATH'))
10
  exit;
11
 
12
- if (wooccm_enable_auto_complete()) {
13
-
14
- function wooccm_retain_field_values() {
15
-
16
- $options = get_option('wccs_settings');
17
- $options2 = get_option('wccs_settings2');
18
- $options3 = get_option('wccs_settings3');
19
-
20
- if (is_checkout() == false)
21
- return;
22
-
23
- $saved = WC()->session->get('wooccm_retain', array());
24
- ?>
25
-
26
- <script type="text/javascript">
27
-
28
- jQuery(document).ready(function () {
29
- window.onload = function () {
30
-
31
- <?php
32
- if (!empty($options['buttons'])) {
33
- foreach ($options['buttons'] as $btn) {
34
- if (
35
- $btn['type'] !== 'wooccmupload' &&
36
- $btn['type'] !== 'changename' &&
37
- $btn['type'] !== 'heading' &&
38
- $btn['disabled'] !== 'true' &&
39
- empty($btn['tax_remove']) &&
40
- empty($btn['add_amount'])
41
- ) {
42
- ?>
43
- document.forms['checkout'].elements['<?php echo $btn['cow']; ?>'].value = "<?php echo $saved[$btn['cow']]; ?>";
44
- <?php
45
- }
46
- }
47
- }
48
-
49
- if (!is_user_logged_in()) {
50
-
51
- if (WC()->cart->needs_shipping_address() === true && sanitize_text_field($_POST['ship_to_different_address']) == 1) {
52
-
53
- if (!empty($options2['shipping_buttons'])) {
54
- foreach ($options2['shipping_buttons'] as $btn) {
55
- if (
56
- $btn['type'] !== 'wooccmupload' &&
57
- $btn['type'] !== 'changename' &&
58
- $btn['type'] !== 'heading' &&
59
- $btn['disabled'] !== 'true' &&
60
- empty($btn['tax_remove']) &&
61
- empty($btn['add_amount'])
62
- ) {
63
- ?>
64
- document.forms['checkout'].elements['shipping_<?php echo $btn['cow']; ?>'].value = "<?php echo $saved[sprintf('shipping_%s', $btn['cow'])]; ?>";
65
- <?php
66
- }
67
- }
68
- }
69
- }
70
-
71
- if (!empty($options3['billing_buttons'])) {
72
- foreach ($options3['billing_buttons'] as $btn) {
73
- if (
74
- $btn['type'] !== 'wooccmupload' &&
75
- $btn['type'] !== 'changename' &&
76
- $btn['type'] !== 'heading' &&
77
- $btn['disabled'] !== 'true' &&
78
- empty($btn['tax_remove']) &&
79
- empty($btn['add_amount'])
80
- ) {
81
- ?>
82
- document.forms['checkout'].elements['billing_<?php echo $btn['cow']; ?>'].value = "<?php echo $saved[sprintf('billing_%s', $btn['cow'])]; ?>";
83
- <?php
84
- }
85
- }
86
- }
87
- }
88
- ?>
89
-
90
- }
91
- });
92
- </script>
93
-
94
- <script type="text/javascript">
95
-
96
- jQuery(document).ready(function() {
97
- jQuery('body').change(function() {
98
-
99
- var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
100
- data = { action: 'retain_val_wccs',
101
- <?php
102
- if (!empty($options['buttons'])) {
103
- foreach ($options['buttons'] as $btn) {
104
- if (
105
- $btn['type'] !== 'wooccmupload' &&
106
- $btn['type'] !== 'changename' &&
107
- $btn['type'] !== 'heading' &&
108
- empty($btn['tax_remove']) &&
109
- empty($btn['add_amount'])
110
- ) {
111
- ?>
112
- <?php echo $btn['cow']; ?>: jQuery("#<?php echo $btn['cow']; ?>").val(),
113
- <?php
114
- }
115
- }
116
- }
117
-
118
- if (!is_user_logged_in()) {
119
-
120
- if (WC()->cart->needs_shipping_address() === true && sanitize_text_field($_POST['ship_to_different_address']) == 1) {
121
-
122
- if (!empty($options2['shipping_buttons'])) {
123
- foreach ($options2['shipping_buttons'] as $btn) {
124
- if (
125
- $btn['type'] !== 'wooccmupload' &&
126
- $btn['type'] !== 'changename' &&
127
- $btn['type'] !== 'heading' &&
128
- empty($btn['tax_remove']) &&
129
- empty($btn['add_amount'])
130
- ) {
131
- ?>
132
- shipping_<?php echo $btn['cow']; ?>: jQuery("shipping_<?php echo $btn['cow']; ?>").val(),
133
- <?php
134
- }
135
- }
136
- }
137
- }
138
-
139
- if (!empty($options3['billing_buttons'])) {
140
- foreach ($options3['billing_buttons'] as $btn) {
141
- if (
142
- $btn['type'] !== 'wooccmupload' &&
143
- $btn['type'] !== 'changename' &&
144
- $btn['type'] !== 'heading' &&
145
- empty($btn['tax_remove']) &&
146
- empty($btn['add_amount'])
147
- ) {
148
- ?>
149
- billing_<?php echo $btn['cow']; ?>: jQuery("#billing_<?php echo $btn['cow']; ?>").val(),
150
- <?php
151
- }
152
- }
153
- }
154
- }
155
- ?>
156
- };
157
- jQuery.post(ajaxurl, data, function(response) { });
158
- return false;
159
- });
160
- });
161
-
162
- </script>
163
-
164
- <?php
165
- }
166
-
167
- function wooccm_retain_val_callback() {
168
-
169
- global $wpdb;
170
-
171
- $options = get_option('wccs_settings');
172
- $options2 = get_option('wccs_settings2');
173
- $options3 = get_option('wccs_settings3');
174
-
175
- if (!empty($options['buttons'])) {
176
- foreach ($options['buttons'] as $btn) {
177
- if (
178
- $btn['type'] !== 'wooccmupload' &&
179
- $btn['type'] !== 'changename' &&
180
- $btn['type'] !== 'heading' &&
181
- empty($btn['tax_remove']) &&
182
- empty($btn['add_amount'])
183
- ) {
184
- if (!empty($_POST[$btn['cow']])) {
185
- $saved[$btn['cow']] = sanitize_text_field($_POST[$btn['cow']]);
186
- }
187
- }
188
- }
189
- }
190
-
191
- if (WC()->cart->needs_shipping_address() === true && sanitize_text_field($_POST['ship_to_different_address']) == 1) {
192
- if (!empty($options2['shipping_buttons'])) {
193
- foreach ($options2['shipping_buttons'] as $btn) {
194
- if (
195
- $btn['type'] !== 'wooccmupload' &&
196
- $btn['type'] !== 'changename' &&
197
- $btn['type'] !== 'heading' &&
198
- empty($btn['tax_remove']) &&
199
- empty($btn['add_amount'])
200
- ) {
201
- if (!empty($_POST[sprintf('shipping_%s', $btn['cow'])])) {
202
- $saved[sprintf('shipping_%s', $btn['cow'])] = sanitize_text_field($_POST[sprintf('shipping_%s', $btn['cow'])]);
203
- }
204
- }
205
- }
206
- }
207
- }
208
-
209
- if (!empty($options3['billing_buttons'])) {
210
- foreach ($options3['billing_buttons'] as $btn) {
211
- if (
212
- $btn['type'] !== 'wooccmupload' &&
213
- $btn['type'] !== 'changename' &&
214
- $btn['type'] !== 'heading' &&
215
- empty($btn['tax_remove']) &&
216
- empty($btn['add_amount'])
217
- ) {
218
- if (!empty($_POST[sprintf('billing_%s', $btn['cow'])])) {
219
- $saved[sprintf('billing_%s', $btn['cow'])] = sanitize_text_field($_POST[sprintf('billing_%s', $btn['cow'])]);
220
- }
221
- }
222
- }
223
- }
224
-
225
- WC()->session->set('wooccm_retain', $saved);
226
-
227
- die();
228
- }
229
-
230
- add_action('wp_ajax_retain_val_wccs', 'wooccm_retain_val_callback');
231
- add_action('wp_ajax_nopriv_retain_val_wccs', 'wooccm_retain_val_callback');
232
- }
233
-
234
- function wooccm_enable_auto_complete() {
235
-
236
- $options = get_option('wccs_settings');
237
-
238
- if (!empty($options['checkness']['retainval'])) {
239
- return true;
240
- } else {
241
- return false;
242
- }
243
- }
244
-
245
- function wooccm_state_default_switch() {
246
-
247
- $options = get_option('wccs_settings');
248
-
249
- if (!empty($options['checkness']['per_state']) && !empty($options['checkness']['per_state_check'])) {
250
- return $options['checkness']['per_state'];
251
- }
252
- }
253
 
254
  function wooccm_woocommerce_delivery_notes_compat($fields, $order) {
255
 
@@ -423,22 +192,26 @@ function wooccm_woocommerce_delivery_notes_compat($fields, $order) {
423
  return array_merge($fields, $new_fields);
424
  }
425
 
426
- function wooccm_order_notes($fields = array()) {
427
-
428
- $options = get_option('wccs_settings');
429
-
430
- if (!empty($options['checkness']['noteslabel'])) {
431
- $fields['order']['order_comments']['label'] = $options['checkness']['noteslabel'];
432
- }
433
- if (!empty($options['checkness']['notesplaceholder'])) {
434
- $fields['order']['order_comments']['placeholder'] = $options['checkness']['notesplaceholder'];
435
- }
436
- if (!empty($options['checkness']['notesenable'])) {
437
- unset($fields['order']['order_comments']);
438
- }
439
-
440
- return $fields;
441
- }
 
 
 
 
442
 
443
  function woooccm_restrict_manage_posts() {
444
 
@@ -546,6 +319,8 @@ function woooccm_restrict_manage_posts() {
546
  }
547
  }
548
 
 
 
549
  function wooccm_query_list($query) {
550
 
551
  global $pagenow;
@@ -556,140 +331,142 @@ function wooccm_query_list($query) {
556
  }
557
  }
558
 
 
 
559
  // ========================================
560
  // Remove conditional notices
561
  // ========================================
562
 
563
- function wooccm_remove_notices_conditional($posted) {
564
-
565
- $notice = WC()->session->get('wc_notices');
566
-
567
- $shipping = array(
568
- 'country',
569
- 'first_name',
570
- 'last_name',
571
- 'company',
572
- 'address_1',
573
- 'address_2',
574
- 'city',
575
- 'state',
576
- 'postcode'
577
- );
578
- $billing = array(
579
- 'country',
580
- 'first_name',
581
- 'last_name',
582
- 'company',
583
- 'address_1',
584
- 'address_2',
585
- 'city',
586
- 'state',
587
- 'postcode',
588
- 'email',
589
- 'phone'
590
- );
591
-
592
- $options = get_option('wccs_settings');
593
- $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
594
-
595
- $names = array(
596
- 'billing',
597
- 'shipping'
598
- );
599
- $inc = 3;
600
- foreach ($names as $name) {
601
-
602
- $array = ( $name == 'billing' ) ? $billing : $shipping;
603
-
604
- $options2 = get_option('wccs_settings' . $inc);
605
- if (!empty($options2[$name . '_buttons'])) {
606
- foreach ($options2[$name . '_buttons'] as $btn) {
607
-
608
- if (
609
- !empty($btn['chosen_valt']) &&
610
- !empty($btn['conditional_parent_use']) &&
611
- !empty($btn['conditional_tie']) &&
612
- $btn['type'] !== 'changename' &&
613
- $btn['type'] !== 'heading' &&
614
- !empty($btn['conditional_parent'])
615
- ) {
616
- if (!empty($_POST[$btn['cow']])) {
617
- foreach ($buttons as $btn2) {
618
-
619
- if (
620
- !empty($btn2['chosen_valt']) &&
621
- !empty($btn2['conditional_parent_use']) &&
622
- !empty($btn2['conditional_tie']) &&
623
- $btn2['type'] !== 'changename' &&
624
- $btn2['type'] !== 'heading' &&
625
- empty($btn2['conditional_parent'])
626
- ) {
627
- if (sanitize_text_field($_POST[$btn['cow']]) != $btn2['chosen_valt']) {
628
- if (empty($_POST[$btn2['cow']])) {
629
- foreach ($notice['error'] as $position => $value) {
630
-
631
- if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
632
- unset($notice['error'][$position]);
633
- }
634
- }
635
- }
636
- }
637
- }
638
- }
639
- } else {
640
- foreach ($notice['error'] as $position => $value) {
641
-
642
- if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
643
- unset($notice['error'][$position]);
644
- }
645
- }
646
- }
647
- }
648
- }
649
- }
650
- $inc--;
651
- }
652
-
653
- $options = get_option('wccs_settings');
654
-
655
- global $woocommerce;
656
-
657
- if (!empty($options['buttons'])) {
658
- foreach ($options['buttons'] as $btn) {
659
-
660
- if (!empty($btn['chosen_valt']) && !empty($btn['conditional_parent_use']) && !empty($btn['conditional_tie']) && $btn['type'] !== 'changename' && ($btn['type'] !== 'heading') && !empty($btn['conditional_parent'])) {
661
-
662
- if (!empty($_POST[$btn['cow']])) {
663
-
664
- foreach ($options['buttons'] as $btn2) {
665
-
666
- if (!empty($btn2['chosen_valt']) && !empty($btn2['conditional_parent_use']) && !empty($btn2['conditional_tie']) && $btn2['type'] !== 'changename' && ($btn2['type'] !== 'heading') && empty($btn2['conditional_parent'])) {
667
- if (sanitize_text_field($_POST[$btn['cow']]) != $btn2['chosen_valt']) {
668
- if (empty($_POST[$btn2['cow']])) {
669
- foreach ($notice['error'] as $position => $value) {
670
-
671
- if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
672
- unset($notice['error'][$position]);
673
- }
674
- }
675
- }
676
- }
677
- }
678
- }
679
- } else {
680
-
681
- foreach ($notice['error'] as $position => $value) {
682
-
683
- if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
684
- unset($notice['error'][$position]);
685
- }
686
- }
687
- }
688
- }
689
- }
690
- }
691
-
692
- WC()->session->set('wc_notices', $notice);
693
- }
694
-
695
- add_action('woocommerce_after_checkout_validation', 'wooccm_remove_notices_conditional');
9
  if (!defined('ABSPATH'))
10
  exit;
11
 
12
+ //function wooccm_state_default_switch() {
13
+ //
14
+ // $options = get_option('wccs_settings');
15
+ //
16
+ // if (!empty($options['checkness']['per_state']) && !empty($options['checkness']['per_state_check'])) {
17
+ // return $options['checkness']['per_state'];
18
+ // }
19
+ //}
20
+ //
21
+ //add_filter('default_checkout_billing_state', 'wooccm_state_default_switch');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  function wooccm_woocommerce_delivery_notes_compat($fields, $order) {
24
 
192
  return array_merge($fields, $new_fields);
193
  }
194
 
195
+ add_filter('wcdn_order_info_fields', 'wooccm_woocommerce_delivery_notes_compat', 10, 2);
196
+
197
+ //function wooccm_order_notes($fields = array()) {
198
+ //
199
+ // $options = get_option('wccs_settings');
200
+ //
201
+ // if (!empty($options['checkness']['noteslabel'])) {
202
+ // $fields['order']['order_comments']['label'] = $options['checkness']['noteslabel'];
203
+ // }
204
+ // if (!empty($options['checkness']['notesplaceholder'])) {
205
+ // $fields['order']['order_comments']['placeholder'] = $options['checkness']['notesplaceholder'];
206
+ // }
207
+ // if (!empty($options['checkness']['notesenable'])) {
208
+ // unset($fields['order']['order_comments']);
209
+ // }
210
+ //
211
+ // return $fields;
212
+ //}
213
+ //
214
+ //add_action('woocommerce_checkout_fields', 'wooccm_order_notes');
215
 
216
  function woooccm_restrict_manage_posts() {
217
 
319
  }
320
  }
321
 
322
+ add_action('restrict_manage_posts', 'woooccm_restrict_manage_posts');
323
+
324
  function wooccm_query_list($query) {
325
 
326
  global $pagenow;
331
  }
332
  }
333
 
334
+ add_filter('parse_query', 'wooccm_query_list');
335
+
336
  // ========================================
337
  // Remove conditional notices
338
  // ========================================
339
 
340
+ //function wooccm_remove_notices_conditional($posted) {
341
+ //
342
+ // $notice = WC()->session->get('wc_notices');
343
+ //
344
+ // $shipping = array(
345
+ // 'country',
346
+ // 'first_name',
347
+ // 'last_name',
348
+ // 'company',
349
+ // 'address_1',
350
+ // 'address_2',
351
+ // 'city',
352
+ // 'state',
353
+ // 'postcode'
354
+ // );
355
+ // $billing = array(
356
+ // 'country',
357
+ // 'first_name',
358
+ // 'last_name',
359
+ // 'company',
360
+ // 'address_1',
361
+ // 'address_2',
362
+ // 'city',
363
+ // 'state',
364
+ // 'postcode',
365
+ // 'email',
366
+ // 'phone'
367
+ // );
368
+ //
369
+ // $options = get_option('wccs_settings');
370
+ // $buttons = ( isset($options['buttons']) ? $options['buttons'] : false );
371
+ //
372
+ // $names = array(
373
+ // 'billing',
374
+ // 'shipping'
375
+ // );
376
+ // $inc = 3;
377
+ // foreach ($names as $name) {
378
+ //
379
+ // $array = ( $name == 'billing' ) ? $billing : $shipping;
380
+ //
381
+ // $options2 = get_option('wccs_settings' . $inc);
382
+ // if (!empty($options2[$name . '_buttons'])) {
383
+ // foreach ($options2[$name . '_buttons'] as $btn) {
384
+ //
385
+ // if (
386
+ // !empty($btn['chosen_valt']) &&
387
+ // !empty($btn['conditional_parent_use']) &&
388
+ // !empty($btn['conditional_tie']) &&
389
+ // $btn['type'] !== 'changename' &&
390
+ // $btn['type'] !== 'heading' &&
391
+ // !empty($btn['conditional_parent'])
392
+ // ) {
393
+ // if (!empty($_POST[$btn['cow']])) {
394
+ // foreach ($buttons as $btn2) {
395
+ //
396
+ // if (
397
+ // !empty($btn2['chosen_valt']) &&
398
+ // !empty($btn2['conditional_parent_use']) &&
399
+ // !empty($btn2['conditional_tie']) &&
400
+ // $btn2['type'] !== 'changename' &&
401
+ // $btn2['type'] !== 'heading' &&
402
+ // empty($btn2['conditional_parent'])
403
+ // ) {
404
+ // if (sanitize_text_field($_POST[$btn['cow']]) != $btn2['chosen_valt']) {
405
+ // if (empty($_POST[$btn2['cow']])) {
406
+ // foreach ($notice['error'] as $position => $value) {
407
+ //
408
+ // if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
409
+ // unset($notice['error'][$position]);
410
+ // }
411
+ // }
412
+ // }
413
+ // }
414
+ // }
415
+ // }
416
+ // } else {
417
+ // foreach ($notice['error'] as $position => $value) {
418
+ //
419
+ // if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
420
+ // unset($notice['error'][$position]);
421
+ // }
422
+ // }
423
+ // }
424
+ // }
425
+ // }
426
+ // }
427
+ // $inc--;
428
+ // }
429
+ //
430
+ // $options = get_option('wccs_settings');
431
+ //
432
+ // global $woocommerce;
433
+ //
434
+ // if (!empty($options['buttons'])) {
435
+ // foreach ($options['buttons'] as $btn) {
436
+ //
437
+ // if (!empty($btn['chosen_valt']) && !empty($btn['conditional_parent_use']) && !empty($btn['conditional_tie']) && $btn['type'] !== 'changename' && ($btn['type'] !== 'heading') && !empty($btn['conditional_parent'])) {
438
+ //
439
+ // if (!empty($_POST[$btn['cow']])) {
440
+ //
441
+ // foreach ($options['buttons'] as $btn2) {
442
+ //
443
+ // if (!empty($btn2['chosen_valt']) && !empty($btn2['conditional_parent_use']) && !empty($btn2['conditional_tie']) && $btn2['type'] !== 'changename' && ($btn2['type'] !== 'heading') && empty($btn2['conditional_parent'])) {
444
+ // if (sanitize_text_field($_POST[$btn['cow']]) != $btn2['chosen_valt']) {
445
+ // if (empty($_POST[$btn2['cow']])) {
446
+ // foreach ($notice['error'] as $position => $value) {
447
+ //
448
+ // if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
449
+ // unset($notice['error'][$position]);
450
+ // }
451
+ // }
452
+ // }
453
+ // }
454
+ // }
455
+ // }
456
+ // } else {
457
+ //
458
+ // foreach ($notice['error'] as $position => $value) {
459
+ //
460
+ // if (strip_tags($value) == sprintf(__('%s is a required field.', 'woocommerce'), wooccm_wpml_string($btn2['label']))) {
461
+ // unset($notice['error'][$position]);
462
+ // }
463
+ // }
464
+ // }
465
+ // }
466
+ // }
467
+ // }
468
+ //
469
+ // WC()->session->set('wc_notices', $notice);
470
+ //}
471
+ //
472
+ //add_action('woocommerce_after_checkout_validation', 'wooccm_remove_notices_conditional');
includes/email.php DELETED
@@ -1,380 +0,0 @@
1
- <?php
2
- function wooccm_order_receipt_checkout_details( $order, $sent_to_admin, $plain_text = '' ) {
3
-
4
- if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
5
- $order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
6
- } else {
7
- $order_id = ( isset( $order->id ) ? $order->id : 0 );
8
- }
9
-
10
- $shipping = array(
11
- 'country',
12
- 'first_name',
13
- 'last_name',
14
- 'company',
15
- 'address_1',
16
- 'address_2',
17
- 'city',
18
- 'state',
19
- 'postcode'
20
- );
21
- $billing = array(
22
- 'country',
23
- 'first_name',
24
- 'last_name',
25
- 'company',
26
- 'address_1',
27
- 'address_2',
28
- 'city',
29
- 'state',
30
- 'postcode',
31
- 'email',
32
- 'phone'
33
- );
34
-
35
- $names = array( 'billing', 'shipping' );
36
- $inc = 3;
37
-
38
- // Are we generating a plain-text or HTML message?
39
- $plain_text = absint( $plain_text );
40
- switch( $plain_text ) {
41
-
42
- // Plain text
43
- case '1':
44
- foreach( $names as $name ) {
45
-
46
- $array = ($name == 'billing') ? $billing : $shipping;
47
-
48
- $options = get_option( 'wccs_settings'.$inc );
49
- if( !empty( $options[$name.'_buttons'] ) ) {
50
- foreach( $options[$name.'_buttons'] as $btn ) {
51
-
52
- if( !in_array( $btn['cow'], $array ) ) {
53
- if(
54
- ( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
55
- !empty( $btn['label'] ) &&
56
- empty( $btn['deny_receipt'] ) &&
57
- $btn['type'] !== 'heading' &&
58
- $btn['type'] !== 'multiselect' &&
59
- $btn['type'] !== 'wooccmupload' &&
60
- $btn['type'] !== 'multicheckbox'
61
- ) {
62
- echo wooccm_wpml_string( $btn['label'] ).': '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
63
- echo "\n";
64
- } elseif (
65
- !empty( $btn['label'] ) &&
66
- empty( $btn['deny_receipt'] ) &&
67
- $btn['type'] == 'heading' &&
68
- $btn['type'] !== 'multiselect' &&
69
- $btn['type'] !== 'wooccmupload' &&
70
- $btn['type'] !== 'multicheckbox'
71
- ) {
72
- echo wooccm_wpml_string( $btn['label'] );
73
- echo "\n";
74
- } elseif(
75
- ( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
76
- !empty( $btn['label'] ) &&
77
- empty( $btn['deny_receipt'] ) &&
78
- $btn['type'] !== 'heading' &&
79
- $btn['type'] !== 'wooccmupload' &&
80
- (
81
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
82
- )
83
- ) {
84
- $value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
85
- $strings = maybe_unserialize( $value );
86
- echo wooccm_wpml_string($btn['label']).': ';
87
- if( !empty( $strings ) ) {
88
- if( is_array( $strings ) ) {
89
- $iww = 0;
90
- $len = count( $strings );
91
- foreach( $strings as $key ) {
92
- if( $iww == $len - 1 ) {
93
- echo $key;
94
- } else {
95
- echo $key.', ';
96
- }
97
- $iww++;
98
- }
99
- } else {
100
- echo $strings;
101
- }
102
- } else {
103
- echo '-';
104
- }
105
- echo "\n";
106
- } elseif( $btn['type'] == 'wooccmupload' ) {
107
- $info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
108
- $btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
109
- echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
110
- echo "\n";
111
- }
112
- }
113
-
114
- }
115
- }
116
- $inc--;
117
-
118
- }
119
-
120
- $options = get_option( 'wccs_settings' );
121
- if( !empty( $options['buttons'] ) ) {
122
- foreach( $options['buttons'] as $btn ) {
123
-
124
- if(
125
- ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
126
- !empty( $btn['label'] ) &&
127
- empty( $btn['deny_receipt'] ) &&
128
- $btn['type'] !== 'heading' &&
129
- $btn['type'] !== 'multiselect' &&
130
- $btn['type'] !== 'wooccmupload' &&
131
- $btn['type'] !== 'multicheckbox'
132
- ) {
133
- echo wooccm_wpml_string( $btn['label'] ).': '.nl2br( get_post_meta( $order_id , $btn['cow'], true ) );
134
- echo "\n";
135
- } elseif(
136
- !empty( $btn['label'] ) &&
137
- empty( $btn['deny_receipt'] ) &&
138
- $btn['type'] == 'heading' &&
139
- $btn['type'] !== 'multiselect' &&
140
- $btn['type'] !== 'wooccmupload' &&
141
- $btn['type'] !== 'multicheckbox'
142
- ) {
143
- echo wooccm_wpml_string( $btn['label'] );
144
- echo "\n";
145
- } elseif(
146
- ( get_post_meta( $order_id, $btn['cow'], true ) !== '' ) &&
147
- !empty( $btn['label'] ) &&
148
- empty( $btn['deny_receipt'] ) &&
149
- $btn['type'] !== 'heading' &&
150
- $btn['type'] !== 'wooccmupload' &&
151
- (
152
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
153
- )
154
- ) {
155
- $value = get_post_meta( $order_id , $btn['cow'], true );
156
- $strings = maybe_unserialize( $value );
157
- echo wooccm_wpml_string($btn['label']).': ';
158
- if( !empty( $strings ) ) {
159
- if( is_array( $strings ) ) {
160
- $iww = 0;
161
- $len = count($strings);
162
- foreach($strings as $key ) {
163
- if( $iww == $len - 1 ) {
164
- echo $key;
165
- } else {
166
- echo $key.', ';
167
- }
168
- $iww++;
169
- }
170
- } else {
171
- echo $strings;
172
- }
173
- } else {
174
- echo '-';
175
- }
176
- echo "\n";
177
- } elseif( $btn['type'] == 'wooccmupload' ) {
178
- $info = explode( "||", get_post_meta( $order_id, $btn['cow'], true ) );
179
- $btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
180
- echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
181
- echo "\n";
182
- }
183
-
184
- }
185
- }
186
-
187
- if( !empty( $options['checkness']['set_timezone'] ) ) {
188
- date_default_timezone_set( $options['checkness']['set_timezone'] );
189
- }
190
- $date = ( !empty( $options['checkness']['twenty_hour'] ) ) ? date( "G:i T (P" ) .' GMT)' : date( "g:i a" );
191
- $options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
192
- if( $options['checkness']['time_stamp'] == true ) {
193
- echo $options['checkness']['time_stamp_title'].' ' . $date . "\n";
194
- }
195
- if( method_exists( $order, 'get_payment_method_title' ) ) {
196
- if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true )
197
- echo $options['checkness']['payment_method_d'].': ' . $order->get_payment_method_title() . "\n";
198
- }
199
- if( method_exists( $order, 'get_shipping_method' ) ) {
200
- if( $order->get_shipping_method() && isset( $options['checkness']['shipping_method_t'] ) && $options['checkness']['shipping_method_t'] == true )
201
- echo $options['checkness']['shipping_method_d'].': ' . $order->get_shipping_method() . "\n";
202
- }
203
-
204
- echo "\n";
205
- break;
206
-
207
- // HTML formatting
208
- case '0':
209
- default:
210
- foreach( $names as $name ) {
211
-
212
- $array = ( $name == 'billing' ) ? $billing : $shipping;
213
-
214
- $options = get_option( 'wccs_settings'.$inc );
215
- if( !empty( $options[$name.'_buttons'] ) ) {
216
- foreach( $options[$name.'_buttons'] as $btn ) {
217
-
218
- if( !in_array( $btn['cow'], $array ) ) {
219
- if(
220
- ( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
221
- !empty( $btn['label'] ) &&
222
- empty( $btn['deny_receipt'] ) &&
223
- $btn['type'] !== 'heading' &&
224
- $btn['type'] !== 'multiselect' &&
225
- $btn['type'] !== 'wooccmupload' &&
226
- $btn['type'] !== 'multicheckbox'
227
- ) {
228
- echo '
229
- <p>
230
- <strong>'.wooccm_wpml_string($btn['label']).':</strong> '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) ).'
231
- </p>';
232
- } elseif (
233
- !empty( $btn['label'] ) &&
234
- empty( $btn['deny_receipt'] ) &&
235
- $btn['type'] == 'heading' &&
236
- $btn['type'] !== 'multiselect' &&
237
- $btn['type'] !== 'wooccmupload' &&
238
- $btn['type'] !== 'multicheckbox'
239
- ) {
240
- echo '
241
- <h2>' .wooccm_wpml_string($btn['label']). '</h2>';
242
- } elseif (
243
- ( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
244
- !empty( $btn['label'] ) &&
245
- empty( $btn['deny_receipt'] ) &&
246
- $btn['type'] !== 'heading' &&
247
- $btn['type'] !== 'wooccmupload' &&
248
- (
249
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
250
- )
251
- ) {
252
- $value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
253
- $strings = maybe_unserialize( $value );
254
- echo '
255
- <p>
256
- <strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
257
- if( !empty( $strings ) ) {
258
- if( is_array( $strings ) ) {
259
- $iww = 0;
260
- $len = count( $strings );
261
- foreach( $strings as $key ) {
262
- if( $iww == $len - 1 ) {
263
- echo $key;
264
- } else {
265
- echo $key.', ';
266
- }
267
- $iww++;
268
- }
269
- } else {
270
- echo $strings;
271
- }
272
- } else {
273
- echo '-';
274
- }
275
- echo '
276
- </p>';
277
- } elseif( $btn['type'] == 'wooccmupload' ) {
278
- $info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
279
- $btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
280
- echo '
281
- <p>
282
- <strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
283
- </p>';
284
- }
285
- }
286
-
287
- }
288
- }
289
- $inc--;
290
-
291
- }
292
-
293
- $options = get_option( 'wccs_settings' );
294
- if( !empty( $options['buttons'] ) ) {
295
- foreach( $options['buttons'] as $btn ) {
296
-
297
- if(
298
- ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
299
- !empty( $btn['label'] ) &&
300
- empty( $btn['deny_receipt'] ) &&
301
- $btn['type'] !== 'heading' &&
302
- $btn['type'] !== 'multiselect' &&
303
- $btn['type'] !== 'wooccmupload' &&
304
- $btn['type'] !== 'multicheckbox'
305
- ) {
306
- echo '<p><strong>'.wooccm_wpml_string( $btn['label'] ).':</strong> '.nl2br( get_post_meta( $order_id , $btn['cow'], true ) ).'</p>';
307
- } elseif ( !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
308
- echo '<h2>'.wooccm_wpml_string($btn['label']).'</h2>';
309
- } elseif ( ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
310
- $value = get_post_meta( $order_id , $btn['cow'], true );
311
- $strings = maybe_unserialize( $value );
312
- echo '
313
- <p>
314
- <strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
315
- if( !empty( $strings ) ) {
316
- if( is_array( $strings ) ) {
317
- $iww = 0;
318
- $len = count( $strings );
319
- foreach( $strings as $key ) {
320
- if( $iww == $len - 1 ) {
321
- echo $key;
322
- } else {
323
- echo $key.', ';
324
- }
325
- $iww++;
326
- }
327
- } else {
328
- echo $strings;
329
- }
330
- } else {
331
- echo '-';
332
- }
333
- echo '
334
- </p>';
335
- } elseif( $btn['type'] == 'wooccmupload' ) {
336
- $info = explode( "||", get_post_meta( $order_id , $btn['cow'], true ) );
337
- $btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
338
- echo '
339
- <p>
340
- <strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
341
- </p>';
342
- }
343
-
344
- }
345
- }
346
-
347
- // @mod - We are not doing any checking for valid TimeZone
348
- if( !empty( $options['checkness']['set_timezone'] ) ) {
349
- date_default_timezone_set( $options['checkness']['set_timezone'] );
350
- }
351
- $date = ( !empty( $options['checkness']['twenty_hour'] ) ) ? date( "G:i T (P" ) . ' GMT)' : date( "g:i a" );
352
- $options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
353
- if( $options['checkness']['time_stamp'] == true ) {
354
- echo '
355
- <p>
356
- <strong>'.$options['checkness']['time_stamp_title'].':</strong> ' . $date . '
357
- </p>';
358
- }
359
- if( method_exists( $order, 'get_payment_method_title' ) ) {
360
- if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true ) {
361
- echo '
362
- <p>
363
- <strong>'.$options['checkness']['payment_method_d'].':</strong> ' . $order->get_payment_method_title() . '
364
- </p>';
365
- }
366
- }
367
- if( method_exists( $order, 'get_shipping_method' ) ) {
368
- if( $order->get_shipping_method() && isset( $options['checkness']['shipping_method_t'] ) && $options['checkness']['shipping_method_t'] == true ) {
369
- echo '
370
- <p>
371
- <strong>'.$options['checkness']['shipping_method_d'].':</strong> ' . $order->get_shipping_method() . '
372
- </p>';
373
- }
374
- }
375
- break;
376
-
377
- }
378
-
379
- }
380
- ?>