PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.2.9
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.2.9
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 1.2.9, at includes/elementor/modules/checkout/widgets/settings-controls.php

972 lines 27.4 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 'label_on' => esc_html__( 'Show', 'sellkit' ),
184 'label_off' => esc_html__( 'Hide', 'sellkit' ),
185 'return_value' => 'yes',
186 'default' => 'yes',
187 'condition' => [
188 'layout-type' => 'multi-step',
189 ],
190 ]
191 );
192
193 $this->add_control(
194 'place_order_btn_txt',
195 [
196 'label' => esc_html__( 'Place Order Button Text', 'sellkit' ),
197 'type' => 'text',
198 'label_block' => true,
199 'default' => esc_html__( 'Complete Order', 'sellkit' ),
200 ]
201 );
202
203 $this->end_controls_section();
204 }
205
206 public function get_template( $texts ) {
207 ob_start();
208 ?>
209 <div class="elementor-nerd-box">
210 <span class="sellkit-checkout-promotion-rocket"></span>
211 <div class="sellkit-checkout-autocomplete-promotion-title"><?php echo $texts['title']; ?></div>
212 <?php foreach ( $texts['messages'] as $message ) { ?>
213 <div class="sellkit-checkout-promotion-message"><?php echo $message; ?></div>
214 <?php }
215
216 // Show a `Go Pro` button only if the user doesn't have Pro.
217 if ( $texts['link'] ) { ?>
218 <a
219 class="sellkit-checkout-autocomplete-promotion-btn"
220 href="https://getsellkit.com/pricing/"
221 target="_blank"
222 >
223 <?php echo esc_html__( 'Upgrade Now', 'sellkit' ); ?>
224 </a>
225 <?php } ?>
226 </div>
227 <?php
228
229 return ob_get_clean();
230 }
231
232 private function google_autocomplete_settings() {
233 if ( sellkit()->has_pro ) {
234 \Sellkit_Elementor_Checkout_Pro_Module::google_address_autocomplete( $this );
235 return;
236 }
237
238 $messages = [
239 sprintf(
240 /* translators: 1: bold tag 2: bold tag */
241 esc_html__( 'You are using a free version of Sellkit. Upgrade to %1$s Sellkit Pro %2$s to use this feature.', 'sellkit' ),
242 '<b>',
243 '</b>'
244 ),
245 ];
246
247 $this->start_controls_section(
248 'google_autocomplete_settings',
249 [
250 'label' => esc_html__( 'Address Autocomplete', 'sellkit' ),
251 ]
252 );
253
254 $this->add_control(
255 'sellkit_checkout_autocomplete_address_promotion',
256 [
257 'type' => 'raw_html',
258 'raw' => $this->get_template( [
259 'title' => esc_html__( 'Upgrade to Sellkit Pro', 'sellkit' ),
260 'messages' => $messages,
261 'link' => 'https://getsellkit.com/pricing/',
262 ] ),
263 ]
264 );
265
266 $this->end_controls_section();
267 }
268
269 private function coupon_form_visibility() {
270 $this->start_controls_section(
271 'coupon_form_visibility',
272 [
273 'label' => esc_html__( 'Coupon', 'sellkit' ),
274 ]
275 );
276
277 $this->add_control(
278 'show_coupon_field',
279 [
280 'label' => esc_html__( 'Enable Coupon Field', 'sellkit' ),
281 'type' => 'switcher',
282 'label_on' => esc_html__( 'Yes', 'sellkit' ),
283 'label_off' => esc_html__( 'No', 'sellkit' ),
284 'return_value' => 'yes',
285 'default' => 'yes',
286 ]
287 );
288
289 $this->add_control(
290 'coupon_field_type',
291 [
292 'label' => esc_html__( 'Coupon Field Behavior', 'sellkit' ),
293 'type' => 'select',
294 'default' => 'normal',
295 'options' => [
296 'normal' => esc_html__( 'ُNormal', 'sellkit' ),
297 'collapsible' => esc_html__( 'Collapsible', 'sellkit' ),
298 ],
299 ]
300 );
301
302 $this->end_controls_section();
303 }
304
305 private function shipping_fields() {
306 $this->start_controls_section(
307 'shipping_fields',
308 [
309 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
310 ]
311 );
312
313 $repeater = new \Elementor\Repeater();
314
315 $repeater->add_control(
316 'shipping_list_field',
317 [
318 'label' => esc_html__( 'Field role', 'sellkit' ),
319 'type' => 'select',
320 'options' => $this->shipping_fields_type(),
321 ]
322 );
323
324 $repeater->add_control(
325 'shipping_custom_type',
326 [
327 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
328 'type' => 'select',
329 'options' => [
330 'text' => esc_html__( 'Text Field', 'sellkit' ),
331 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
332 'select' => esc_html__( 'Select Field', 'sellkit' ),
333 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
334 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
335 'radio' => esc_html__( 'Radio', 'sellkit' ),
336 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
337 'email' => esc_html__( 'Email Field', 'sellkit' ),
338 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
339 ],
340 'condition' => [
341 'shipping_list_field' => 'custom_role',
342 ],
343 'default' => 'text',
344 ]
345 );
346
347 $repeater->add_control(
348 'shipping_custom_options',
349 [
350 'label' => esc_html__( 'Options', 'sellkit' ),
351 'type' => 'textarea',
352 'rows' => 5,
353 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
354 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
355 'condition' => [
356 'shipping_custom_type' => [ 'select', 'multiselect', 'radio' ],
357 ],
358 ]
359 );
360
361 $repeater->add_control(
362 'shipping_radio_field_mode',
363 [
364 'label' => esc_html__( 'Display Mode', 'sellkit' ),
365 'type' => 'choose',
366 'options' => [
367 'inline' => [
368 'title' => esc_html__( 'Inline', 'sellkit' ),
369 'icon' => 'eicon-ellipsis-h',
370 ],
371 'list' => [
372 'title' => esc_html__( 'List', 'sellkit' ),
373 'icon' => 'eicon-bullet-list',
374 ],
375 ],
376 'default' => 'list',
377 'toggle' => true,
378 'condition' => [
379 'shipping_custom_type' => [ 'radio' ],
380 ],
381 ]
382 );
383
384 $repeater->add_control(
385 'shipping_custom_id',
386 [
387 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
388 'type' => 'text',
389 'placeholder' => 'e.g. my_custom_field',
390 'condition' => [
391 'shipping_list_field' => 'custom_role',
392 ],
393 ]
394 );
395
396 $repeater->add_control(
397 'shipping_custom_value',
398 [
399 'label' => esc_html__( 'Default Value', 'sellkit' ),
400 'type' => 'text',
401 'condition' => [
402 'shipping_list_field' => 'custom_role',
403 'shipping_custom_type' => [ 'text', 'textarea', 'select', 'radio', 'hidden', 'tel', 'email' ],
404 ],
405 ]
406 );
407
408 $repeater->add_control(
409 'shipping_checkbox_custom_value',
410 [
411 'label' => esc_html__( 'Default Value', 'sellkit' ),
412 'type' => 'select',
413 'options' => [
414 'true' => 'True',
415 'false' => 'False',
416 ],
417 'condition' => [
418 'shipping_list_field' => 'custom_role',
419 'shipping_custom_type' => [ 'checkbox' ],
420 ],
421 ]
422 );
423
424 $repeater->add_control(
425 'shipping_width',
426 [
427 'label' => esc_html__( 'Width', 'sellkit' ),
428 'type' => 'select',
429 'options' => [
430 'w-10' => esc_html__( '10%', 'sellkit' ),
431 'w-20' => esc_html__( '20%', 'sellkit' ),
432 'w-30' => esc_html__( '30%', 'sellkit' ),
433 'w-33' => esc_html__( '33%', 'sellkit' ),
434 'w-34' => esc_html__( '34%', 'sellkit' ),
435 'w-40' => esc_html__( '40%', 'sellkit' ),
436 'w-50' => esc_html__( '50%', 'sellkit' ),
437 'w-60' => esc_html__( '60%', 'sellkit' ),
438 'w-70' => esc_html__( '70%', 'sellkit' ),
439 'w-80' => esc_html__( '80%', 'sellkit' ),
440 'w-90' => esc_html__( '90%', 'sellkit' ),
441 'w-100' => esc_html__( '100%', 'sellkit' ),
442 ],
443 'default' => 'w-100',
444 ]
445 );
446
447 $repeater->add_control(
448 'shipping_list_placeholder',
449 [
450 'label' => esc_html__( 'Field Label', 'sellkit' ),
451 'type' => 'text',
452 'default' => esc_html__( 'Default label', 'sellkit' ),
453 ]
454 );
455
456 $repeater->add_control(
457 'shipping_list_class',
458 [
459 'label' => esc_html__( 'Field Class', 'sellkit' ),
460 'type' => 'text',
461 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
462 ]
463 );
464
465 $repeater->add_control(
466 'shipping_list_validation',
467 [
468 'label' => esc_html__( 'Validation', 'sellkit' ),
469 'type' => 'select',
470 'options' => [
471 '' => esc_html__( 'Select one...', 'sellkit' ),
472 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
473 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
474 ],
475 'default' => '',
476 'condition' => [
477 'shipping_custom_type' => [ 'text', 'select', 'tel' ],
478 ],
479 ]
480 );
481
482 $repeater->add_control(
483 'shipping_list_required',
484 [
485 'label' => esc_html__( 'Field Required?', 'sellkit' ),
486 'type' => 'select',
487 'options' => [
488 'yes' => esc_html__( 'Yes', 'sellkit' ),
489 'no' => esc_html__( 'No', 'sellkit' ),
490 ],
491 'default' => 'no',
492 ]
493 );
494
495 $repeater->add_control(
496 'shipping_list_clear',
497 [
498 'label' => esc_html__( 'Field Clear', 'sellkit' ),
499 'type' => 'select',
500 'description' => 'Applies a clear fix to the field',
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_show_in_thankyou',
511 [
512 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
513 'type' => 'switcher',
514 'label_on' => esc_html__( 'Show', 'sellkit' ),
515 'label_off' => esc_html__( 'Hide', 'sellkit' ),
516 'return_value' => 'yes',
517 'default' => 'no',
518 'condition' => [
519 'shipping_list_field' => 'custom_role',
520 ],
521 ]
522 );
523
524 $repeater->add_control(
525 'shipping_show_in_order_mail',
526 [
527 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
528 'type' => 'switcher',
529 'label_on' => esc_html__( 'Show', 'sellkit' ),
530 'label_off' => esc_html__( 'Hide', 'sellkit' ),
531 'return_value' => 'yes',
532 'default' => 'no',
533 'condition' => [
534 'shipping_list_field' => 'custom_role',
535 ],
536 ]
537 );
538
539 $this->add_control(
540 'shipping_list',
541 [
542 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
543 'type' => 'repeater',
544 'fields' => $repeater->get_controls(),
545 'item_actions' => [
546 'duplicate' => false,
547 ],
548 'prevent_empty' => false,
549 'default' => [
550 [
551 'shipping_list_field' => 'shipping_first_name',
552 'shipping_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
553 'shipping_width' => 'w-50',
554 'shipping_list_required' => 'yes',
555 'shipping_list_clear' => 'no',
556 ],
557 [
558 'shipping_list_field' => 'shipping_last_name',
559 'shipping_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
560 'shipping_width' => 'w-50',
561 'shipping_list_required' => 'no',
562 'shipping_list_clear' => 'no',
563 ],
564 [
565 'shipping_list_field' => 'shipping_address_1',
566 'shipping_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
567 'shipping_width' => 'w-100',
568 'shipping_list_required' => 'no',
569 'shipping_list_clear' => 'no',
570 ],
571 [
572 'shipping_list_field' => 'shipping_address_2',
573 'shipping_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
574 'shipping_width' => 'w-100',
575 'shipping_list_required' => 'no',
576 'shipping_list_clear' => 'no',
577 ],
578 [
579 'shipping_list_field' => 'shipping_country',
580 'shipping_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
581 'shipping_width' => 'w-33',
582 'shipping_list_required' => 'no',
583 'shipping_list_clear' => 'no',
584 ],
585 [
586 'shipping_list_field' => 'shipping_state',
587 'shipping_list_placeholder' => esc_html__( 'State', 'sellkit' ),
588 'shipping_width' => 'w-33',
589 'shipping_list_required' => 'no',
590 'shipping_list_clear' => 'no',
591 ],
592 [
593 'shipping_list_field' => 'shipping_postcode',
594 'shipping_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
595 'shipping_width' => 'w-34',
596 'shipping_list_required' => 'no',
597 'shipping_list_clear' => 'no',
598 ],
599 [
600 'shipping_list_field' => 'shipping_city',
601 'shipping_list_placeholder' => esc_html__( 'City', 'sellkit' ),
602 'shipping_width' => 'w-100',
603 'shipping_list_required' => 'no',
604 'shipping_list_clear' => 'no',
605 ],
606 ],
607 'title_field' => '{{{ shipping_list_placeholder }}}',
608 ]
609 );
610
611 $this->end_controls_section();
612 }
613
614 public function billing_fields() {
615 $this->start_controls_section(
616 'billing_fields',
617 [
618 'label' => esc_html__( 'Billings Fields', 'sellkit' ),
619 ]
620 );
621
622 $repeater = new \Elementor\Repeater();
623
624 /* Prevent user to add email field , we added that at login form. billing_email excluded. */
625 $repeater->add_control(
626 'billing_list_field',
627 [
628 'label' => esc_html__( 'Field role', 'sellkit' ),
629 'type' => 'select',
630 'options' => $this->billing_fields_type(),
631 ]
632 );
633
634 $repeater->add_control(
635 'billing_custom_type',
636 [
637 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
638 'type' => 'select',
639 'options' => [
640 'text' => esc_html__( 'Text Field', 'sellkit' ),
641 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
642 'select' => esc_html__( 'Select Field', 'sellkit' ),
643 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
644 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
645 'radio' => esc_html__( 'Radio', 'sellkit' ),
646 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
647 'email' => esc_html__( 'Email Field', 'sellkit' ),
648 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
649 ],
650 'condition' => [
651 'billing_list_field' => 'custom_role',
652 ],
653 'default' => 'text',
654 ]
655 );
656
657 $repeater->add_control(
658 'billing_custom_options',
659 [
660 'label' => esc_html__( 'Options', 'sellkit' ),
661 'type' => 'textarea',
662 'rows' => 5,
663 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
664 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
665 'condition' => [
666 'billing_custom_type' => [ 'select', 'multiselect', 'radio' ],
667 ],
668 ]
669 );
670
671 $repeater->add_control(
672 'billing_radio_field_mode',
673 [
674 'label' => esc_html__( 'Display Mode', 'sellkit' ),
675 'type' => 'choose',
676 'options' => [
677 'inline' => [
678 'title' => esc_html__( 'Inline', 'sellkit' ),
679 'icon' => 'eicon-ellipsis-h',
680 ],
681 'list' => [
682 'title' => esc_html__( 'List', 'sellkit' ),
683 'icon' => 'eicon-bullet-list',
684 ],
685 ],
686 'default' => 'list',
687 'toggle' => true,
688 'condition' => [
689 'billing_custom_type' => [ 'radio' ],
690 ],
691 ]
692 );
693
694 $repeater->add_control(
695 'billing_custom_id',
696 [
697 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
698 'type' => 'text',
699 'placeholder' => 'e.g. my_custom_field',
700 'condition' => [
701 'billing_list_field' => 'custom_role',
702 ],
703 ]
704 );
705
706 $repeater->add_control(
707 'billing_custom_value',
708 [
709 'label' => esc_html__( 'Default Value', 'sellkit' ),
710 'type' => 'text',
711 'condition' => [
712 'billing_list_field' => 'custom_role',
713 'billing_custom_type' => [ 'text', 'textarea', 'select', 'multiselect', 'radio', 'tel', 'email', 'hidden' ],
714 ],
715 ]
716 );
717
718 $repeater->add_control(
719 'billing_checkbox_custom_value',
720 [
721 'label' => esc_html__( 'Default Value', 'sellkit' ),
722 'type' => 'select',
723 'options' => [
724 'true' => 'True',
725 'false' => 'False',
726 ],
727 'condition' => [
728 'billing_list_field' => 'custom_role',
729 'billing_custom_type' => [ 'checkbox' ],
730 ],
731 ]
732 );
733
734 $repeater->add_control(
735 'billing_width',
736 [
737 'label' => esc_html__( 'Width', 'sellkit' ),
738 'type' => 'select',
739 'options' => [
740 'w-10' => esc_html__( '10%', 'sellkit' ),
741 'w-20' => esc_html__( '20%', 'sellkit' ),
742 'w-30' => esc_html__( '30%', 'sellkit' ),
743 'w-33' => esc_html__( '33%', 'sellkit' ),
744 'w-34' => esc_html__( '34%', 'sellkit' ),
745 'w-40' => esc_html__( '40%', 'sellkit' ),
746 'w-50' => esc_html__( '50%', 'sellkit' ),
747 'w-60' => esc_html__( '60%', 'sellkit' ),
748 'w-70' => esc_html__( '70%', 'sellkit' ),
749 'w-80' => esc_html__( '80%', 'sellkit' ),
750 'w-90' => esc_html__( '90%', 'sellkit' ),
751 'w-100' => esc_html__( '100%', 'sellkit' ),
752 ],
753 'default' => 'w-100',
754 ]
755 );
756
757 $repeater->add_control(
758 'billing_list_placeholder',
759 [
760 'label' => esc_html__( 'Field Label', 'sellkit' ),
761 'type' => 'text',
762 'default' => esc_html__( 'Default label', 'sellkit' ),
763 ]
764 );
765
766 $repeater->add_control(
767 'billing_list_class',
768 [
769 'label' => esc_html__( 'Field Class', 'sellkit' ),
770 'type' => 'text',
771 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
772 ]
773 );
774
775 $repeater->add_control(
776 'billing_list_validation',
777 [
778 'label' => esc_html__( 'Validation', 'sellkit' ),
779 'type' => 'select',
780 'options' => [
781 '' => esc_html__( 'Select one...', 'sellkit' ),
782 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
783 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
784 ],
785 'default' => '',
786 'condition' => [
787 'billing_custom_type' => [ 'text', 'select', 'tel' ],
788 ],
789 ]
790 );
791
792 $repeater->add_control(
793 'billing_list_required',
794 [
795 'label' => esc_html__( 'Field Required?', 'sellkit' ),
796 'type' => 'select',
797 'options' => [
798 'yes' => esc_html__( 'Yes', 'sellkit' ),
799 'no' => esc_html__( 'No', 'sellkit' ),
800 ],
801 'default' => 'no',
802 ]
803 );
804
805 $repeater->add_control(
806 'billing_list_clear',
807 [
808 'label' => esc_html__( 'Field Clear', 'sellkit' ),
809 'type' => 'select',
810 'description' => esc_html__( 'Yes or No, applies a clear fix to the field', 'sellkit' ),
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_show_in_thankyou',
821 [
822 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
823 'type' => 'switcher',
824 'label_on' => esc_html__( 'Show', 'sellkit' ),
825 'label_off' => esc_html__( 'Hide', 'sellkit' ),
826 'return_value' => 'yes',
827 'default' => 'no',
828 'condition' => [
829 'billing_list_field' => 'custom_role',
830 ],
831 ]
832 );
833
834 $repeater->add_control(
835 'billing_show_in_order_mail',
836 [
837 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
838 'type' => 'switcher',
839 'label_on' => esc_html__( 'Show', 'sellkit' ),
840 'label_off' => esc_html__( 'Hide', 'sellkit' ),
841 'return_value' => 'yes',
842 'default' => 'no',
843 'condition' => [
844 'billing_list_field' => 'custom_role',
845 ],
846 ]
847 );
848
849 $this->add_control(
850 'billing_list',
851 [
852 'label' => esc_html__( 'Billing Fields', 'sellkit' ),
853 'type' => 'repeater',
854 'fields' => $repeater->get_controls(),
855 'item_actions' => [
856 'duplicate' => false,
857 ],
858 'prevent_empty' => false,
859 'default' => [
860 [
861 'billing_list_field' => 'billing_first_name',
862 'billing_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
863 'billing_width' => 'w-50',
864 'billing_list_required' => 'yes',
865 'billing_list_clear' => 'no',
866 ],
867 [
868 'billing_list_field' => 'billing_last_name',
869 'billing_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
870 'billing_width' => 'w-50',
871 'billing_list_required' => 'no',
872 'billing_list_clear' => 'no',
873 ],
874 [
875 'billing_list_field' => 'billing_address_1',
876 'billing_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
877 'billing_width' => 'w-100',
878 'billing_list_required' => 'no',
879 'billing_list_clear' => 'no',
880 ],
881 [
882 'billing_list_field' => 'billing_address_2',
883 'billing_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
884 'billing_width' => 'w-100',
885 'billing_list_required' => 'no',
886 'billing_list_clear' => 'no',
887 ],
888 [
889 'billing_list_field' => 'billing_country',
890 'billing_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
891 'billing_width' => 'w-33',
892 'billing_list_required' => 'no',
893 'billing_list_clear' => 'no',
894 ],
895 [
896 'billing_list_field' => 'billing_state',
897 'billing_list_placeholder' => esc_html__( 'State', 'sellkit' ),
898 'billing_width' => 'w-33',
899 'billing_list_required' => 'no',
900 'billing_list_clear' => 'no',
901 ],
902 [
903 'billing_list_field' => 'billing_postcode',
904 'billing_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
905 'billing_width' => 'w-34',
906 'billing_list_required' => 'no',
907 'billing_list_clear' => 'no',
908 ],
909 [
910 'billing_list_field' => 'billing_city',
911 'billing_list_placeholder' => esc_html__( 'City', 'sellkit' ),
912 'billing_width' => 'w-100',
913 'billing_list_required' => 'no',
914 'billing_list_clear' => 'no',
915 ],
916 ],
917 'title_field' => '{{{ billing_list_placeholder }}}',
918 ]
919 );
920
921 $this->end_controls_section();
922 }
923
924 private function custom_messages() {
925 $this->start_controls_section(
926 'custom_messages',
927 [
928 'label' => esc_html__( 'Custom Messages', 'sellkit' ),
929 ]
930 );
931
932 $this->add_control(
933 'empty_cart',
934 [
935 'type' => 'text',
936 'default' => esc_html__( 'Your shopping cart is empty.', 'sellkit' ),
937 'label_block' => true,
938 ]
939 );
940
941 $this->add_control(
942 'create_website_account',
943 [
944 'type' => 'text',
945 'default' => esc_html__( 'Create a {{website}} account', 'sellkit' ),
946 'label_block' => true,
947 'description' => '{{website}} will automatically point to your website name',
948 ]
949 );
950
951 $this->add_control(
952 'secure_transaction_text',
953 [
954 'type' => 'text',
955 'default' => esc_html__( 'All transactions are secure and encrypted.', 'sellkit' ),
956 'label_block' => true,
957 ]
958 );
959
960 $this->add_control(
961 'select_address_text',
962 [
963 'type' => 'text',
964 'default' => esc_html__( 'Select the address that matches your card or payment method.', 'sellkit' ),
965 'label_block' => true,
966 ]
967 );
968
969 $this->end_controls_section();
970 }
971 }
972