Version Description
- Fix: small CSS issues
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 4.9.1 |
Comparing to | |
See all releases |
Code changes from version 4.9.0 to 4.9.1
- includes/controller/class-wooccm-email.php +4 -4
- includes/controller/class-wooccm-field-additional.php +222 -0
- includes/controller/class-wooccm-field-billing.php +93 -0
- includes/controller/class-wooccm-field-shipping.php +93 -0
- includes/controller/class-wooccm-field.php +25 -263
- includes/model/class-wooccm-field-additional.php +2 -0
- includes/model/class-wooccm-field-billing.php +3 -1
- includes/model/class-wooccm-field-shipping.php +2 -0
- includes/view/backend/pages/modals/parts/panel-admin.php +1 -1
- includes/view/backend/pages/modals/parts/panel-datepicker.php +1 -1
- includes/view/backend/pages/modals/parts/panel-display.php +1 -1
- includes/view/backend/pages/modals/parts/panel-filter.php +1 -1
- includes/view/backend/pages/modals/parts/panel-general.php +1 -1
- includes/view/backend/pages/modals/parts/panel-options.php +1 -1
- includes/view/backend/pages/modals/parts/panel-price.php +1 -1
- includes/view/backend/pages/modals/parts/panel-select2.php +1 -1
- includes/view/backend/pages/modals/parts/panel-timepicker.php +2 -2
- includes/view/backend/pages/modals/parts/tabs.php +1 -1
- includes/view/frontend/class-wooccm-fields-additional.php +21 -22
- includes/view/frontend/class-wooccm-fields-handler.php +8 -6
- readme.txt +4 -1
- woocommerce-checkout-manager.php +2 -2
includes/controller/class-wooccm-email.php
CHANGED
@@ -26,7 +26,7 @@ class WOOCCM_Order_Email_Controller {
|
|
26 |
),
|
27 |
array(
|
28 |
'name' => esc_html__('Add upload files', 'woocommerce-checkout-manager'),
|
29 |
-
'desc_tip' => esc_html__('Allow customers to upload files in the
|
30 |
'id' => 'wooccm_email_upload_files',
|
31 |
'type' => 'select',
|
32 |
'class' => 'chosen_select wooccm-premium-field',
|
@@ -39,7 +39,7 @@ class WOOCCM_Order_Email_Controller {
|
|
39 |
),
|
40 |
array(
|
41 |
'name' => esc_html__('Add for this order status', 'woocommerce-checkout-manager'),
|
42 |
-
'desc_tip' => esc_html__('Allow customers to upload files in the
|
43 |
'id' => 'wooccm_email_upload_files_order_status',
|
44 |
'type' => 'multiselect',
|
45 |
'class' => 'chosen_select wooccm-premium-field',
|
@@ -58,7 +58,7 @@ class WOOCCM_Order_Email_Controller {
|
|
58 |
),
|
59 |
array(
|
60 |
'name' => esc_html__('Add custom fields', 'woocommerce-checkout-manager-pro'),
|
61 |
-
'desc_tip' => esc_html__('Show the selected fields in the
|
62 |
'id' => 'wooccm_email_custom_fields',
|
63 |
'type' => 'select',
|
64 |
'class' => 'chosen_select wooccm-premium-field',
|
@@ -71,7 +71,7 @@ class WOOCCM_Order_Email_Controller {
|
|
71 |
),
|
72 |
array(
|
73 |
'name' => esc_html__('Add for this order status', 'woocommerce-checkout-manager-pro'),
|
74 |
-
'desc_tip' => esc_html__('Allow customers to upload files in the
|
75 |
'id' => 'wooccm_email_custom_fields_status',
|
76 |
'type' => 'multiselect',
|
77 |
'class' => 'chosen_select wooccm-premium-field',
|
26 |
),
|
27 |
array(
|
28 |
'name' => esc_html__('Add upload files', 'woocommerce-checkout-manager'),
|
29 |
+
'desc_tip' => esc_html__('Allow customers to upload files in the email.', 'woocommerce-checkout-manager'),
|
30 |
'id' => 'wooccm_email_upload_files',
|
31 |
'type' => 'select',
|
32 |
'class' => 'chosen_select wooccm-premium-field',
|
39 |
),
|
40 |
array(
|
41 |
'name' => esc_html__('Add for this order status', 'woocommerce-checkout-manager'),
|
42 |
+
'desc_tip' => esc_html__('Allow customers to upload files in the email.', 'woocommerce-checkout-manager'),
|
43 |
'id' => 'wooccm_email_upload_files_order_status',
|
44 |
'type' => 'multiselect',
|
45 |
'class' => 'chosen_select wooccm-premium-field',
|
58 |
),
|
59 |
array(
|
60 |
'name' => esc_html__('Add custom fields', 'woocommerce-checkout-manager-pro'),
|
61 |
+
'desc_tip' => esc_html__('Show the selected fields in the email.', 'woocommerce-checkout-manager-pro'),
|
62 |
'id' => 'wooccm_email_custom_fields',
|
63 |
'type' => 'select',
|
64 |
'class' => 'chosen_select wooccm-premium-field',
|
71 |
),
|
72 |
array(
|
73 |
'name' => esc_html__('Add for this order status', 'woocommerce-checkout-manager-pro'),
|
74 |
+
'desc_tip' => esc_html__('Allow customers to upload files in the email.', 'woocommerce-checkout-manager-pro'),
|
75 |
'id' => 'wooccm_email_custom_fields_status',
|
76 |
'type' => 'multiselect',
|
77 |
'class' => 'chosen_select wooccm-premium-field',
|
includes/controller/class-wooccm-field-additional.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WOOCCM_Field_Controller_Additional extends WOOCCM_Field_Controller {
|
4 |
+
|
5 |
+
protected static $_instance;
|
6 |
+
public $additional;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
$this->includes();
|
10 |
+
$this->init();
|
11 |
+
}
|
12 |
+
|
13 |
+
public static function instance() {
|
14 |
+
if (is_null(self::$_instance)) {
|
15 |
+
self::$_instance = new self();
|
16 |
+
}
|
17 |
+
return self::$_instance;
|
18 |
+
}
|
19 |
+
|
20 |
+
function includes() {
|
21 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field-additional.php' );
|
22 |
+
}
|
23 |
+
|
24 |
+
function init() {
|
25 |
+
add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'add_order_data'));
|
26 |
+
add_action('woocommerce_checkout_update_order_meta', array($this, 'save_order_data'), 10, 2);
|
27 |
+
add_action('wooccm_sections_header', array($this, 'add_header'));
|
28 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
|
29 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_settings'));
|
30 |
+
}
|
31 |
+
|
32 |
+
function save_order_data($order_id, $data) {
|
33 |
+
|
34 |
+
if (count($fields = WOOCCM()->additional->get_fields())) {
|
35 |
+
|
36 |
+
foreach ($fields as $field_id => $field) {
|
37 |
+
|
38 |
+
$key = sprintf('_%s', $field['key']);
|
39 |
+
|
40 |
+
if (!empty($data[$field['key']])) {
|
41 |
+
|
42 |
+
$value = $data[$field['key']];
|
43 |
+
|
44 |
+
if ($field['type'] == 'textarea') {
|
45 |
+
update_post_meta($order_id, $key, wp_kses($value, false));
|
46 |
+
} else if (is_array($value)) {
|
47 |
+
update_post_meta($order_id, $key, implode(',', array_map('sanitize_text_field', $value)));
|
48 |
+
} else {
|
49 |
+
update_post_meta($order_id, $key, sanitize_text_field($value));
|
50 |
+
}
|
51 |
+
}
|
52 |
+
//
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function save_settings() {
|
58 |
+
|
59 |
+
global $current_section;
|
60 |
+
|
61 |
+
if ('additional' == $current_section) {
|
62 |
+
woocommerce_update_options($this->get_settings());
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
function get_settings() {
|
67 |
+
|
68 |
+
return array(
|
69 |
+
array(
|
70 |
+
'desc_tip' => esc_html__('Select the position of the additional fields.', 'woocommerce-checkout-manager'),
|
71 |
+
'id' => 'wooccm_additional_position',
|
72 |
+
'type' => 'select',
|
73 |
+
//'class' => 'chosen_select',
|
74 |
+
'options' => array(
|
75 |
+
'before_billing_form' => esc_html__('Before billing form', 'woocommerce-checkout-manager'),
|
76 |
+
'after_billing_form' => esc_html__('After billing form', 'woocommerce-checkout-manager'),
|
77 |
+
'before_order_notes' => esc_html__('Before order notes', 'woocommerce-checkout-manager'),
|
78 |
+
'after_order_notes' => esc_html__('After order notes', 'woocommerce-checkout-manager'),
|
79 |
+
),
|
80 |
+
'default' => 'before_order_notes',
|
81 |
+
));
|
82 |
+
}
|
83 |
+
|
84 |
+
// Admin Order
|
85 |
+
// ---------------------------------------------------------------------------
|
86 |
+
|
87 |
+
function add_order_data($order) {
|
88 |
+
|
89 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-handler.php' );
|
90 |
+
|
91 |
+
if ($fields = WOOCCM()->additional->get_fields()) {
|
92 |
+
$template = WOOCCM()->additional->get_template_types();
|
93 |
+
$options = WOOCCM()->additional->get_option_types();
|
94 |
+
$multiple = WOOCCM()->additional->get_multiple_types();
|
95 |
+
?>
|
96 |
+
</div>
|
97 |
+
<style>
|
98 |
+
#order_data .order_data_column {
|
99 |
+
width: 23%;
|
100 |
+
}
|
101 |
+
#order_data .order_data_column_additional .form-field {
|
102 |
+
width: 100%;
|
103 |
+
clear: both;
|
104 |
+
}
|
105 |
+
</style>
|
106 |
+
<div class="order_data_column order_data_column_additional">
|
107 |
+
<h3>
|
108 |
+
<?php esc_html_e('Additional', 'woocommerce-checkout-manager'); ?>
|
109 |
+
<a href="#" class="edit_address"><?php esc_html_e('Edit', 'woocommerce-checkout-manager'); ?></a>
|
110 |
+
<span>
|
111 |
+
<a href="<?php echo esc_url(WOOCCM_PURCHASE_URL); ?>" class="load_customer_additional" target="_blank" style="display:none;font-size: 13px;font-weight: 400;">
|
112 |
+
<?php esc_html_e('This is a premium feature.', 'woocommerce-checkout-manager'); ?>
|
113 |
+
</a>
|
114 |
+
</span>
|
115 |
+
</h3>
|
116 |
+
<div class="address">
|
117 |
+
<?php
|
118 |
+
foreach ($fields as $field_id => $field) {
|
119 |
+
|
120 |
+
$key = sprintf('_%s', $field['key']);
|
121 |
+
|
122 |
+
if (!$value = get_post_meta($order->get_id(), $key, true)) {
|
123 |
+
|
124 |
+
$value = maybe_unserialize(get_post_meta($order->get_id(), sprintf('%s', $field['name']), true));
|
125 |
+
|
126 |
+
if (is_array($value)) {
|
127 |
+
$value = implode(',', $value);
|
128 |
+
}
|
129 |
+
|
130 |
+
update_post_meta($order->get_id(), $key, $value);
|
131 |
+
delete_post_meta($order->get_id(), sprintf('%s', $field['name']));
|
132 |
+
}
|
133 |
+
|
134 |
+
if ($value) {
|
135 |
+
?>
|
136 |
+
<p id="<?php echo esc_attr($field['key']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
137 |
+
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $key, __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
138 |
+
<?php printf('%s', $field['label'] ? esc_html($field['label']) : sprintf(esc_html__('Field %s', 'woocommerce-checkout-manager'), $field_id)); ?>
|
139 |
+
</strong>
|
140 |
+
<?php echo esc_html($value); ?>
|
141 |
+
</p>
|
142 |
+
<?php
|
143 |
+
}
|
144 |
+
}
|
145 |
+
?>
|
146 |
+
</div>
|
147 |
+
<div class="edit_address">
|
148 |
+
<?php
|
149 |
+
foreach ($fields as $field_id => $field) {
|
150 |
+
|
151 |
+
if (in_array($field['type'], $template)) {
|
152 |
+
continue;
|
153 |
+
}
|
154 |
+
|
155 |
+
$key = sprintf('_%s', $field['key']);
|
156 |
+
|
157 |
+
$field['id'] = sprintf('_%s', $field['key']);
|
158 |
+
$field['name'] = $field['key'];
|
159 |
+
$field['value'] = null;
|
160 |
+
$field['class'] = join(' ', $field['class']);
|
161 |
+
$field['wrapper_class'] = 'wooccm-premium';
|
162 |
+
|
163 |
+
if (!$field['value'] = get_post_meta($order->get_id(), $key, true)) {
|
164 |
+
|
165 |
+
$field['value'] = maybe_unserialize(get_post_meta($order->get_id(), sprintf('%s', $field['name']), true));
|
166 |
+
|
167 |
+
if (is_array($field['value'])) {
|
168 |
+
$field['value'] = implode(',', $field['value']);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
switch ($field['type']) {
|
173 |
+
case 'textarea':
|
174 |
+
woocommerce_wp_textarea_input($field);
|
175 |
+
break;
|
176 |
+
default:
|
177 |
+
$field['type'] = 'text';
|
178 |
+
woocommerce_wp_text_input($field);
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
?>
|
183 |
+
</div>
|
184 |
+
<?php
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
// Admin
|
189 |
+
// ---------------------------------------------------------------------------
|
190 |
+
|
191 |
+
public function add_header() {
|
192 |
+
global $current_section;
|
193 |
+
?>
|
194 |
+
<li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm§ion=additional'); ?>" class="<?php echo ( $current_section == 'additional' ? 'current' : '' ); ?>"><?php esc_html_e('Additional', 'woocommerce-checkout-manager'); ?></a> | </li>
|
195 |
+
<?php
|
196 |
+
}
|
197 |
+
|
198 |
+
public function add_section() {
|
199 |
+
|
200 |
+
global $current_section, $wp_roles, $wp_locale;
|
201 |
+
|
202 |
+
if ('additional' == $current_section) {
|
203 |
+
|
204 |
+
$fields = WOOCCM()->additional->get_fields();
|
205 |
+
$defaults = WOOCCM()->additional->get_defaults();
|
206 |
+
$types = WOOCCM()->additional->get_types();
|
207 |
+
$conditionals = WOOCCM()->additional->get_conditional_types();
|
208 |
+
$option = WOOCCM()->additional->get_option_types();
|
209 |
+
$multiple = WOOCCM()->additional->get_multiple_types();
|
210 |
+
$template = WOOCCM()->additional->get_template_types();
|
211 |
+
$disabled = WOOCCM()->additional->get_disabled_types();
|
212 |
+
$product_categories = $this->get_product_categories();
|
213 |
+
$settings = $this->get_settings();
|
214 |
+
|
215 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/backend/pages/additional.php' );
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
WOOCCM_Field_Controller_Additional::instance();
|
222 |
+
|
includes/controller/class-wooccm-field-billing.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WOOCCM_Field_Controller_Billing extends WOOCCM_Field_Controller {
|
4 |
+
|
5 |
+
protected static $_instance;
|
6 |
+
public $billing;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
$this->includes();
|
10 |
+
$this->init();
|
11 |
+
}
|
12 |
+
|
13 |
+
public static function instance() {
|
14 |
+
if (is_null(self::$_instance)) {
|
15 |
+
self::$_instance = new self();
|
16 |
+
}
|
17 |
+
return self::$_instance;
|
18 |
+
}
|
19 |
+
|
20 |
+
function includes() {
|
21 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field-billing.php' );
|
22 |
+
}
|
23 |
+
|
24 |
+
function init() {
|
25 |
+
add_action('wooccm_sections_header', array($this, 'add_header'));
|
26 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
|
27 |
+
add_action('woocommerce_admin_order_data_after_billing_address', array($this, 'add_order_data'));
|
28 |
+
}
|
29 |
+
|
30 |
+
// Admin
|
31 |
+
// ---------------------------------------------------------------------------
|
32 |
+
|
33 |
+
public function add_section() {
|
34 |
+
|
35 |
+
global $current_section, $wp_roles, $wp_locale;
|
36 |
+
|
37 |
+
if ('billing' == $current_section) {
|
38 |
+
|
39 |
+
$fields = WOOCCM()->billing->get_fields();
|
40 |
+
$defaults = WOOCCM()->billing->get_defaults();
|
41 |
+
$types = WOOCCM()->billing->get_types();
|
42 |
+
$conditionals = WOOCCM()->billing->get_conditional_types();
|
43 |
+
$option = WOOCCM()->billing->get_option_types();
|
44 |
+
$multiple = WOOCCM()->billing->get_multiple_types();
|
45 |
+
$template = WOOCCM()->billing->get_template_types();
|
46 |
+
$disabled = WOOCCM()->billing->get_disabled_types();
|
47 |
+
$product_categories = $this->get_product_categories();
|
48 |
+
|
49 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/backend/pages/billing.php' );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
public function add_header() {
|
54 |
+
global $current_section;
|
55 |
+
?>
|
56 |
+
<li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm§ion=billing'); ?>" class="<?php echo ( $current_section == 'billing' ? 'current' : '' ); ?>"><?php esc_html_e('Billing', 'woocommerce-checkout-manager'); ?></a> | </li>
|
57 |
+
<?php
|
58 |
+
}
|
59 |
+
|
60 |
+
// Admin Order
|
61 |
+
// ---------------------------------------------------------------------------
|
62 |
+
|
63 |
+
function add_order_data($order) {
|
64 |
+
|
65 |
+
if ($fields = WOOCCM()->billing->get_fields()) {
|
66 |
+
|
67 |
+
$defaults = WOOCCM()->billing->get_defaults();
|
68 |
+
|
69 |
+
foreach ($fields as $field_id => $field) {
|
70 |
+
|
71 |
+
if (!in_array($field['name'], $defaults)) {
|
72 |
+
|
73 |
+
$key = sprintf('_%s', $field['key']);
|
74 |
+
|
75 |
+
if ($value = get_post_meta($order->get_id(), $key, true)) {
|
76 |
+
?>
|
77 |
+
<p id="<?php echo esc_attr($field['key']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
78 |
+
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $key, __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
79 |
+
<?php echo esc_attr(trim($field['label'])); ?>:
|
80 |
+
</strong>
|
81 |
+
<br />
|
82 |
+
<?php echo esc_html($value); ?>
|
83 |
+
</p>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
WOOCCM_Field_Controller_Billing::instance();
|
includes/controller/class-wooccm-field-shipping.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WOOCCM_Field_Controller_Shipping extends WOOCCM_Field_Controller {
|
4 |
+
|
5 |
+
protected static $_instance;
|
6 |
+
public $shipping;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
$this->includes();
|
10 |
+
$this->init();
|
11 |
+
}
|
12 |
+
|
13 |
+
public static function instance() {
|
14 |
+
if (is_null(self::$_instance)) {
|
15 |
+
self::$_instance = new self();
|
16 |
+
}
|
17 |
+
return self::$_instance;
|
18 |
+
}
|
19 |
+
|
20 |
+
function includes() {
|
21 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field-shipping.php' );
|
22 |
+
}
|
23 |
+
|
24 |
+
function init() {
|
25 |
+
add_action('wooccm_sections_header', array($this, 'add_header'));
|
26 |
+
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section'), 99);
|
27 |
+
add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'add_order_data'));
|
28 |
+
}
|
29 |
+
|
30 |
+
// Admin
|
31 |
+
// ---------------------------------------------------------------------------
|
32 |
+
|
33 |
+
public function add_header() {
|
34 |
+
global $current_section;
|
35 |
+
?>
|
36 |
+
<li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm§ion=shipping'); ?>" class="<?php echo ( $current_section == 'shipping' ? 'current' : '' ); ?>"><?php esc_html_e('Shipping', 'woocommerce-checkout-manager'); ?></a> | </li>
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
|
40 |
+
public function add_section() {
|
41 |
+
|
42 |
+
global $current_section, $wp_roles, $wp_locale;
|
43 |
+
|
44 |
+
if ('shipping' == $current_section) {
|
45 |
+
|
46 |
+
$fields = WOOCCM()->shipping->get_fields();
|
47 |
+
$defaults = WOOCCM()->shipping->get_defaults();
|
48 |
+
$types = WOOCCM()->shipping->get_types();
|
49 |
+
$conditionals = WOOCCM()->shipping->get_conditional_types();
|
50 |
+
$option = WOOCCM()->billing->get_option_types();
|
51 |
+
$multiple = WOOCCM()->billing->get_multiple_types();
|
52 |
+
$template = WOOCCM()->billing->get_template_types();
|
53 |
+
$disabled = WOOCCM()->billing->get_disabled_types();
|
54 |
+
$product_categories = $this->get_product_categories();
|
55 |
+
|
56 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/backend/pages/shipping.php' );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
// Admin Order
|
61 |
+
// ---------------------------------------------------------------------------
|
62 |
+
|
63 |
+
function add_order_data($order) {
|
64 |
+
|
65 |
+
if ($fields = WOOCCM()->shipping->get_fields()) {
|
66 |
+
|
67 |
+
$defaults = WOOCCM()->shipping->get_defaults();
|
68 |
+
|
69 |
+
foreach ($fields as $field_id => $field) {
|
70 |
+
|
71 |
+
if (!in_array($field['name'], $defaults)) {
|
72 |
+
|
73 |
+
$key = sprintf('_%s', $field['key']);
|
74 |
+
|
75 |
+
if ($value = get_post_meta($order->get_id(), $key, true)) {
|
76 |
+
?>
|
77 |
+
<p id="<?php echo esc_attr($field['key']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
78 |
+
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $key, __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
79 |
+
<?php echo esc_attr(trim($field['label'])); ?>:
|
80 |
+
</strong>
|
81 |
+
<br/>
|
82 |
+
<?php echo esc_html($value); ?>
|
83 |
+
</p>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
WOOCCM_Field_Controller_Shipping::instance();
|
includes/controller/class-wooccm-field.php
CHANGED
@@ -4,8 +4,6 @@ class WOOCCM_Field_Controller {
|
|
4 |
|
5 |
protected static $_instance;
|
6 |
public $billing;
|
7 |
-
public $shipping;
|
8 |
-
public $additional;
|
9 |
|
10 |
public function __construct() {
|
11 |
$this->includes();
|
@@ -354,272 +352,36 @@ class WOOCCM_Field_Controller {
|
|
354 |
}
|
355 |
}
|
356 |
|
357 |
-
function
|
358 |
-
|
359 |
-
return array(
|
360 |
-
array(
|
361 |
-
'desc_tip' => esc_html__('Select the position of the additional fields.', 'woocommerce-checkout-manager'),
|
362 |
-
'id' => 'wooccm_additional_position',
|
363 |
-
'type' => 'select',
|
364 |
-
//'class' => 'chosen_select',
|
365 |
-
'options' => array(
|
366 |
-
'before_billing_form' => esc_html__('Before billing form', 'woocommerce-checkout-manager'),
|
367 |
-
'after_billing_form' => esc_html__('After billing form', 'woocommerce-checkout-manager'),
|
368 |
-
'before_order_notes' => esc_html__('Before order notes', 'woocommerce-checkout-manager'),
|
369 |
-
'after_order_notes' => esc_html__('After order notes', 'woocommerce-checkout-manager'),
|
370 |
-
),
|
371 |
-
'default' => 'before_order_notes',
|
372 |
-
));
|
373 |
-
}
|
374 |
|
375 |
-
|
|
|
|
|
376 |
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
}
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
if (!in_array($field['name'], $defaults)) {
|
396 |
-
|
397 |
-
$key = sprintf('_%s', $field['key']);
|
398 |
-
|
399 |
-
if ($value = get_post_meta($order->get_id(), $key, true)) {
|
400 |
-
?>
|
401 |
-
<p id="<?php echo esc_attr($field['key']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
402 |
-
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $key, __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
403 |
-
<?php echo esc_attr(trim($field['label'])); ?>:
|
404 |
-
</strong>
|
405 |
-
<br />
|
406 |
-
<?php echo esc_html($value); ?>
|
407 |
-
</p>
|
408 |
-
<?php
|
409 |
-
}
|
410 |
-
}
|
411 |
-
}
|
412 |
-
}
|
413 |
}
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
if ($fields = WOOCCM()->shipping->get_fields()) {
|
418 |
-
|
419 |
-
$defaults = WOOCCM()->shipping->get_defaults();
|
420 |
-
|
421 |
-
foreach ($fields as $field_id => $field) {
|
422 |
-
|
423 |
-
if (!in_array($field['name'], $defaults)) {
|
424 |
-
|
425 |
-
$key = sprintf('_%s', $field['key']);
|
426 |
-
|
427 |
-
if ($value = get_post_meta($order->get_id(), $key, true)) {
|
428 |
-
?>
|
429 |
-
<p id="<?php echo esc_attr($field['key']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
430 |
-
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $key, __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
431 |
-
<?php echo esc_attr(trim($field['label'])); ?>:
|
432 |
-
</strong>
|
433 |
-
<br/>
|
434 |
-
<?php echo esc_html($value); ?>
|
435 |
-
</p>
|
436 |
-
<?php
|
437 |
-
}
|
438 |
-
}
|
439 |
-
}
|
440 |
-
}
|
441 |
-
}
|
442 |
-
|
443 |
-
function add_order_additional_data($order) {
|
444 |
-
|
445 |
-
if ($fields = WOOCCM()->additional->get_fields()) {
|
446 |
-
?>
|
447 |
-
<!--<div class="order_data_column">-->
|
448 |
-
</div>
|
449 |
-
<style>
|
450 |
-
#order_data .order_data_column {
|
451 |
-
width: 23%;
|
452 |
-
}
|
453 |
-
</style>
|
454 |
-
<div class="order_data_column">
|
455 |
-
<h3><?php esc_html_e('Additional', 'woocommerce-checkout-manager'); ?></h3>
|
456 |
-
<?php
|
457 |
-
$defaults = WOOCCM()->additional->get_defaults();
|
458 |
-
|
459 |
-
foreach ($fields as $field_id => $field) {
|
460 |
-
|
461 |
-
$key = sprintf('_%s', $field['key']);
|
462 |
-
|
463 |
-
if (!$value = get_post_meta($order->get_id(), $key, true)) {
|
464 |
-
|
465 |
-
$value = maybe_unserialize(get_post_meta($order->get_id(), sprintf('%s', $field['name']), true));
|
466 |
-
|
467 |
-
if (is_array($value)) {
|
468 |
-
$value = implode(',', $value);
|
469 |
-
}
|
470 |
-
|
471 |
-
update_post_meta($order->get_id(), $key, $value);
|
472 |
-
delete_post_meta($order->get_id(), sprintf('%s', $field['name']));
|
473 |
-
}
|
474 |
-
|
475 |
-
if ($value) {
|
476 |
-
?>
|
477 |
-
<p id="<?php echo esc_attr($field['key']); ?>" class="form-field form-field-wide form-field-type-<?php echo esc_attr($field['type']); ?>">
|
478 |
-
<strong title="<?php echo esc_attr(sprintf(__('ID: %s | Field Type: %s', 'woocommerce-checkout-manager'), $key, __('Generic', 'woocommerce-checkout-manager'))); ?>">
|
479 |
-
<?php printf('%s', $field['label'] ? esc_html($field['label']) : sprintf(esc_html__('Field %s', 'woocommerce-checkout-manager'), $field_id)); ?>
|
480 |
-
</strong>
|
481 |
-
<br/>
|
482 |
-
<?php echo esc_html($value); ?>
|
483 |
-
</p>
|
484 |
-
<?php
|
485 |
-
}
|
486 |
-
}
|
487 |
-
?>
|
488 |
-
<!--</div>-->
|
489 |
-
<?php
|
490 |
-
}
|
491 |
-
}
|
492 |
-
|
493 |
-
// Admin
|
494 |
-
// ---------------------------------------------------------------------------
|
495 |
-
|
496 |
-
public function add_section_billing() {
|
497 |
-
|
498 |
-
global $current_section, $wp_roles, $wp_locale;
|
499 |
-
|
500 |
-
if ('billing' == $current_section) {
|
501 |
-
|
502 |
-
$fields = WOOCCM()->billing->get_fields();
|
503 |
-
$defaults = WOOCCM()->billing->get_defaults();
|
504 |
-
$types = WOOCCM()->billing->get_types();
|
505 |
-
$conditionals = WOOCCM()->billing->get_conditional_types();
|
506 |
-
$option = WOOCCM()->billing->get_option_types();
|
507 |
-
$multiple = WOOCCM()->billing->get_multiple_types();
|
508 |
-
$template = WOOCCM()->billing->get_template_types();
|
509 |
-
$disabled = WOOCCM()->billing->get_disabled_types();
|
510 |
-
$product_categories = $this->get_product_categories();
|
511 |
-
|
512 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/backend/pages/billing.php' );
|
513 |
-
}
|
514 |
-
}
|
515 |
-
|
516 |
-
public function add_header_billing() {
|
517 |
-
global $current_section;
|
518 |
-
?>
|
519 |
-
<li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm§ion=billing'); ?>" class="<?php echo ( $current_section == 'billing' ? 'current' : '' ); ?>"><?php esc_html_e('Billing', 'woocommerce-checkout-manager'); ?></a> | </li>
|
520 |
-
<?php
|
521 |
-
}
|
522 |
-
|
523 |
-
public function add_header_shipping() {
|
524 |
-
global $current_section;
|
525 |
-
?>
|
526 |
-
<li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm§ion=shipping'); ?>" class="<?php echo ( $current_section == 'shipping' ? 'current' : '' ); ?>"><?php esc_html_e('Shipping', 'woocommerce-checkout-manager'); ?></a> | </li>
|
527 |
-
<?php
|
528 |
-
}
|
529 |
-
|
530 |
-
public function add_header_additional() {
|
531 |
-
global $current_section;
|
532 |
-
?>
|
533 |
-
<li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm§ion=additional'); ?>" class="<?php echo ( $current_section == 'additional' ? 'current' : '' ); ?>"><?php esc_html_e('Additional', 'woocommerce-checkout-manager'); ?></a> | </li>
|
534 |
-
<?php
|
535 |
-
}
|
536 |
-
|
537 |
-
public function add_section_shipping() {
|
538 |
-
|
539 |
-
global $current_section, $wp_roles, $wp_locale;
|
540 |
-
|
541 |
-
if ('shipping' == $current_section) {
|
542 |
-
|
543 |
-
$fields = WOOCCM()->shipping->get_fields();
|
544 |
-
$defaults = WOOCCM()->shipping->get_defaults();
|
545 |
-
$types = WOOCCM()->shipping->get_types();
|
546 |
-
$conditionals = WOOCCM()->shipping->get_conditional_types();
|
547 |
-
$option = WOOCCM()->billing->get_option_types();
|
548 |
-
$multiple = WOOCCM()->billing->get_multiple_types();
|
549 |
-
$template = WOOCCM()->billing->get_template_types();
|
550 |
-
$disabled = WOOCCM()->billing->get_disabled_types();
|
551 |
-
$product_categories = $this->get_product_categories();
|
552 |
-
|
553 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/backend/pages/shipping.php' );
|
554 |
-
}
|
555 |
-
}
|
556 |
-
|
557 |
-
public function add_section_additional() {
|
558 |
-
|
559 |
-
global $current_section, $wp_roles, $wp_locale;
|
560 |
-
|
561 |
-
if ('additional' == $current_section) {
|
562 |
-
|
563 |
-
$fields = WOOCCM()->additional->get_fields();
|
564 |
-
$defaults = WOOCCM()->additional->get_defaults();
|
565 |
-
$types = WOOCCM()->additional->get_types();
|
566 |
-
$conditionals = WOOCCM()->additional->get_conditional_types();
|
567 |
-
$option = WOOCCM()->billing->get_option_types();
|
568 |
-
$multiple = WOOCCM()->billing->get_multiple_types();
|
569 |
-
$template = WOOCCM()->billing->get_template_types();
|
570 |
-
$disabled = WOOCCM()->billing->get_disabled_types();
|
571 |
-
$product_categories = $this->get_product_categories();
|
572 |
-
$settings = $this->get_additional_settings();
|
573 |
-
|
574 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/backend/pages/additional.php' );
|
575 |
-
}
|
576 |
-
}
|
577 |
-
|
578 |
-
function includes() {
|
579 |
-
|
580 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field.php' );
|
581 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field-billing.php' );
|
582 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field-shipping.php' );
|
583 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field-additional.php' );
|
584 |
-
|
585 |
-
if (!is_admin()) {
|
586 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-register.php' );
|
587 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-additional.php' );
|
588 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-disable.php' );
|
589 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-conditional.php' );
|
590 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-handler.php' );
|
591 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-i18n.php' );
|
592 |
-
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-filters.php' );
|
593 |
-
}
|
594 |
-
}
|
595 |
-
|
596 |
-
function init() {
|
597 |
-
|
598 |
-
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
599 |
-
add_action('wp_ajax_wooccm_load_parent', array($this, 'ajax_load_parent'));
|
600 |
-
add_action('wp_ajax_wooccm_load_field', array($this, 'ajax_load_field'));
|
601 |
-
add_action('wp_ajax_wooccm_save_field', array($this, 'ajax_save_field'));
|
602 |
-
add_action('wp_ajax_wooccm_delete_field', array($this, 'ajax_delete_field'));
|
603 |
-
add_action('wp_ajax_wooccm_reset_fields', array($this, 'ajax_reset_fields'));
|
604 |
-
add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
|
605 |
-
add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
|
606 |
-
|
607 |
-
add_action('woocommerce_admin_order_data_after_billing_address', array($this, 'add_order_billing_data'));
|
608 |
-
add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'add_order_shipping_data'));
|
609 |
-
add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'add_order_additional_data'));
|
610 |
-
|
611 |
-
|
612 |
-
add_action('wooccm_sections_header', array($this, 'add_header_billing'));
|
613 |
-
add_action('wooccm_sections_header', array($this, 'add_header_shipping'));
|
614 |
-
add_action('wooccm_sections_header', array($this, 'add_header_additional'));
|
615 |
-
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_billing'), 99);
|
616 |
-
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_shipping'), 99);
|
617 |
-
add_action('woocommerce_sections_' . WOOCCM_PREFIX, array($this, 'add_section_additional'), 99);
|
618 |
-
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_field_order'));
|
619 |
-
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_additional_settings'));
|
620 |
-
}
|
621 |
-
|
622 |
-
}
|
623 |
|
624 |
-
|
625 |
-
|
4 |
|
5 |
protected static $_instance;
|
6 |
public $billing;
|
|
|
|
|
7 |
|
8 |
public function __construct() {
|
9 |
$this->includes();
|
352 |
}
|
353 |
}
|
354 |
|
355 |
+
function includes() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-billing.php' );
|
358 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-shipping.php' );
|
359 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-additional.php' );
|
360 |
|
361 |
+
if (!is_admin()) {
|
362 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-register.php' );
|
363 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-additional.php' );
|
364 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-disable.php' );
|
365 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-conditional.php' );
|
366 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-handler.php' );
|
367 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-i18n.php' );
|
368 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-filters.php' );
|
369 |
}
|
370 |
}
|
371 |
|
372 |
+
function init() {
|
373 |
+
|
374 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
375 |
+
add_action('wp_ajax_wooccm_load_parent', array($this, 'ajax_load_parent'));
|
376 |
+
add_action('wp_ajax_wooccm_load_field', array($this, 'ajax_load_field'));
|
377 |
+
add_action('wp_ajax_wooccm_save_field', array($this, 'ajax_save_field'));
|
378 |
+
add_action('wp_ajax_wooccm_delete_field', array($this, 'ajax_delete_field'));
|
379 |
+
add_action('wp_ajax_wooccm_reset_fields', array($this, 'ajax_reset_fields'));
|
380 |
+
add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
|
381 |
+
add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
|
382 |
+
add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_field_order'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
|
385 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
|
387 |
+
WOOCCM_Field_Controller::instance();
|
|
includes/model/class-wooccm-field-additional.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
if (!class_exists('WOOCCM_Field_Additional')) {
|
4 |
|
|
|
|
|
5 |
class WOOCCM_Field_Additional extends WOOCCM_Field {
|
6 |
|
7 |
protected static $_instance;
|
2 |
|
3 |
if (!class_exists('WOOCCM_Field_Additional')) {
|
4 |
|
5 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field.php' );
|
6 |
+
|
7 |
class WOOCCM_Field_Additional extends WOOCCM_Field {
|
8 |
|
9 |
protected static $_instance;
|
includes/model/class-wooccm-field-billing.php
CHANGED
@@ -2,9 +2,11 @@
|
|
2 |
|
3 |
if (!class_exists('WOOCCM_Field_Billing')) {
|
4 |
|
|
|
|
|
5 |
class WOOCCM_Field_Billing extends WOOCCM_Field {
|
6 |
|
7 |
-
protected static $_instance;
|
8 |
//protected $fields = array();
|
9 |
protected $prefix = 'billing';
|
10 |
protected $option_name = 'wooccm_billing';
|
2 |
|
3 |
if (!class_exists('WOOCCM_Field_Billing')) {
|
4 |
|
5 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field.php' );
|
6 |
+
|
7 |
class WOOCCM_Field_Billing extends WOOCCM_Field {
|
8 |
|
9 |
+
protected static $_instance;
|
10 |
//protected $fields = array();
|
11 |
protected $prefix = 'billing';
|
12 |
protected $option_name = 'wooccm_billing';
|
includes/model/class-wooccm-field-shipping.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
if (!class_exists('WOOCCM_Field_Shipping')) {
|
4 |
|
|
|
|
|
5 |
class WOOCCM_Field_Shipping extends WOOCCM_Field {
|
6 |
|
7 |
protected static $_instance;
|
2 |
|
3 |
if (!class_exists('WOOCCM_Field_Shipping')) {
|
4 |
|
5 |
+
include_once( WOOCCM_PLUGIN_DIR . 'includes/model/class-wooccm-field.php' );
|
6 |
+
|
7 |
class WOOCCM_Field_Shipping extends WOOCCM_Field {
|
8 |
|
9 |
protected static $_instance;
|
includes/view/backend/pages/modals/parts/panel-admin.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<# if (!_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
|
2 |
-
<div class="panel woocommerce_options_panel
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></label>
|
1 |
<# if (!_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
|
2 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'admin') { #>hidden<# } #>">
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-datepicker.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<# if (data.type == 'date') { #>
|
2 |
-
<div class="panel woocommerce_options_panel
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Enhance', 'woocommerce-checkout-manager'); ?></label>
|
1 |
<# if (data.type == 'date') { #>
|
2 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'datepicker') { #>hidden<# } #>">
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Enhance', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-display.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="panel woocommerce_options_panel
|
2 |
<div class="options_group wooccm-premium">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Hide on account', 'woocommerce-checkout-manager'); ?></label>
|
1 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'display') { #>hidden<# } #>">
|
2 |
<div class="options_group wooccm-premium">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Hide on account', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-filter.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="panel woocommerce_options_panel
|
2 |
<div class="options_group wooccm-premium wooccm-enhanced-between-days">
|
3 |
<p class="form-field dimensions_field">
|
4 |
<label><?php esc_html_e('Cart subtotal', 'woocommerce-checkout-manager'); ?></label>
|
1 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'filter') { #>hidden<# } #>">
|
2 |
<div class="options_group wooccm-premium wooccm-enhanced-between-days">
|
3 |
<p class="form-field dimensions_field">
|
4 |
<label><?php esc_html_e('Cart subtotal', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-general.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="panel woocommerce_options_panel
|
2 |
<div class="options_group">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Name', 'woocommerce-checkout-manager'); ?></label>
|
1 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'general') { #>hidden<# } #>">
|
2 |
<div class="options_group">
|
3 |
<p class="form-field">
|
4 |
<label><?php esc_html_e('Name', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-options.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<# if ( _.contains(<?php echo json_encode($option); ?>, data.type)) { #>
|
2 |
-
<div class="panel woocommerce_options_panel
|
3 |
<# if ( _.isObject(data.options)) { #>
|
4 |
<div class="options_group">
|
5 |
<table class="wc_gateways widefat wooccm-enhanced-options" style="border:none;box-shadow: none">
|
1 |
<# if ( _.contains(<?php echo json_encode($option); ?>, data.type)) { #>
|
2 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'options') { #>hidden<# } #>">
|
3 |
<# if ( _.isObject(data.options)) { #>
|
4 |
<div class="options_group">
|
5 |
<table class="wc_gateways widefat wooccm-enhanced-options" style="border:none;box-shadow: none">
|
includes/view/backend/pages/modals/parts/panel-price.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<# if (!_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
|
2 |
-
<div class="panel woocommerce_options_panel
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></label>
|
1 |
<# if (!_.contains(<?php echo json_encode(array_merge($option, $template)); ?>, data.type)) { #>
|
2 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'price') { #>hidden<# } #>">
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Price', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-select2.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<# if (_.contains(<?php echo json_encode(array('select', 'multiselect')); ?>, data.type)) { #>
|
2 |
-
<div class="panel woocommerce_options_panel
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Select2', 'woocommerce-checkout-manager'); ?></label>
|
1 |
<# if (_.contains(<?php echo json_encode(array('select', 'multiselect')); ?>, data.type)) { #>
|
2 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'select2') { #>hidden<# } #>">
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Select2', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/panel-timepicker.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
|
2 |
-
<div class="panel woocommerce_options_panel
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Enhance', 'woocommerce-checkout-manager'); ?></label>
|
1 |
+
<# if (data.type == 'time') { #>
|
2 |
+
<div class="panel woocommerce_options_panel <# if (data.panel != 'timepicker') { #>hidden<# } #>">
|
3 |
<div class="options_group wooccm-premium">
|
4 |
<p class="form-field">
|
5 |
<label><?php esc_html_e('Enhance', 'woocommerce-checkout-manager'); ?></label>
|
includes/view/backend/pages/modals/parts/tabs.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<ul class="wc-tabs">
|
2 |
-
<li class="media-modal-tab
|
3 |
<a href="#general"><span><?php esc_html_e('General', 'woocommerce-checkout-manager'); ?></span></a>
|
4 |
</li>
|
5 |
<# if ( _.contains(<?php echo json_encode(array('select', 'multiselect')); ?>, data.type)) { #>
|
1 |
<ul class="wc-tabs">
|
2 |
+
<li class="media-modal-tab active">
|
3 |
<a href="#general"><span><?php esc_html_e('General', 'woocommerce-checkout-manager'); ?></span></a>
|
4 |
</li>
|
5 |
<# if ( _.contains(<?php echo json_encode(array('select', 'multiselect')); ?>, data.type)) { #>
|
includes/view/frontend/class-wooccm-fields-additional.php
CHANGED
@@ -31,27 +31,27 @@ class WOOCCM_Fields_Additional {
|
|
31 |
}
|
32 |
}
|
33 |
|
34 |
-
function add_order_meta($order_id = 0, $data) {
|
35 |
-
|
36 |
-
if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
|
37 |
-
|
38 |
-
foreach ($fields as $key => $field) {
|
39 |
-
|
40 |
-
if (!empty($data[$key])) {
|
41 |
-
|
42 |
-
$value = $data[$key];
|
43 |
-
|
44 |
-
if ($field['type'] == 'textarea') {
|
45 |
-
update_post_meta($order_id, sprintf('_%s', $key), wp_kses($value, false));
|
46 |
-
} else if (is_array($value)) {
|
47 |
-
update_post_meta($order_id, sprintf('_%s', $key), implode(',', array_map('sanitize_text_field', $value)));
|
48 |
-
} else {
|
49 |
-
update_post_meta($order_id, sprintf('_%s', $key), sanitize_text_field($value));
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
|
56 |
function add_additional_fields($checkout) {
|
57 |
?>
|
@@ -98,7 +98,6 @@ class WOOCCM_Fields_Additional {
|
|
98 |
|
99 |
function init() {
|
100 |
add_action('woocommerce_checkout_process', array($this, 'add_required_notice'));
|
101 |
-
add_action('woocommerce_checkout_update_order_meta', array($this, 'add_order_meta'), 10, 2);
|
102 |
|
103 |
// Compatibility
|
104 |
// -----------------------------------------------------------------------
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
// function add_order_meta($order_id = 0, $data) {
|
35 |
+
//
|
36 |
+
// if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
|
37 |
+
//
|
38 |
+
// foreach ($fields as $key => $field) {
|
39 |
+
//
|
40 |
+
// if (!empty($data[$key])) {
|
41 |
+
//
|
42 |
+
// $value = $data[$key];
|
43 |
+
//
|
44 |
+
// if ($field['type'] == 'textarea') {
|
45 |
+
// update_post_meta($order_id, sprintf('_%s', $key), wp_kses($value, false));
|
46 |
+
// } else if (is_array($value)) {
|
47 |
+
// update_post_meta($order_id, sprintf('_%s', $key), implode(',', array_map('sanitize_text_field', $value)));
|
48 |
+
// } else {
|
49 |
+
// update_post_meta($order_id, sprintf('_%s', $key), sanitize_text_field($value));
|
50 |
+
// }
|
51 |
+
// }
|
52 |
+
// }
|
53 |
+
// }
|
54 |
+
// }
|
55 |
|
56 |
function add_additional_fields($checkout) {
|
57 |
?>
|
98 |
|
99 |
function init() {
|
100 |
add_action('woocommerce_checkout_process', array($this, 'add_required_notice'));
|
|
|
101 |
|
102 |
// Compatibility
|
103 |
// -----------------------------------------------------------------------
|
includes/view/frontend/class-wooccm-fields-handler.php
CHANGED
@@ -56,7 +56,9 @@ class WOOCCM_Fields_Handler {
|
|
56 |
|
57 |
public function add_field_filter($field) {
|
58 |
|
59 |
-
|
|
|
|
|
60 |
|
61 |
// keep attr id = attr name
|
62 |
// -------------------------------------------------------------------------
|
@@ -107,10 +109,11 @@ class WOOCCM_Fields_Handler {
|
|
107 |
if (isset($field['order'])) {
|
108 |
$field['priority'] = $field['order'] * 10;
|
109 |
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
114 |
|
115 |
return $field;
|
116 |
}
|
@@ -239,7 +242,6 @@ class WOOCCM_Fields_Handler {
|
|
239 |
// add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
240 |
//
|
241 |
// add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
242 |
-
|
243 |
// Fix required country notice when shipping address is activated
|
244 |
// -----------------------------------------------------------------------
|
245 |
add_filter('woocommerce_checkout_posted_data', array($this, 'remove_address_fields'));
|
56 |
|
57 |
public function add_field_filter($field) {
|
58 |
|
59 |
+
if (isset(WC()->session)) {
|
60 |
+
$session_data = WC()->session->wooccm;
|
61 |
+
}
|
62 |
|
63 |
// keep attr id = attr name
|
64 |
// -------------------------------------------------------------------------
|
109 |
if (isset($field['order'])) {
|
110 |
$field['priority'] = $field['order'] * 10;
|
111 |
}
|
112 |
+
|
113 |
+
if (isset(WC()->session)) {
|
114 |
+
$session_data['fields'][$field['key']] = $field;
|
115 |
+
WC()->session->wooccm = $session_data;
|
116 |
+
}
|
117 |
|
118 |
return $field;
|
119 |
}
|
242 |
// add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
243 |
//
|
244 |
// add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
|
|
245 |
// Fix required country notice when shipping address is activated
|
246 |
// -----------------------------------------------------------------------
|
247 |
add_filter('woocommerce_checkout_posted_data', array($this, 'remove_address_fields'));
|
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.4
|
6 |
Tested up to: 5.3
|
7 |
-
Stable tag: 4.9.
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 3.9
|
10 |
License: GPLv2 or later
|
@@ -101,6 +101,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
104 |
= 4.9.0 =
|
105 |
* Fix: woocommerce checkout fees
|
106 |
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.3
|
7 |
+
Stable tag: 4.9.1
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 3.9
|
10 |
License: GPLv2 or later
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 4.9.1 =
|
105 |
+
* Fix: small CSS issues
|
106 |
+
|
107 |
= 4.9.0 =
|
108 |
* Fix: woocommerce checkout fees
|
109 |
|
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.9.
|
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.9.
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
3 |
/**
|
4 |
* Plugin Name: WooCommerce Checkout Manager
|
5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
+
* Version: 4.9.1
|
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.9.1');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|