Version Description
- Fix: woocommerce default label and placeholder i18n
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 4.5.7 |
Comparing to | |
See all releases |
Code changes from version 4.5.5 to 4.5.7
- assets/js/wooccm-field.js +2 -2
- assets/js/wooccm-field.min.js +1 -1
- assets/js/wooccm-order-upload.js +2 -2
- assets/js/wooccm-order-upload.min.js +1 -1
- changelog.txt +25 -0
- includes/admin.php +135 -136
- includes/checkout.php +0 -338
- includes/classes/main.php +167 -390
- includes/email.php +0 -380
- includes/export.php +31 -30
- includes/functions.php +0 -16
- includes/templates/admin/woocheckout-billing.php +2 -0
- new/class-wooccm-admin.php +61 -42
- new/class-wooccm.php +40 -15
- new/controller/class-wooccm-checkout-advanced-controller.php +110 -0
- new/controller/class-wooccm-checkout-controller.php +337 -61
- new/controller/class-wooccm-field-controller.php +139 -154
- new/controller/class-wooccm-field-upload.php +182 -0
- new/controller/class-wooccm-order-controller.php +249 -30
- new/controller/class-wooccm-upload-handler.php +0 -123
- new/model/class-wooccm-field-billing.php +1 -0
- new/model/class-wooccm-field-old.php +103 -21
- new/model/class-wooccm-field.php +68 -25
- new/view/backend/order.php +0 -66
- new/view/backend/pages/advanced.php +12 -29
- new/view/backend/pages/billing.php +1 -0
- new/view/backend/pages/checkout.php +7 -0
- new/view/backend/pages/general.php +0 -133
- new/view/backend/pages/modals/edit.php +1 -1
- new/view/backend/pages/modals/parts/edit-info.php +1 -1
- new/view/backend/pages/modals/parts/panel-advanced.php +3 -3
- new/view/backend/pages/modals/parts/panel-amount.php +4 -4
- new/view/backend/pages/modals/parts/panel-conditional.php +1 -1
- new/view/backend/pages/modals/parts/panel-display.php +2 -2
- new/view/backend/pages/modals/parts/panel-general.php +44 -1
- new/view/backend/pages/order.php +8 -0
- new/view/backend/pages/orders.php +0 -8
- new/view/backend/pages/parts/actions.php +9 -4
- new/view/backend/pages/parts/header.php +8 -3
- new/view/backend/pages/parts/loop.php +14 -16
- new/view/frontend/checkout.php +0 -112
- new/view/frontend/{fields/additional.php → class-wooccm-fields-additional.php} +47 -17
- new/view/frontend/{fields/conditional.php → class-wooccm-fields-conditional.php} +0 -0
- new/view/frontend/{fields/display.php → class-wooccm-fields-display.php} +0 -0
- new/view/frontend/{fields/handler.php → class-wooccm-fields-handler.php} +0 -0
- new/view/frontend/{fields/register.php → class-wooccm-fields-register.php} +14 -2
- new/view/frontend/{fields/filters.php → filters.php} +52 -2
- new/view/frontend/order.php +0 -65
- readme.txt +10 -1
- templates/{checkout/thankyou-fields.php → order/order-custom-fields.php} +4 -4
- templates/order/{order-uploads.php → order-upload-files.php} +2 -0
- 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 |
-
|
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 |
-
|
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.
|
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.
|
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.
|
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 |
-
|
82 |
-
//
|
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 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
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 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
}
|
472 |
|
473 |
$ship++;
|
474 |
-
|
475 |
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
|
490 |
-
|
491 |
|
492 |
-
|
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 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
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 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
$
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
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 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
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 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/export.php
CHANGED
@@ -62,6 +62,8 @@ function wooccm_csv_export_modify_column_headers($column_headers) {
|
|
62 |
return array_merge($column_headers, $new_headers);
|
63 |
}
|
64 |
|
|
|
|
|
65 |
// set the data for each for custom columns
|
66 |
function wooccm_csv_export_modify_row_data($order_data, $order, $csv_generator) {
|
67 |
|
@@ -222,9 +224,7 @@ function wooccm_csv_export_modify_row_data($order_data, $order, $csv_generator)
|
|
222 |
return $new_order_data;
|
223 |
}
|
224 |
|
225 |
-
|
226 |
-
if (!defined('ABSPATH'))
|
227 |
-
exit;
|
228 |
|
229 |
function wooccm_additional_gen($tab, $abbr, $section, $wooname = '') {
|
230 |
|
@@ -653,54 +653,56 @@ function wooccm_advance_export() {
|
|
653 |
?>
|
654 |
|
655 |
<script type="text/javascript">
|
656 |
-
|
657 |
jQuery(function () {
|
658 |
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
|
|
|
|
671 |
jQuery("input[name=single-download]").val("shipping");
|
672 |
jQuery("#additional_export").submit();
|
673 |
});
|
674 |
-
|
675 |
-
jQuery(".button.all-download.shipping").click(function() {
|
676 |
jQuery("input[name=all-download]").val("shipping");
|
677 |
jQuery("#additional_export").submit();
|
678 |
});
|
679 |
-
jQuery(".button.setting-download.additional").click(function() {
|
680 |
jQuery("input[name=setting-download]").val("shipping");
|
681 |
jQuery("#additional_export").submit();
|
682 |
});
|
683 |
-
|
684 |
|
685 |
-
|
686 |
-
jQuery(".button.single-download.billing").click(function() {
|
687 |
jQuery("input[name=single-download]").val("billing");
|
688 |
jQuery("#additional_export").submit();
|
689 |
});
|
690 |
-
|
691 |
-
jQuery(".button.all-download.billing").click(function() {
|
692 |
jQuery("input[name=all-download]").val("billing");
|
693 |
jQuery("#additional_export").submit();
|
694 |
});
|
695 |
-
|
696 |
-
jQuery(".button.setting-download.additional").click(function() {
|
697 |
jQuery("input[name=setting-download]").val("billing");
|
698 |
jQuery("#additional_export").submit();
|
699 |
});
|
700 |
-
|
701 |
|
702 |
});
|
703 |
-
|
704 |
});
|
705 |
</script>
|
706 |
|
@@ -956,5 +958,4 @@ function wooccm_advance_export() {
|
|
956 |
</div>
|
957 |
<!-- .wrap -->
|
958 |
<?php
|
959 |
-
}
|
960 |
-
?>
|
62 |
return array_merge($column_headers, $new_headers);
|
63 |
}
|
64 |
|
65 |
+
add_filter('wc_customer_order_csv_export_order_headers', 'wooccm_csv_export_modify_column_headers');
|
66 |
+
|
67 |
// set the data for each for custom columns
|
68 |
function wooccm_csv_export_modify_row_data($order_data, $order, $csv_generator) {
|
69 |
|
224 |
return $new_order_data;
|
225 |
}
|
226 |
|
227 |
+
add_filter('wc_customer_order_csv_export_order_row', 'wooccm_csv_export_modify_row_data', 10, 3);
|
|
|
|
|
228 |
|
229 |
function wooccm_additional_gen($tab, $abbr, $section, $wooname = '') {
|
230 |
|
653 |
?>
|
654 |
|
655 |
<script type="text/javascript">
|
656 |
+
jQuery(document).ready(function () {
|
657 |
jQuery(function () {
|
658 |
|
659 |
+
jQuery(".button.single-download.additional").click(function () {
|
660 |
+
jQuery("input[name=single-download]").val("additional");
|
661 |
+
jQuery("#additional_export").submit();
|
662 |
+
});
|
663 |
+
jQuery(".b utton.al l-download.additional").click(function () {
|
664 |
+
jQuery("input[name=all-download]").val("additional");
|
665 |
+
jQuery("#additional_export").submit();
|
666 |
+
});
|
667 |
+
jQuery(".button.setting-download.additional").click(function () {
|
668 |
+
jQuery("input[name=setting-download]").val("additional");
|
669 |
+
jQuery("#additional_export").submit();
|
670 |
+
});
|
671 |
+
< !-- shipping -- >
|
672 |
+
jQuery(".button.single-download.shipping").click(function () {
|
673 |
jQuery("input[name=single-download]").val("shipping");
|
674 |
jQuery("#additional_export").submit();
|
675 |
});
|
676 |
+
|
677 |
+
jQuery(".button.all-download.shipping").click(function () {
|
678 |
jQuery("input[name=all-download]").val("shipping");
|
679 |
jQuery("#additional_export").submit();
|
680 |
});
|
681 |
+
jQuery(".button.setting-download.additional").click(function () {
|
682 |
jQuery("input[name=setting-download]").val("shipping");
|
683 |
jQuery("#additional_export").submit();
|
684 |
});
|
685 |
+
<!-- end shipping -->
|
686 |
|
687 |
+
<!-- billing -->
|
688 |
+
jQuery(".button.single-download.billing").click(function () {
|
689 |
jQuery("input[name=single-download]").val("billing");
|
690 |
jQuery("#additional_export").submit();
|
691 |
});
|
692 |
+
|
693 |
+
jQuery(".button.all-download.billing").click(function () {
|
694 |
jQuery("input[name=all-download]").val("billing");
|
695 |
jQuery("#additional_export").submit();
|
696 |
});
|
697 |
+
|
698 |
+
jQuery(".button.setting-download.additional").click(function () {
|
699 |
jQuery("input[name=setting-download]").val("billing");
|
700 |
jQuery("#additional_export").submit();
|
701 |
});
|
702 |
+
<!-- end billing -->
|
703 |
|
704 |
});
|
705 |
+
|
706 |
});
|
707 |
</script>
|
708 |
|
958 |
</div>
|
959 |
<!-- .wrap -->
|
960 |
<?php
|
961 |
+
}
|
|
includes/functions.php
CHANGED
@@ -1,20 +1,4 @@
|
|
1 |
<?php
|
2 |
-
// We use wooccm_error_log() for reporting to the WooCommerce Logs system
|
3 |
-
function wooccm_error_log( $message = '' ) {
|
4 |
-
|
5 |
-
if( $message == '' )
|
6 |
-
return;
|
7 |
-
|
8 |
-
if( class_exists( 'WC_Logger' ) ) {
|
9 |
-
$logger = new WC_Logger();
|
10 |
-
$logger->add( 'wooccm', $message );
|
11 |
-
return true;
|
12 |
-
} else {
|
13 |
-
// Fallback where the WooCommerce logging engine is unavailable
|
14 |
-
error_log( sprintf( '[checkout-manager] %s', $message ) );
|
15 |
-
}
|
16 |
-
|
17 |
-
}
|
18 |
|
19 |
function wooccm_get_woo_version() {
|
20 |
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
function wooccm_get_woo_version() {
|
4 |
|
includes/templates/admin/woocheckout-billing.php
CHANGED
@@ -14,6 +14,8 @@
|
|
14 |
|
15 |
<?php
|
16 |
if ($fields = WOOCCM()->field->billing->get_fields('old')) {
|
|
|
|
|
17 |
|
18 |
$defaults = WOOCCM()->field->billing->get_defaults();
|
19 |
|
14 |
|
15 |
<?php
|
16 |
if ($fields = WOOCCM()->field->billing->get_fields('old')) {
|
17 |
+
|
18 |
+
//var_dump($fields);
|
19 |
|
20 |
$defaults = WOOCCM()->field->billing->get_defaults();
|
21 |
|
new/class-wooccm-admin.php
CHANGED
@@ -5,11 +5,64 @@ if (!class_exists('WOOCCM_Field_Admin')) {
|
|
5 |
|
6 |
protected static $instance;
|
7 |
|
8 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
@@ -18,14 +71,13 @@ if (!class_exists('WOOCCM_Field_Admin')) {
|
|
18 |
if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
|
19 |
wp_enqueue_style('wooccm-admin');
|
20 |
wp_enqueue_script('wooccm-admin');
|
21 |
-
wp_enqueue_script('wooccm-modal');
|
22 |
}
|
23 |
}
|
24 |
|
25 |
function add_beta_badge() {
|
26 |
?>
|
27 |
<style>
|
28 |
-
body #adminmenu #toplevel_page_woocommerce a[href="<?php echo admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(WOOCCM_PREFIX)
|
29 |
content: 'BETA';
|
30 |
color: #fff;
|
31 |
background-color: #21c2f8;
|
@@ -47,51 +99,18 @@ if (!class_exists('WOOCCM_Field_Admin')) {
|
|
47 |
return $settings_tabs;
|
48 |
}
|
49 |
|
50 |
-
function add_section_general() {
|
51 |
-
|
52 |
-
global $current_section;
|
53 |
-
|
54 |
-
if ('' == $current_section) {
|
55 |
-
if ($options = get_option('wccs_settings', array())) {
|
56 |
-
include_once('pages/general.php');
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
function add_section_orders() {
|
62 |
-
|
63 |
-
global $current_section;
|
64 |
-
|
65 |
-
if ('shipping' == $current_section) {
|
66 |
-
if ($options = get_option('wccs_settings', array())) {
|
67 |
-
include_once('pages/orders.php');
|
68 |
-
}
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
function add_section_advanced() {
|
73 |
-
global $current_section;
|
74 |
-
if ('advanced' == $current_section) {
|
75 |
-
if ($options = get_option('wccs_settings', array())) {
|
76 |
-
require_once('pages/advanced.php');
|
77 |
-
}
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
function add_menu_page() {
|
82 |
-
|
83 |
-
add_submenu_page('woocommerce', esc_html__('Checkout', 'woocommerce-checkout-manager'), esc_html__('Checkout', 'woocommerce-checkout-manager'), 'manage_options', admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(WOOCCM_PREFIX) . '§ion=billing'));
|
84 |
}
|
85 |
|
86 |
function init() {
|
|
|
|
|
|
|
87 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
88 |
add_action('admin_head', array($this, 'add_beta_badge'));
|
89 |
add_action('admin_menu', array($this, 'add_menu_page'));
|
90 |
add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
|
91 |
-
//add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_general'), 99);
|
92 |
-
//add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_orders'), 99);
|
93 |
-
//add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_advanced'), 99);
|
94 |
-
//add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_section_billing'));
|
95 |
}
|
96 |
|
97 |
public static function instance() {
|
5 |
|
6 |
protected static $instance;
|
7 |
|
8 |
+
public function ajax_select_search_products() {
|
9 |
+
|
10 |
+
if (current_user_can('manage_woocommerce') && check_ajax_referer('search-products', 'security') && isset($_REQUEST['term'])) {
|
11 |
+
|
12 |
+
if (empty($term) && isset($_GET['term'])) {
|
13 |
+
$term = (string) wc_clean(wp_unslash($_GET['term']));
|
14 |
+
}
|
15 |
+
|
16 |
+
if (empty($term)) {
|
17 |
+
wp_die();
|
18 |
+
}
|
19 |
+
|
20 |
+
if (!empty($_GET['limit'])) {
|
21 |
+
$limit = absint($_GET['limit']);
|
22 |
+
} else {
|
23 |
+
$limit = absint(apply_filters('woocommerce_json_search_limit', 30));
|
24 |
+
}
|
25 |
+
|
26 |
+
$include_ids = !empty($_GET['include']) ? array_map('absint', (array) wp_unslash($_GET['include'])) : array();
|
27 |
+
$exclude_ids = !empty($_GET['exclude']) ? array_map('absint', (array) wp_unslash($_GET['exclude'])) : array();
|
28 |
+
$selected_ids = !empty($_GET['selected']) ? array_map('absint', (array) wp_unslash($_GET['selected'])) : array();
|
29 |
+
|
30 |
+
$include_variations = false;
|
31 |
|
32 |
+
$data_store = WC_Data_Store::load('product');
|
33 |
+
$ids = $data_store->search_products($term, '', (bool) $include_variations, false, $limit, $include_ids, $exclude_ids + $selected_ids);
|
34 |
|
35 |
+
$product_objects = array_filter(array_map('wc_get_product', $ids), 'wc_products_array_filter_readable');
|
36 |
+
$products = array();
|
37 |
+
|
38 |
+
foreach ($product_objects as $product_object) {
|
39 |
+
$formatted_name = $product_object->get_formatted_name();
|
40 |
+
$managing_stock = $product_object->managing_stock();
|
41 |
+
|
42 |
+
if ($managing_stock && !empty($_GET['display_stock'])) {
|
43 |
+
$stock_amount = $product_object->get_stock_quantity();
|
44 |
+
/* Translators: %d stock amount */
|
45 |
+
$formatted_name .= ' – ' . sprintf(__('Stock: %d', 'woocommerce'), wc_format_stock_quantity_for_display($stock_amount, $product_object));
|
46 |
+
}
|
47 |
+
|
48 |
+
$products[$product_object->get_id()] = rawurldecode($formatted_name);
|
49 |
+
}
|
50 |
+
|
51 |
+
wp_send_json(apply_filters('woocommerce_json_search_found_products', $products));
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
// public function ajax_select_search_states() {
|
56 |
+
//
|
57 |
+
// if (current_user_can('manage_woocommerce') && check_ajax_referer('search-states', 'security') && isset($_REQUEST['country'])) {
|
58 |
+
//
|
59 |
+
// if ($states = WC()->countries->get_states($_REQUEST['country'])) {
|
60 |
+
// wp_send_json($states);
|
61 |
+
// }
|
62 |
+
// }
|
63 |
+
// }
|
64 |
+
|
65 |
+
function enqueue_scripts() {
|
66 |
|
67 |
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');
|
68 |
|
71 |
if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
|
72 |
wp_enqueue_style('wooccm-admin');
|
73 |
wp_enqueue_script('wooccm-admin');
|
|
|
74 |
}
|
75 |
}
|
76 |
|
77 |
function add_beta_badge() {
|
78 |
?>
|
79 |
<style>
|
80 |
+
body #adminmenu #toplevel_page_woocommerce a[href="<?php echo admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(WOOCCM_PREFIX)); ?>"]:before {
|
81 |
content: 'BETA';
|
82 |
color: #fff;
|
83 |
background-color: #21c2f8;
|
99 |
return $settings_tabs;
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
function add_menu_page() {
|
103 |
+
add_submenu_page('woocommerce', esc_html__('Checkout', 'woocommerce-checkout-manager'), esc_html__('Checkout', 'woocommerce-checkout-manager'), 'manage_woocommerce', admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(WOOCCM_PREFIX)));
|
|
|
104 |
}
|
105 |
|
106 |
function init() {
|
107 |
+
add_action('wp_ajax_wooccm_select_search_products', array($this, 'ajax_select_search_products'));
|
108 |
+
//add_action('wp_ajax_wooccm_select_search_states', array($this, 'ajax_select_search_states'));
|
109 |
+
|
110 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
111 |
add_action('admin_head', array($this, 'add_beta_badge'));
|
112 |
add_action('admin_menu', array($this, 'add_menu_page'));
|
113 |
add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
public static function instance() {
|
new/class-wooccm.php
CHANGED
@@ -33,10 +33,11 @@ final class WOOCCM {
|
|
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
|
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() {
|
@@ -44,8 +45,7 @@ final class WOOCCM {
|
|
44 |
// -----------------------------------------------------------------------
|
45 |
include_once( WOOCCM_PLUGIN_DIR . 'includes/install.php' );
|
46 |
include_once( WOOCCM_PLUGIN_DIR . 'includes/functions.php' );
|
47 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/checkout.php' );
|
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' );
|
@@ -57,22 +57,17 @@ final class WOOCCM {
|
|
57 |
|
58 |
// Frontend
|
59 |
// -----------------------------------------------------------------------
|
60 |
-
|
61 |
wp_register_style('wooccm', plugins_url('assets/css/wooccm.css', WOOCCM_PLUGIN_FILE), false, WOOCCM_PLUGIN_VERSION, 'all');
|
62 |
|
63 |
-
|
64 |
-
// -----------------------------------------------------------------------
|
65 |
-
|
66 |
-
wp_register_script('wooccm-order-upload', plugins_url('assets/js/wooccm-order-upload.js', WOOCCM_PLUGIN_FILE), array(), WOOCCM_PLUGIN_VERSION, true);
|
67 |
|
68 |
-
wp_localize_script('wooccm-
|
69 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
70 |
'nonce' => wp_create_nonce('wooccm_upload'),
|
71 |
-
'
|
72 |
-
'
|
73 |
-
'
|
74 |
-
|
75 |
-
'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
|
76 |
),
|
77 |
'icons' => array(
|
78 |
'interactive' => site_url('wp-includes/images/media/interactive.png'),
|
@@ -81,8 +76,38 @@ final class WOOCCM {
|
|
81 |
'audio' => site_url('wp-includes/images/media/audio.png'),
|
82 |
'text' => site_url('wp-includes/images/media/text.png'),
|
83 |
'video' => site_url('wp-includes/images/media/video.png')
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
)
|
85 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
}
|
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-checkout-controller.php' );
|
37 |
include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-field-controller.php' );
|
38 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-field-upload.php' );
|
39 |
include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-order-controller.php' );
|
40 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/controller/class-wooccm-checkout-advanced-controller.php' );
|
41 |
}
|
42 |
|
43 |
function includes_old() {
|
45 |
// -----------------------------------------------------------------------
|
46 |
include_once( WOOCCM_PLUGIN_DIR . 'includes/install.php' );
|
47 |
include_once( WOOCCM_PLUGIN_DIR . 'includes/functions.php' );
|
48 |
+
//include_once( WOOCCM_PLUGIN_DIR . 'includes/checkout.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' );
|
57 |
|
58 |
// Frontend
|
59 |
// -----------------------------------------------------------------------
|
|
|
60 |
wp_register_style('wooccm', plugins_url('assets/css/wooccm.css', WOOCCM_PLUGIN_FILE), false, WOOCCM_PLUGIN_VERSION, 'all');
|
61 |
|
62 |
+
wp_register_script('wooccm-checkout', plugins_url('assets/js/wooccm-checkout.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
|
|
|
|
|
|
|
63 |
|
64 |
+
wp_localize_script('wooccm-checkout', 'wooccm_upload', array(
|
65 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
66 |
'nonce' => wp_create_nonce('wooccm_upload'),
|
67 |
+
'limit' => array(
|
68 |
+
'max_file_size' => wp_max_upload_size(),
|
69 |
+
'max_files' => 4,
|
70 |
+
//'mime_types' => $this->get_mime_types(),
|
|
|
71 |
),
|
72 |
'icons' => array(
|
73 |
'interactive' => site_url('wp-includes/images/media/interactive.png'),
|
76 |
'audio' => site_url('wp-includes/images/media/audio.png'),
|
77 |
'text' => site_url('wp-includes/images/media/text.png'),
|
78 |
'video' => site_url('wp-includes/images/media/video.png')
|
79 |
+
),
|
80 |
+
'message' => array(
|
81 |
+
'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
|
82 |
+
'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
|
83 |
+
'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
|
84 |
+
'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
|
85 |
)
|
86 |
));
|
87 |
+
|
88 |
+
// UI
|
89 |
+
// ---------------------------------------------------------------------
|
90 |
+
wp_register_style('jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), WC_VERSION);
|
91 |
+
|
92 |
+
// Timepicker
|
93 |
+
// ---------------------------------------------------------------------
|
94 |
+
wp_register_style('jquery-ui-timepicker', plugins_url('assets/timepicker/jquery.ui.timepicker.css', WOOCCM_PLUGIN_FILE), false, WOOCCM_PLUGIN_VERSION);
|
95 |
+
wp_register_script('jquery-ui-timepicker', plugins_url('assets/timepicker/jquery.ui.timepicker.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION);
|
96 |
+
|
97 |
+
// Colorpicker
|
98 |
+
// ---------------------------------------------------------------------
|
99 |
+
wp_register_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false);
|
100 |
+
|
101 |
+
wp_register_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris'), false);
|
102 |
+
|
103 |
+
wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array(
|
104 |
+
'clear' => __('Clear'),
|
105 |
+
'defaultString' => __('Default'),
|
106 |
+
'pick' => __('Select Color'),
|
107 |
+
'current' => __('Current Color'),
|
108 |
+
));
|
109 |
+
|
110 |
+
wp_register_script('farbtastic', admin_url('js/farbtastic.js'), array('jquery'), false);
|
111 |
}
|
112 |
|
113 |
}
|
new/controller/class-wooccm-checkout-advanced-controller.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WOOCCM_Checkout_Advanced_Controller {
|
4 |
+
|
5 |
+
protected static $instance;
|
6 |
+
|
7 |
+
public function add_inline_scripts() {
|
8 |
+
|
9 |
+
if ($css = get_option('wooccm_advanced_custom_css', false)) {
|
10 |
+
?>
|
11 |
+
<style type="text/css">
|
12 |
+
<?php echo $css; ?>
|
13 |
+
</style>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
public function get_settings() {
|
19 |
+
|
20 |
+
return array(
|
21 |
+
array(
|
22 |
+
'type' => 'title',
|
23 |
+
'id' => 'section_title'
|
24 |
+
),
|
25 |
+
//array(
|
26 |
+
// 'name' => esc_html__('Allow custom field names', 'woocommerce-checkout-manager'),
|
27 |
+
// 'desc_tip' => esc_html__('Show the selected fields in the thankyou page.', 'woocommerce-checkout-manager'),
|
28 |
+
// 'id' => 'wooccm_allow_custom_field_names',
|
29 |
+
// 'type' => 'select',
|
30 |
+
// 'class' => 'chosen_select',
|
31 |
+
// 'options' => array(
|
32 |
+
// 'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
33 |
+
// 'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
34 |
+
// ),
|
35 |
+
// 'default' => 'no',
|
36 |
+
// ),
|
37 |
+
array(
|
38 |
+
'name' => esc_html__('Custom CSS', 'woocommerce-checkout-manager'),
|
39 |
+
'desc_tip' => esc_html__('Add custom stylesheets to the checkout page.', 'woocommerce-checkout-manager'),
|
40 |
+
'id' => 'wooccm_advanced_custom_css',
|
41 |
+
'type' => 'textarea',
|
42 |
+
'placeholder' => ''
|
43 |
+
),
|
44 |
+
array(
|
45 |
+
'type' => 'sectionend',
|
46 |
+
'id' => 'section_end'
|
47 |
+
)
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
// Admin
|
52 |
+
// -------------------------------------------------------------------------
|
53 |
+
|
54 |
+
public function add_section() {
|
55 |
+
|
56 |
+
global $current_section;
|
57 |
+
|
58 |
+
if ('advanced' == $current_section) {
|
59 |
+
|
60 |
+
$settings = $this->get_settings();
|
61 |
+
|
62 |
+
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/advanced.php');
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
public function save_settings() {
|
67 |
+
woocommerce_update_options($this->get_settings());
|
68 |
+
}
|
69 |
+
|
70 |
+
public function custom_css_w($value) {
|
71 |
+
|
72 |
+
$options = get_option('wccs_settings');
|
73 |
+
|
74 |
+
if ($css = @$options['checkness']['custom_css_w']) {
|
75 |
+
return $css;
|
76 |
+
}
|
77 |
+
|
78 |
+
return $value;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function init() {
|
82 |
+
|
83 |
+
// global $wooccm_sections;
|
84 |
+
//
|
85 |
+
// $wooccm_sections['advanced'] = esc_html__('Advanced', 'woocommerce-checkout-manager');
|
86 |
+
|
87 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'));
|
88 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
|
89 |
+
|
90 |
+
// Frontend
|
91 |
+
// -------------------------------------------------------------------------
|
92 |
+
add_action('woocommerce_before_checkout_form', array($this, 'add_inline_scripts'));
|
93 |
+
|
94 |
+
// Compatibility
|
95 |
+
// -------------------------------------------------------------------------
|
96 |
+
add_filter('default_option_wooccm_advanced_custom_css', array($this, 'custom_css_w'));
|
97 |
+
}
|
98 |
+
|
99 |
+
public static function instance() {
|
100 |
+
if (!isset(self::$instance)) {
|
101 |
+
self::$instance = new self();
|
102 |
+
self::$instance->init();
|
103 |
+
}
|
104 |
+
return self::$instance;
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
WOOCCM_Checkout_Advanced_Controller::instance();
|
110 |
+
|
new/controller/class-wooccm-checkout-controller.php
CHANGED
@@ -1,107 +1,383 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
|
|
27 |
|
28 |
-
|
|
|
|
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
|
|
33 |
}
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
}
|
|
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
|
|
|
|
47 |
}
|
|
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
|
55 |
-
|
56 |
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
$key = $field['cow'];
|
63 |
-
}
|
64 |
|
65 |
-
|
|
|
|
|
66 |
|
67 |
-
|
|
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
-
}
|
80 |
}
|
81 |
|
82 |
-
|
83 |
-
|
84 |
}
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
92 |
}
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
-
WOOCCM_Checkout_Controller::instance();
|
106 |
}
|
107 |
-
|
|
|
|
1 |
<?php
|
2 |
|
3 |
+
class WOOCCM_Checkout_Controller {
|
4 |
|
5 |
+
protected static $instance;
|
6 |
|
7 |
+
public function enqueue_scripts() {
|
8 |
|
9 |
+
WOOCCM()->register_scripts();
|
10 |
|
11 |
+
if (is_checkout()) {
|
12 |
|
13 |
+
$i18n = substr(get_user_locale(), 0, 2);
|
14 |
|
15 |
+
wp_enqueue_style('wooccm');
|
16 |
+
|
17 |
+
wp_enqueue_script('wooccm-checkout');
|
18 |
+
|
19 |
+
// UI
|
20 |
+
// ---------------------------------------------------------------------
|
21 |
+
wp_enqueue_style('jquery-ui-style');
|
22 |
+
|
23 |
+
// Datepicker
|
24 |
+
// ---------------------------------------------------------------------
|
25 |
+
wp_enqueue_script('jquery-ui-datepicker');
|
26 |
+
|
27 |
+
// Timepicker
|
28 |
+
// ---------------------------------------------------------------------
|
29 |
+
wp_enqueue_style('jquery-ui-timepicker');
|
30 |
+
wp_enqueue_script('jquery-ui-timepicker');
|
31 |
+
|
32 |
+
if (is_file(WOOCCM_PLUGIN_DIR . 'assets/timepicker/i18n/jquery.ui.timepicker-' . $i18n . '.js')) {
|
33 |
+
wp_enqueue_script('jquery-ui-timepicker-' . $i18n, plugins_url('assets/timepicker/i18n/jquery.ui.timepicker-' . $i18n . '.js', WOOCCM_PLUGIN_FILE), array('jquery-ui-timepicker'), WOOCCM_PLUGIN_VERSION);
|
34 |
+
}
|
35 |
+
|
36 |
+
// Colorpicker
|
37 |
+
// ---------------------------------------------------------------------
|
38 |
+
wp_enqueue_style('wp-color-picker');
|
39 |
+
wp_enqueue_script('wp-color-picker');
|
40 |
+
|
41 |
+
// Farbtastic
|
42 |
+
// ---------------------------------------------------------------------
|
43 |
+
wp_enqueue_style('farbtastic');
|
44 |
+
wp_enqueue_script('farbtastic');
|
45 |
+
|
46 |
+
// Dashicons
|
47 |
+
// ---------------------------------------------------------------------
|
48 |
+
wp_enqueue_style('dashicons');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
public function add_inline_scripts() {
|
53 |
+
|
54 |
+
if (get_option('wooccm_checkout_force_shipping_address', 'no') == 'yes') {
|
55 |
+
?>
|
56 |
+
<style type="text/css">
|
57 |
+
.woocommerce-shipping-fields h3:first-child input {
|
58 |
+
display: none!important;
|
59 |
}
|
60 |
+
.woocommerce-shipping-fields .shipping_address {
|
61 |
+
display: block !important;
|
62 |
+
}
|
63 |
+
</style>
|
64 |
+
<?php
|
65 |
|
66 |
+
}
|
67 |
+
|
68 |
+
if (get_option('wooccm_checkout_force_create_account', 'no') == 'yes') {
|
69 |
+
?>
|
70 |
+
<style type="text/css">
|
71 |
+
.create-account {
|
72 |
+
display:none;
|
73 |
}
|
74 |
+
</style>
|
75 |
+
<script type="text/javascript">
|
76 |
+
jQuery(document).ready(function (e) {
|
77 |
+
jQuery("input#createaccount").prop('checked', 'checked');
|
78 |
+
});
|
79 |
+
</script>
|
80 |
+
<?php
|
81 |
+
|
82 |
}
|
83 |
+
}
|
84 |
|
85 |
+
// Frontend
|
86 |
+
// -------------------------------------------------------------------------
|
87 |
+
public function order_notes($fields) {
|
88 |
|
89 |
+
$options = get_option('wccs_settings');
|
90 |
|
91 |
+
if ($label = get_option('wooccm_checkout_order_notes_label', false)) {
|
92 |
+
$fields['order']['order_comments']['label'] = $label;
|
93 |
}
|
94 |
|
95 |
+
if ($placeholder = get_option('wooccm_checkout_order_notes_placeholder', false)) {
|
96 |
+
$fields['order']['order_comments']['placeholder'] = $placeholder;
|
97 |
+
}
|
98 |
+
|
99 |
+
if (get_option('wooccm_checkout_remove_order_notes', 'no') === 'yes') {
|
100 |
+
unset($fields['order']['order_comments']);
|
101 |
+
}
|
102 |
+
|
103 |
+
return $fields;
|
104 |
+
}
|
105 |
|
106 |
+
function add_checkout_form_before_message($param) {
|
107 |
|
108 |
+
if ($text = get_option('wooccm_checkout_checkout_form_before_message', false)) {
|
109 |
+
|
110 |
+
wc_get_template('notices/notice.php', array(
|
111 |
+
'messages' => array_filter((array) $text),
|
112 |
+
));
|
113 |
}
|
114 |
+
}
|
115 |
|
116 |
+
function add_checkout_form_after_message($param) {
|
117 |
|
118 |
+
if ($text = get_option('wooccm_checkout_checkout_form_after_message', false)) {
|
119 |
|
120 |
+
wc_get_template('notices/notice.php', array(
|
121 |
+
'messages' => array_filter((array) $text),
|
122 |
+
));
|
123 |
}
|
124 |
+
}
|
125 |
|
126 |
+
// Admin
|
127 |
+
// ---------------------------------------------------------------------------
|
128 |
+
|
129 |
+
public function get_settings() {
|
130 |
+
|
131 |
+
return array(
|
132 |
+
array(
|
133 |
+
'type' => 'title',
|
134 |
+
'id' => 'section_title'
|
135 |
+
),
|
136 |
+
array(
|
137 |
+
'name' => esc_html__('Force shipping address', 'woocommerce-checkout-manager'),
|
138 |
+
'desc_tip' => esc_html__('Force show shipping checkout fields.', 'woocommerce-checkout-manager'),
|
139 |
+
'id' => 'wooccm_checkout_force_shipping_address',
|
140 |
+
'type' => 'select',
|
141 |
+
'class' => 'chosen_select',
|
142 |
+
'options' => array(
|
143 |
+
'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
144 |
+
'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
145 |
+
),
|
146 |
+
'default' => 'no',
|
147 |
+
),
|
148 |
+
array(
|
149 |
+
'name' => esc_html__('Force create an account', 'woocommerce-checkout-manager'),
|
150 |
+
'desc_tip' => esc_html__('Force create an account for guests users.', 'woocommerce-checkout-manager'),
|
151 |
+
'id' => 'wooccm_checkout_force_create_account',
|
152 |
+
'type' => 'select',
|
153 |
+
'class' => 'chosen_select',
|
154 |
+
'options' => array(
|
155 |
+
'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
156 |
+
'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
157 |
+
),
|
158 |
+
'default' => 'no',
|
159 |
+
),
|
160 |
+
array(
|
161 |
+
'name' => esc_html__('Remove order notes', 'woocommerce-checkout-manager'),
|
162 |
+
'desc_tip' => esc_html__('Remove create an account for guests users.', 'woocommerce-checkout-manager'),
|
163 |
+
'id' => 'wooccm_checkout_remove_order_notes',
|
164 |
+
'type' => 'select',
|
165 |
+
'class' => 'chosen_select',
|
166 |
+
'options' => array(
|
167 |
+
'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
168 |
+
'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
169 |
+
),
|
170 |
+
'default' => 'no',
|
171 |
+
),
|
172 |
+
array(
|
173 |
+
'name' => esc_html__('Order notes label', 'woocommerce-checkout-manager'),
|
174 |
+
'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
175 |
+
'id' => 'wooccm_checkout_order_notes_label',
|
176 |
+
'type' => 'text',
|
177 |
+
'placeholder' => esc_attr__('Order notes', 'woocommerce-checkout-manager'),
|
178 |
+
),
|
179 |
+
array(
|
180 |
+
'name' => esc_html__('Order notes placeholder', 'woocommerce-checkout-manager'),
|
181 |
+
'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
182 |
+
'id' => 'wooccm_checkout_order_notes_placeholder',
|
183 |
+
'type' => 'text',
|
184 |
+
'placeholder' => esc_attr__('Notes about your order, e.g. special notes for delivery.', 'woocommerce-checkout-manager'),
|
185 |
+
),
|
186 |
+
array(
|
187 |
+
'name' => esc_html__('Add message before checkout', 'woocommerce-checkout-manager'),
|
188 |
+
'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
189 |
+
'id' => 'wooccm_checkout_checkout_form_before_message',
|
190 |
+
'type' => 'textarea',
|
191 |
+
'placeholder' => ''
|
192 |
+
),
|
193 |
+
array(
|
194 |
+
'name' => esc_html__('Add message after checkout', 'woocommerce-checkout-manager'),
|
195 |
+
'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
196 |
+
'id' => 'wooccm_checkout_checkout_form_after_message',
|
197 |
+
'type' => 'textarea',
|
198 |
+
'placeholder' => ''
|
199 |
+
),
|
200 |
+
// thankyou
|
201 |
+
// -------------------------------------------------------------------------
|
202 |
+
//array(
|
203 |
+
// 'name' => esc_html__('Add thankyou custom fields', 'woocommerce-checkout-manager'),
|
204 |
+
// 'desc_tip' => esc_html__('Show the selected fields in the thankyou page.', 'woocommerce-checkout-manager'),
|
205 |
+
// 'id' => 'wooccm_checkout_thankyou_custom_fields',
|
206 |
+
// 'type' => 'select',
|
207 |
+
// 'class' => 'chosen_select',
|
208 |
+
// 'options' => array(
|
209 |
+
// 'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
210 |
+
// 'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
211 |
+
// ),
|
212 |
+
// 'default' => 'no',
|
213 |
+
// ),
|
214 |
+
//array(
|
215 |
+
// 'name' => esc_html__('Add thankyou custom fields title', 'woocommerce-checkout-manager'),
|
216 |
+
// 'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
217 |
+
// 'id' => 'wooccm_checkout_thankyou_custom_fields_text',
|
218 |
+
// 'type' => 'text',
|
219 |
+
// 'placeholder' => esc_html__('Checkout extra', 'woocommerce-checkout-manager')
|
220 |
+
// ),
|
221 |
+
// upload
|
222 |
+
// -------------------------------------------------------------------------
|
223 |
+
//array(
|
224 |
+
// 'name' => esc_html__('Add upload files limit', 'woocommerce-checkout-manager'),
|
225 |
+
// 'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
226 |
+
// 'id' => 'wooccm_checkout_upload_files_limit',
|
227 |
+
// 'type' => 'number',
|
228 |
+
// 'placeholder' => 4
|
229 |
+
// ),
|
230 |
+
//array(
|
231 |
+
// 'name' => esc_html__('Add upload files types', 'woocommerce-checkout-manager'),
|
232 |
+
// 'desc_tip' => esc_html__('Add custom title for the custom fields table in the thankyou page.', 'woocommerce-checkout-manager'),
|
233 |
+
// 'id' => 'wooccm_checkout_upload_files_types',
|
234 |
+
// 'type' => 'text',
|
235 |
+
// 'placeholder' => 'jpg,gif,png'
|
236 |
+
// ),
|
237 |
+
array(
|
238 |
+
'type' => 'sectionend',
|
239 |
+
'id' => 'section_end'
|
240 |
+
)
|
241 |
+
);
|
242 |
+
}
|
243 |
|
244 |
+
public function add_section() {
|
245 |
|
246 |
+
global $current_section;
|
247 |
|
248 |
+
if ('' == $current_section) {
|
249 |
|
250 |
+
$settings = $this->get_settings();
|
251 |
|
252 |
+
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/checkout.php');
|
253 |
+
}
|
254 |
+
}
|
|
|
|
|
255 |
|
256 |
+
public function save_settings() {
|
257 |
+
woocommerce_update_options($this->get_settings());
|
258 |
+
}
|
259 |
|
260 |
+
// Compatibility
|
261 |
+
// ---------------------------------------------------------------------------
|
262 |
|
263 |
+
public function additional_info($value) {
|
264 |
|
265 |
+
$options = get_option('wccs_settings');
|
266 |
|
267 |
+
if (!empty($options['checkness']['additional_info'])) {
|
268 |
+
return 'yes';
|
|
|
|
|
|
|
|
|
|
|
269 |
}
|
270 |
|
271 |
+
if (!empty($options['checkness']['show_shipping_fields'])) {
|
272 |
+
return 'yes';
|
273 |
}
|
274 |
|
275 |
+
return $value;
|
276 |
+
}
|
277 |
+
|
278 |
+
public function auto_create_wccm_account($value) {
|
279 |
+
|
280 |
+
$options = get_option('wccs_settings');
|
281 |
+
|
282 |
+
if (!empty($options['checkness']['auto_create_wccm_account'])) {
|
283 |
+
return 'yes';
|
284 |
}
|
285 |
|
286 |
+
return $value;
|
287 |
+
}
|
288 |
+
|
289 |
+
public function notesenable($value) {
|
290 |
+
|
291 |
+
$options = get_option('wccs_settings');
|
292 |
+
|
293 |
+
if (!empty($options['checkness']['notesenable'])) {
|
294 |
+
return 'yes';
|
295 |
+
}
|
296 |
+
|
297 |
+
return $value;
|
298 |
+
}
|
299 |
+
|
300 |
+
public function noteslabel($value) {
|
301 |
+
|
302 |
+
$options = get_option('wccs_settings');
|
303 |
+
|
304 |
+
if ($text = @$options['checkness']['noteslabel']) {
|
305 |
+
return $text;
|
306 |
+
}
|
307 |
+
|
308 |
+
return $value;
|
309 |
+
}
|
310 |
+
|
311 |
+
public function notesplaceholder($value) {
|
312 |
+
|
313 |
+
$options = get_option('wccs_settings');
|
314 |
+
|
315 |
+
if ($text = @$options['checkness']['notesplaceholder']) {
|
316 |
+
return $text;
|
317 |
+
}
|
318 |
+
|
319 |
+
return $value;
|
320 |
+
}
|
321 |
+
|
322 |
+
public function text1($value) {
|
323 |
+
|
324 |
+
$options = get_option('wccs_settings');
|
325 |
+
|
326 |
+
if ($text = @$options['checkness']['text1']) {
|
327 |
+
return $text;
|
328 |
+
}
|
329 |
+
|
330 |
+
return $value;
|
331 |
+
}
|
332 |
+
|
333 |
+
public function text2($value) {
|
334 |
+
|
335 |
+
$options = get_option('wccs_settings');
|
336 |
+
|
337 |
+
if ($text = @$options['checkness']['text2']) {
|
338 |
+
return $text;
|
339 |
}
|
340 |
|
341 |
+
return $value;
|
342 |
+
}
|
343 |
+
|
344 |
+
public function init() {
|
345 |
+
|
346 |
+
// global $wooccm_sections;
|
347 |
+
//
|
348 |
+
// $wooccm_sections = array('' => esc_html__('Checkout', 'woocommerce-checkout-manager'));
|
349 |
+
|
350 |
+
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
351 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
|
352 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
|
353 |
+
|
354 |
+
// Frontend
|
355 |
+
// -----------------------------------------------------------------------
|
356 |
+
add_action('woocommerce_before_checkout_form', array($this, 'add_inline_scripts'));
|
357 |
+
add_action('woocommerce_checkout_fields', array($this, 'order_notes'));
|
358 |
+
add_action('woocommerce_before_checkout_form', array($this, 'add_checkout_form_before_message'));
|
359 |
+
add_action('woocommerce_after_checkout_form', array($this, 'add_checkout_form_after_message'));
|
360 |
+
|
361 |
+
// Compatibility
|
362 |
+
// -----------------------------------------------------------------------
|
363 |
+
add_filter('default_option_wooccm_checkout_force_shipping_address', array($this, 'additional_info'));
|
364 |
+
add_filter('default_option_wooccm_checkout_force_create_account', array($this, 'auto_create_wccm_account'));
|
365 |
+
add_filter('default_option_wooccm_checkout_remove_order_notes', array($this, 'notesenable'));
|
366 |
+
add_filter('default_option_wooccm_checkout_order_notes_label', array($this, 'noteslabel'));
|
367 |
+
add_filter('default_option_wooccm_checkout_order_notes_placeholder', array($this, 'notesplaceholder'));
|
368 |
+
add_filter('default_option_wooccm_checkout_checkout_form_before_message', array($this, 'text1'));
|
369 |
+
add_filter('default_option_wooccm_checkout_checkout_form_after_message', array($this, 'text2'));
|
370 |
+
}
|
371 |
+
|
372 |
+
public static function instance() {
|
373 |
+
if (!isset(self::$instance)) {
|
374 |
+
self::$instance = new self();
|
375 |
+
self::$instance->init();
|
376 |
+
}
|
377 |
+
return self::$instance;
|
378 |
}
|
379 |
|
|
|
380 |
}
|
381 |
+
|
382 |
+
WOOCCM_Checkout_Controller::instance();
|
383 |
+
|
new/controller/class-wooccm-field-controller.php
CHANGED
@@ -23,7 +23,7 @@ class WOOCCM_Field_Controller {
|
|
23 |
|
24 |
global $current_section;
|
25 |
|
26 |
-
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);
|
27 |
|
28 |
wp_localize_script('wooccm-field', 'wooccm_field', array(
|
29 |
'ajax_url' => admin_url('admin-ajax.php?section=' . $current_section),
|
@@ -55,53 +55,6 @@ class WOOCCM_Field_Controller {
|
|
55 |
// Ajax
|
56 |
// ---------------------------------------------------------------------------
|
57 |
|
58 |
-
public function ajax_select_search_products() {
|
59 |
-
|
60 |
-
if (current_user_can('manage_woocommerce') && check_ajax_referer('search-products', 'security') && isset($_REQUEST['term'])) {
|
61 |
-
|
62 |
-
if (empty($term) && isset($_GET['term'])) {
|
63 |
-
$term = (string) wc_clean(wp_unslash($_GET['term']));
|
64 |
-
}
|
65 |
-
|
66 |
-
if (empty($term)) {
|
67 |
-
wp_die();
|
68 |
-
}
|
69 |
-
|
70 |
-
if (!empty($_GET['limit'])) {
|
71 |
-
$limit = absint($_GET['limit']);
|
72 |
-
} else {
|
73 |
-
$limit = absint(apply_filters('woocommerce_json_search_limit', 30));
|
74 |
-
}
|
75 |
-
|
76 |
-
$include_ids = !empty($_GET['include']) ? array_map('absint', (array) wp_unslash($_GET['include'])) : array();
|
77 |
-
$exclude_ids = !empty($_GET['exclude']) ? array_map('absint', (array) wp_unslash($_GET['exclude'])) : array();
|
78 |
-
$selected_ids = !empty($_GET['selected']) ? array_map('absint', (array) wp_unslash($_GET['selected'])) : array();
|
79 |
-
|
80 |
-
$include_variations = false;
|
81 |
-
|
82 |
-
$data_store = WC_Data_Store::load('product');
|
83 |
-
$ids = $data_store->search_products($term, '', (bool) $include_variations, false, $limit, $include_ids, $exclude_ids + $selected_ids);
|
84 |
-
|
85 |
-
$product_objects = array_filter(array_map('wc_get_product', $ids), 'wc_products_array_filter_readable');
|
86 |
-
$products = array();
|
87 |
-
|
88 |
-
foreach ($product_objects as $product_object) {
|
89 |
-
$formatted_name = $product_object->get_formatted_name();
|
90 |
-
$managing_stock = $product_object->managing_stock();
|
91 |
-
|
92 |
-
if ($managing_stock && !empty($_GET['display_stock'])) {
|
93 |
-
$stock_amount = $product_object->get_stock_quantity();
|
94 |
-
/* Translators: %d stock amount */
|
95 |
-
$formatted_name .= ' – ' . sprintf(__('Stock: %d', 'woocommerce'), wc_format_stock_quantity_for_display($stock_amount, $product_object));
|
96 |
-
}
|
97 |
-
|
98 |
-
$products[$product_object->get_id()] = rawurldecode($formatted_name);
|
99 |
-
}
|
100 |
-
|
101 |
-
wp_send_json(apply_filters('woocommerce_json_search_found_products', $products));
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
public function ajax_toggle_field_attribute() {
|
106 |
|
107 |
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_id']) && isset($_REQUEST['field_attr'])) {
|
@@ -253,7 +206,7 @@ class WOOCCM_Field_Controller {
|
|
253 |
|
254 |
if ($field = WOOCCM()->field->$section->get_field($field_id)) {
|
255 |
|
256 |
-
$field_data = array($attr =>
|
257 |
|
258 |
$field = WOOCCM()->field->$section->update_field($field_id, $field_data);
|
259 |
|
@@ -321,11 +274,11 @@ class WOOCCM_Field_Controller {
|
|
321 |
|
322 |
$loop = 1;
|
323 |
|
324 |
-
foreach ($field_order as $
|
325 |
|
326 |
-
if (isset($fields[$
|
327 |
|
328 |
-
$fields[$
|
329 |
|
330 |
$loop++;
|
331 |
}
|
@@ -338,6 +291,30 @@ class WOOCCM_Field_Controller {
|
|
338 |
}
|
339 |
}
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
// Admin Order
|
342 |
// ---------------------------------------------------------------------------
|
343 |
|
@@ -355,167 +332,175 @@ class WOOCCM_Field_Controller {
|
|
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 |
-
|
359 |
</strong>
|
360 |
<br />
|
361 |
-
|
362 |
</p>
|
363 |
-
|
|
|
364 |
}
|
365 |
}
|
366 |
}
|
367 |
}
|
368 |
-
}
|
369 |
|
370 |
-
|
371 |
|
372 |
-
|
373 |
|
374 |
-
|
375 |
|
376 |
-
|
377 |
|
378 |
-
|
379 |
|
380 |
-
|
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 |
-
|
385 |
</strong>
|
386 |
<br/>
|
387 |
-
|
388 |
</p>
|
389 |
-
|
|
|
390 |
}
|
391 |
}
|
392 |
}
|
393 |
}
|
394 |
-
}
|
395 |
|
396 |
-
|
397 |
|
398 |
-
|
399 |
|
400 |
-
|
401 |
|
402 |
-
|
403 |
|
404 |
-
|
405 |
|
406 |
-
|
407 |
-
|
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 |
-
|
412 |
</strong>
|
413 |
<br/>
|
414 |
-
|
415 |
</p>
|
416 |
-
|
|
|
417 |
}
|
418 |
}
|
419 |
}
|
420 |
}
|
421 |
-
}
|
422 |
|
423 |
-
|
424 |
-
|
425 |
|
426 |
-
|
427 |
|
428 |
-
|
429 |
|
430 |
-
|
431 |
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
|
440 |
-
|
|
|
441 |
}
|
442 |
-
}
|
443 |
|
444 |
-
|
445 |
|
446 |
-
|
447 |
|
448 |
-
|
449 |
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
|
458 |
-
|
|
|
459 |
}
|
460 |
-
}
|
461 |
|
462 |
-
|
463 |
|
464 |
-
|
465 |
|
466 |
-
|
467 |
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
475 |
|
476 |
-
|
|
|
477 |
}
|
478 |
-
}
|
479 |
|
480 |
-
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
-
}
|
|
23 |
|
24 |
global $current_section;
|
25 |
|
26 |
+
wp_register_script('wooccm-field', plugins_url('assets/js/wooccm-field.js', WOOCCM_PLUGIN_FILE), array('jquery', 'jquery-ui-datepicker', 'backbone', 'wp-util'), WOOCCM_PLUGIN_VERSION, true);
|
27 |
|
28 |
wp_localize_script('wooccm-field', 'wooccm_field', array(
|
29 |
'ajax_url' => admin_url('admin-ajax.php?section=' . $current_section),
|
55 |
// Ajax
|
56 |
// ---------------------------------------------------------------------------
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
public function ajax_toggle_field_attribute() {
|
59 |
|
60 |
if (current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce') && isset($_REQUEST['field_id']) && isset($_REQUEST['field_attr'])) {
|
206 |
|
207 |
if ($field = WOOCCM()->field->$section->get_field($field_id)) {
|
208 |
|
209 |
+
$field_data = array($attr => !(bool) @$field[$attr]);
|
210 |
|
211 |
$field = WOOCCM()->field->$section->update_field($field_id, $field_data);
|
212 |
|
274 |
|
275 |
$loop = 1;
|
276 |
|
277 |
+
foreach ($field_order as $field_id) {
|
278 |
|
279 |
+
if (isset($fields[$field_id])) {
|
280 |
|
281 |
+
$fields[$field_id]['order'] = $loop;
|
282 |
|
283 |
$loop++;
|
284 |
}
|
291 |
}
|
292 |
}
|
293 |
|
294 |
+
function get_additional_settings() {
|
295 |
+
|
296 |
+
return array(
|
297 |
+
array(
|
298 |
+
'desc_tip' => esc_html__('Select the position of the additional fields.', 'woocommerce-checkout-manager'),
|
299 |
+
'id' => 'wooccm_additional_position',
|
300 |
+
'type' => 'select',
|
301 |
+
//'class' => 'chosen_select',
|
302 |
+
'options' => array(
|
303 |
+
'before_shipping_form' => esc_html__('Before shipping form', 'woocommerce-checkout-manager'),
|
304 |
+
'after_shipping_form' => esc_html__('After shipping form', 'woocommerce-checkout-manager'),
|
305 |
+
'before_billing_form' => esc_html__('Before billing form', 'woocommerce-checkout-manager'),
|
306 |
+
'after_billing_form' => esc_html__('After billing form', 'woocommerce-checkout-manager'),
|
307 |
+
'before_order_notes' => esc_html__('Before order notes', 'woocommerce-checkout-manager'),
|
308 |
+
'after_order_notes' => esc_html__('After order notes', 'woocommerce-checkout-manager'),
|
309 |
+
),
|
310 |
+
'default' => 'before_shipping_form',
|
311 |
+
));
|
312 |
+
}
|
313 |
+
|
314 |
+
function save_additional_settings() {
|
315 |
+
woocommerce_update_options($this->get_additional_settings());
|
316 |
+
}
|
317 |
+
|
318 |
// Admin Order
|
319 |
// ---------------------------------------------------------------------------
|
320 |
|
332 |
?>
|
333 |
<p id="billing_<?php echo esc_attr($field['cow']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
334 |
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_billing_%s', $field['cow']), __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
335 |
+
<?php echo esc_attr(wooccm_wpml_string(trim($field['label']))); ?>:
|
336 |
</strong>
|
337 |
<br />
|
338 |
+
<?php echo esc_html($value); ?>
|
339 |
</p>
|
340 |
+
<?php
|
341 |
+
}
|
342 |
}
|
343 |
}
|
344 |
}
|
345 |
}
|
|
|
346 |
|
347 |
+
function add_order_shipping_data($order) {
|
348 |
|
349 |
+
if ($fields = WOOCCM()->field->shipping->get_fields('old')) {
|
350 |
|
351 |
+
$defaults = WOOCCM()->field->shipping->get_defaults();
|
352 |
|
353 |
+
foreach ($fields as $field_id => $field) {
|
354 |
|
355 |
+
if (!in_array($field['cow'], $defaults)) {
|
356 |
|
357 |
+
if ($value = get_post_meta($order->get_id(), sprintf('_shipping_%s', $field['cow']), true)) {
|
358 |
+
?>
|
359 |
<p id="shipping_<?php echo esc_attr($field['cow']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
360 |
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_shipping_%s', $field['cow']), __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
361 |
+
<?php echo esc_attr(wooccm_wpml_string(trim($field['label']))); ?>:
|
362 |
</strong>
|
363 |
<br/>
|
364 |
+
<?php echo esc_html($value); ?>
|
365 |
</p>
|
366 |
+
<?php
|
367 |
+
}
|
368 |
}
|
369 |
}
|
370 |
}
|
371 |
}
|
|
|
372 |
|
373 |
+
function add_order_additional_data($order) {
|
374 |
|
375 |
+
if ($fields = WOOCCM()->field->additional->get_fields('old')) {
|
376 |
|
377 |
+
$defaults = WOOCCM()->field->additional->get_defaults();
|
378 |
|
379 |
+
foreach ($fields as $field_id => $field) {
|
380 |
|
381 |
+
if (!in_array($field['cow'], $defaults)) {
|
382 |
|
383 |
+
$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);
|
384 |
+
if ($value) {
|
385 |
+
?>
|
386 |
<p id="additional_<?php echo esc_attr($field['cow']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
387 |
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), sprintf('_%s', $field['cow']), __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
388 |
+
<?php echo esc_attr(wooccm_wpml_string(trim($field['label']))); ?>:
|
389 |
</strong>
|
390 |
<br/>
|
391 |
+
<?php echo esc_html($value); ?>
|
392 |
</p>
|
393 |
+
<?php
|
394 |
+
}
|
395 |
}
|
396 |
}
|
397 |
}
|
398 |
}
|
|
|
399 |
|
400 |
+
// Admin
|
401 |
+
// ---------------------------------------------------------------------------
|
402 |
|
403 |
+
public function add_section_billing() {
|
404 |
|
405 |
+
global $current_section, $wp_roles, $wp_locale;
|
406 |
|
407 |
+
if ('billing' == $current_section) {
|
408 |
|
409 |
+
$fields = WOOCCM()->field->billing->get_fields();
|
410 |
+
$defaults = WOOCCM()->field->billing->get_defaults();
|
411 |
+
$types = WOOCCM()->field->billing->get_types();
|
412 |
+
$conditionals = WOOCCM()->field->billing->get_conditional_types();
|
413 |
+
$multiple = WOOCCM()->field->billing->get_multiple_types();
|
414 |
+
$template = WOOCCM()->field->billing->get_template_types();
|
415 |
+
$product_categories = $this->get_product_categories();
|
416 |
|
417 |
+
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/billing.php');
|
418 |
+
}
|
419 |
}
|
|
|
420 |
|
421 |
+
public function add_section_shipping() {
|
422 |
|
423 |
+
global $current_section, $wp_roles, $wp_locale;
|
424 |
|
425 |
+
if ('shipping' == $current_section) {
|
426 |
|
427 |
+
$fields = WOOCCM()->field->shipping->get_fields();
|
428 |
+
$defaults = WOOCCM()->field->shipping->get_defaults();
|
429 |
+
$types = WOOCCM()->field->shipping->get_types();
|
430 |
+
$conditionals = WOOCCM()->field->shipping->get_conditional_types();
|
431 |
+
$multiple = WOOCCM()->field->shipping->get_multiple_types();
|
432 |
+
$template = WOOCCM()->field->billing->get_template_types();
|
433 |
+
$product_categories = $this->get_product_categories();
|
434 |
|
435 |
+
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/shipping.php');
|
436 |
+
}
|
437 |
}
|
|
|
438 |
|
439 |
+
public function add_section_additional() {
|
440 |
|
441 |
+
global $current_section, $wp_roles, $wp_locale;
|
442 |
|
443 |
+
if ('additional' == $current_section) {
|
444 |
|
445 |
+
$fields = WOOCCM()->field->additional->get_fields();
|
446 |
+
$defaults = WOOCCM()->field->additional->get_defaults();
|
447 |
+
$types = WOOCCM()->field->additional->get_types();
|
448 |
+
$conditionals = WOOCCM()->field->additional->get_conditional_types();
|
449 |
+
$multiple = WOOCCM()->field->additional->get_multiple_types();
|
450 |
+
$template = WOOCCM()->field->billing->get_template_types();
|
451 |
+
$product_categories = $this->get_product_categories();
|
452 |
+
$settings = $this->get_additional_settings();
|
453 |
|
454 |
+
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/additional.php');
|
455 |
+
}
|
456 |
}
|
|
|
457 |
|
458 |
+
function includes() {
|
459 |
|
460 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/model/class-wooccm-field.php' );
|
461 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/model/class-wooccm-field-old.php' );
|
462 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/model/class-wooccm-field-billing.php' );
|
463 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/model/class-wooccm-field-shipping.php' );
|
464 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/model/class-wooccm-field-additional.php' );
|
465 |
|
466 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/class-wooccm-fields-register.php' );
|
467 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/class-wooccm-fields-additional.php' );
|
468 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/class-wooccm-fields-display.php' );
|
469 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/class-wooccm-fields-conditional.php' );
|
470 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/class-wooccm-fields-handler.php' );
|
471 |
+
include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/filters.php' );
|
472 |
|
473 |
+
$this->billing = WOOCCM_Field_Billing::instance();
|
474 |
+
$this->shipping = WOOCCM_Field_Shipping::instance();
|
475 |
+
$this->additional = WOOCCM_Field_Additional::instance();
|
476 |
+
}
|
477 |
|
478 |
+
function init() {
|
479 |
+
|
480 |
+
// global $wooccm_sections;
|
481 |
+
//
|
482 |
+
// $wooccm_sections['billing'] = esc_html__('Billing', 'woocommerce-checkout-manager');
|
483 |
+
// $wooccm_sections['shipping'] = esc_html__('Shipping', 'woocommerce-checkout-manager');
|
484 |
+
// $wooccm_sections['additional'] = esc_html__('Additional', 'woocommerce-checkout-manager');
|
485 |
+
|
486 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
487 |
+
add_action('wp_ajax_wooccm_load_field', array($this, 'ajax_load_field'));
|
488 |
+
add_action('wp_ajax_wooccm_save_field', array($this, 'ajax_save_field'));
|
489 |
+
add_action('wp_ajax_wooccm_delete_field', array($this, 'ajax_delete_field'));
|
490 |
+
add_action('wp_ajax_wooccm_reset_fields', array($this, 'ajax_reset_fields'));
|
491 |
+
add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
|
492 |
+
add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
|
493 |
+
|
494 |
+
add_action('woocommerce_admin_order_data_after_billing_address', array($this, 'add_order_billing_data'));
|
495 |
+
add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'add_order_shipping_data'));
|
496 |
+
add_action('woocommerce_admin_order_data_after_order_details', array($this, 'add_order_additional_data'));
|
497 |
+
|
498 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_billing'), 99);
|
499 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_shipping'), 99);
|
500 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_additional'), 99);
|
501 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_field_order'));
|
502 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_additional_settings'));
|
503 |
+
}
|
504 |
|
505 |
+
}
|
506 |
+
|
new/controller/class-wooccm-field-upload.php
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WOOCCM_Upload {
|
4 |
+
|
5 |
+
protected static $instance;
|
6 |
+
|
7 |
+
protected function process_uploads($files, $key, $post_id = 0) {
|
8 |
+
|
9 |
+
if (!function_exists('media_handle_upload')) {
|
10 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
11 |
+
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
12 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
13 |
+
}
|
14 |
+
|
15 |
+
$attachment_ids = array();
|
16 |
+
|
17 |
+
add_filter('upload_dir', function( $param ) {
|
18 |
+
$param['path'] = sprintf('%s/wooccm_uploads', $param['basedir']);
|
19 |
+
$param['url'] = sprintf('%s/wooccm_uploads', $param['baseurl']);
|
20 |
+
return $param;
|
21 |
+
}, 10);
|
22 |
+
|
23 |
+
foreach ($files['name'] as $id => $value) {
|
24 |
+
|
25 |
+
if ($files['name'][$id]) {
|
26 |
+
|
27 |
+
$_FILES[$key] = array(
|
28 |
+
'name' => $files['name'][$id],
|
29 |
+
'type' => $files['type'][$id],
|
30 |
+
'tmp_name' => $files['tmp_name'][$id],
|
31 |
+
'error' => $files['error'][$id],
|
32 |
+
'size' => $files['size'][$id]
|
33 |
+
);
|
34 |
+
|
35 |
+
if (!is_wp_error($attachment_id = media_handle_upload($key, $post_id))) {
|
36 |
+
$attachment_ids[] = $attachment_id;
|
37 |
+
} else {
|
38 |
+
wc_add_notice($attachment_id->get_error_message(), 'error');
|
39 |
+
wp_send_json_error($attachment_id->get_error_message());
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
return $attachment_ids;
|
45 |
+
}
|
46 |
+
|
47 |
+
function ajax_delete_attachment() {
|
48 |
+
|
49 |
+
if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
|
50 |
+
|
51 |
+
$array1 = explode(',', sanitize_text_field(isset($_REQUEST['all_attachments_ids']) ? $_REQUEST['all_attachments_ids'] : '' ));
|
52 |
+
$array2 = explode(',', sanitize_text_field(isset($_REQUEST['delete_attachments_ids']) ? $_REQUEST['delete_attachments_ids'] : '' ));
|
53 |
+
|
54 |
+
if (empty($array1) || empty($array2)) {
|
55 |
+
wp_send_json_error(esc_html__('No attachment selected.', 'woocommerce-checkout-manager'));
|
56 |
+
}
|
57 |
+
|
58 |
+
$attachment_ids = array_diff($array1, $array2);
|
59 |
+
|
60 |
+
if (!empty($attachment_ids)) {
|
61 |
+
|
62 |
+
foreach ($attachment_ids as $key => $attachtoremove) {
|
63 |
+
|
64 |
+
// Check the Attachment exists...
|
65 |
+
if (get_post_status($attachtoremove) == false)
|
66 |
+
continue;
|
67 |
+
|
68 |
+
// Check the Attachment is associated with an Order
|
69 |
+
$post_parent = get_post_field('post_parent', $attachtoremove);
|
70 |
+
|
71 |
+
if (empty($post_parent)) {
|
72 |
+
continue;
|
73 |
+
} else {
|
74 |
+
if (get_post_type($post_parent) <> 'shop_order')
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
wp_delete_attachment($attachtoremove);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
wp_send_json_success('Deleted successfully.', 'woocommerce-checkout-manager');
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
public function ajax_checkout_attachment_upload() {
|
86 |
+
|
87 |
+
if (check_admin_referer('wooccm_upload', 'nonce') && isset($_FILES['wooccm_checkout_attachment_upload'])) {
|
88 |
+
|
89 |
+
$files = $_FILES['wooccm_checkout_attachment_upload'];
|
90 |
+
|
91 |
+
if (empty($files)) {
|
92 |
+
wc_add_notice(esc_html__('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager'), 'error');
|
93 |
+
wp_send_json_error();
|
94 |
+
}
|
95 |
+
|
96 |
+
if (count($attachment_ids = $this->process_uploads($files, 'wooccm_checkout_attachment_upload'))) {
|
97 |
+
wp_send_json_success($attachment_ids);
|
98 |
+
}
|
99 |
+
wc_add_notice(esc_html__('Unknow error.', 'woocommerce-checkout-manager'), 'error');
|
100 |
+
wp_send_json_error();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
public function checkout_billing_attachment_update_ids($order_id = 0) {
|
105 |
+
|
106 |
+
$fields = WOOCCM()->field->billing->get_fields('old');
|
107 |
+
|
108 |
+
$this->checkout_attachment_update_ids($order_id, 'billing_', $fields);
|
109 |
+
}
|
110 |
+
|
111 |
+
public function checkout_shipping_attachment_update_ids($order_id = 0) {
|
112 |
+
|
113 |
+
$fields = WOOCCM()->field->shipping->get_fields('old');
|
114 |
+
|
115 |
+
$this->checkout_attachment_update_ids($order_id, 'shipping_', $fields);
|
116 |
+
}
|
117 |
+
|
118 |
+
public function checkout_additional_attachment_update_ids($order_id = 0) {
|
119 |
+
|
120 |
+
$fields = WOOCCM()->field->additional->get_fields('old');
|
121 |
+
|
122 |
+
$this->checkout_attachment_update_ids($order_id, '', $fields);
|
123 |
+
}
|
124 |
+
|
125 |
+
public function checkout_attachment_update_ids($order_id = 0, $prefix = '', $fields = array()) {
|
126 |
+
|
127 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
128 |
+
|
129 |
+
if (count($fields)) {
|
130 |
+
|
131 |
+
foreach ($fields as $id => $field) {
|
132 |
+
|
133 |
+
if ($field['type'] == 'wooccmupload') {
|
134 |
+
|
135 |
+
if ($prefix) {
|
136 |
+
$key = sprintf("_%s%s", $prefix, $field['cow']);
|
137 |
+
} else {
|
138 |
+
$key = $field['cow'];
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($attachments = get_post_meta($order_id, $key, true)) {
|
142 |
+
|
143 |
+
if ($attachments = (array) explode(',', $attachments)) {
|
144 |
+
|
145 |
+
foreach ($attachments as $image_id) {
|
146 |
+
|
147 |
+
wp_update_post(array('ID' => $image_id, 'post_parent' => $order_id));
|
148 |
+
|
149 |
+
wp_update_attachment_metadata($image_id, wp_generate_attachment_metadata($image_id, get_attached_file($image_id)));
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
function init() {
|
159 |
+
add_action('wp_ajax_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
|
160 |
+
add_action('wp_ajax_nopriv_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
|
161 |
+
|
162 |
+
|
163 |
+
// Checkout
|
164 |
+
// -----------------------------------------------------------------------
|
165 |
+
add_action('wp_ajax_wooccm_checkout_attachment_upload', array($this, 'ajax_checkout_attachment_upload'));
|
166 |
+
add_action('wp_ajax_nopriv_wooccm_checkout_attachment_upload', array($this, 'ajax_checkout_attachment_upload'));
|
167 |
+
add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_billing_attachment_update_ids'));
|
168 |
+
add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_shipping_attachment_update_ids'));
|
169 |
+
add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_additional_attachment_update_ids'));
|
170 |
+
}
|
171 |
+
|
172 |
+
public static function instance() {
|
173 |
+
if (!isset(self::$instance)) {
|
174 |
+
self::$instance = new self();
|
175 |
+
self::$instance->init();
|
176 |
+
}
|
177 |
+
return self::$instance;
|
178 |
+
}
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
WOOCCM_Upload::instance();
|
new/controller/class-wooccm-order-controller.php
CHANGED
@@ -6,39 +6,52 @@ if (!class_exists('WOOCCM_Order_Controller')) {
|
|
6 |
|
7 |
protected static $instance;
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
-
function ajax_order_attachment_upload() {
|
32 |
-
|
33 |
-
//include_once( WOOCCM_PLUGIN_DIR . 'new/view/backend/order.php' );
|
34 |
-
//include_once( WOOCCM_PLUGIN_DIR . 'new/view/frontend/order.php' );
|
35 |
|
36 |
if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
|
37 |
|
38 |
$files = ( isset($_FILES['wooccm_order_attachment_upload']) ? $_FILES['wooccm_order_attachment_upload'] : false );
|
39 |
|
40 |
if (empty($files)) {
|
41 |
-
//
|
42 |
wp_send_json_error(esc_html__('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager'), 'error');
|
43 |
}
|
44 |
|
@@ -56,10 +69,10 @@ if (!class_exists('WOOCCM_Order_Controller')) {
|
|
56 |
|
57 |
ob_start();
|
58 |
|
59 |
-
if (!
|
60 |
-
|
61 |
} else {
|
62 |
-
|
63 |
}
|
64 |
|
65 |
wp_send_json_success(ob_get_clean());
|
@@ -98,20 +111,226 @@ if (!class_exists('WOOCCM_Order_Controller')) {
|
|
98 |
}
|
99 |
}
|
100 |
|
101 |
-
function
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
function init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
add_action('wp_ajax_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
|
108 |
add_action('wp_ajax_nopriv_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
public static function instance() {
|
112 |
if (!isset(self::$instance)) {
|
113 |
self::$instance = new self();
|
114 |
-
self::$instance->includes();
|
115 |
self::$instance->init();
|
116 |
}
|
117 |
return self::$instance;
|
6 |
|
7 |
protected static $instance;
|
8 |
|
9 |
+
public function enqueue_scripts() {
|
10 |
+
|
11 |
+
WOOCCM()->register_scripts();
|
12 |
+
|
13 |
+
wp_register_script('wooccm-order-upload', plugins_url('assets/js/wooccm-order-upload.js', WOOCCM_PLUGIN_FILE), array(), WOOCCM_PLUGIN_VERSION, true);
|
14 |
+
|
15 |
+
wp_localize_script('wooccm-order-upload', 'wooccm_upload', array(
|
16 |
+
'ajax_url' => admin_url('admin-ajax.php?metabox=' . is_admin()),
|
17 |
+
'nonce' => wp_create_nonce('wooccm_upload'),
|
18 |
+
'message' => array(
|
19 |
+
'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
|
20 |
+
'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
|
21 |
+
'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
|
22 |
+
'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
|
23 |
+
),
|
24 |
+
'icons' => array(
|
25 |
+
'interactive' => site_url('wp-includes/images/media/interactive.png'),
|
26 |
+
'spreadsheet' => site_url('wp-includes/images/media/spreadsheet.png'),
|
27 |
+
'archive' => site_url('wp-includes/images/media/archive.png'),
|
28 |
+
'audio' => site_url('wp-includes/images/media/audio.png'),
|
29 |
+
'text' => site_url('wp-includes/images/media/text.png'),
|
30 |
+
'video' => site_url('wp-includes/images/media/video.png')
|
31 |
+
)
|
32 |
+
));
|
33 |
+
|
34 |
+
if (is_admin() && $screen = get_current_screen()) {
|
35 |
+
if (in_array($screen->id, array(/* 'product', 'edit-product', */'shop_order', 'edit-shop_order'))) {
|
36 |
+
wp_enqueue_script('wooccm-order-upload');
|
37 |
+
}
|
38 |
}
|
39 |
|
40 |
+
if (is_account_page()) {
|
41 |
+
wp_enqueue_style('wooccm');
|
42 |
+
wp_enqueue_style('dashicons');
|
43 |
+
wp_enqueue_script('wooccm-order-upload');
|
44 |
+
}
|
45 |
}
|
46 |
|
47 |
+
public function ajax_order_attachment_upload() {
|
|
|
|
|
|
|
48 |
|
49 |
if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
|
50 |
|
51 |
$files = ( isset($_FILES['wooccm_order_attachment_upload']) ? $_FILES['wooccm_order_attachment_upload'] : false );
|
52 |
|
53 |
if (empty($files)) {
|
54 |
+
//wc_order_notice(esc_html__('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager'), 'error');
|
55 |
wp_send_json_error(esc_html__('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager'), 'error');
|
56 |
}
|
57 |
|
69 |
|
70 |
ob_start();
|
71 |
|
72 |
+
if (!empty($_REQUEST['metabox'])) {
|
73 |
+
$this->add_metabox_content($post);
|
74 |
} else {
|
75 |
+
$this->add_upload_files($post->ID);
|
76 |
}
|
77 |
|
78 |
wp_send_json_success(ob_get_clean());
|
111 |
}
|
112 |
}
|
113 |
|
114 |
+
public function add_upload_files($order_id) {
|
115 |
+
|
116 |
+
if (get_option('wooccm_order_upload_files', 'no') === 'yes') {
|
117 |
+
|
118 |
+
if ($order = wc_get_order($order_id)) {
|
119 |
+
|
120 |
+
if (in_array("wc-{$order->get_status()}", array_values(get_option('wooccm_order_upload_files_order_status', array())))) {
|
121 |
+
|
122 |
+
$attachments = get_posts(array(
|
123 |
+
'fields' => 'ids',
|
124 |
+
'post_type' => 'attachment',
|
125 |
+
'numberposts' => -1,
|
126 |
+
'post_status' => null,
|
127 |
+
'post_parent' => $order->get_id())
|
128 |
+
);
|
129 |
+
|
130 |
+
wc_get_template('templates/order/order-upload-files.php', array('order' => $order, 'attachments' => $attachments), '', WOOCCM_PLUGIN_DIR);
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
public function add_custom_fields($order_id) {
|
137 |
+
|
138 |
+
if (get_option('wooccm_order_custom_fields', 'no') === 'yes') {
|
139 |
+
|
140 |
+
if ($order = wc_get_order($order_id)) {
|
141 |
+
|
142 |
+
if (in_array("wc-{$order->get_status()}", array_values(get_option('wooccm_order_custom_fields_status', array())))) {
|
143 |
+
|
144 |
+
wc_get_template('templates/order/order-custom-fields.php', array('order_id' => $order_id), '', WOOCCM_PLUGIN_DIR);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
public function add_metabox_content($post) {
|
151 |
+
|
152 |
+
if ($order = wc_get_order($post->ID)) {
|
153 |
+
|
154 |
+
$attachments = get_posts(array(
|
155 |
+
'fields' => 'ids',
|
156 |
+
'post_type' => 'attachment',
|
157 |
+
'numberposts' => -1,
|
158 |
+
'post_status' => null,
|
159 |
+
'post_parent' => $order->get_id()
|
160 |
+
));
|
161 |
+
?>
|
162 |
+
|
163 |
+
<?php wp_enqueue_style('wccm_upload_file_style', plugins_url('assets/old/edit-order-uploads-file_editing_table.css', WOOCCM_PLUGIN_FILE)); ?>
|
164 |
+
|
165 |
+
<?php include WOOCCM_PLUGIN_DIR . 'new/view/backend/meta-boxes/html-order-uploads.php'; ?>
|
166 |
+
|
167 |
+
<?php
|
168 |
+
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
// Admin
|
173 |
+
// -------------------------------------------------------------------------
|
174 |
+
|
175 |
+
public function add_metabox() {
|
176 |
+
add_meta_box('woocommerce-order-files', esc_html__('Order Uploaded Files', 'woocommerce-checkout-manager'), array($this, 'add_metabox_content'), 'shop_order', 'normal', 'default');
|
177 |
+
}
|
178 |
+
|
179 |
+
public function get_settings() {
|
180 |
+
return array(
|
181 |
+
array(
|
182 |
+
'type' => 'title',
|
183 |
+
'id' => 'section_title'
|
184 |
+
),
|
185 |
+
array(
|
186 |
+
'name' => esc_html__('Add upload files', 'woocommerce-checkout-manager'),
|
187 |
+
'desc_tip' => esc_html__('Allow customers to upload files in the order.', 'woocommerce-checkout-manager'),
|
188 |
+
'id' => 'wooccm_order_upload_files',
|
189 |
+
'type' => 'select',
|
190 |
+
'class' => 'chosen_select',
|
191 |
+
'options' => array(
|
192 |
+
'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
193 |
+
'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
194 |
+
),
|
195 |
+
'default' => 'no',
|
196 |
+
),
|
197 |
+
array(
|
198 |
+
'name' => esc_html__('Add for this order status', 'woocommerce-checkout-manager'),
|
199 |
+
'desc_tip' => esc_html__('Allow customers to upload files in the order.', 'woocommerce-checkout-manager'),
|
200 |
+
'id' => 'wooccm_order_upload_files_order_status',
|
201 |
+
'type' => 'multiselect',
|
202 |
+
'class' => 'chosen_select',
|
203 |
+
'options' => wc_get_order_statuses(),
|
204 |
+
),
|
205 |
+
array(
|
206 |
+
'name' => esc_html__('Add upload files title', 'woocommerce-checkout-manager'),
|
207 |
+
'desc_tip' => esc_html__('Add custom title for the uploads files table.', 'woocommerce-checkout-manager'),
|
208 |
+
'id' => 'wooccm_order_upload_files_title',
|
209 |
+
'type' => 'text',
|
210 |
+
'placeholder' => esc_html__('Upload files', 'woocommerce-checkout-manager')
|
211 |
+
),
|
212 |
+
array(
|
213 |
+
'name' => esc_html__('Add custom fields', 'woocommerce-checkout-manager'),
|
214 |
+
'desc_tip' => esc_html__('Show the selected fields in the order.', 'woocommerce-checkout-manager'),
|
215 |
+
'id' => 'wooccm_order_custom_fields',
|
216 |
+
'type' => 'select',
|
217 |
+
'class' => 'chosen_select',
|
218 |
+
'options' => array(
|
219 |
+
'yes' => esc_html__('Yes', 'woocommerce-checkout-manager'),
|
220 |
+
'no' => esc_html__('No', 'woocommerce-checkout-manager'),
|
221 |
+
),
|
222 |
+
'default' => 'no',
|
223 |
+
),
|
224 |
+
array(
|
225 |
+
'name' => esc_html__('Add for this order status', 'woocommerce-checkout-manager'),
|
226 |
+
'desc_tip' => esc_html__('Allow customers to upload files in the order.', 'woocommerce-checkout-manager'),
|
227 |
+
'id' => 'wooccm_order_custom_fields_status',
|
228 |
+
'type' => 'multiselect',
|
229 |
+
'class' => 'chosen_select',
|
230 |
+
'options' => wc_get_order_statuses(),
|
231 |
+
),
|
232 |
+
array(
|
233 |
+
'name' => esc_html__('Add custom fields title', 'woocommerce-checkout-manager'),
|
234 |
+
'desc_tip' => esc_html__('Add custom title for the uploads files table.', 'woocommerce-checkout-manager'),
|
235 |
+
'id' => 'wooccm_order_custom_fields_title',
|
236 |
+
'type' => 'text',
|
237 |
+
'placeholder' => esc_html__('Order extra', 'woocommerce-checkout-manager')
|
238 |
+
),
|
239 |
+
array(
|
240 |
+
'type' => 'sectionend',
|
241 |
+
'id' => 'section_end'
|
242 |
+
)
|
243 |
+
);
|
244 |
+
}
|
245 |
+
|
246 |
+
public function add_section() {
|
247 |
+
|
248 |
+
global $current_section;
|
249 |
+
|
250 |
+
if ('order' == $current_section) {
|
251 |
+
|
252 |
+
$settings = $this->get_settings();
|
253 |
+
|
254 |
+
include_once(WOOCCM_PLUGIN_DIR . 'new/view/backend/pages/order.php');
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
public function save_settings() {
|
259 |
+
woocommerce_update_options($this->get_settings());
|
260 |
+
}
|
261 |
+
|
262 |
+
// Compatibility
|
263 |
+
// -------------------------------------------------------------------------
|
264 |
+
|
265 |
+
public function enable_file_upload($value) {
|
266 |
+
|
267 |
+
$options = get_option('wccs_settings');
|
268 |
+
|
269 |
+
if (!empty($options['checkness']['enable_file_upload'])) {
|
270 |
+
return 'yes';
|
271 |
+
}
|
272 |
+
|
273 |
+
return $value;
|
274 |
+
}
|
275 |
+
|
276 |
+
public function upload_os($value) {
|
277 |
+
|
278 |
+
$options = get_option('wccs_settings');
|
279 |
+
|
280 |
+
if (!empty($options['checkness']['upload_os'])) {
|
281 |
+
return (array) implode(',', $options['checkness']['upload_os']);
|
282 |
+
}
|
283 |
+
|
284 |
+
return $value;
|
285 |
+
}
|
286 |
+
|
287 |
+
public function upload_title($value) {
|
288 |
+
|
289 |
+
$options = get_option('wccs_settings');
|
290 |
+
|
291 |
+
if (!empty($options['checkness']['upload_title'])) {
|
292 |
+
return $options['checkness']['upload_title'];
|
293 |
+
}
|
294 |
+
|
295 |
+
return $value;
|
296 |
}
|
297 |
|
298 |
function init() {
|
299 |
+
//
|
300 |
+
// global $wooccm_sections;
|
301 |
+
//
|
302 |
+
// $wooccm_sections['order'] = esc_html__('Order', 'woocommerce-checkout-manager');
|
303 |
+
|
304 |
+
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
305 |
+
|
306 |
add_action('wp_ajax_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
|
307 |
add_action('wp_ajax_nopriv_wooccm_order_attachment_upload', array($this, 'ajax_order_attachment_upload'));
|
308 |
+
|
309 |
+
add_action('add_meta_boxes', array($this, 'add_metabox'));
|
310 |
+
|
311 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
|
312 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
|
313 |
+
|
314 |
+
// Frontend
|
315 |
+
// -----------------------------------------------------------------------
|
316 |
+
|
317 |
+
add_action('woocommerce_thankyou', array($this, 'add_upload_files'));
|
318 |
+
add_action('woocommerce_view_order', array($this, 'add_upload_files'));
|
319 |
+
|
320 |
+
add_action('woocommerce_thankyou', array($this, 'add_custom_fields'));
|
321 |
+
add_action('woocommerce_view_order', array($this, 'add_custom_fields'));
|
322 |
+
|
323 |
+
// Compatibility
|
324 |
+
// -----------------------------------------------------------------------
|
325 |
+
|
326 |
+
add_filter('default_option_wooccm_order_upload_files', array($this, 'enable_file_upload'));
|
327 |
+
add_filter('default_option_wooccm_order_upload_files_order_status', array($this, 'upload_os'));
|
328 |
+
add_filter('default_option_wooccm_order_upload_files_title', array($this, 'upload_title'));
|
329 |
}
|
330 |
|
331 |
public static function instance() {
|
332 |
if (!isset(self::$instance)) {
|
333 |
self::$instance = new self();
|
|
|
334 |
self::$instance->init();
|
335 |
}
|
336 |
return self::$instance;
|
new/controller/class-wooccm-upload-handler.php
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!class_exists('WOOCCM_Upload')) {
|
4 |
-
|
5 |
-
class WOOCCM_Upload {
|
6 |
-
|
7 |
-
protected static $instance;
|
8 |
-
|
9 |
-
protected function process_uploads($files, $key, $post_id = 0) {
|
10 |
-
|
11 |
-
if (!function_exists('media_handle_upload')) {
|
12 |
-
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
13 |
-
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
14 |
-
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
15 |
-
}
|
16 |
-
|
17 |
-
$attachment_ids = array();
|
18 |
-
|
19 |
-
add_filter('upload_dir', function( $param ) {
|
20 |
-
$param['path'] = sprintf('%s/wooccm_uploads', $param['basedir']);
|
21 |
-
$param['url'] = sprintf('%s/wooccm_uploads', $param['baseurl']);
|
22 |
-
return $param;
|
23 |
-
}, 10);
|
24 |
-
|
25 |
-
foreach ($files['name'] as $id => $value) {
|
26 |
-
|
27 |
-
if ($files['name'][$id]) {
|
28 |
-
|
29 |
-
$_FILES[$key] = array(
|
30 |
-
'name' => $files['name'][$id],
|
31 |
-
'type' => $files['type'][$id],
|
32 |
-
'tmp_name' => $files['tmp_name'][$id],
|
33 |
-
'error' => $files['error'][$id],
|
34 |
-
'size' => $files['size'][$id]
|
35 |
-
);
|
36 |
-
|
37 |
-
if (!is_wp_error($attachment_id = media_handle_upload($key, $post_id))) {
|
38 |
-
$attachment_ids[] = $attachment_id;
|
39 |
-
} else {
|
40 |
-
wc_add_notice($attachment_id->get_error_message(), 'error');
|
41 |
-
wp_send_json_error($attachment_id->get_error_message());
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
return $attachment_ids;
|
47 |
-
}
|
48 |
-
|
49 |
-
function ajax_checkout_attachment_upload() {
|
50 |
-
|
51 |
-
if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
|
52 |
-
|
53 |
-
$files = ( isset($_FILES['wooccm_checkout_attachment_upload']) ? $_FILES['wooccm_checkout_attachment_upload'] : false );
|
54 |
-
|
55 |
-
if (empty($files)) {
|
56 |
-
wc_add_notice(esc_html__('No uploads were recognised. Files were not uploaded.', 'woocommerce-checkout-manager'), 'error');
|
57 |
-
wp_send_json_error();
|
58 |
-
}
|
59 |
-
|
60 |
-
if (count($attachment_ids = $this->process_uploads($files, 'wooccm_checkout_attachment_upload'))) {
|
61 |
-
wp_send_json_success($attachment_ids);
|
62 |
-
}
|
63 |
-
wc_add_notice(esc_html__('Unknow error.', 'woocommerce-checkout-manager'), 'error');
|
64 |
-
wp_send_json_error();
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
function ajax_delete_attachment() {
|
69 |
-
|
70 |
-
if (!empty($_REQUEST) && check_admin_referer('wooccm_upload', 'nonce')) {
|
71 |
-
|
72 |
-
$array1 = explode(',', sanitize_text_field(isset($_REQUEST['all_attachments_ids']) ? $_REQUEST['all_attachments_ids'] : '' ));
|
73 |
-
$array2 = explode(',', sanitize_text_field(isset($_REQUEST['delete_attachments_ids']) ? $_REQUEST['delete_attachments_ids'] : '' ));
|
74 |
-
|
75 |
-
if (empty($array1) || empty($array2)) {
|
76 |
-
wp_send_json_error(esc_html__('No attachment selected.', 'woocommerce-checkout-manager'));
|
77 |
-
}
|
78 |
-
|
79 |
-
$attachment_ids = array_diff($array1, $array2);
|
80 |
-
|
81 |
-
if (!empty($attachment_ids)) {
|
82 |
-
|
83 |
-
foreach ($attachment_ids as $key => $attachtoremove) {
|
84 |
-
|
85 |
-
// Check the Attachment exists...
|
86 |
-
if (get_post_status($attachtoremove) == false)
|
87 |
-
continue;
|
88 |
-
|
89 |
-
// Check the Attachment is associated with an Order
|
90 |
-
$post_parent = get_post_field('post_parent', $attachtoremove);
|
91 |
-
|
92 |
-
if (empty($post_parent)) {
|
93 |
-
continue;
|
94 |
-
} else {
|
95 |
-
if (get_post_type($post_parent) <> 'shop_order')
|
96 |
-
continue;
|
97 |
-
}
|
98 |
-
wp_delete_attachment($attachtoremove);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
wp_send_json_success('Deleted successfully.', 'woocommerce-checkout-manager');
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
function init() {
|
107 |
-
add_action('wp_ajax_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
|
108 |
-
add_action('wp_ajax_nopriv_wooccm_order_attachment_update', array($this, 'ajax_delete_attachment'));
|
109 |
-
}
|
110 |
-
|
111 |
-
public static function instance() {
|
112 |
-
if (!isset(self::$instance)) {
|
113 |
-
self::$instance = new self();
|
114 |
-
self::$instance->init();
|
115 |
-
}
|
116 |
-
return self::$instance;
|
117 |
-
}
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
WOOCCM_Upload::instance();
|
122 |
-
}
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 static $_instance;
|
8 |
protected $prefix = 'billing';
|
9 |
protected $option_name = 'wccs_settings3';
|
4 |
|
5 |
class WOOCCM_Field_Billing extends WOOCCM_Field_Compatibility {
|
6 |
|
7 |
+
protected $fields = null;
|
8 |
protected static $_instance;
|
9 |
protected $prefix = 'billing';
|
10 |
protected $option_name = 'wccs_settings3';
|
new/model/class-wooccm-field-old.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
4 |
|
|
|
5 |
protected $prefix = '';
|
6 |
protected $option_name = '';
|
7 |
protected $defaults = array();
|
@@ -79,17 +80,18 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
79 |
// Color
|
80 |
// -------------------------------------------------------------------
|
81 |
'pickertype' => 'colorpickertype',
|
82 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
// -------------------------------------------------------------------
|
84 |
'listable' => null,
|
85 |
'sortable' => null,
|
86 |
'filterable' => null,
|
87 |
-
//
|
88 |
-
// Email
|
89 |
-
// -------------------------------------------------------------------
|
90 |
-
//deny_receipt
|
91 |
-
//'pickertype' => null,
|
92 |
-
//'fancy' => null,
|
93 |
);
|
94 |
private $old_args = array(
|
95 |
'disabled',
|
@@ -145,6 +147,14 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
145 |
'role_options2',
|
146 |
'changenamep',
|
147 |
'changename',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
);
|
149 |
|
150 |
function replace_keys($array = array(), $replace = array()) {
|
@@ -245,6 +255,47 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
245 |
return $type;
|
246 |
}
|
247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
function new_panel_compatibility($field_id, $field = array(), $fields = array()) {
|
249 |
|
250 |
$field = $this->get_new_args($field);
|
@@ -262,17 +313,17 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
262 |
}
|
263 |
}
|
264 |
|
265 |
-
|
266 |
-
|
267 |
-
|
|
|
268 |
}
|
269 |
-
//}
|
270 |
|
271 |
-
if (
|
272 |
$field['order'] = $field_id + 1;
|
273 |
}
|
274 |
|
275 |
-
if (
|
276 |
$field['key'] = $this->get_key($this->prefix, $field['name']);
|
277 |
}
|
278 |
|
@@ -324,7 +375,7 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
324 |
}
|
325 |
|
326 |
//return $field;
|
327 |
-
return array_intersect_key($field, array_flip(array_keys($this->get_args())));
|
328 |
}
|
329 |
|
330 |
function old_panel_compatibility($field_id, $field = array()) {
|
@@ -339,6 +390,12 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
339 |
|
340 |
$field['type'] = $this->get_old_type($field['type']);
|
341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
$field['role_option'] = $this->array_to_string($field['role_option']);
|
343 |
$field['role_option2'] = $this->array_to_string($field['role_option2']);
|
344 |
//$field['option_array'] = $this->array_to_string($field['option_array']);
|
@@ -384,11 +441,19 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
384 |
|
385 |
public function get_fields($old = false) {
|
386 |
|
|
|
|
|
|
|
|
|
387 |
if ($old) {
|
388 |
-
|
389 |
} else {
|
390 |
-
|
391 |
}
|
|
|
|
|
|
|
|
|
392 |
}
|
393 |
|
394 |
protected function get_fields_old() {
|
@@ -413,7 +478,12 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
413 |
if ($fields = $this->get_option($defaults)) {
|
414 |
|
415 |
foreach ($fields as $field_id => $field) {
|
|
|
|
|
|
|
416 |
$fields[$field_id] = $this->new_panel_compatibility($field_id, $field, $fields);
|
|
|
|
|
417 |
}
|
418 |
}
|
419 |
|
@@ -447,7 +517,11 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
447 |
return false;
|
448 |
}
|
449 |
|
|
|
|
|
450 |
$fields[$field_id] = $this->old_panel_compatibility($field_id, $field);
|
|
|
|
|
451 |
}
|
452 |
|
453 |
if ($this->update_option($fields)) {
|
@@ -464,8 +538,16 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
464 |
|
465 |
if (array_key_exists($field_id, $fields)) {
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
$fields[$field_id] = array_replace($fields[$field_id], $field_data);
|
468 |
|
|
|
|
|
469 |
if ($this->update_fields($fields)) {
|
470 |
return $fields[$field_id];
|
471 |
}
|
@@ -478,8 +560,9 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
478 |
|
479 |
$fields = $this->get_fields_new();
|
480 |
|
481 |
-
|
482 |
-
|
|
|
483 |
|
484 |
$field_data = $this->new_panel_compatibility($field_id, $field_data, $fields);
|
485 |
|
@@ -510,6 +593,8 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
510 |
|
511 |
protected function get_option($defaults = array()) {
|
512 |
|
|
|
|
|
513 |
if ($fields = get_option($this->option_name, $defaults)) {
|
514 |
|
515 |
// Compatibility with 4.x
|
@@ -525,9 +610,6 @@ class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
|
525 |
}
|
526 |
}
|
527 |
|
528 |
-
// Resort the fields by order
|
529 |
-
uasort($fields, array(__CLASS__, 'order_fields'));
|
530 |
-
|
531 |
return $fields;
|
532 |
}
|
533 |
|
2 |
|
3 |
class WOOCCM_Field_Compatibility extends WOOCCM_Field {
|
4 |
|
5 |
+
protected $fields = null;
|
6 |
protected $prefix = '';
|
7 |
protected $option_name = '';
|
8 |
protected $defaults = array();
|
80 |
// Color
|
81 |
// -------------------------------------------------------------------
|
82 |
'pickertype' => 'colorpickertype',
|
83 |
+
// State
|
84 |
+
// -------------------------------------------------------------------
|
85 |
+
'country' => null,
|
86 |
+
// Upload
|
87 |
+
// -------------------------------------------------------------------
|
88 |
+
'file_limit' => null,
|
89 |
+
'file_types' => null,
|
90 |
+
// Listing
|
91 |
// -------------------------------------------------------------------
|
92 |
'listable' => null,
|
93 |
'sortable' => null,
|
94 |
'filterable' => null,
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
);
|
96 |
private $old_args = array(
|
97 |
'disabled',
|
147 |
'role_options2',
|
148 |
'changenamep',
|
149 |
'changename',
|
150 |
+
// New
|
151 |
+
// -----------------------------------------------------------------------
|
152 |
+
'country',
|
153 |
+
'file_limit',
|
154 |
+
'file_types',
|
155 |
+
'listable',
|
156 |
+
'sortable',
|
157 |
+
'filterable',
|
158 |
);
|
159 |
|
160 |
function replace_keys($array = array(), $replace = array()) {
|
255 |
return $type;
|
256 |
}
|
257 |
|
258 |
+
function register_wpml_string($value) {
|
259 |
+
|
260 |
+
if (!empty($value) && function_exists('icl_register_string')) {
|
261 |
+
|
262 |
+
if (is_array($value)) {
|
263 |
+
|
264 |
+
foreach ($value as $key => $name) {
|
265 |
+
icl_register_string(WOOCCM_PLUGIN_NAME, $name, $name);
|
266 |
+
}
|
267 |
+
|
268 |
+
return $value;
|
269 |
+
}
|
270 |
+
|
271 |
+
if (is_string($value)) {
|
272 |
+
icl_register_string(WOOCCM_PLUGIN_NAME, $value, $value);
|
273 |
+
return $value;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
return $value;
|
278 |
+
}
|
279 |
+
|
280 |
+
function get_wpml_string($value) {
|
281 |
+
|
282 |
+
if (!empty($value) && function_exists('icl_t')) {
|
283 |
+
|
284 |
+
if (is_array($value)) {
|
285 |
+
|
286 |
+
foreach ($value as $key => $name) {
|
287 |
+
$value[$key] = icl_t(WOOCCM_PLUGIN_NAME, $name, $name);
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
if (is_string($value)) {
|
292 |
+
$value = icl_t(WOOCCM_PLUGIN_NAME, $value, $value);
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
return $value;
|
297 |
+
}
|
298 |
+
|
299 |
function new_panel_compatibility($field_id, $field = array(), $fields = array()) {
|
300 |
|
301 |
$field = $this->get_new_args($field);
|
313 |
}
|
314 |
}
|
315 |
|
316 |
+
if (empty($field['position']) && isset($field['class'])) {
|
317 |
+
if ($position = $this->array_to_string(array_intersect((array) $field['class'], array('form-row-wide', 'form-row-first', 'form-row-last')))) {
|
318 |
+
$field['position'] = $position;
|
319 |
+
}
|
320 |
}
|
|
|
321 |
|
322 |
+
if (empty($field['order'])) {
|
323 |
$field['order'] = $field_id + 1;
|
324 |
}
|
325 |
|
326 |
+
if (empty($field['key'])) {
|
327 |
$field['key'] = $this->get_key($this->prefix, $field['name']);
|
328 |
}
|
329 |
|
375 |
}
|
376 |
|
377 |
//return $field;
|
378 |
+
return $this->sanitize_field_data(array_intersect_key($field, array_flip(array_keys($this->get_args()))));
|
379 |
}
|
380 |
|
381 |
function old_panel_compatibility($field_id, $field = array()) {
|
390 |
|
391 |
$field['type'] = $this->get_old_type($field['type']);
|
392 |
|
393 |
+
if (empty($field['position']) && isset($field['class'])) {
|
394 |
+
if ($position = $this->array_to_string(array_intersect((array) $field['class'], array('form-row-wide', 'form-row-first', 'form-row-last')))) {
|
395 |
+
$field['position'] = $position;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
$field['role_option'] = $this->array_to_string($field['role_option']);
|
400 |
$field['role_option2'] = $this->array_to_string($field['role_option2']);
|
401 |
//$field['option_array'] = $this->array_to_string($field['option_array']);
|
441 |
|
442 |
public function get_fields($old = false) {
|
443 |
|
444 |
+
if (!is_null($this->fields)) {
|
445 |
+
return $this->fields;
|
446 |
+
}
|
447 |
+
|
448 |
if ($old) {
|
449 |
+
$this->fields = $this->get_fields_old();
|
450 |
} else {
|
451 |
+
$this->fields = $this->get_fields_new();
|
452 |
}
|
453 |
+
// Resort the fields by order
|
454 |
+
uasort($this->fields, array(__CLASS__, 'order_fields'));
|
455 |
+
|
456 |
+
return $this->fields;
|
457 |
}
|
458 |
|
459 |
protected function get_fields_old() {
|
478 |
if ($fields = $this->get_option($defaults)) {
|
479 |
|
480 |
foreach ($fields as $field_id => $field) {
|
481 |
+
|
482 |
+
//error_log(json_encode($fields[$field_id]));
|
483 |
+
|
484 |
$fields[$field_id] = $this->new_panel_compatibility($field_id, $field, $fields);
|
485 |
+
|
486 |
+
//error_log(json_encode($fields[$field_id]));
|
487 |
}
|
488 |
}
|
489 |
|
517 |
return false;
|
518 |
}
|
519 |
|
520 |
+
//error_log(json_encode($fields[$field_id]));
|
521 |
+
|
522 |
$fields[$field_id] = $this->old_panel_compatibility($field_id, $field);
|
523 |
+
|
524 |
+
//error_log(json_encode($fields[$field_id]));
|
525 |
}
|
526 |
|
527 |
if ($this->update_option($fields)) {
|
538 |
|
539 |
if (array_key_exists($field_id, $fields)) {
|
540 |
|
541 |
+
//error_log(json_encode($field_data));
|
542 |
+
|
543 |
+
$field_data = $this->sanitize_field_data($field_data);
|
544 |
+
|
545 |
+
/// error_log(json_encode($field_data));
|
546 |
+
|
547 |
$fields[$field_id] = array_replace($fields[$field_id], $field_data);
|
548 |
|
549 |
+
//error_log(json_encode($fields[$field_id]));
|
550 |
+
|
551 |
if ($this->update_fields($fields)) {
|
552 |
return $fields[$field_id];
|
553 |
}
|
560 |
|
561 |
$fields = $this->get_fields_new();
|
562 |
|
563 |
+
$field_id = $this->get_id($fields);
|
564 |
+
|
565 |
+
$field_data = $this->sanitize_field_data($field_data);
|
566 |
|
567 |
$field_data = $this->new_panel_compatibility($field_id, $field_data, $fields);
|
568 |
|
593 |
|
594 |
protected function get_option($defaults = array()) {
|
595 |
|
596 |
+
error_log('get_option');
|
597 |
+
|
598 |
if ($fields = get_option($this->option_name, $defaults)) {
|
599 |
|
600 |
// Compatibility with 4.x
|
610 |
}
|
611 |
}
|
612 |
|
|
|
|
|
|
|
613 |
return $fields;
|
614 |
}
|
615 |
|
new/model/class-wooccm-field.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
class WOOCCM_Field {
|
4 |
|
|
|
5 |
protected $prefix = '';
|
6 |
protected $option_name = '';
|
7 |
protected $defaults = array();
|
@@ -17,7 +18,7 @@ class WOOCCM_Field {
|
|
17 |
return ( $a['order'] < $b['order'] ) ? -1 : 1;
|
18 |
}
|
19 |
|
20 |
-
function duplicated_name($name, $fields) {
|
21 |
|
22 |
if (!empty($fields)) {
|
23 |
if (is_array($fields)) {
|
@@ -30,6 +31,10 @@ class WOOCCM_Field {
|
|
30 |
}
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
33 |
public function get_name($field_id) {
|
34 |
return WOOCCM_PREFIX . $field_id;
|
35 |
}
|
@@ -62,8 +67,12 @@ class WOOCCM_Field {
|
|
62 |
public function get_template_types() {
|
63 |
|
64 |
return array(
|
65 |
-
'button',
|
66 |
'heading',
|
|
|
|
|
|
|
|
|
|
|
67 |
);
|
68 |
}
|
69 |
|
@@ -93,25 +102,25 @@ class WOOCCM_Field {
|
|
93 |
|
94 |
return array(
|
95 |
'id' => null,
|
96 |
-
'key' =>
|
97 |
'name' => '',
|
98 |
'type' => 'text',
|
99 |
-
'disabled' =>
|
100 |
'order' => null,
|
101 |
'priority' => null,
|
102 |
-
'label' =>
|
103 |
-
'placeholder' =>
|
104 |
-
'default' =>
|
105 |
'position' => 'form-row-wide',
|
106 |
-
'clear' =>
|
107 |
-
'options' =>
|
108 |
-
'required' =>
|
109 |
-
'class' =>
|
110 |
// Display
|
111 |
// -------------------------------------------------------------------
|
112 |
-
'show_role' =>
|
113 |
-
'hide_role' =>
|
114 |
-
'more_product' =>
|
115 |
'show_product' => array(),
|
116 |
'hide_product' => array(),
|
117 |
'show_product_cat' => array(),
|
@@ -128,25 +137,59 @@ class WOOCCM_Field {
|
|
128 |
'date_limit_fixed_max' => date('Y-m-d'),
|
129 |
// Amount
|
130 |
// -------------------------------------------------------------------
|
131 |
-
'add_amount' =>
|
132 |
-
'add_amount_name' =>
|
133 |
'add_amount_total' => null,
|
134 |
-
'add_amount_type' =>
|
135 |
-
'add_amount_tax' =>
|
136 |
-
'extra_class' =>
|
137 |
// Conditional
|
138 |
// -------------------------------------------------------------------
|
139 |
-
'conditional' =>
|
140 |
-
'conditional_parent_name' =>
|
141 |
-
'conditional_parent_value' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
// Listing
|
143 |
// -------------------------------------------------------------------
|
144 |
-
'listable' =>
|
145 |
-
'sortable' =>
|
146 |
-
'filterable' =>
|
147 |
);
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
public function get_default_fields() {
|
151 |
|
152 |
$fields = array();
|
2 |
|
3 |
class WOOCCM_Field {
|
4 |
|
5 |
+
protected $fields = null;
|
6 |
protected $prefix = '';
|
7 |
protected $option_name = '';
|
8 |
protected $defaults = array();
|
18 |
return ( $a['order'] < $b['order'] ) ? -1 : 1;
|
19 |
}
|
20 |
|
21 |
+
protected function duplicated_name($name, $fields) {
|
22 |
|
23 |
if (!empty($fields)) {
|
24 |
if (is_array($fields)) {
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
public function get_id($fields) {
|
35 |
+
return absint(key(array_slice($fields, -1, 1, true))) + 1;
|
36 |
+
}
|
37 |
+
|
38 |
public function get_name($field_id) {
|
39 |
return WOOCCM_PREFIX . $field_id;
|
40 |
}
|
67 |
public function get_template_types() {
|
68 |
|
69 |
return array(
|
|
|
70 |
'heading',
|
71 |
+
'button',
|
72 |
+
'message',
|
73 |
+
'file',
|
74 |
+
'country',
|
75 |
+
'state'
|
76 |
);
|
77 |
}
|
78 |
|
102 |
|
103 |
return array(
|
104 |
'id' => null,
|
105 |
+
'key' => '',
|
106 |
'name' => '',
|
107 |
'type' => 'text',
|
108 |
+
'disabled' => false,
|
109 |
'order' => null,
|
110 |
'priority' => null,
|
111 |
+
'label' => '',
|
112 |
+
'placeholder' => '',
|
113 |
+
'default' => '',
|
114 |
'position' => 'form-row-wide',
|
115 |
+
'clear' => false,
|
116 |
+
'options' => '',
|
117 |
+
'required' => false,
|
118 |
+
'class' => array(),
|
119 |
// Display
|
120 |
// -------------------------------------------------------------------
|
121 |
+
'show_role' => array(),
|
122 |
+
'hide_role' => array(),
|
123 |
+
'more_product' => false,
|
124 |
'show_product' => array(),
|
125 |
'hide_product' => array(),
|
126 |
'show_product_cat' => array(),
|
137 |
'date_limit_fixed_max' => date('Y-m-d'),
|
138 |
// Amount
|
139 |
// -------------------------------------------------------------------
|
140 |
+
'add_amount' => false,
|
141 |
+
'add_amount_name' => '',
|
142 |
'add_amount_total' => null,
|
143 |
+
'add_amount_type' => '',
|
144 |
+
'add_amount_tax' => false,
|
145 |
+
'extra_class' => '',
|
146 |
// Conditional
|
147 |
// -------------------------------------------------------------------
|
148 |
+
'conditional' => false,
|
149 |
+
'conditional_parent_name' => '',
|
150 |
+
'conditional_parent_value' => '',
|
151 |
+
// State
|
152 |
+
// -------------------------------------------------------------------
|
153 |
+
'country' => '',
|
154 |
+
// Upload
|
155 |
+
// -------------------------------------------------------------------
|
156 |
+
'file_limit' => 1,
|
157 |
+
'file_types' => array(),
|
158 |
// Listing
|
159 |
// -------------------------------------------------------------------
|
160 |
+
'listable' => false,
|
161 |
+
'sortable' => false,
|
162 |
+
'filterable' => false,
|
163 |
);
|
164 |
}
|
165 |
|
166 |
+
public function sanitize_field_data($field_data) {
|
167 |
+
|
168 |
+
$args = $this->get_args();
|
169 |
+
|
170 |
+
foreach ($field_data as $key => $value) {
|
171 |
+
|
172 |
+
if (array_key_exists($key, $args)) {
|
173 |
+
|
174 |
+
$type = $args[$key];
|
175 |
+
|
176 |
+
if (is_null($type) && !is_numeric($value)) {
|
177 |
+
$field_data[$key] = (int) $value;
|
178 |
+
} elseif (is_bool($type) && !is_bool($value)) {
|
179 |
+
$field_data[$key] = ($value === 'true' || $value === '1' || $value === 1);
|
180 |
+
} elseif (is_string($type) && !is_string($value)) {
|
181 |
+
$field_data[$key] = strval($value);
|
182 |
+
} elseif (is_array($type) && !is_array($value)) {
|
183 |
+
$field_data[$key] = (array) $type;
|
184 |
+
}
|
185 |
+
} else {
|
186 |
+
unset($field_data[$key]);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
return $field_data;
|
191 |
+
}
|
192 |
+
|
193 |
public function get_default_fields() {
|
194 |
|
195 |
$fields = array();
|
new/view/backend/order.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!class_exists('WOOCCM_Order_Admin')) {
|
4 |
-
|
5 |
-
class WOOCCM_Order_Admin {
|
6 |
-
|
7 |
-
protected static $instance;
|
8 |
-
|
9 |
-
function enqueue_scripts() {
|
10 |
-
|
11 |
-
if ($screen = get_current_screen()) {
|
12 |
-
|
13 |
-
if (in_array($screen->id, array(/* 'product', 'edit-product', */'shop_order', 'edit-shop_order'))) {
|
14 |
-
|
15 |
-
WOOCCM()->register_scripts();
|
16 |
-
|
17 |
-
// only for backend maybe orders
|
18 |
-
wp_enqueue_media();
|
19 |
-
wp_enqueue_script('wooccm-order-upload');
|
20 |
-
}
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
function order_uploads_metabox_content($post) {
|
25 |
-
|
26 |
-
if ($order = wc_get_order($post->ID)) {
|
27 |
-
|
28 |
-
$attachments = get_posts(array(
|
29 |
-
'fields' => 'ids',
|
30 |
-
'post_type' => 'attachment',
|
31 |
-
'numberposts' => -1,
|
32 |
-
'post_status' => null,
|
33 |
-
'post_parent' => $order->get_id()
|
34 |
-
));
|
35 |
-
?>
|
36 |
-
|
37 |
-
<?php wp_enqueue_style('wccm_upload_file_style', plugins_url('assets/old/edit-order-uploads-file_editing_table.css', WOOCCM_PLUGIN_FILE)); ?>
|
38 |
-
|
39 |
-
<?php include WOOCCM_PLUGIN_DIR . 'new/view/backend/meta-boxes/html-order-uploads.php'; ?>
|
40 |
-
|
41 |
-
<?php
|
42 |
-
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
function order_uploads_metabox() {
|
47 |
-
add_meta_box('woocommerce-order-files', esc_html__('Order Uploaded Files', 'woocommerce-checkout-manager'), array($this, 'order_uploads_metabox_content'), 'shop_order', 'normal', 'default');
|
48 |
-
}
|
49 |
-
|
50 |
-
function init() {
|
51 |
-
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
52 |
-
add_action('add_meta_boxes', array($this, 'order_uploads_metabox'));
|
53 |
-
}
|
54 |
-
|
55 |
-
public static function instance() {
|
56 |
-
if (!isset(self::$instance)) {
|
57 |
-
self::$instance = new self();
|
58 |
-
self::$instance->init();
|
59 |
-
}
|
60 |
-
return self::$instance;
|
61 |
-
}
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
WOOCCM_Order_Admin::instance();
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new/view/backend/pages/advanced.php
CHANGED
@@ -1,29 +1,12 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
<ul>
|
14 |
-
<li><a href="<?php echo add_query_arg(array('action' => 'wooccm_reset_update_notice', '_wpnonce' => wp_create_nonce('wooccm_reset_update_notice'))); ?>"><?php _e('Reset <em>Run the updater</em> prompt', 'woocommerce-checkout-manager'); ?></a></li>
|
15 |
-
<li><a href="<?php echo add_query_arg(array('action' => 'wooccm_nuke_options', '_wpnonce' => wp_create_nonce('wooccm_nuke_options'))); ?>" class="confirm-button" data-confirm="<?php _e('This will permanently delete all WordPress Options associated with WooCommerce Checkout Manager. Are you sure you want to proceed?', 'woocommerce-checkout-manager'); ?>"><?php _e('Delete WooCommerce Checkout Manager WordPress Options', 'woocommerce-checkout-manager'); ?></a></li>
|
16 |
-
<li><a href="<?php echo add_query_arg(array('action' => 'wooccm_nuke_order_meta', '_wpnonce' => wp_create_nonce('wooccm_nuke_order_meta'))); ?>" class="confirm-button" data-confirm="<?php _e('This will permanently delete all WordPress Post meta associated with WooCommerce Checkout Manager that is linked to Orders. Are you sure you want to proceed?', 'woocommerce-checkout-manager'); ?>"><?php _e('Delete WooCommerce Checkout Manager Orders Post meta', 'woocommerce-checkout-manager'); ?></a></li>
|
17 |
-
<li><a href="<?php echo add_query_arg(array('action' => 'wooccm_nuke_user_meta', '_wpnonce' => wp_create_nonce('wooccm_nuke_user_meta'))); ?>" class="confirm-button" data-confirm="<?php _e('This will permanently delete all WordPress Post meta associated with WooCommerce Checkout Manager that is linked to Users. Are you sure you want to proceed?', 'woocommerce-checkout-manager'); ?>"><?php _e('Delete WooCommerce Checkout Manager Users Post meta', 'woocommerce-checkout-manager'); ?></a></li>
|
18 |
-
</ul>
|
19 |
-
<?php } else { ?>
|
20 |
-
<p><?php _e('These actions are available only to WordPress Users with the <em>manage_options</em> User Capability.', 'woocommerce-checkout-manager'); ?></p>
|
21 |
-
<?php } ?>
|
22 |
-
</div>
|
23 |
-
<!-- .option -->
|
24 |
-
|
25 |
-
</div>
|
26 |
-
<!-- .section -->
|
27 |
-
|
28 |
-
</div>
|
29 |
-
<!--.advanced -->
|
1 |
+
<?php include_once('parts/header.php'); ?>
|
2 |
+
<h1 class="screen-reader-text"><?php esc_html_e('Advanced', 'woocommerce-checkout-manager'); ?></h1>
|
3 |
+
<h2><?php esc_html_e('Advanced settings', 'woocommerce-checkout-manager'); ?></h2>
|
4 |
+
<!--<div id="<?php printf('wooccm_%s_settings-description', $current_section); ?>">
|
5 |
+
<p><?php printf(esc_html__('Customize and manage the checkout %s fields.', 'woocommerce-checkout-manager'), $current_section); ?></p>
|
6 |
+
</div>-->
|
7 |
+
<?php if (current_user_can('manage_options')) : ?>
|
8 |
+
<a href="<?php echo add_query_arg(array('action' => 'wooccm_nuke_options', '_wpnonce' => wp_create_nonce('wooccm_nuke_options'))); ?>" class="button button-primary" data-confirm="<?php _e('This will permanently delete all WordPress Options associated with WooCommerce Checkout Manager. Are you sure you want to proceed?', 'woocommerce-checkout-manager'); ?>"><?php _e('Delete Options', 'woocommerce-checkout-manager'); ?></a>
|
9 |
+
<a href="<?php echo add_query_arg(array('action' => 'wooccm_nuke_order_meta', '_wpnonce' => wp_create_nonce('wooccm_nuke_order_meta'))); ?>" class="button button-primary" data-confirm="<?php _e('This will permanently delete all WordPress Post meta associated with that is linked to Orders. Are you sure you want to proceed?', 'woocommerce-checkout-manager'); ?>"><?php _e('Delete Orders Post meta', 'woocommerce-checkout-manager'); ?></a>
|
10 |
+
<a href="<?php echo add_query_arg(array('action' => 'wooccm_nuke_user_meta', '_wpnonce' => wp_create_nonce('wooccm_nuke_user_meta'))); ?>" class="button button-primary" data-confirm="<?php _e('This will permanently delete all WordPress Post meta associated with that is linked to Users. Are you sure you want to proceed?', 'woocommerce-checkout-manager'); ?>"><?php _e('Delete Users Post meta', 'woocommerce-checkout-manager'); ?></a>
|
11 |
+
<?php endif; ?>
|
12 |
+
<?php woocommerce_admin_fields($settings); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new/view/backend/pages/billing.php
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
<?php include_once('parts/header.php'); ?>
|
2 |
<h1 class="screen-reader-text"><?php esc_html_e('Billing', 'woocommerce-checkout-manager'); ?></h1>
|
3 |
<h2><?php esc_html_e('Billing fields', 'woocommerce-checkout-manager'); ?></h2>
|
1 |
+
<?php //var_dump($fields); ?>
|
2 |
<?php include_once('parts/header.php'); ?>
|
3 |
<h1 class="screen-reader-text"><?php esc_html_e('Billing', 'woocommerce-checkout-manager'); ?></h1>
|
4 |
<h2><?php esc_html_e('Billing fields', 'woocommerce-checkout-manager'); ?></h2>
|
new/view/backend/pages/checkout.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php include_once('parts/header.php'); ?>
|
2 |
+
<h1 class="screen-reader-text"><?php esc_html_e('Checkout', 'woocommerce-checkout-manager'); ?></h1>
|
3 |
+
<h2><?php esc_html_e('Checkout settings', 'woocommerce-checkout-manager'); ?></h2>
|
4 |
+
<div id="<?php printf('wooccm_%s_settings-description', $current_section); ?>">
|
5 |
+
<p><?php printf(esc_html__('Customize and manage the checkout settings.', 'woocommerce-checkout-manager'), $current_section); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php woocommerce_admin_fields($settings); ?>
|
new/view/backend/pages/general.php
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
<h1 class="screen-reader-text"><?php esc_html_e('General', 'woocommerce-checkout-manager'); ?></h1>
|
2 |
-
<h2><?php esc_html_e('General', 'woocommerce-checkout-manager'); ?></h2>
|
3 |
-
<div id="wooccm_billing_settings-description">
|
4 |
-
<p>Email notifications sent from WooCommerce are listed below. Click on an email to configure it.</p>
|
5 |
-
</div>
|
6 |
-
<table class="form-table" cellspacing="0">
|
7 |
-
<tbody>
|
8 |
-
<tr valign="top" class="">
|
9 |
-
<th scope="row" class="titledesc">
|
10 |
-
<?php esc_html_e('Hide shipping fields', 'woocommerce-checkout-manager'); ?>
|
11 |
-
</th>
|
12 |
-
<td class="forminp forminp-checkbox">
|
13 |
-
<fieldset>
|
14 |
-
<legend class="screen-reader-text">
|
15 |
-
<span>
|
16 |
-
<?php printf(__('Hide %s heading', 'woocommerce-checkout-manager'), __('Ship to a different address?', 'woocommerce-checkout-manager')); ?>
|
17 |
-
</span>
|
18 |
-
</legend>
|
19 |
-
<label for="woocommerce_allow_bulk_remove_personal_data">
|
20 |
-
<input type="checkbox" name="wccs_settings[checkness][additional_info]" value="true"<?php checked(!empty($options['checkness']['additional_info']), true); ?> />
|
21 |
-
<?php printf(__('Hide %s heading', 'woocommerce-checkout-manager'), __('Ship to a different address?', 'woocommerce-checkout-manager')); ?>
|
22 |
-
</label>
|
23 |
-
<!--<p class="description"><?php printf(__('Hide %s heading', 'woocommerce-checkout-manager'), __('Ship to a different address?', 'woocommerce-checkout-manager')); ?></p>-->
|
24 |
-
</fieldset>
|
25 |
-
</td>
|
26 |
-
</tr>
|
27 |
-
|
28 |
-
<tr valign="top" class="">
|
29 |
-
<th scope="row" class="titledesc">
|
30 |
-
<?php esc_html_e('Show shipping checkout fields', 'woocommerce-checkout-manager'); ?>
|
31 |
-
</th>
|
32 |
-
<td class="forminp forminp-checkbox">
|
33 |
-
<fieldset>
|
34 |
-
<legend class="screen-reader-text">
|
35 |
-
<span>
|
36 |
-
<?php esc_html_e('Show shipping checkout fields', 'woocommerce-checkout-manager'); ?>
|
37 |
-
</span>
|
38 |
-
</legend>
|
39 |
-
<label for="show_shipping_fields">
|
40 |
-
<input type="checkbox" name="wccs_settings[checkness][show_shipping_fields]" value="true"<?php checked(!empty($options['checkness']['show_shipping_fields']), true); ?> />
|
41 |
-
<?php printf(__(' Force show Shipping Checkout fields', 'woocommerce-checkout-manager'), sprintf(__('Hide %s heading', 'woocommerce-checkout-manager'), __('Ship to a different address?', 'woocommerce-checkout-manager'))); ?>
|
42 |
-
</label>
|
43 |
-
<p class="description"><?php printf(__('To be used in conjunction with %s', 'woocommerce-checkout-manager'), __('Ship to a different address?', 'woocommerce-checkout-manager')); ?></p>
|
44 |
-
</fieldset>
|
45 |
-
</td>
|
46 |
-
</tr>
|
47 |
-
<tr valign="top" class="">
|
48 |
-
<th scope="row" class="titledesc">
|
49 |
-
<?php esc_html_e('Hide create an account', 'woocommerce-checkout-manager'); ?>
|
50 |
-
</th>
|
51 |
-
<td class="forminp forminp-checkbox">
|
52 |
-
<fieldset>
|
53 |
-
<legend class="screen-reader-text">
|
54 |
-
<span>
|
55 |
-
<?php esc_html_e('Hide create an account', 'woocommerce-checkout-manager'); ?>
|
56 |
-
</span>
|
57 |
-
</legend>
|
58 |
-
<label for="auto_create_wccm_account">
|
59 |
-
<input type="checkbox" name="wccs_settings[checkness][auto_create_wccm_account]" value="true"<?php checked(!empty($options['checkness']['auto_create_wccm_account']), true); ?> />
|
60 |
-
<?php printf(__('Hide %s checkbox on Checkout page for guests', 'woocommerce-checkout-manager'), __('Create an account?', 'woocommerce-checkout-manager')); ?>
|
61 |
-
</label>
|
62 |
-
<p class="description"><?php printf(__('Hide %s checkbox on Checkout page for guests', 'woocommerce-checkout-manager'), __('Create an account?', 'woocommerce-checkout-manager')); ?></p>
|
63 |
-
</fieldset>
|
64 |
-
</td>
|
65 |
-
</tr>
|
66 |
-
<tr valign="top" class="">
|
67 |
-
<th scope="row" class="titledesc">
|
68 |
-
<?php _e('Retain Fields Information', 'woocommerce-checkout-manager'); ?>
|
69 |
-
</th>
|
70 |
-
<td class="forminp forminp-checkbox">
|
71 |
-
<fieldset>
|
72 |
-
<legend class="screen-reader-text">
|
73 |
-
<span>
|
74 |
-
<?php _e('Retain Fields Information', 'woocommerce-checkout-manager'); ?>
|
75 |
-
</span>
|
76 |
-
</legend>
|
77 |
-
<label for="retainval">
|
78 |
-
<input type="checkbox" name="wccs_settings[checkness][retainval]" value="true"<?php checked(!empty($options['checkness']['retainval']), true); ?> />
|
79 |
-
<?php _e('Retain Fields Information', 'woocommerce-checkout-manager'); ?>
|
80 |
-
</label>
|
81 |
-
<p class="description"><?php _e('Retain Fields Information', 'woocommerce-checkout-manager'); ?></p>
|
82 |
-
</fieldset>
|
83 |
-
</td>
|
84 |
-
</tr>
|
85 |
-
<tr valign="top" class="">
|
86 |
-
<th scope="row" class="titledesc">
|
87 |
-
<?php _e('Editing Of Abbreviation Fields', 'woocommerce-checkout-manager'); ?>
|
88 |
-
</th>
|
89 |
-
<td class="forminp forminp-checkbox">
|
90 |
-
<fieldset>
|
91 |
-
<legend class="screen-reader-text">
|
92 |
-
<span>
|
93 |
-
<?php _e('Editing Of Abbreviation Fields', 'woocommerce-checkout-manager'); ?>
|
94 |
-
</span>
|
95 |
-
</legend>
|
96 |
-
<label for="abbreviation">
|
97 |
-
<input type="checkbox" name="wccs_settings[checkness][abbreviation]" value="true"<?php checked(!empty($options['checkness']['abbreviation']), true); ?> />
|
98 |
-
<?php _e('Editing Of Abbreviation Fields', 'woocommerce-checkout-manager'); ?>
|
99 |
-
</label>
|
100 |
-
<p class="description"><?php _e('Editing Of Abbreviation Fields', 'woocommerce-checkout-manager'); ?></p>
|
101 |
-
</fieldset>
|
102 |
-
</td>
|
103 |
-
</tr>
|
104 |
-
<tr valign="top">
|
105 |
-
<th scope="row" class="titledesc">
|
106 |
-
<label for="position">
|
107 |
-
<?php _e('Additional fields position', 'woocommerce-checkout-manager'); ?>
|
108 |
-
<span class="woocommerce-help-tip"></span>
|
109 |
-
</label>
|
110 |
-
</th>
|
111 |
-
<td class="forminp forminp-select">
|
112 |
-
<select name="position" id="position" style="min-width:300px;" class="wc-enhanced-select enhanced" tabindex="-1" aria-hidden="true">
|
113 |
-
<option value="before_billing_form" <?php selected($options['checkness']['position'], 'before_billing_form'); ?>><?php _e('Before Billing fields', 'woocommerce-checkout-manager'); ?></option>
|
114 |
-
<option value="after_billing_form" <?php selected($options['checkness']['position'], 'after_billing_form'); ?>><?php _e('After Billing fields', 'woocommerce-checkout-manager'); ?></option>
|
115 |
-
<option value="before_shipping_form" <?php selected($options['checkness']['position'], 'before_shipping_form'); ?>><?php _e('Before Shipping fields', 'woocommerce-checkout-manager'); ?></option>
|
116 |
-
<option value="after_shipping_form" <?php selected($options['checkness']['position'], 'after_shipping_form'); ?>><?php _e('After Shipping fields', 'woocommerce-checkout-manager'); ?></option>
|
117 |
-
<option value="after_order_notes" <?php selected($options['checkness']['position'], 'after_order_notes'); ?>><?php _e('After Order Notes', 'woocommerce-checkout-manager'); ?></option>
|
118 |
-
</select>
|
119 |
-
</td>
|
120 |
-
</tr>
|
121 |
-
</tbody>
|
122 |
-
</table>
|
123 |
-
<!--<div class="section">
|
124 |
-
<h3 class="heading checkbox">
|
125 |
-
<div class="option">
|
126 |
-
<label>
|
127 |
-
<input type="checkbox" name="wccs_settings[checkness][admin_translation]" value="true"<?php checked(!empty($options['checkness']['admin_translation']), true); ?> />
|
128 |
-
<div class="info-of"><?php _e('Translate WooCommerce Checkout Manager Options Panel', 'woocommerce-checkout-manager'); ?></div>
|
129 |
-
</label>
|
130 |
-
</div>
|
131 |
-
</h3>
|
132 |
-
</div>-->
|
133 |
-
<!-- section -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new/view/backend/pages/modals/edit.php
CHANGED
@@ -20,9 +20,9 @@
|
|
20 |
<div class="panel-wrap product_data" style="overflow:visible;">
|
21 |
<?php include_once('parts/edit-tabs.php'); ?>
|
22 |
<?php include_once('parts/panel-general.php'); ?>
|
|
|
23 |
<?php //include_once('parts/panel-conditional.php'); ?>
|
24 |
<?php //include_once('parts/panel-amount.php'); ?>
|
25 |
-
<?php include_once('parts/panel-display.php'); ?>
|
26 |
<?php //include_once('parts/panel-datepicker.php'); ?>
|
27 |
<?php //include_once('parts/panel-timepicker.php'); ?>
|
28 |
<?php //include_once('parts/panel-advanced.php'); ?>
|
20 |
<div class="panel-wrap product_data" style="overflow:visible;">
|
21 |
<?php include_once('parts/edit-tabs.php'); ?>
|
22 |
<?php include_once('parts/panel-general.php'); ?>
|
23 |
+
<?php include_once('parts/panel-display.php'); ?>
|
24 |
<?php //include_once('parts/panel-conditional.php'); ?>
|
25 |
<?php //include_once('parts/panel-amount.php'); ?>
|
|
|
26 |
<?php //include_once('parts/panel-datepicker.php'); ?>
|
27 |
<?php //include_once('parts/panel-timepicker.php'); ?>
|
28 |
<?php //include_once('parts/panel-advanced.php'); ?>
|
new/view/backend/pages/modals/parts/edit-info.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
<div class="settings">
|
16 |
<label class="setting" data-setting="label">
|
17 |
<span class="name"><?php esc_html_e('Conditional', 'woocommerce-checkout-manager'); ?></span>
|
18 |
-
<input <# if (
|
19 |
</label>
|
20 |
<p class="description"><?php esc_html_e('Activate conditional field requirement.', 'woocommerce-checkout-manager'); ?></p>
|
21 |
<label class="setting" data-setting="label">
|
15 |
<div class="settings">
|
16 |
<label class="setting" data-setting="label">
|
17 |
<span class="name"><?php esc_html_e('Conditional', 'woocommerce-checkout-manager'); ?></span>
|
18 |
+
<input <# if (data.conditional) { #>checked<# } #> type="checkbox" name="conditional" value="1">
|
19 |
</label>
|
20 |
<p class="description"><?php esc_html_e('Activate conditional field requirement.', 'woocommerce-checkout-manager'); ?></p>
|
21 |
<label class="setting" data-setting="label">
|
new/view/backend/pages/modals/parts/panel-advanced.php
CHANGED
@@ -2,17 +2,17 @@
|
|
2 |
<div class="options_group">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></label>
|
5 |
-
<input <# if ( data.clear
|
6 |
<span class="description"><?php esc_html_e('Display in View Orders screen ', 'woocommerce-checkout-manager'); ?></span>
|
7 |
</p>
|
8 |
<p class="form-field">
|
9 |
<label><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></label>
|
10 |
-
<input <# if ( data.clear
|
11 |
<span class="description"><?php esc_html_e('Allow Sorting on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
|
12 |
</p>
|
13 |
<p class="form-field">
|
14 |
<label><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></label>
|
15 |
-
<input <# if ( data.clear
|
16 |
<span class="description"><?php esc_html_e('Allow Filtering on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
|
17 |
</p>
|
18 |
</div>
|
2 |
<div class="options_group">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></label>
|
5 |
+
<input <# if ( data.clear ) { #>checked<# } #> type="checkbox" name="listable" value="1">
|
6 |
<span class="description"><?php esc_html_e('Display in View Orders screen ', 'woocommerce-checkout-manager'); ?></span>
|
7 |
</p>
|
8 |
<p class="form-field">
|
9 |
<label><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></label>
|
10 |
+
<input <# if ( data.clear ) { #>checked<# } #> type="checkbox" name="sortable" value="1">
|
11 |
<span class="description"><?php esc_html_e('Allow Sorting on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
|
12 |
</p>
|
13 |
<p class="form-field">
|
14 |
<label><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></label>
|
15 |
+
<input <# if ( data.clear ) { #>checked<# } #> type="checkbox" name="filterable" value="1">
|
16 |
<span class="description"><?php esc_html_e('Allow Filtering on View Orders screen', 'woocommerce-checkout-manager'); ?></span>
|
17 |
</p>
|
18 |
</div>
|
new/view/backend/pages/modals/parts/panel-amount.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<div class="options_group">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Add Amount', 'woocommerce-checkout-manager'); ?></label>
|
6 |
-
<input <# if ( data.add_amount
|
7 |
</p>
|
8 |
<p class="form-field">
|
9 |
<label><?php esc_html_e('Amount Name', 'woocommerce-checkout-manager'); ?></label>
|
@@ -22,15 +22,15 @@
|
|
22 |
<div class="options_group">
|
23 |
<p class="form-field">
|
24 |
<label><?php esc_html_e('Amount Tax', 'woocommerce-checkout-manager'); ?></label>
|
25 |
-
<input <# if ( data.add_amount_tax
|
26 |
</p>
|
27 |
<p class="form-field">
|
28 |
<label><?php esc_html_e('Deny Checkout', 'woocommerce-checkout-manager'); ?></label>
|
29 |
-
<input <# if ( data.deny_checkout
|
30 |
</p>
|
31 |
<p class="form-field">
|
32 |
<label><?php esc_html_e('Deny Receipt', 'woocommerce-checkout-manager'); ?></label>
|
33 |
-
<input <# if ( data.deny_receipt
|
34 |
</p>
|
35 |
|
36 |
</div>
|
3 |
<div class="options_group">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Add Amount', 'woocommerce-checkout-manager'); ?></label>
|
6 |
+
<input <# if ( data.add_amount ) { #>checked<# } #> type="checkbox" name="add_amount" value="1">
|
7 |
</p>
|
8 |
<p class="form-field">
|
9 |
<label><?php esc_html_e('Amount Name', 'woocommerce-checkout-manager'); ?></label>
|
22 |
<div class="options_group">
|
23 |
<p class="form-field">
|
24 |
<label><?php esc_html_e('Amount Tax', 'woocommerce-checkout-manager'); ?></label>
|
25 |
+
<input <# if ( data.add_amount_tax ) { #>checked<# } #> type="checkbox" name="add_amount_tax" value="1">
|
26 |
</p>
|
27 |
<p class="form-field">
|
28 |
<label><?php esc_html_e('Deny Checkout', 'woocommerce-checkout-manager'); ?></label>
|
29 |
+
<input <# if ( data.deny_checkout ) { #>checked<# } #> type="checkbox" name="deny_checkout" value="1">
|
30 |
</p>
|
31 |
<p class="form-field">
|
32 |
<label><?php esc_html_e('Deny Receipt', 'woocommerce-checkout-manager'); ?></label>
|
33 |
+
<input <# if ( data.deny_receipt ) { #>checked<# } #> type="checkbox" name="deny_receipt" value="1">
|
34 |
</p>
|
35 |
|
36 |
</div>
|
new/view/backend/pages/modals/parts/panel-conditional.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<div class="options_group">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Conditional', 'woocommerce-checkout-manager'); ?></label>
|
5 |
-
<input <# if (
|
6 |
</p>
|
7 |
<p class="form-field">
|
8 |
<label><?php esc_html_e('Parent', 'woocommerce-checkout-manager'); ?></label>
|
2 |
<div class="options_group">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Conditional', 'woocommerce-checkout-manager'); ?></label>
|
5 |
+
<input <# if (data.conditional) { #>checked<# } #> type="checkbox" name="conditional" value="1">
|
6 |
</p>
|
7 |
<p class="form-field">
|
8 |
<label><?php esc_html_e('Parent', 'woocommerce-checkout-manager'); ?></label>
|
new/view/backend/pages/modals/parts/panel-display.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<div class="options_group">
|
3 |
<!--<p class="form-field">
|
4 |
<label><?php esc_html_e('User Role', 'woocommerce-checkout-manager'); ?></label>
|
5 |
-
<input <# if (
|
6 |
</p>-->
|
7 |
<p class="form-field">
|
8 |
<label><?php esc_html_e('Show for roles', 'woocommerce-checkout-manager'); ?></label>
|
@@ -25,7 +25,7 @@
|
|
25 |
<div class="options_group">
|
26 |
<p class="form-field">
|
27 |
<label><?php esc_html_e('More', 'woocommerce-checkout-manager'); ?></label>
|
28 |
-
<input <# if (
|
29 |
<span class="description"><?php esc_html_e('Apply conditions event it there is more than one product', 'woocommerce-checkout-manager'); ?></span>
|
30 |
</p>
|
31 |
</div>
|
2 |
<div class="options_group">
|
3 |
<!--<p class="form-field">
|
4 |
<label><?php esc_html_e('User Role', 'woocommerce-checkout-manager'); ?></label>
|
5 |
+
<input <# if (data.user_role) { #>checked<# } #> type="checkbox" name="user_role" value="1">
|
6 |
</p>-->
|
7 |
<p class="form-field">
|
8 |
<label><?php esc_html_e('Show for roles', 'woocommerce-checkout-manager'); ?></label>
|
25 |
<div class="options_group">
|
26 |
<p class="form-field">
|
27 |
<label><?php esc_html_e('More', 'woocommerce-checkout-manager'); ?></label>
|
28 |
+
<input <# if (data.more_product) { #>checked<# } #> type="checkbox" name="more_product" value="1">
|
29 |
<span class="description"><?php esc_html_e('Apply conditions event it there is more than one product', 'woocommerce-checkout-manager'); ?></span>
|
30 |
</p>
|
31 |
</div>
|
new/view/backend/pages/modals/parts/panel-general.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('You can\'t change the slug of default fields.', 'woocommerce-checkout-manager'); ?>"></span>
|
7 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly">
|
8 |
<# } else { #>
|
9 |
-
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Currently is not possible to change the name of the fields.', 'woocommerce-checkout-manager'); ?><?php //esc_html_e('To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager');
|
10 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly" <?php /* if (empty($options['checkness']['abbreviation'])) { ?>readonly="readonly"<?php } */ ?>>
|
11 |
<# } #>
|
12 |
</p>
|
@@ -66,6 +66,49 @@
|
|
66 |
<# } #>
|
67 |
</div>
|
68 |
<# } #>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
<div class="options_group">
|
70 |
<p class="form-field">
|
71 |
<label><?php esc_html_e('Extra class', 'woocommerce-checkout-manager'); ?></label>
|
6 |
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('You can\'t change the slug of default fields.', 'woocommerce-checkout-manager'); ?>"></span>
|
7 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly">
|
8 |
<# } else { #>
|
9 |
+
<span class="woocommerce-help-tip" data-tip="<?php esc_html_e('Currently is not possible to change the name of the fields.', 'woocommerce-checkout-manager'); ?><?php //esc_html_e('To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager'); ?>"></span>
|
10 |
<input class="short" type="text" name="name" placeholder="<?php esc_html_e('myfield', 'woocommerce-checkout-manager'); ?>" value="{{data.name}}" readonly="readonly" <?php /* if (empty($options['checkness']['abbreviation'])) { ?>readonly="readonly"<?php } */ ?>>
|
11 |
<# } #>
|
12 |
</p>
|
66 |
<# } #>
|
67 |
</div>
|
68 |
<# } #>
|
69 |
+
<# if (data.type == 'file') { #>
|
70 |
+
<!--<div class="options_group">
|
71 |
+
<p class="form-field">
|
72 |
+
<label><?php esc_html_e('Upload files', 'woocommerce-checkout-manager'); ?></label>
|
73 |
+
<input class="short" type="number" placeholder="1" min="0" max="12" name="file_limit" value="{{data.file_limit}}">
|
74 |
+
</p>
|
75 |
+
<p class="form-field">
|
76 |
+
<select class="wooccm-enhanced-select" name="file_types" multiple="multiple" data-placeholder="<?php esc_attr_e('Choose the allowed types…', 'woocommerce-checkout-manager'); ?>" data-allow_clear="true" >
|
77 |
+
<?php foreach (wp_get_mime_types() as $type => $name) : ?>
|
78 |
+
<option <# if ( _.contains(data.file_types, '<?php echo esc_attr($type); ?>') ) { #>selected="selected"<# } #> value="<?php echo esc_attr($type); ?>"><?php echo esc_html($type); ?></option>
|
79 |
+
<?php endforeach; ?>
|
80 |
+
</select>
|
81 |
+
</p>
|
82 |
+
</div>-->
|
83 |
+
<# } #>
|
84 |
+
|
85 |
+
<# if (data.type == 'country') { #>
|
86 |
+
<div class="options_group">
|
87 |
+
<p class="form-field">
|
88 |
+
<label><?php esc_html_e('Default', 'woocommerce-checkout-manager'); ?></label>
|
89 |
+
<select class="wooccm-enhanced-select" name="default" data-placeholder="<?php esc_attr_e('Preserve default country…', 'woocommerce-checkout-manager'); ?>" data-allow_clear="true" >
|
90 |
+
<option <# if (data.default == '') { #>selected="selected"<# } #> value=""><?php //esc_attr_e('Preserve default country', 'woocommerce-checkout-manager'); ?></option>
|
91 |
+
<?php foreach (WC()->countries->get_countries() as $id => $name) : ?>
|
92 |
+
<option <# if (data.default == '<?php echo esc_attr($id); ?>') { #>selected="selected"<# } #> value="<?php echo esc_attr($id); ?>"><?php echo esc_html($name); ?></option>
|
93 |
+
<?php endforeach; ?>
|
94 |
+
</select>
|
95 |
+
</p>
|
96 |
+
</div>
|
97 |
+
<# } #>
|
98 |
+
|
99 |
+
<# if (data.type == 'state') { #>
|
100 |
+
<div class="options_group">
|
101 |
+
<p class="form-field">
|
102 |
+
<label><?php esc_html_e('Country', 'woocommerce-checkout-manager'); ?></label>
|
103 |
+
<select class="wooccm-enhanced-select" name="country" data-placeholder="<?php esc_attr_e('Select country…', 'woocommerce-checkout-manager'); ?>" data-allow_clear="true" >
|
104 |
+
<?php foreach (WC()->countries->get_countries() as $id => $name) : ?>
|
105 |
+
<option <# if (data.country == '<?php echo esc_attr($id); ?>') { #>selected="selected"<# } #> value="<?php echo esc_attr($id); ?>"><?php echo esc_html($name); ?></option>
|
106 |
+
<?php endforeach; ?>
|
107 |
+
</select>
|
108 |
+
</p>
|
109 |
+
</div>
|
110 |
+
<# } #>
|
111 |
+
|
112 |
<div class="options_group">
|
113 |
<p class="form-field">
|
114 |
<label><?php esc_html_e('Extra class', 'woocommerce-checkout-manager'); ?></label>
|
new/view/backend/pages/order.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php include_once('parts/header.php'); ?>
|
2 |
+
<h1 class="screen-reader-text"><?php esc_html_e('Order', 'woocommerce-checkout-manager'); ?></h1>
|
3 |
+
<h2><?php esc_html_e('Order settings', 'woocommerce-checkout-manager'); ?></h2>
|
4 |
+
<div id="<?php printf('wooccm_%s_settings-description', $current_section); ?>">
|
5 |
+
<p><?php printf(esc_html__('Customize and manage the order settings.', 'woocommerce-checkout-manager'), $current_section); ?></p>
|
6 |
+
</div>
|
7 |
+
|
8 |
+
<?php woocommerce_admin_fields($settings); ?>
|
new/view/backend/pages/orders.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* To change this license header, choose License Headers in Project Properties.
|
5 |
-
* To change this template file, choose Tools | Templates
|
6 |
-
* and open the template in the editor.
|
7 |
-
*/
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new/view/backend/pages/parts/actions.php
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
-
<div id="<?php printf('wooccm_%s_settings-actions', $current_section); ?>">
|
2 |
-
<
|
3 |
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_add', $current_section); ?>" class="button button-primary"><?php esc_html_e('+ Add New Field', 'woocommerce-checkout-manager') ?></a>
|
4 |
-
|
5 |
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_reset', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Reset', 'woocommerce-checkout-manager') ?></a>
|
6 |
-
</
|
|
|
|
|
|
|
|
|
|
|
7 |
</div>
|
1 |
+
<div id="<?php printf('wooccm_%s_settings-actions', $current_section); ?>" class="tablenav top" style="margin-bottom:15px">
|
2 |
+
<div class="alignleft actions bulkactions">
|
3 |
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_add', $current_section); ?>" class="button button-primary"><?php esc_html_e('+ Add New Field', 'woocommerce-checkout-manager') ?></a>
|
4 |
+
<!--<a href="javascript:;" id="<?php printf('wooccm_%s_settings_import', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Import', 'woocommerce-checkout-manager') ?></a>-->
|
5 |
<a href="javascript:;" id="<?php printf('wooccm_%s_settings_reset', $current_section); ?>" class="button button-secondary"><?php esc_html_e('Reset', 'woocommerce-checkout-manager') ?></a>
|
6 |
+
</div>
|
7 |
+
<?php if ('additional' == $current_section) : ?>
|
8 |
+
<div class="alignright actions">
|
9 |
+
<?php woocommerce_admin_fields($settings); ?>
|
10 |
+
</div>
|
11 |
+
<?php endif; ?>
|
12 |
</div>
|
new/view/backend/pages/parts/header.php
CHANGED
@@ -1,13 +1,18 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
2 |
|
3 |
$sections = array();
|
4 |
|
5 |
-
|
6 |
-
//$sections['orders'] = esc_html__('Orders', 'woocommerce-checkout-manager');
|
7 |
$sections['billing'] = esc_html__('Billing', 'woocommerce-checkout-manager');
|
8 |
$sections['shipping'] = esc_html__('Shipping', 'woocommerce-checkout-manager');
|
9 |
$sections['additional'] = esc_html__('Additional', 'woocommerce-checkout-manager');
|
10 |
-
|
|
|
|
|
11 |
|
12 |
echo '<ul class="subsubsub">';
|
13 |
|
1 |
<?php
|
2 |
+
//
|
3 |
+
//global $wooccm_sections;
|
4 |
+
//
|
5 |
+
//var_dump($wooccm_sections);
|
6 |
|
7 |
$sections = array();
|
8 |
|
9 |
+
$sections[''] = esc_html__('Checkout', 'woocommerce-checkout-manager');
|
|
|
10 |
$sections['billing'] = esc_html__('Billing', 'woocommerce-checkout-manager');
|
11 |
$sections['shipping'] = esc_html__('Shipping', 'woocommerce-checkout-manager');
|
12 |
$sections['additional'] = esc_html__('Additional', 'woocommerce-checkout-manager');
|
13 |
+
$sections['order'] = esc_html__('Order', 'woocommerce-checkout-manager');
|
14 |
+
//$sections['email'] = esc_html__('Email', 'woocommerce-checkout-manager');
|
15 |
+
$sections['advanced'] = esc_html__('Advanced', 'woocommerce-checkout-manager');
|
16 |
|
17 |
echo '<ul class="subsubsub">';
|
18 |
|
new/view/backend/pages/parts/loop.php
CHANGED
@@ -17,8 +17,8 @@
|
|
17 |
<th class="sortable"><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></th>
|
18 |
<th class="filterable"><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></th>-->
|
19 |
<th class="status" style="width:1%"><?php esc_html_e('Disabled', 'woocommerce-checkout-manager'); ?></th>
|
20 |
-
<th class="edit" style="width:1%"><?php //esc_html_e('Edit', 'woocommerce-checkout-manager');
|
21 |
-
<th class="delete" style="width:1%"><?php //esc_html_e('Delete', 'woocommerce-checkout-manager');
|
22 |
</tr>
|
23 |
</thead>
|
24 |
<tbody class="ui-sortable">
|
@@ -36,7 +36,7 @@
|
|
36 |
<td class="required">
|
37 |
<a data-field_attr="required" class="wooccm-field-toggle-attribute" href="#">
|
38 |
<?php
|
39 |
-
if (
|
40 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently enabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
|
41 |
} else {
|
42 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently disabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('No', 'woocommerce-checkout-manager') . '</span>';
|
@@ -54,10 +54,9 @@
|
|
54 |
<td class="clear">
|
55 |
<a data-field_attr="clear" class="wooccm-field-toggle-attribute" href="#">
|
56 |
<?php
|
57 |
-
if (
|
58 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently enabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
|
59 |
} else {
|
60 |
-
|
61 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently disabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('No', 'woocommerce-checkout-manager') . '</span>';
|
62 |
}
|
63 |
?>
|
@@ -74,38 +73,37 @@
|
|
74 |
</td>
|
75 |
<!--<td class="listable">
|
76 |
<?php
|
77 |
-
if (
|
78 |
?>
|
79 |
-
|
80 |
<?php } else { ?>
|
81 |
-
|
82 |
<?php } ?>
|
83 |
</td>
|
84 |
<td class="sortable">
|
85 |
<?php
|
86 |
-
if (
|
87 |
?>
|
88 |
-
|
89 |
<?php } else { ?>
|
90 |
-
|
91 |
<?php } ?>
|
92 |
</td>
|
93 |
<td class="filterable">
|
94 |
<?php
|
95 |
-
if (
|
96 |
?>
|
97 |
-
|
98 |
<?php } else { ?>
|
99 |
-
|
100 |
<?php } ?>
|
101 |
</td>-->
|
102 |
<td class="status">
|
103 |
<a data-field_attr="disabled" class="wooccm-field-toggle-attribute" href="#">
|
104 |
<?php
|
105 |
-
if (
|
106 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently enabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
|
107 |
} else {
|
108 |
-
|
109 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently disabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('No', 'woocommerce-checkout-manager') . '</span>';
|
110 |
}
|
111 |
?>
|
17 |
<th class="sortable"><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></th>
|
18 |
<th class="filterable"><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></th>-->
|
19 |
<th class="status" style="width:1%"><?php esc_html_e('Disabled', 'woocommerce-checkout-manager'); ?></th>
|
20 |
+
<th class="edit" style="width:1%"><?php //esc_html_e('Edit', 'woocommerce-checkout-manager'); ?></th>
|
21 |
+
<th class="delete" style="width:1%"><?php //esc_html_e('Delete', 'woocommerce-checkout-manager'); ?></th>
|
22 |
</tr>
|
23 |
</thead>
|
24 |
<tbody class="ui-sortable">
|
36 |
<td class="required">
|
37 |
<a data-field_attr="required" class="wooccm-field-toggle-attribute" href="#">
|
38 |
<?php
|
39 |
+
if ($field['required'] === true) {
|
40 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently enabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
|
41 |
} else {
|
42 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently disabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('No', 'woocommerce-checkout-manager') . '</span>';
|
54 |
<td class="clear">
|
55 |
<a data-field_attr="clear" class="wooccm-field-toggle-attribute" href="#">
|
56 |
<?php
|
57 |
+
if ($field['clear'] === true) {
|
58 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently enabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
|
59 |
} else {
|
|
|
60 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently disabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('No', 'woocommerce-checkout-manager') . '</span>';
|
61 |
}
|
62 |
?>
|
73 |
</td>
|
74 |
<!--<td class="listable">
|
75 |
<?php
|
76 |
+
if ($field['listable'] === true) {
|
77 |
?>
|
78 |
+
<span class="status-enabled"><?php esc_html_e('Yes'); ?></span>
|
79 |
<?php } else { ?>
|
80 |
+
<span class="status-disabled"><?php esc_html_e('Yes'); ?></span>
|
81 |
<?php } ?>
|
82 |
</td>
|
83 |
<td class="sortable">
|
84 |
<?php
|
85 |
+
if ($field['sortable'] === true) {
|
86 |
?>
|
87 |
+
<span class="status-enabled"><?php esc_html_e('Yes'); ?></span>
|
88 |
<?php } else { ?>
|
89 |
+
<span class="status-disabled"><?php esc_html_e('Yes'); ?></span>
|
90 |
<?php } ?>
|
91 |
</td>
|
92 |
<td class="filterable">
|
93 |
<?php
|
94 |
+
if ($field['filterable'] === true) {
|
95 |
?>
|
96 |
+
<span class="status-enabled"><?php esc_html_e('Yes'); ?></span>
|
97 |
<?php } else { ?>
|
98 |
+
<span class="status-disabled"><?php esc_html_e('Yes'); ?></span>
|
99 |
<?php } ?>
|
100 |
</td>-->
|
101 |
<td class="status">
|
102 |
<a data-field_attr="disabled" class="wooccm-field-toggle-attribute" href="#">
|
103 |
<?php
|
104 |
+
if ($field['disabled'] === true) {
|
105 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently enabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
|
106 |
} else {
|
|
|
107 |
echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr(sprintf(__('The "%s" field currently disabled', 'woocommerce-checkout-manager'), $field['label'])) . '">' . esc_attr__('No', 'woocommerce-checkout-manager') . '</span>';
|
108 |
}
|
109 |
?>
|
new/view/frontend/checkout.php
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!class_exists('WOOCCM_Checkout')) {
|
4 |
-
|
5 |
-
class WOOCCM_Checkout {
|
6 |
-
|
7 |
-
protected static $instance;
|
8 |
-
|
9 |
-
function enqueue_scripts() {
|
10 |
-
|
11 |
-
if (is_checkout()) {
|
12 |
-
|
13 |
-
WOOCCM()->register_scripts();
|
14 |
-
|
15 |
-
$i18n = substr(get_user_locale(), 0, 2);
|
16 |
-
|
17 |
-
wp_enqueue_style('wooccm');
|
18 |
-
|
19 |
-
wp_enqueue_script('wooccm-checkout', plugins_url('assets/js/wooccm-checkout.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
|
20 |
-
|
21 |
-
wp_localize_script('wooccm-checkout', 'wooccm_upload', array(
|
22 |
-
'ajaxurl' => admin_url('admin-ajax.php'),
|
23 |
-
'nonce' => wp_create_nonce('wooccm_upload'),
|
24 |
-
'limit' => array(
|
25 |
-
'max_file_size' => wp_max_upload_size(),
|
26 |
-
'max_files' => 4,
|
27 |
-
//'mime_types' => $this->get_mime_types(),
|
28 |
-
),
|
29 |
-
'icons' => array(
|
30 |
-
'interactive' => site_url('wp-includes/images/media/interactive.png'),
|
31 |
-
'spreadsheet' => site_url('wp-includes/images/media/spreadsheet.png'),
|
32 |
-
'archive' => site_url('wp-includes/images/media/archive.png'),
|
33 |
-
'audio' => site_url('wp-includes/images/media/audio.png'),
|
34 |
-
'text' => site_url('wp-includes/images/media/text.png'),
|
35 |
-
'video' => site_url('wp-includes/images/media/video.png')
|
36 |
-
),
|
37 |
-
'message' => array(
|
38 |
-
'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
|
39 |
-
'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
|
40 |
-
'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
|
41 |
-
'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
|
42 |
-
)
|
43 |
-
));
|
44 |
-
|
45 |
-
// UI
|
46 |
-
// ---------------------------------------------------------------------
|
47 |
-
wp_enqueue_style('jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), WC_VERSION);
|
48 |
-
|
49 |
-
// Datepicker
|
50 |
-
// ---------------------------------------------------------------------
|
51 |
-
wp_enqueue_script('jquery-ui-datepicker');
|
52 |
-
|
53 |
-
// Timepicker
|
54 |
-
// ---------------------------------------------------------------------
|
55 |
-
wp_enqueue_style('jquery-ui-timepicker', plugins_url('assets/timepicker/jquery.ui.timepicker.css', WOOCCM_PLUGIN_FILE), false, WOOCCM_PLUGIN_VERSION);
|
56 |
-
wp_enqueue_script('jquery-ui-timepicker', plugins_url('assets/timepicker/jquery.ui.timepicker.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION);
|
57 |
-
|
58 |
-
if (is_file(WOOCCM_PLUGIN_DIR . 'assets/timepicker/i18n/jquery.ui.timepicker-' . $i18n . '.js')) {
|
59 |
-
wp_enqueue_script('jquery-ui-timepicker-' . $i18n, plugins_url('assets/timepicker/i18n/jquery.ui.timepicker-' . $i18n . '.js', WOOCCM_PLUGIN_FILE), array('jquery-ui-timepicker'), WOOCCM_PLUGIN_VERSION);
|
60 |
-
}
|
61 |
-
|
62 |
-
// Colorpicker
|
63 |
-
// ---------------------------------------------------------------------
|
64 |
-
wp_enqueue_style('wp-color-picker');
|
65 |
-
|
66 |
-
wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false);
|
67 |
-
wp_enqueue_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris'), false);
|
68 |
-
|
69 |
-
wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array(
|
70 |
-
'clear' => __('Clear'),
|
71 |
-
'defaultString' => __('Default'),
|
72 |
-
'pick' => __('Select Color'),
|
73 |
-
'current' => __('Current Color'),
|
74 |
-
));
|
75 |
-
|
76 |
-
// Farbtastic
|
77 |
-
// ---------------------------------------------------------------------
|
78 |
-
wp_enqueue_style('farbtastic');
|
79 |
-
wp_enqueue_script('farbtastic', admin_url('js/farbtastic.js'), array('jquery'), false);
|
80 |
-
|
81 |
-
// Dashicons
|
82 |
-
// ---------------------------------------------------------------------
|
83 |
-
wp_enqueue_style('dashicons');
|
84 |
-
|
85 |
-
wp_enqueue_script('wooccm-checkout');
|
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() {
|
101 |
-
if (!isset(self::$instance)) {
|
102 |
-
self::$instance = new self();
|
103 |
-
self::$instance->init();
|
104 |
-
}
|
105 |
-
return self::$instance;
|
106 |
-
}
|
107 |
-
|
108 |
-
}
|
109 |
-
|
110 |
-
WOOCCM_Checkout::instance();
|
111 |
-
}
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new/view/frontend/{fields/additional.php → class-wooccm-fields-additional.php}
RENAMED
@@ -5,21 +5,7 @@ if (!class_exists('WOOCCM_Fields_Additional')) {
|
|
5 |
|
6 |
protected static $instance;
|
7 |
|
8 |
-
function
|
9 |
-
|
10 |
-
if ($options = get_option('wccs_settings')) {
|
11 |
-
|
12 |
-
if (!empty($options['checkness']['position'])) {
|
13 |
-
$position = sanitize_text_field($options['checkness']['position']);
|
14 |
-
}
|
15 |
-
|
16 |
-
return $position;
|
17 |
-
}
|
18 |
-
|
19 |
-
return false;
|
20 |
-
}
|
21 |
-
|
22 |
-
function add_checkout_additional_required($fields) {
|
23 |
|
24 |
if ($fields = WOOCCM()->field->additional->get_fields('old')) {
|
25 |
|
@@ -43,6 +29,32 @@ if (!class_exists('WOOCCM_Fields_Additional')) {
|
|
43 |
}
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
function add_checkout_additional_fields($checkout) {
|
47 |
?>
|
48 |
<div class="wooccm-clearfix"></div>
|
@@ -63,12 +75,22 @@ if (!class_exists('WOOCCM_Fields_Additional')) {
|
|
63 |
<?php
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
function init() {
|
67 |
-
add_action('woocommerce_checkout_process', array($this, '
|
|
|
68 |
|
69 |
// Additional fields
|
70 |
// -----------------------------------------------------------------------
|
71 |
-
switch (
|
72 |
case 'before_shipping_form':
|
73 |
add_action('woocommerce_before_checkout_shipping_form', array($this, 'add_checkout_additional_fields'));
|
74 |
break;
|
@@ -85,10 +107,18 @@ if (!class_exists('WOOCCM_Fields_Additional')) {
|
|
85 |
add_action('woocommerce_after_checkout_billing_form', array($this, 'add_checkout_additional_fields'));
|
86 |
break;
|
87 |
|
|
|
|
|
|
|
|
|
88 |
case 'after_order_notes':
|
89 |
add_action('woocommerce_after_order_notes', array($this, 'add_checkout_additional_fields'));
|
90 |
break;
|
91 |
}
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
|
94 |
public static function instance() {
|
5 |
|
6 |
protected static $instance;
|
7 |
|
8 |
+
function add_checkout_require_notice($fields) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
if ($fields = WOOCCM()->field->additional->get_fields('old')) {
|
11 |
|
29 |
}
|
30 |
}
|
31 |
|
32 |
+
function add_order_meta($order_id = 0) {
|
33 |
+
|
34 |
+
$fields = WOOCCM()->field->additional->get_fields('old');
|
35 |
+
|
36 |
+
if (count($fields)) {
|
37 |
+
|
38 |
+
foreach ($fields as $id => $field) {
|
39 |
+
|
40 |
+
$key = $name = $field['cow'];
|
41 |
+
|
42 |
+
if (!empty($_POST[$key])) {
|
43 |
+
|
44 |
+
$value = $_POST[$key];
|
45 |
+
|
46 |
+
if ($field['type'] == 'wooccmtextarea') {
|
47 |
+
update_post_meta($order_id, $name, wp_kses($value, false));
|
48 |
+
} else if (is_array($value)) {
|
49 |
+
update_post_meta($order_id, $name, maybe_serialize(array_map('sanitize_text_field', $value)));
|
50 |
+
} else {
|
51 |
+
update_post_meta($order_id, $name, sanitize_text_field($value));
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
function add_checkout_additional_fields($checkout) {
|
59 |
?>
|
60 |
<div class="wooccm-clearfix"></div>
|
75 |
<?php
|
76 |
}
|
77 |
|
78 |
+
function position($position = 'after_order_notes') {
|
79 |
+
|
80 |
+
$options = get_option('wccs_settings');
|
81 |
+
|
82 |
+
if (!empty($options['checkness']['position'])) {
|
83 |
+
return sanitize_text_field($options['checkness']['position']);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
function init() {
|
88 |
+
add_action('woocommerce_checkout_process', array($this, 'add_checkout_require_notice'));
|
89 |
+
add_action('woocommerce_checkout_update_order_meta', array($this, 'add_order_meta'));
|
90 |
|
91 |
// Additional fields
|
92 |
// -----------------------------------------------------------------------
|
93 |
+
switch (get_option('wooccm_additional_position', 'after_order_notes')) {
|
94 |
case 'before_shipping_form':
|
95 |
add_action('woocommerce_before_checkout_shipping_form', array($this, 'add_checkout_additional_fields'));
|
96 |
break;
|
107 |
add_action('woocommerce_after_checkout_billing_form', array($this, 'add_checkout_additional_fields'));
|
108 |
break;
|
109 |
|
110 |
+
case 'before_order_notes':
|
111 |
+
add_action('woocommerce_before_order_notes', array($this, 'add_checkout_additional_fields'));
|
112 |
+
break;
|
113 |
+
|
114 |
case 'after_order_notes':
|
115 |
add_action('woocommerce_after_order_notes', array($this, 'add_checkout_additional_fields'));
|
116 |
break;
|
117 |
}
|
118 |
+
// Compatibility
|
119 |
+
// -----------------------------------------------------------------------
|
120 |
+
|
121 |
+
add_filter('default_option_wooccm_additional_position', array($this, 'position'));
|
122 |
}
|
123 |
|
124 |
public static function instance() {
|
new/view/frontend/{fields/conditional.php → class-wooccm-fields-conditional.php}
RENAMED
File without changes
|
new/view/frontend/{fields/display.php → class-wooccm-fields-display.php}
RENAMED
File without changes
|
new/view/frontend/{fields/handler.php → class-wooccm-fields-handler.php}
RENAMED
File without changes
|
new/view/frontend/{fields/register.php → class-wooccm-fields-register.php}
RENAMED
@@ -66,6 +66,9 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
66 |
if ($fields[$key]['type'] == 'wooccmtext') {
|
67 |
$fields[$key]['type'] = 'text';
|
68 |
}
|
|
|
|
|
|
|
69 |
if ($fields[$key]['type'] == 'wooccmpassword') {
|
70 |
$fields[$key]['type'] = 'password';
|
71 |
}
|
@@ -119,7 +122,12 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
119 |
|
120 |
// Override for State fields
|
121 |
// -----------------------------------------------------------------------
|
122 |
-
if ($fields[$key]['type'] == '
|
|
|
|
|
|
|
|
|
|
|
123 |
$country_key = false;
|
124 |
if ($key == 'billing_state') {
|
125 |
$country_key = 'billing_country';
|
@@ -137,7 +145,11 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
137 |
}
|
138 |
}
|
139 |
|
140 |
-
//
|
|
|
|
|
|
|
|
|
141 |
|
142 |
return apply_filters('wooccm_checkout_field_filter', $fields[$key], $key);
|
143 |
}
|
66 |
if ($fields[$key]['type'] == 'wooccmtext') {
|
67 |
$fields[$key]['type'] = 'text';
|
68 |
}
|
69 |
+
if ($fields[$key]['type'] == 'wooccmradio') {
|
70 |
+
$fields[$key]['type'] = 'radio';
|
71 |
+
}
|
72 |
if ($fields[$key]['type'] == 'wooccmpassword') {
|
73 |
$fields[$key]['type'] = 'password';
|
74 |
}
|
122 |
|
123 |
// Override for State fields
|
124 |
// -----------------------------------------------------------------------
|
125 |
+
if ($fields[$key]['type'] == 'state') {
|
126 |
+
|
127 |
+
//$fields[$key]['country'] = $fields[$key]['default'];
|
128 |
+
|
129 |
+
unset($fields[$key]['default']);
|
130 |
+
|
131 |
$country_key = false;
|
132 |
if ($key == 'billing_state') {
|
133 |
$country_key = 'billing_country';
|
145 |
}
|
146 |
}
|
147 |
|
148 |
+
// ii18n
|
149 |
+
// -----------------------------------------------------------------------
|
150 |
+
|
151 |
+
$fields[$key]['label'] = esc_html__($fields[$key]['label'], WOOCCM_WC_DOMAIN);
|
152 |
+
$fields[$key]['placeholder'] = esc_html__($fields[$key]['placeholder'], WOOCCM_WC_DOMAIN);
|
153 |
|
154 |
return apply_filters('wooccm_checkout_field_filter', $fields[$key], $key);
|
155 |
}
|
new/view/frontend/{fields/filters.php → filters.php}
RENAMED
@@ -94,7 +94,7 @@ function wooccm_checkout_field_radio_handler($field = '', $key, $args, $value) {
|
|
94 |
|
95 |
if (!empty($args['options'])) {
|
96 |
foreach ($args['options'] as $option_key => $option_text) {
|
97 |
-
$field .= '<label><input type="radio" ' . checked($value, wooccm_wpml_string(esc_attr($option_text)), false) . ' name="' . esc_attr($key) . '" value="' . wooccm_wpml_string(esc_attr($option_text)) . '" /> ' . wooccm_wpml_string(esc_html($option_text)) . '</label>';
|
98 |
}
|
99 |
}
|
100 |
|
@@ -103,7 +103,7 @@ function wooccm_checkout_field_radio_handler($field = '', $key, $args, $value) {
|
|
103 |
return $field;
|
104 |
}
|
105 |
|
106 |
-
add_filter('
|
107 |
|
108 |
// Multi-Checkbox
|
109 |
function wooccm_checkout_field_multicheckbox_handler($field = '', $key, $args, $value) {
|
@@ -217,3 +217,53 @@ function wooccm_checkout_field_heading_handler($field = '', $key, $args, $value)
|
|
217 |
}
|
218 |
|
219 |
add_filter('woocommerce_form_field_heading', 'wooccm_checkout_field_heading_handler', 10, 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
if (!empty($args['options'])) {
|
96 |
foreach ($args['options'] as $option_key => $option_text) {
|
97 |
+
$field .= '<label style="display:block;"><input type="radio" ' . checked($value, wooccm_wpml_string(esc_attr($option_text)), false) . ' name="' . esc_attr($key) . '" value="' . wooccm_wpml_string(esc_attr($option_text)) . '" /> ' . wooccm_wpml_string(esc_html($option_text)) . '</label>';
|
98 |
}
|
99 |
}
|
100 |
|
103 |
return $field;
|
104 |
}
|
105 |
|
106 |
+
add_filter('woocommerce_form_field_radio', 'wooccm_checkout_field_radio_handler', 10, 4);
|
107 |
|
108 |
// Multi-Checkbox
|
109 |
function wooccm_checkout_field_multicheckbox_handler($field = '', $key, $args, $value) {
|
217 |
}
|
218 |
|
219 |
add_filter('woocommerce_form_field_heading', 'wooccm_checkout_field_heading_handler', 10, 4);
|
220 |
+
|
221 |
+
// Country
|
222 |
+
// -----------------------------------------------------------------------------
|
223 |
+
function wooccm_checkout_field_country_handler($field = '', $key, $args, $value) {
|
224 |
+
|
225 |
+
static $instance = 0;
|
226 |
+
|
227 |
+
if ($instance) {
|
228 |
+
return $field;
|
229 |
+
}
|
230 |
+
|
231 |
+
$instance++;
|
232 |
+
|
233 |
+
ob_start();
|
234 |
+
|
235 |
+
if (!empty($args['default'])) {
|
236 |
+
$value = $args['default'];
|
237 |
+
}
|
238 |
+
|
239 |
+
woocommerce_form_field($key, $args, $value);
|
240 |
+
|
241 |
+
return ob_get_clean();
|
242 |
+
}
|
243 |
+
|
244 |
+
add_filter('woocommerce_form_field_country', 'wooccm_checkout_field_country_handler', 10, 4);
|
245 |
+
|
246 |
+
// State
|
247 |
+
// -----------------------------------------------------------------------------
|
248 |
+
function wooccm_checkout_field_state_handler($field = '', $key, $args, $value) {
|
249 |
+
|
250 |
+
static $instance = 0;
|
251 |
+
|
252 |
+
if ($instance) {
|
253 |
+
return $field;
|
254 |
+
}
|
255 |
+
|
256 |
+
$instance++;
|
257 |
+
|
258 |
+
ob_start();
|
259 |
+
|
260 |
+
if (!empty($args['default'])) {
|
261 |
+
$value = $args['default'];
|
262 |
+
}
|
263 |
+
|
264 |
+
woocommerce_form_field($key, $args, $value);
|
265 |
+
|
266 |
+
return ob_get_clean();
|
267 |
+
}
|
268 |
+
|
269 |
+
add_filter('woocommerce_form_field_state', 'wooccm_checkout_field_state_handler', 10, 4);
|
new/view/frontend/order.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!class_exists('WOOCCM_Order')) {
|
4 |
-
|
5 |
-
class WOOCCM_Order {
|
6 |
-
|
7 |
-
protected static $instance;
|
8 |
-
|
9 |
-
function enqueue_scripts() {
|
10 |
-
|
11 |
-
if (is_account_page()) {
|
12 |
-
|
13 |
-
WOOCCM()->register_scripts();
|
14 |
-
|
15 |
-
wp_enqueue_style('wooccm');
|
16 |
-
wp_enqueue_style('dashicons');
|
17 |
-
wp_enqueue_script('wooccm-order-upload');
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
function add_order_uploads($order_id) {
|
22 |
-
|
23 |
-
if ($order = wc_get_order($order_id)) {
|
24 |
-
|
25 |
-
$options = get_option('wccs_settings');
|
26 |
-
|
27 |
-
if (empty($options['checkness']['upload_os']) || ( $order->get_status() == "wc-{$options['checkness']['upload_os']}" )) {
|
28 |
-
|
29 |
-
|
30 |
-
$attachments = get_posts(array(
|
31 |
-
'fields' => 'ids',
|
32 |
-
'post_type' => 'attachment',
|
33 |
-
'numberposts' => -1,
|
34 |
-
'post_status' => null,
|
35 |
-
'post_parent' => $order->get_id())
|
36 |
-
);
|
37 |
-
|
38 |
-
wc_get_template('templates/order/order-uploads.php', array('order' => $order, 'attachments' => $attachments), '', WOOCCM_PLUGIN_DIR);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
function init() {
|
44 |
-
|
45 |
-
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
46 |
-
|
47 |
-
if ($options = get_option('wccs_settings')) {
|
48 |
-
if (!empty($options['checkness']['enable_file_upload'])) {
|
49 |
-
add_action('woocommerce_view_order', array($this, 'add_order_uploads'));
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
public static function instance() {
|
55 |
-
if (!isset(self::$instance)) {
|
56 |
-
self::$instance = new self();
|
57 |
-
self::$instance->init();
|
58 |
-
}
|
59 |
-
return self::$instance;
|
60 |
-
}
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
WOOCCM_Order::instance();
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
|
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 5.2.3
|
7 |
-
Stable tag: 4.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -137,8 +137,17 @@ Example:
|
|
137 |
|
138 |
== Changelog ==
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
= 4.5.5 =
|
141 |
* Fix: woocommerce default phone and email missing
|
|
|
|
|
|
|
142 |
|
143 |
= 4.5.4 =
|
144 |
* Improvement: woocommerce order fields rebuilt
|
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.7
|
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.7 =
|
141 |
+
* Fix: woocommerce default label and placeholder i18n
|
142 |
+
|
143 |
+
= 4.5.6 =
|
144 |
+
* Fix: woocommerce settings page permissions
|
145 |
+
|
146 |
= 4.5.5 =
|
147 |
* Fix: woocommerce default phone and email missing
|
148 |
+
* Improvement: woocommerce checkout options panel
|
149 |
+
* Improvement: woocommerce order options panel
|
150 |
+
* Improvement: woocommerce advanced options panel
|
151 |
|
152 |
= 4.5.4 =
|
153 |
* Improvement: woocommerce order fields rebuilt
|
templates/{checkout/thankyou-fields.php → order/order-custom-fields.php}
RENAMED
@@ -1,11 +1,11 @@
|
|
1 |
-
<h2 class="woocommerce-order-details__title"><?php
|
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($
|
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']); ?>
|
@@ -19,7 +19,7 @@
|
|
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($
|
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']); ?>
|
@@ -34,7 +34,7 @@
|
|
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($
|
38 |
if ($value):
|
39 |
?>
|
40 |
<tr id="tr-<?php echo esc_attr($field['key']); ?>" class="woocommerce-table__line-item order_item">
|
1 |
+
<h2 class="woocommerce-order-details__title"><?php echo ($title = get_option('wooccm_order_custom_fields_title', false)) ? esc_html($title) : esc_html__('Upload files', '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_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']); ?>
|
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_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']); ?>
|
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_id, sprintf('_%s_%s', 'additional', $field['name']), true) ? $value : get_post_meta($order_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">
|
templates/order/{order-uploads.php → order-upload-files.php}
RENAMED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
<div id="wooccm_order_attachment_inner">
|
2 |
<table class="woocommerce_order_items shop_table">
|
3 |
<thead>
|
1 |
+
<h2 class="woocommerce-order-details__title"><?php echo ($title = get_option('wooccm_order_upload_files_title', false)) ? esc_html($title) : esc_html__('Custom fields', 'woocommerce-checkout-manager'); ?></h2>
|
2 |
+
|
3 |
<div id="wooccm_order_attachment_inner">
|
4 |
<table class="woocommerce_order_items shop_table">
|
5 |
<thead>
|
woocommerce-checkout-manager.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Plugin Name: WooCommerce Checkout Manager
|
5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
-
* Version: 4.5.
|
7 |
* Author: QuadLayers
|
8 |
* Author URI: https://www.quadlayers.com
|
9 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
@@ -17,7 +17,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
|
|
17 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
18 |
}
|
19 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
20 |
-
define('WOOCCM_PLUGIN_VERSION', '4.5.
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
@@ -50,6 +50,10 @@ if (!defined('WOOCCM_GROUP_URL')) {
|
|
50 |
define('WOOCCM_GROUP_URL', 'https://www.facebook.com/groups/quadlayers');
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
53 |
if (!class_exists('WOOCCM', false)) {
|
54 |
include_once WOOCCM_PLUGIN_DIR . 'new/class-wooccm.php';
|
55 |
}
|
@@ -61,31 +65,3 @@ function WOOCCM() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionNam
|
|
61 |
// Global for backwards compatibility.
|
62 |
$GLOBALS['wooccm'] = WOOCCM();
|
63 |
|
64 |
-
add_action('woocommerce_before_checkout_form', 'wooccm_autocreate_account');
|
65 |
-
// E-mail - Order receipt
|
66 |
-
add_action('woocommerce_email_after_order_table', 'wooccm_order_receipt_checkout_details', 10, 3);
|
67 |
-
// Save the Order meta
|
68 |
-
add_action('woocommerce_checkout_update_order_meta', 'wooccm_custom_checkout_field_update_order_meta');
|
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);
|
76 |
-
add_filter('woocommerce_checkout_fields', 'wooccm_remove_fields_filter_shipping', 1);
|
77 |
-
add_action('wp_head', 'wooccm_display_front');
|
78 |
-
|
79 |
-
add_filter('wcdn_order_info_fields', 'wooccm_woocommerce_delivery_notes_compat', 10, 2);
|
80 |
-
add_filter('wc_customer_order_csv_export_order_row', 'wooccm_csv_export_modify_row_data', 10, 3);
|
81 |
-
add_filter('wc_customer_order_csv_export_order_headers', 'wooccm_csv_export_modify_column_headers');
|
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 |
-
}
|
3 |
/**
|
4 |
* Plugin Name: WooCommerce Checkout Manager
|
5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
+
* Version: 4.5.7
|
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.7');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
50 |
define('WOOCCM_GROUP_URL', 'https://www.facebook.com/groups/quadlayers');
|
51 |
}
|
52 |
|
53 |
+
if (!defined('WOOCCM_WC_DOMAIN')) {
|
54 |
+
define('WOOCCM_WC_DOMAIN', 'woocommerce');
|
55 |
+
}
|
56 |
+
|
57 |
if (!class_exists('WOOCCM', false)) {
|
58 |
include_once WOOCCM_PLUGIN_DIR . 'new/class-wooccm.php';
|
59 |
}
|
65 |
// Global for backwards compatibility.
|
66 |
$GLOBALS['wooccm'] = WOOCCM();
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|