PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / trunk
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster vtrunk
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / elementor / modules / checkout / widgets / settings-controls.php

settings-controls.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster trunk, at includes/elementor/modules/checkout/widgets/settings-controls.php

986 lines 27.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Elementor\Modules\Checkout\Widgets;
4
5 defined( 'ABSPATH' ) || die();
6
7 use Elementor\Settings;
8 use Elementor\Plugin;
9
10 /**
11 * Checkout settings controls.
12 *
13 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
14 * @since 1.1.0
15 */
16 class Settings_Controls extends \Sellkit_Elementor_Checkout_Widget {
17 public function __construct() {
18 $this->layout_settings();
19 $this->google_autocomplete_settings();
20 $this->coupon_form_visibility();
21 $this->shipping_fields();
22 $this->billing_fields();
23 $this->custom_messages();
24 }
25
26 private function shipping_fields_type() {
27 $fields = [
28 'shipping_first_name' => esc_html__( 'Shipping First Name', 'sellkit' ),
29 'shipping_last_name' => esc_html__( 'Shipping Last Name', 'sellkit' ),
30 'shipping_company' => esc_html__( 'Shipping Company', 'sellkit' ),
31 'shipping_address_1' => esc_html__( 'Shipping Address 1', 'sellkit' ),
32 'shipping_address_2' => esc_html__( 'Shipping Address 2', 'sellkit' ),
33 'shipping_city' => esc_html__( 'Shipping City', 'sellkit' ),
34 'shipping_postcode' => esc_html__( 'Shipping Postcode', 'sellkit' ),
35 'shipping_country' => esc_html__( 'Shipping Country', 'sellkit' ),
36 'shipping_state' => esc_html__( 'Shipping State', 'sellkit' ),
37 'custom_field_pro' => esc_html__( 'Custom Field (Sellkit Pro)', 'sellkit' ),
38 ];
39
40 if ( sellkit()->has_pro ) {
41 unset( $fields['custom_field_pro'] );
42 $fields = \Sellkit_Elementor_Checkout_Pro_Module::checkout_custom_fields( $fields );
43 }
44
45 return $fields;
46 }
47
48 private function billing_fields_type() {
49 $fields = [
50 'billing_first_name' => esc_html__( 'Billing First Name', 'sellkit' ),
51 'billing_last_name' => esc_html__( 'Billing Last Name', 'sellkit' ),
52 'billing_company' => esc_html__( 'Billing Company', 'sellkit' ),
53 'billing_address_1' => esc_html__( 'Billing Address 1', 'sellkit' ),
54 'billing_address_2' => esc_html__( 'Billing Address 2', 'sellkit' ),
55 'billing_city' => esc_html__( 'Billing City', 'sellkit' ),
56 'billing_postcode' => esc_html__( 'Billing Postcode', 'sellkit' ),
57 'billing_country' => esc_html__( 'Billing Country', 'sellkit' ),
58 'billing_state' => esc_html__( 'Billing State', 'sellkit' ),
59 'billing_phone' => esc_html__( 'Billing Phone', 'sellkit' ),
60 'custom_field_pro' => esc_html__( 'Custom Field (Sellkit Pro)', 'sellkit' ),
61 ];
62
63 if ( sellkit()->has_pro ) {
64 unset( $fields['custom_field_pro'] );
65 $fields = \Sellkit_Elementor_Checkout_Pro_Module::checkout_custom_fields( $fields );
66 }
67
68 return $fields;
69 }
70
71 private function layout_settings() {
72 $this->start_controls_section(
73 'section_content',
74 [
75 'label' => esc_html__( 'Content', 'sellkit' ),
76 ]
77 );
78
79 $this->add_control(
80 'layout-type',
81 [
82 'label' => esc_html__( 'Layout', 'sellkit' ),
83 'type' => 'select',
84 'default' => 'one-page',
85 'options' => [
86 'one-page' => esc_html__( 'Single Page', 'sellkit' ),
87 'multi-step' => esc_html__( 'Multi Steps', 'sellkit' ),
88 ],
89 ]
90 );
91
92 $this->add_control(
93 'show_cart_items',
94 [
95 'label' => esc_html__( 'Cart Items', 'sellkit' ),
96 'type' => 'switcher',
97 'label_on' => esc_html__( 'Show', 'sellkit' ),
98 'label_off' => esc_html__( 'Hide', 'sellkit' ),
99 'return_value' => 'yes',
100 'default' => 'yes',
101 ]
102 );
103
104 $this->add_control(
105 'show_cart_edit',
106 [
107 'label' => esc_html__( 'Enable Cart Editing', 'sellkit' ),
108 'type' => 'switcher',
109 'label_on' => esc_html__( 'Show', 'sellkit' ),
110 'label_off' => esc_html__( 'Hide', 'sellkit' ),
111 'return_value' => 'yes',
112 'default' => 'yes',
113 'condition' => [
114 'show_cart_items' => 'yes',
115 ],
116 ]
117 );
118
119 $this->add_control(
120 'show_breadcrumb',
121 [
122 'label' => esc_html__( 'Steps', 'sellkit' ),
123 'type' => 'switcher',
124 'label_on' => esc_html__( 'Show', 'sellkit' ),
125 'label_off' => esc_html__( 'Hide', 'sellkit' ),
126 'return_value' => 'yes',
127 'default' => 'yes',
128 'condition' => [
129 'layout-type' => 'multi-step',
130 ],
131 ]
132 );
133
134 $this->add_control(
135 'show_shipping_method',
136 [
137 'label' => esc_html__( 'Shipping Method', 'sellkit' ),
138 'type' => 'switcher',
139 'label_on' => esc_html__( 'Show', 'sellkit' ),
140 'label_off' => esc_html__( 'Hide', 'sellkit' ),
141 'return_value' => 'yes',
142 'default' => 'yes',
143 ]
144 );
145
146 $this->add_control(
147 'show_preview_box',
148 [
149 'label' => esc_html__( 'Preview Box', 'sellkit' ),
150 'type' => 'switcher',
151 'label_on' => esc_html__( 'Show', 'sellkit' ),
152 'label_off' => esc_html__( 'Hide', 'sellkit' ),
153 'return_value' => 'yes',
154 'default' => 'yes',
155 'condition' => [
156 'layout-type' => 'multi-step',
157 ],
158 ]
159 );
160
161 if ( sellkit()->has_pro ) {
162 \Sellkit_Elementor_Checkout_Pro_Module::express_checkout_control( $this );
163 } else {
164 $this->add_control(
165 'show_express_checkout_promotions',
166 [
167 'label' => esc_html__( 'Express Checkout', 'sellkit' ),
168 'classes' => 'elementor-control-checkout-express-promotion',
169 'type' => 'switcher',
170 'label_on' => esc_html__( 'Show', 'sellkit' ),
171 'label_off' => esc_html__( 'Hide', 'sellkit' ),
172 'return_value' => 'yes',
173 'default' => 'no',
174 ]
175 );
176 }
177
178 $this->add_control(
179 'show_sticky_cart_details',
180 [
181 'label' => esc_html__( 'Checkout Sticky Cart', 'sellkit' ),
182 'type' => 'switcher',
183 'frontend_available' => true,
184 'label_on' => esc_html__( 'Show', 'sellkit' ),
185 'label_off' => esc_html__( 'Hide', 'sellkit' ),
186 'return_value' => 'yes',
187 'default' => 'yes',
188 'condition' => [
189 'layout-type' => 'multi-step',
190 ],
191 ]
192 );
193
194 $this->add_control(
195 'sticky_cart_offset',
196 [
197 'label' => esc_html__( 'Offset', 'sellkit' ),
198 'type' => 'number',
199 'frontend_available' => true,
200 'condition' => [
201 'layout-type' => 'multi-step',
202 'show_sticky_cart_details' => 'yes',
203 ],
204 ]
205 );
206
207 $this->add_control(
208 'place_order_btn_txt',
209 [
210 'label' => esc_html__( 'Place Order Button Text', 'sellkit' ),
211 'type' => 'text',
212 'label_block' => true,
213 'default' => esc_html__( 'Complete Order', 'sellkit' ),
214 ]
215 );
216
217 $this->end_controls_section();
218 }
219
220 public function get_template( $texts ) {
221 ob_start();
222 ?>
223 <div class="elementor-nerd-box">
224 <span class="sellkit-checkout-promotion-rocket"></span>
225 <div class="sellkit-checkout-autocomplete-promotion-title"><?php echo esc_html( $texts['title'] ); ?></div>
226 <?php foreach ( $texts['messages'] as $message ) { ?>
227 <div class="sellkit-checkout-promotion-message"><?php echo wp_kses_post( $message ); ?></div>
228 <?php }
229
230 // Show a `Go Pro` button only if the user doesn't have Pro.
231 if ( $texts['link'] ) { ?>
232 <a
233 class="sellkit-checkout-autocomplete-promotion-btn"
234 href="https://getsellkit.com/pricing/"
235 target="_blank"
236 >
237 <?php echo esc_html__( 'Upgrade Now', 'sellkit' ); ?>
238 </a>
239 <?php } ?>
240 </div>
241 <?php
242
243 return ob_get_clean();
244 }
245
246 private function google_autocomplete_settings() {
247 if ( sellkit()->has_pro ) {
248 \Sellkit_Elementor_Checkout_Pro_Module::google_address_autocomplete( $this );
249 return;
250 }
251
252 $messages = [
253 sprintf(
254 /* translators: 1: bold tag 2: bold tag */
255 esc_html__( 'You are using a free version of Sellkit. Upgrade to %1$s Sellkit Pro %2$s to use this feature.', 'sellkit' ),
256 '<b>',
257 '</b>'
258 ),
259 ];
260
261 $this->start_controls_section(
262 'google_autocomplete_settings',
263 [
264 'label' => esc_html__( 'Address Autocomplete', 'sellkit' ),
265 ]
266 );
267
268 $this->add_control(
269 'sellkit_checkout_autocomplete_address_promotion',
270 [
271 'type' => 'raw_html',
272 'raw' => $this->get_template( [
273 'title' => esc_html__( 'Upgrade to Sellkit Pro', 'sellkit' ),
274 'messages' => $messages,
275 'link' => 'https://getsellkit.com/pricing/',
276 ] ),
277 ]
278 );
279
280 $this->end_controls_section();
281 }
282
283 private function coupon_form_visibility() {
284 $this->start_controls_section(
285 'coupon_form_visibility',
286 [
287 'label' => esc_html__( 'Coupon', 'sellkit' ),
288 ]
289 );
290
291 $this->add_control(
292 'show_coupon_field',
293 [
294 'label' => esc_html__( 'Enable Coupon Field', 'sellkit' ),
295 'type' => 'switcher',
296 'label_on' => esc_html__( 'Yes', 'sellkit' ),
297 'label_off' => esc_html__( 'No', 'sellkit' ),
298 'return_value' => 'yes',
299 'default' => 'yes',
300 ]
301 );
302
303 $this->add_control(
304 'coupon_field_type',
305 [
306 'label' => esc_html__( 'Coupon Field Behavior', 'sellkit' ),
307 'type' => 'select',
308 'default' => 'normal',
309 'options' => [
310 'normal' => esc_html__( 'ُNormal', 'sellkit' ),
311 'collapsible' => esc_html__( 'Collapsible', 'sellkit' ),
312 ],
313 ]
314 );
315
316 $this->end_controls_section();
317 }
318
319 private function shipping_fields() {
320 $this->start_controls_section(
321 'shipping_fields',
322 [
323 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
324 ]
325 );
326
327 $repeater = new \Elementor\Repeater();
328
329 $repeater->add_control(
330 'shipping_list_field',
331 [
332 'label' => esc_html__( 'Field role', 'sellkit' ),
333 'type' => 'select',
334 'options' => $this->shipping_fields_type(),
335 ]
336 );
337
338 $repeater->add_control(
339 'shipping_custom_type',
340 [
341 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
342 'type' => 'select',
343 'options' => [
344 'text' => esc_html__( 'Text Field', 'sellkit' ),
345 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
346 'select' => esc_html__( 'Select Field', 'sellkit' ),
347 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
348 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
349 'radio' => esc_html__( 'Radio', 'sellkit' ),
350 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
351 'email' => esc_html__( 'Email Field', 'sellkit' ),
352 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
353 ],
354 'condition' => [
355 'shipping_list_field' => 'custom_role',
356 ],
357 'default' => 'text',
358 ]
359 );
360
361 $repeater->add_control(
362 'shipping_custom_options',
363 [
364 'label' => esc_html__( 'Options', 'sellkit' ),
365 'type' => 'textarea',
366 'rows' => 5,
367 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
368 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
369 'condition' => [
370 'shipping_custom_type' => [ 'select', 'multiselect', 'radio' ],
371 ],
372 ]
373 );
374
375 $repeater->add_control(
376 'shipping_radio_field_mode',
377 [
378 'label' => esc_html__( 'Display Mode', 'sellkit' ),
379 'type' => 'choose',
380 'options' => [
381 'inline' => [
382 'title' => esc_html__( 'Inline', 'sellkit' ),
383 'icon' => 'eicon-ellipsis-h',
384 ],
385 'list' => [
386 'title' => esc_html__( 'List', 'sellkit' ),
387 'icon' => 'eicon-bullet-list',
388 ],
389 ],
390 'default' => 'list',
391 'toggle' => true,
392 'condition' => [
393 'shipping_custom_type' => [ 'radio' ],
394 ],
395 ]
396 );
397
398 $repeater->add_control(
399 'shipping_custom_id',
400 [
401 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
402 'type' => 'text',
403 'placeholder' => 'e.g. my_custom_field',
404 'condition' => [
405 'shipping_list_field' => 'custom_role',
406 ],
407 ]
408 );
409
410 $repeater->add_control(
411 'shipping_custom_value',
412 [
413 'label' => esc_html__( 'Default Value', 'sellkit' ),
414 'type' => 'text',
415 'condition' => [
416 'shipping_list_field' => 'custom_role',
417 'shipping_custom_type' => [ 'text', 'textarea', 'select', 'radio', 'hidden', 'tel', 'email' ],
418 ],
419 ]
420 );
421
422 $repeater->add_control(
423 'shipping_checkbox_custom_value',
424 [
425 'label' => esc_html__( 'Default Value', 'sellkit' ),
426 'type' => 'select',
427 'options' => [
428 'true' => 'True',
429 'false' => 'False',
430 ],
431 'condition' => [
432 'shipping_list_field' => 'custom_role',
433 'shipping_custom_type' => [ 'checkbox' ],
434 ],
435 ]
436 );
437
438 $repeater->add_control(
439 'shipping_width',
440 [
441 'label' => esc_html__( 'Width', 'sellkit' ),
442 'type' => 'select',
443 'options' => [
444 'w-10' => esc_html__( '10%', 'sellkit' ),
445 'w-20' => esc_html__( '20%', 'sellkit' ),
446 'w-30' => esc_html__( '30%', 'sellkit' ),
447 'w-33' => esc_html__( '33%', 'sellkit' ),
448 'w-34' => esc_html__( '34%', 'sellkit' ),
449 'w-40' => esc_html__( '40%', 'sellkit' ),
450 'w-50' => esc_html__( '50%', 'sellkit' ),
451 'w-60' => esc_html__( '60%', 'sellkit' ),
452 'w-70' => esc_html__( '70%', 'sellkit' ),
453 'w-80' => esc_html__( '80%', 'sellkit' ),
454 'w-90' => esc_html__( '90%', 'sellkit' ),
455 'w-100' => esc_html__( '100%', 'sellkit' ),
456 ],
457 'default' => 'w-100',
458 ]
459 );
460
461 $repeater->add_control(
462 'shipping_list_placeholder',
463 [
464 'label' => esc_html__( 'Field Label', 'sellkit' ),
465 'type' => 'text',
466 'default' => esc_html__( 'Default label', 'sellkit' ),
467 ]
468 );
469
470 $repeater->add_control(
471 'shipping_list_class',
472 [
473 'label' => esc_html__( 'Field Class', 'sellkit' ),
474 'type' => 'text',
475 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
476 ]
477 );
478
479 $repeater->add_control(
480 'shipping_list_validation',
481 [
482 'label' => esc_html__( 'Validation', 'sellkit' ),
483 'type' => 'select',
484 'options' => [
485 '' => esc_html__( 'Select one...', 'sellkit' ),
486 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
487 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
488 ],
489 'default' => '',
490 'condition' => [
491 'shipping_custom_type' => [ 'text', 'select', 'tel' ],
492 ],
493 ]
494 );
495
496 $repeater->add_control(
497 'shipping_list_required',
498 [
499 'label' => esc_html__( 'Field Required?', 'sellkit' ),
500 'type' => 'select',
501 'options' => [
502 'yes' => esc_html__( 'Yes', 'sellkit' ),
503 'no' => esc_html__( 'No', 'sellkit' ),
504 ],
505 'default' => 'no',
506 ]
507 );
508
509 $repeater->add_control(
510 'shipping_list_clear',
511 [
512 'label' => esc_html__( 'Field Clear', 'sellkit' ),
513 'type' => 'select',
514 'description' => 'Applies a clear fix to the field',
515 'options' => [
516 'yes' => esc_html__( 'Yes', 'sellkit' ),
517 'no' => esc_html__( 'No', 'sellkit' ),
518 ],
519 'default' => 'no',
520 ]
521 );
522
523 $repeater->add_control(
524 'shipping_show_in_thankyou',
525 [
526 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
527 'type' => 'switcher',
528 'label_on' => esc_html__( 'Show', 'sellkit' ),
529 'label_off' => esc_html__( 'Hide', 'sellkit' ),
530 'return_value' => 'yes',
531 'default' => 'no',
532 'condition' => [
533 'shipping_list_field' => 'custom_role',
534 ],
535 ]
536 );
537
538 $repeater->add_control(
539 'shipping_show_in_order_mail',
540 [
541 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
542 'type' => 'switcher',
543 'label_on' => esc_html__( 'Show', 'sellkit' ),
544 'label_off' => esc_html__( 'Hide', 'sellkit' ),
545 'return_value' => 'yes',
546 'default' => 'no',
547 'condition' => [
548 'shipping_list_field' => 'custom_role',
549 ],
550 ]
551 );
552
553 $this->add_control(
554 'shipping_list',
555 [
556 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
557 'type' => 'repeater',
558 'fields' => $repeater->get_controls(),
559 'item_actions' => [
560 'duplicate' => false,
561 ],
562 'prevent_empty' => false,
563 'default' => [
564 [
565 'shipping_list_field' => 'shipping_first_name',
566 'shipping_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
567 'shipping_width' => 'w-50',
568 'shipping_list_required' => 'yes',
569 'shipping_list_clear' => 'no',
570 ],
571 [
572 'shipping_list_field' => 'shipping_last_name',
573 'shipping_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
574 'shipping_width' => 'w-50',
575 'shipping_list_required' => 'no',
576 'shipping_list_clear' => 'no',
577 ],
578 [
579 'shipping_list_field' => 'shipping_address_1',
580 'shipping_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
581 'shipping_width' => 'w-100',
582 'shipping_list_required' => 'no',
583 'shipping_list_clear' => 'no',
584 ],
585 [
586 'shipping_list_field' => 'shipping_address_2',
587 'shipping_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
588 'shipping_width' => 'w-100',
589 'shipping_list_required' => 'no',
590 'shipping_list_clear' => 'no',
591 ],
592 [
593 'shipping_list_field' => 'shipping_country',
594 'shipping_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
595 'shipping_width' => 'w-33',
596 'shipping_list_required' => 'no',
597 'shipping_list_clear' => 'no',
598 ],
599 [
600 'shipping_list_field' => 'shipping_state',
601 'shipping_list_placeholder' => esc_html__( 'State', 'sellkit' ),
602 'shipping_width' => 'w-33',
603 'shipping_list_required' => 'no',
604 'shipping_list_clear' => 'no',
605 ],
606 [
607 'shipping_list_field' => 'shipping_postcode',
608 'shipping_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
609 'shipping_width' => 'w-34',
610 'shipping_list_required' => 'no',
611 'shipping_list_clear' => 'no',
612 ],
613 [
614 'shipping_list_field' => 'shipping_city',
615 'shipping_list_placeholder' => esc_html__( 'City', 'sellkit' ),
616 'shipping_width' => 'w-100',
617 'shipping_list_required' => 'no',
618 'shipping_list_clear' => 'no',
619 ],
620 ],
621 'title_field' => '{{{ shipping_list_placeholder }}}',
622 ]
623 );
624
625 $this->end_controls_section();
626 }
627
628 public function billing_fields() {
629 $this->start_controls_section(
630 'billing_fields',
631 [
632 'label' => esc_html__( 'Billings Fields', 'sellkit' ),
633 ]
634 );
635
636 $repeater = new \Elementor\Repeater();
637
638 /* Prevent user to add email field , we added that at login form. billing_email excluded. */
639 $repeater->add_control(
640 'billing_list_field',
641 [
642 'label' => esc_html__( 'Field role', 'sellkit' ),
643 'type' => 'select',
644 'options' => $this->billing_fields_type(),
645 ]
646 );
647
648 $repeater->add_control(
649 'billing_custom_type',
650 [
651 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
652 'type' => 'select',
653 'options' => [
654 'text' => esc_html__( 'Text Field', 'sellkit' ),
655 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
656 'select' => esc_html__( 'Select Field', 'sellkit' ),
657 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
658 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
659 'radio' => esc_html__( 'Radio', 'sellkit' ),
660 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
661 'email' => esc_html__( 'Email Field', 'sellkit' ),
662 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
663 ],
664 'condition' => [
665 'billing_list_field' => 'custom_role',
666 ],
667 'default' => 'text',
668 ]
669 );
670
671 $repeater->add_control(
672 'billing_custom_options',
673 [
674 'label' => esc_html__( 'Options', 'sellkit' ),
675 'type' => 'textarea',
676 'rows' => 5,
677 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
678 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
679 'condition' => [
680 'billing_custom_type' => [ 'select', 'multiselect', 'radio' ],
681 ],
682 ]
683 );
684
685 $repeater->add_control(
686 'billing_radio_field_mode',
687 [
688 'label' => esc_html__( 'Display Mode', 'sellkit' ),
689 'type' => 'choose',
690 'options' => [
691 'inline' => [
692 'title' => esc_html__( 'Inline', 'sellkit' ),
693 'icon' => 'eicon-ellipsis-h',
694 ],
695 'list' => [
696 'title' => esc_html__( 'List', 'sellkit' ),
697 'icon' => 'eicon-bullet-list',
698 ],
699 ],
700 'default' => 'list',
701 'toggle' => true,
702 'condition' => [
703 'billing_custom_type' => [ 'radio' ],
704 ],
705 ]
706 );
707
708 $repeater->add_control(
709 'billing_custom_id',
710 [
711 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
712 'type' => 'text',
713 'placeholder' => 'e.g. my_custom_field',
714 'condition' => [
715 'billing_list_field' => 'custom_role',
716 ],
717 ]
718 );
719
720 $repeater->add_control(
721 'billing_custom_value',
722 [
723 'label' => esc_html__( 'Default Value', 'sellkit' ),
724 'type' => 'text',
725 'condition' => [
726 'billing_list_field' => 'custom_role',
727 'billing_custom_type' => [ 'text', 'textarea', 'select', 'multiselect', 'radio', 'tel', 'email', 'hidden' ],
728 ],
729 ]
730 );
731
732 $repeater->add_control(
733 'billing_checkbox_custom_value',
734 [
735 'label' => esc_html__( 'Default Value', 'sellkit' ),
736 'type' => 'select',
737 'options' => [
738 'true' => 'True',
739 'false' => 'False',
740 ],
741 'condition' => [
742 'billing_list_field' => 'custom_role',
743 'billing_custom_type' => [ 'checkbox' ],
744 ],
745 ]
746 );
747
748 $repeater->add_control(
749 'billing_width',
750 [
751 'label' => esc_html__( 'Width', 'sellkit' ),
752 'type' => 'select',
753 'options' => [
754 'w-10' => esc_html__( '10%', 'sellkit' ),
755 'w-20' => esc_html__( '20%', 'sellkit' ),
756 'w-30' => esc_html__( '30%', 'sellkit' ),
757 'w-33' => esc_html__( '33%', 'sellkit' ),
758 'w-34' => esc_html__( '34%', 'sellkit' ),
759 'w-40' => esc_html__( '40%', 'sellkit' ),
760 'w-50' => esc_html__( '50%', 'sellkit' ),
761 'w-60' => esc_html__( '60%', 'sellkit' ),
762 'w-70' => esc_html__( '70%', 'sellkit' ),
763 'w-80' => esc_html__( '80%', 'sellkit' ),
764 'w-90' => esc_html__( '90%', 'sellkit' ),
765 'w-100' => esc_html__( '100%', 'sellkit' ),
766 ],
767 'default' => 'w-100',
768 ]
769 );
770
771 $repeater->add_control(
772 'billing_list_placeholder',
773 [
774 'label' => esc_html__( 'Field Label', 'sellkit' ),
775 'type' => 'text',
776 'default' => esc_html__( 'Default label', 'sellkit' ),
777 ]
778 );
779
780 $repeater->add_control(
781 'billing_list_class',
782 [
783 'label' => esc_html__( 'Field Class', 'sellkit' ),
784 'type' => 'text',
785 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
786 ]
787 );
788
789 $repeater->add_control(
790 'billing_list_validation',
791 [
792 'label' => esc_html__( 'Validation', 'sellkit' ),
793 'type' => 'select',
794 'options' => [
795 '' => esc_html__( 'Select one...', 'sellkit' ),
796 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
797 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
798 ],
799 'default' => '',
800 'condition' => [
801 'billing_custom_type' => [ 'text', 'select', 'tel' ],
802 ],
803 ]
804 );
805
806 $repeater->add_control(
807 'billing_list_required',
808 [
809 'label' => esc_html__( 'Field Required?', 'sellkit' ),
810 'type' => 'select',
811 'options' => [
812 'yes' => esc_html__( 'Yes', 'sellkit' ),
813 'no' => esc_html__( 'No', 'sellkit' ),
814 ],
815 'default' => 'no',
816 ]
817 );
818
819 $repeater->add_control(
820 'billing_list_clear',
821 [
822 'label' => esc_html__( 'Field Clear', 'sellkit' ),
823 'type' => 'select',
824 'description' => esc_html__( 'Yes or No, applies a clear fix to the field', 'sellkit' ),
825 'options' => [
826 'yes' => esc_html__( 'Yes', 'sellkit' ),
827 'no' => esc_html__( 'No', 'sellkit' ),
828 ],
829 'default' => 'no',
830 ]
831 );
832
833 $repeater->add_control(
834 'billing_show_in_thankyou',
835 [
836 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
837 'type' => 'switcher',
838 'label_on' => esc_html__( 'Show', 'sellkit' ),
839 'label_off' => esc_html__( 'Hide', 'sellkit' ),
840 'return_value' => 'yes',
841 'default' => 'no',
842 'condition' => [
843 'billing_list_field' => 'custom_role',
844 ],
845 ]
846 );
847
848 $repeater->add_control(
849 'billing_show_in_order_mail',
850 [
851 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
852 'type' => 'switcher',
853 'label_on' => esc_html__( 'Show', 'sellkit' ),
854 'label_off' => esc_html__( 'Hide', 'sellkit' ),
855 'return_value' => 'yes',
856 'default' => 'no',
857 'condition' => [
858 'billing_list_field' => 'custom_role',
859 ],
860 ]
861 );
862
863 $this->add_control(
864 'billing_list',
865 [
866 'label' => esc_html__( 'Billing Fields', 'sellkit' ),
867 'type' => 'repeater',
868 'fields' => $repeater->get_controls(),
869 'item_actions' => [
870 'duplicate' => false,
871 ],
872 'prevent_empty' => false,
873 'default' => [
874 [
875 'billing_list_field' => 'billing_first_name',
876 'billing_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
877 'billing_width' => 'w-50',
878 'billing_list_required' => 'yes',
879 'billing_list_clear' => 'no',
880 ],
881 [
882 'billing_list_field' => 'billing_last_name',
883 'billing_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
884 'billing_width' => 'w-50',
885 'billing_list_required' => 'no',
886 'billing_list_clear' => 'no',
887 ],
888 [
889 'billing_list_field' => 'billing_address_1',
890 'billing_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
891 'billing_width' => 'w-100',
892 'billing_list_required' => 'no',
893 'billing_list_clear' => 'no',
894 ],
895 [
896 'billing_list_field' => 'billing_address_2',
897 'billing_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
898 'billing_width' => 'w-100',
899 'billing_list_required' => 'no',
900 'billing_list_clear' => 'no',
901 ],
902 [
903 'billing_list_field' => 'billing_country',
904 'billing_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
905 'billing_width' => 'w-33',
906 'billing_list_required' => 'no',
907 'billing_list_clear' => 'no',
908 ],
909 [
910 'billing_list_field' => 'billing_state',
911 'billing_list_placeholder' => esc_html__( 'State', 'sellkit' ),
912 'billing_width' => 'w-33',
913 'billing_list_required' => 'no',
914 'billing_list_clear' => 'no',
915 ],
916 [
917 'billing_list_field' => 'billing_postcode',
918 'billing_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
919 'billing_width' => 'w-34',
920 'billing_list_required' => 'no',
921 'billing_list_clear' => 'no',
922 ],
923 [
924 'billing_list_field' => 'billing_city',
925 'billing_list_placeholder' => esc_html__( 'City', 'sellkit' ),
926 'billing_width' => 'w-100',
927 'billing_list_required' => 'no',
928 'billing_list_clear' => 'no',
929 ],
930 ],
931 'title_field' => '{{{ billing_list_placeholder }}}',
932 ]
933 );
934
935 $this->end_controls_section();
936 }
937
938 private function custom_messages() {
939 $this->start_controls_section(
940 'custom_messages',
941 [
942 'label' => esc_html__( 'Custom Messages', 'sellkit' ),
943 ]
944 );
945
946 $this->add_control(
947 'empty_cart',
948 [
949 'type' => 'text',
950 'default' => esc_html__( 'Your shopping cart is empty.', 'sellkit' ),
951 'label_block' => true,
952 ]
953 );
954
955 $this->add_control(
956 'create_website_account',
957 [
958 'type' => 'text',
959 'default' => esc_html__( 'Create a {{website}} account', 'sellkit' ),
960 'label_block' => true,
961 'description' => '{{website}} will automatically point to your website name',
962 ]
963 );
964
965 $this->add_control(
966 'secure_transaction_text',
967 [
968 'type' => 'text',
969 'default' => esc_html__( 'All transactions are secure and encrypted.', 'sellkit' ),
970 'label_block' => true,
971 ]
972 );
973
974 $this->add_control(
975 'select_address_text',
976 [
977 'type' => 'text',
978 'default' => esc_html__( 'Select the address that matches your card or payment method.', 'sellkit' ),
979 'label_block' => true,
980 ]
981 );
982
983 $this->end_controls_section();
984 }
985 }
986