PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.0.7
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.0.7
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / modules / page-order / widgets / page-order.php

page-order.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 3.0.7, at modules/page-order/widgets/page-order.php

1,293 lines 50.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimateStoreKit\Modules\PageOrder\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Typography;
10 use UltimateStoreKit\Base\Module_Base;
11
12 if ( !defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 // Exit if accessed directly
17
18 // class Add_To_Cart extends Widget_Button {
19 class Page_Order extends Module_Base {
20
21 public function get_show_in_panel_tags() {
22 return ['shop_single'];
23 }
24
25 public function get_name() {
26 return 'usk-page-order';
27 }
28
29 public function get_title() {
30 return BDTUSK . esc_html__( 'Order Page', 'ultimate-store-kit' );
31 }
32
33 public function get_icon() {
34 return 'usk-widget-icon usk-icon-page-order usk-new';
35 }
36
37 public function get_categories() {
38 return ['ultimate-store-kit-order-thankyou'];
39 }
40
41 public function show_in_panel() {
42 return get_post_type() !== 'page';
43 }
44
45 public function get_keywords() {
46 return ['add', 'to', 'cart', 'woocommerce', 'wc', 'additional', 'info'];
47 }
48
49 public function get_style_depends() {
50
51 if ( $this->usk_is_edit_mode() ) {
52 return ['usk-all-styles'];
53 } else {
54 return ['usk-font', 'usk-add-to-cart', 'usk-page-order'];
55 }
56
57 }
58
59 public function has_widget_inner_wrapper(): bool {
60 return !\Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
61 }
62
63 protected function register_controls() {
64 $this->start_controls_section(
65 'section_layout_thankyou_orders',
66 [
67 'label' => __( 'ThankYou Order', 'ultimate-store-kit' ),
68 'tab' => Controls_Manager::TAB_CONTENT,
69 ]
70 );
71
72 $this->add_responsive_control(
73 'thankyou_spacing',
74 [
75 'label' => __( 'Spacing', 'ultimate-store-kit' ),
76 'type' => Controls_Manager::SLIDER,
77 'size_units' => ['px'],
78 'range' => [
79 'px' => [
80 'min' => 0,
81 'max' => 100,
82 'step' => 1,
83 ],
84 ],
85 'selectors' => [
86 '{{WRAPPER}}' => '--usk-order-page-spacing: {{SIZE}}{{UNIT}};',
87 ],
88 ]
89 );
90
91 $this->add_control(
92 'thankyou_show_order_id',
93 [
94 'label' => __( 'Show Order ID', 'ultimate-store-kit' ),
95 'type' => Controls_Manager::SWITCHER,
96 'default' => 'yes',
97 'separator' => 'after',
98 ]
99 );
100 $this->add_control(
101 'thankyou_order_received_text',
102 [
103 'label' => __( 'Description', 'ultimate-store-kit' ),
104 'type' => Controls_Manager::TEXTAREA,
105 'dynamic' => ['active' => true],
106 'rows' => 5,
107 'default' => __( 'Thank you. Your order has been received.', 'ultimate-store-kit' ),
108 'placeholder' => __( 'Thank you. Your order has been received.', 'ultimate-store-kit' ),
109 ]
110 );
111 $this->add_control(
112 'thankyour_order_alignment',
113 [
114 'label' => __( 'Alignment', 'ultimate-store-kit' ),
115 'type' => Controls_Manager::CHOOSE,
116 'options' => [
117 'left' => [
118 'title' => __( 'Left', 'ultimate-store-kit' ),
119 'icon' => 'eicon-h-align-left',
120 ],
121 'center' => [
122 'title' => __( 'Center', 'ultimate-store-kit' ),
123 'icon' => 'eicon-h-align-center',
124 ],
125 'right' => [
126 'title' => __( 'Right', 'ultimate-store-kit' ),
127 'icon' => 'eicon-h-align-right',
128 ],
129 ],
130 'default' => 'center',
131 'toggle' => false,
132 'selectors' => [
133 '{{WRAPPER}} .usk-page-order .usk-page-order-heading' => 'text-align:{{VALUE}}; display:block;',
134 ],
135 ]
136 );
137
138 $this->end_controls_section();
139 $this->start_controls_section(
140 'section_style_thankyou_orders_style',
141 [
142 'label' => __( 'Order Heading', 'ultimate-store-kit' ),
143 'tab' => Controls_Manager::TAB_STYLE,
144 ]
145 );
146
147 $this->add_group_control(
148 Group_Control_Background::get_type(),
149 [
150 'name' => 'thankyou_orders_background',
151 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
152 'types' => ['classic', 'gradient'],
153 'selector' => '{{WRAPPER}} .usk-page-order .usk-page-order-heading',
154 ]
155 );
156
157 $this->add_control(
158 'thankyou_orders_border_color',
159 [
160 'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ),
161 'type' => Controls_Manager::COLOR,
162 'selectors' => [
163 '{{WRAPPER}} .usk-page-order .usk-page-order-heading' => 'border-color: {{VALUE}};',
164 ],
165 ]
166 );
167
168 $this->start_controls_tabs(
169 'tabs_style_thankyou_order'
170 );
171
172 $this->start_controls_tab(
173 'tab_style_thankyou_order_heading',
174 [
175 'label' => __( 'Title', 'ultimate-store-kit' ),
176 ]
177 );
178 $this->add_control(
179 'heading_color',
180 [
181 'label' => __( 'Color', 'ultimate-store-kit' ),
182 'type' => Controls_Manager::COLOR,
183 'selectors' => [
184 '{{WRAPPER}} .usk-page-order .usk-page-order-heading .thankyou-order-heading' => 'color: {{VALUE}}',
185 ],
186 ]
187 );
188
189 $this->add_group_control(
190 Group_Control_Typography::get_type(),
191 [
192 'name' => 'heading_typography',
193 'label' => __( 'Typography', 'ultimate-store-kit' ),
194 'selector' => '{{WRAPPER}} .usk-page-order .thankyou-order-heading',
195 ]
196 );
197 $this->end_controls_tab();
198 $this->start_controls_tab(
199 'tab_style_thankyou_order_desc',
200 [
201 'label' => __( 'Description', 'ultimate-store-kit' ),
202 ]
203 );
204 $this->add_control(
205 'desc_color',
206 [
207 'label' => __( 'Color', 'ultimate-store-kit' ),
208 'type' => Controls_Manager::COLOR,
209 'selectors' => [
210 '{{WRAPPER}} .usk-page-order .thankyou-order-desc ' => 'color: {{VALUE}}',
211 ],
212 ]
213 );
214 $this->add_group_control(
215 Group_Control_Typography::get_type(),
216 [
217 'name' => 'desc_typography',
218 'label' => __( 'Typography', 'ultimate-store-kit' ),
219 'selector' => '{{WRAPPER}} .usk-page-order .thankyou-order-desc',
220 ]
221 );
222 $this->end_controls_tab();
223 $this->end_controls_tabs();
224 $this->end_controls_section();
225
226 // Order Details List Style Section
227 $this->start_controls_section(
228 'section_style_order_details_list',
229 [
230 'label' => esc_html__( 'Order Card', 'ultimate-store-kit' ),
231 'tab' => Controls_Manager::TAB_STYLE,
232 ]
233 );
234
235 // Container Style
236 $this->add_control(
237 'order_list_container_heading',
238 [
239 'label' => esc_html__( 'Container', 'ultimate-store-kit' ),
240 'type' => Controls_Manager::HEADING,
241 ]
242 );
243
244 $this->add_responsive_control(
245 'order_list_columns',
246 [
247 'label' => esc_html__( 'Columns', 'ultimate-store-kit' ),
248 'type' => Controls_Manager::SLIDER,
249 'size_units' => ['px'],
250 'range' => [
251 'px' => [
252 'min' => 1,
253 'max' => 6,
254 'step' => 1,
255 ],
256 ],
257 'selectors' => [
258 '{{WRAPPER}} .order_details' => 'grid-template-columns: repeat({{SIZE}}, 1fr);',
259 ],
260 ]
261 );
262
263 $this->add_responsive_control(
264 'order_list_gap',
265 [
266 'label' => esc_html__( 'Gap', 'ultimate-store-kit' ),
267 'type' => Controls_Manager::SLIDER,
268 'size_units' => ['px'],
269 'range' => [
270 'px' => [
271 'min' => 0,
272 'max' => 50,
273 ],
274 ],
275 'default' => [
276 'unit' => 'px',
277 'size' => 20,
278 ],
279 'selectors' => [
280 '{{WRAPPER}} .order_details' => 'gap: {{SIZE}}{{UNIT}};',
281 ],
282 ]
283 );
284
285 // Typography Style
286 $this->add_control(
287 'order_list_typography_heading',
288 [
289 'label' => esc_html__( 'Items', 'ultimate-store-kit' ),
290 'type' => Controls_Manager::HEADING,
291 'separator' => 'before',
292 ]
293 );
294
295 $this->start_controls_tabs( 'order_list_typography_tabs' );
296
297 $this->start_controls_tab(
298 'order_list_typography_wrapper',
299 [
300 'label' => esc_html__( 'Wrapper', 'ultimate-store-kit' ),
301 ]
302 );
303 $this->add_group_control(
304 Group_Control_Background::get_type(),
305 [
306 'name' => 'order_list_item_background',
307 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
308 'types' => ['classic', 'gradient'],
309 'selector' => '{{WRAPPER}} .order_details li',
310 'separator' => 'before',
311 ]
312 );
313
314 $this->add_control(
315 'order_list_item_border_color',
316 [
317 'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ),
318 'type' => Controls_Manager::COLOR,
319 'selectors' => [
320 '{{WRAPPER}} .order_details li' => 'border-color: {{VALUE}};',
321 ],
322 ]
323 );
324
325 $this->add_control(
326 'order_list_icon_color_style-border',
327 [
328 'label' => esc_html__( 'Style Border Color', 'ultimate-store-kit' ),
329 'type' => Controls_Manager::COLOR,
330 'selectors' => [
331 '{{WRAPPER}} .usk-page-order .order_details li, {{WRAPPER}} .usk-page-order .order_details li:last-of-type' => 'border-left-color: {{VALUE}} !important;',
332 ],
333 ]
334 );
335
336 $this->end_controls_tab();
337 // Label Typography Tab
338 $this->start_controls_tab(
339 'order_list_typography_label',
340 [
341 'label' => esc_html__( 'Label', 'ultimate-store-kit' ),
342 ]
343 );
344
345 $this->add_control(
346 'order_list_label_color',
347 [
348 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
349 'type' => Controls_Manager::COLOR,
350 'selectors' => [
351 '{{WRAPPER}} .order_details li .usk-label' => 'color: {{VALUE}};',
352 ],
353 ]
354 );
355
356 $this->add_group_control(
357 Group_Control_Typography::get_type(),
358 [
359 'name' => 'order_list_label_typography',
360 'selector' => '{{WRAPPER}} .order_details li .usk-label',
361 ]
362 );
363
364 $this->end_controls_tab();
365
366 // Value Typography Tab
367 $this->start_controls_tab(
368 'order_list_typography_value',
369 [
370 'label' => esc_html__( 'Value', 'ultimate-store-kit' ),
371 ]
372 );
373
374 $this->add_control(
375 'order_list_value_color',
376 [
377 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
378 'type' => Controls_Manager::COLOR,
379 'selectors' => [
380 '{{WRAPPER}} .order_details li .usk-value' => 'color: {{VALUE}};',
381 ],
382 'default' => '#1e293b',
383 ]
384 );
385
386 $this->add_control(
387 'order_list_total_value_color',
388 [
389 'label' => esc_html__( 'Total Value Color', 'ultimate-store-kit' ),
390 'type' => Controls_Manager::COLOR,
391 'selectors' => [
392 '{{WRAPPER}} .order_details li.total .usk-value' => 'color: {{VALUE}};',
393 ],
394 'default' => '#0f766e',
395 ]
396 );
397
398 $this->add_group_control(
399 Group_Control_Typography::get_type(),
400 [
401 'name' => 'order_list_value_typography',
402 'selector' => '{{WRAPPER}} .order_details li .usk-value',
403 ]
404 );
405
406 $this->end_controls_tab();
407
408 // Icon Typography Tab
409 $this->start_controls_tab(
410 'order_list_typography_icon',
411 [
412 'label' => esc_html__( 'Icon', 'ultimate-store-kit' ),
413 ]
414 );
415
416 $this->add_responsive_control(
417 'order_list_icon_size',
418 [
419 'label' => esc_html__( 'Size', 'ultimate-store-kit' ),
420 'type' => Controls_Manager::SLIDER,
421 'size_units' => ['px'],
422 'range' => [
423 'px' => [
424 'min' => 10,
425 'max' => 50,
426 ],
427 ],
428 'default' => [
429 'unit' => 'px',
430 'size' => 24,
431 ],
432 'selectors' => [
433 '{{WRAPPER}} .order_details li .usk-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
434 ],
435 ]
436 );
437
438 $this->add_control(
439 'order_list_icon_global_color',
440 [
441 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
442 'type' => Controls_Manager::COLOR,
443 'selectors' => [
444 '{{WRAPPER}} .usk-page-order .order_details li .usk-icon' => 'stroke: {{VALUE}}',
445 ],
446 ]
447 );
448
449 $this->end_controls_tab();
450
451 $this->end_controls_tabs();
452
453 $this->end_controls_section();
454
455 $this->start_controls_section(
456 'style_section_order_details',
457 [
458 'label' => esc_html__( 'Order Details', 'ultimate-store-kit' ),
459 'tab' => Controls_Manager::TAB_STYLE,
460 ]
461 );
462 $this->start_controls_tabs( 'order_details_title_tabs' );
463
464 $this->start_controls_tab(
465 'order_details_wrap_tab',
466 [
467 'label' => esc_html__( 'Wrapper', 'ultimate-store-kit' ),
468 ]
469 );
470
471 $this->add_group_control(
472 Group_Control_Background::get_type(),
473 [
474 'name' => 'order_details_wrap_background',
475 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
476 'types' => ['classic', 'gradient'],
477 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details',
478 ]
479 );
480
481 $this->add_control(
482 'order_details_wrap_border_color',
483 [
484 'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ),
485 'type' => Controls_Manager::COLOR,
486 'selectors' => [
487 '{{WRAPPER}} .usk-page-order .woocommerce-order-details' => 'border-color: {{VALUE}};',
488 ],
489 ]
490 );
491
492 $this->end_controls_tab();
493
494 $this->start_controls_tab(
495 'order_details_heading_tab',
496 [
497 'label' => esc_html__( 'Title', 'ultimate-store-kit' ),
498 ]
499 );
500
501 $this->add_control(
502 'order_details_title_color',
503 [
504 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
505 'type' => Controls_Manager::COLOR,
506 'selectors' => [
507 '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title' => 'color: {{VALUE}}',
508 ],
509 ]
510 );
511
512 $this->add_control(
513 'order_details_title_border_color',
514 [
515 'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ),
516 'type' => Controls_Manager::COLOR,
517 'selectors' => [
518 '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title::after' => 'background: {{VALUE}}',
519 ],
520 ]
521 );
522
523 $this->add_group_control(
524 Group_Control_Typography::get_type(),
525 [
526 'name' => 'order_details_title_typography',
527 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
528 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title',
529 ]
530 );
531
532 $this->end_controls_tab();
533
534 $this->end_controls_tabs();
535
536 $this->add_control(
537 'order_details_tabs_heading',
538 [
539 'label' => esc_html__( 'Table', 'ultimate-store-kit' ),
540 'type' => Controls_Manager::HEADING,
541 'separator' => 'before',
542 ]
543 );
544
545 $this->start_controls_tabs( 'order_details_tabs_tables' );
546
547 $this->start_controls_tab(
548 'order_details_tabs_table_header',
549 [
550 'label' => esc_html__( 'Header', 'ultimate-store-kit' ),
551 ]
552 );
553
554 $this->add_group_control(
555 Group_Control_Background::get_type(),
556 [
557 'name' => 'table_header_background',
558 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
559 'types' => ['classic', 'gradient'],
560 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table thead , {{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tfoot tr:last-child',
561 ]
562 );
563
564 $this->add_control(
565 'table_header_color',
566 [
567 'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ),
568 'type' => Controls_Manager::COLOR,
569 'selectors' => [
570 '{{WRAPPER}} .usk-page-order .woocommerce-table thead th, {{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tfoot tr:last-child th' => 'color: {{VALUE}};',
571 ],
572 ]
573 );
574
575 $this->add_group_control(
576 Group_Control_Typography::get_type(),
577 [
578 'name' => 'table_header_typography',
579 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
580 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table thead th',
581 ]
582 );
583
584 $this->end_controls_tab();
585
586 $this->start_controls_tab(
587 'order_details_tabs_table_body',
588 [
589 'label' => esc_html__( 'Body', 'ultimate-store-kit' ),
590 ]
591 );
592
593 $this->add_control(
594 'table_body_odd_row',
595 [
596 'label' => esc_html__( 'Odd Row', 'ultimate-store-kit' ),
597 'type' => Controls_Manager::HEADING,
598 ]
599 );
600
601 $this->add_control(
602 'table_body_odd_row_bg_color',
603 [
604 'label' => esc_html__( 'Background Color', 'ultimate-store-kit' ),
605 'type' => Controls_Manager::COLOR,
606 'selectors' => [
607 '{{WRAPPER}} .usk-page-order .woocommerce-table tbody tr:nth-child(odd)' => 'background-color: {{VALUE}};',
608 ],
609 ]
610 );
611
612 $this->add_control(
613 'table_body_odd_row_text_color',
614 [
615 'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ),
616 'type' => Controls_Manager::COLOR,
617 'selectors' => [
618 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(odd) td.product-name a' => 'color: {{VALUE}};',
619 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(odd) td .product-quantity' => 'color: {{VALUE}};',
620 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(odd) td.product-total .amount' => 'color: {{VALUE}};',
621 ],
622 ]
623 );
624
625 $this->add_control(
626 'table_body_even_row',
627 [
628 'label' => esc_html__( 'Even Row', 'ultimate-store-kit' ),
629 'type' => Controls_Manager::HEADING,
630 'separator' => 'before',
631 ]
632 );
633
634 $this->add_control(
635 'table_body_even_row_bg_color',
636 [
637 'label' => esc_html__( 'Background Color', 'ultimate-store-kit' ),
638 'type' => Controls_Manager::COLOR,
639 'selectors' => [
640 '{{WRAPPER}} .usk-page-order .woocommerce-table tbody tr:nth-child(even)' => 'background-color: {{VALUE}};',
641 ],
642 ]
643 );
644
645 $this->add_control(
646 'table_body_even_row_text_color',
647 [
648 'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ),
649 'type' => Controls_Manager::COLOR,
650 'selectors' => [
651 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(even) td.product-name a' => 'color: {{VALUE}};',
652 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(even) td .product-quantity' => 'color: {{VALUE}};',
653 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(even) td.product-total .amount' => 'color: {{VALUE}};',
654 ],
655 'separator' => 'after',
656 ]
657 );
658
659 $this->add_group_control(
660 Group_Control_Typography::get_type(),
661 [
662 'name' => 'table_body_typography',
663 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
664 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td',
665 ]
666 );
667
668 $this->add_control(
669 'table_body_meta_heading',
670 [
671 'label' => esc_html__( 'Meta Data', 'ultimate-store-kit' ),
672 'type' => Controls_Manager::HEADING,
673 'separator' => 'before',
674 ]
675 );
676
677 $this->add_control(
678 'table_body_meta_color',
679 [
680 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
681 'type' => Controls_Manager::COLOR,
682 'selectors' => [
683 '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dt' => 'color: {{VALUE}};',
684 '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dd' => 'color: {{VALUE}};',
685 '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li' => 'color: {{VALUE}};',
686 '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li p' => 'color: {{VALUE}};',
687 ],
688 ]
689 );
690
691 $this->add_group_control(
692 Group_Control_Typography::get_type(),
693 [
694 'name' => 'table_body_meta_typography',
695 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
696 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dt, {{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dd, {{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li, {{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li p',
697 ]
698 );
699
700 $this->end_controls_tab();
701
702 $this->start_controls_tab(
703 'order_details_tabs_table_footer',
704 [
705 'label' => esc_html__( 'Footer', 'ultimate-store-kit' ),
706 ]
707 );
708
709 $this->add_group_control(
710 Group_Control_Background::get_type(),
711 [
712 'name' => 'table_footer_background',
713 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
714 'types' => ['classic', 'gradient'],
715 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tfoot',
716 ]
717 );
718
719 $this->add_control(
720 'table_footer_text_color',
721 [
722 'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ),
723 'type' => Controls_Manager::COLOR,
724 'selectors' => [
725 '{{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr th' => 'color: {{VALUE}};',
726 '{{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr td' => 'color: {{VALUE}};',
727 ],
728 ]
729 );
730
731 $this->add_control(
732 'table_footer_total_color',
733 [
734 'label' => esc_html__( 'Total Amount Color', 'ultimate-store-kit' ),
735 'type' => Controls_Manager::COLOR,
736 'selectors' => [
737 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tfoot tr:last-child td .amount' => 'color: {{VALUE}};',
738 ],
739 ]
740 );
741
742 $this->add_group_control(
743 Group_Control_Typography::get_type(),
744 [
745 'name' => 'table_footer_typography',
746 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
747 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr th, {{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr td',
748 ]
749 );
750
751 $this->end_controls_tab();
752
753 $this->end_controls_tabs();
754
755 $this->add_control(
756 'order_again_button_heading',
757 [
758 'label' => esc_html__( 'Order Button', 'ultimate-store-kit' ),
759 'type' => Controls_Manager::HEADING,
760 'separator' => 'before',
761 ]
762 );
763
764 $this->start_controls_tabs( 'order_again_button_tabs' );
765 $this->start_controls_tab(
766 'tab_order_again_button_normal',
767 [
768 'label' => __( 'Normal', 'ultimate-store-kit' ),
769 ]
770 );
771
772 $this->add_control(
773 'order_again_button_text_color',
774 [
775 'label' => __( 'Color', 'ultimate-store-kit' ),
776 'type' => Controls_Manager::COLOR,
777 'default' => '#fff',
778 'selectors' => [
779 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button' => 'color: {{VALUE}};',
780 ],
781 ]
782 );
783
784 $this->add_group_control(
785 Group_Control_Background::get_type(),
786 [
787 'name' => 'order_again_button_background',
788 'label' => __( 'Background', 'ultimate-store-kit' ),
789 'types' => ['classic', 'gradient'],
790 'exclude' => ['image'],
791 'fields_options' => [
792 'background' => [
793 'default' => 'classic',
794 ],
795 'color' => [
796 'default' => '#1E87F0',
797 ],
798 ],
799 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button',
800 ]
801 );
802
803 $this->add_group_control(
804 Group_Control_Border::get_type(),
805 [
806 'name' => 'order_again_button_border',
807 'label' => __( 'Border', 'ultimate-store-kit' ),
808 'default' => 'n',
809 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button',
810 ]
811 );
812
813 $this->add_control(
814 'order_again_button_border_radius',
815 [
816 'label' => __( 'Border Radius', 'ultimate-store-kit' ),
817 'type' => Controls_Manager::DIMENSIONS,
818 'size_units' => ['px', 'rem', '%'],
819 'selectors' => [
820 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
821 ],
822 ]
823 );
824
825 $this->add_responsive_control(
826 'order_again_button_padding',
827 [
828 'label' => __( 'Padding', 'ultimate-store-kit' ),
829 'type' => Controls_Manager::DIMENSIONS,
830 'size_units' => ['px', 'rem', '%'],
831 'selectors' => [
832 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
833 ],
834 ]
835 );
836
837 $this->add_group_control(
838 Group_Control_Typography::get_type(),
839 [
840 'name' => 'order_again_button_typography',
841 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button',
842 ]
843 );
844
845 $this->add_group_control(
846 Group_Control_Box_Shadow::get_type(),
847 [
848 'name' => 'order_again_button_box_shadow',
849 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button',
850 ]
851 );
852
853 $this->end_controls_tab();
854 $this->start_controls_tab(
855 'tab_order_again_button_hover',
856 [
857 'label' => __( 'Hover', 'ultimate-store-kit' ),
858 ]
859 );
860
861 $this->add_control(
862 'order_again_button_hover_color',
863 [
864 'label' => __( 'Color', 'ultimate-store-kit' ),
865 'type' => Controls_Manager::COLOR,
866 'selectors' => [
867 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button:hover' => 'color: {{VALUE}};',
868 ],
869 ]
870 );
871
872 $this->add_control(
873 'order_again_button_hover_border_color',
874 [
875 'label' => __( 'Border Color', 'ultimate-store-kit' ),
876 'type' => Controls_Manager::COLOR,
877 'condition' => [
878 'order_again_button_border_border!' => 'none',
879 ],
880 'selectors' => [
881 '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button:hover' => 'border-color: {{VALUE}};',
882 ],
883 ]
884 );
885
886 $this->add_group_control(
887 Group_Control_Background::get_type(),
888 [
889 'name' => 'order_again_button_hover_background',
890 'label' => __( 'Background', 'ultimate-store-kit' ),
891 'exclude' => ['image'],
892 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button:hover',
893 ]
894 );
895
896 $this->end_controls_tab();
897 $this->end_controls_tabs();
898
899 $this->end_controls_section();
900
901 $this->start_controls_section(
902 'styles_section_thankyou_address_details',
903 [
904 'label' => esc_html__( 'Address Details', 'ultimate-store-kit' ),
905 'tab' => Controls_Manager::TAB_STYLE,
906 ]
907 );
908
909 $this->start_controls_tabs( 'thankyou_address_details_tabs' );
910
911 $this->start_controls_tab(
912 'thankyou_address_details_wrapper',
913 [
914 'label' => esc_html__( 'Wrapper', 'ultimate-store-kit' ),
915 ]
916 );
917
918 $this->add_group_control(
919 Group_Control_Background::get_type(),
920 [
921 'name' => 'thankyou_address_details_background',
922 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
923 'types' => ['classic', 'gradient'],
924 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column',
925 ]
926 );
927
928 $this->add_control(
929 'thankyou_address_details_border_color',
930 [
931 'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ),
932 'type' => Controls_Manager::COLOR,
933 'selectors' => [
934 '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column' => 'border-color: {{VALUE}};',
935 ],
936 ]
937 );
938
939 $this->end_controls_tab();
940
941 $this->start_controls_tab(
942 'thankyou_address_details_title_tab',
943 [
944 'label' => esc_html__( 'Title', 'ultimate-store-kit' ),
945 ]
946 );
947
948 $this->add_control(
949 'thankyou_address_details_title_color',
950 [
951 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
952 'type' => Controls_Manager::COLOR,
953 'selectors' => [
954 '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column__title' => 'color: {{VALUE}};',
955 ],
956 ]
957 );
958
959 $this->add_control(
960 'thankyou_address_details_title_border_color',
961 [
962 'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ),
963 'type' => Controls_Manager::COLOR,
964 'selectors' => [
965 '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column__title::after' => 'background: {{VALUE}};',
966 ],
967 ]
968 );
969
970 $this->add_group_control(
971 Group_Control_Typography::get_type(),
972 [
973 'name' => 'thankyou_address_details_title_typography',
974 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
975 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column__title',
976 ]
977 );
978
979 $this->end_controls_tab();
980
981 $this->start_controls_tab(
982 'thankyou_address_details_address_tab',
983 [
984 'label' => esc_html__( 'Address', 'ultimate-store-kit' ),
985 ]
986 );
987
988 $this->add_control(
989 'thankyou_address_details_address_color',
990 [
991 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
992 'type' => Controls_Manager::COLOR,
993 'selectors' => [
994 '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column address,
995 {{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column p' => 'color: {{VALUE}};',
996 ],
997 ]
998 );
999
1000 $this->add_group_control(
1001 Group_Control_Typography::get_type(),
1002 [
1003 'name' => 'thankyou_address_details_address_typography',
1004 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
1005 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column address,
1006 {{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column p',
1007 ]
1008 );
1009
1010 $this->end_controls_tabs();
1011
1012 $this->end_controls_section();
1013 }
1014
1015 protected function get_last_order_id() {
1016 global $wpdb;
1017 $statuses = array_keys( wc_get_order_statuses() );
1018 $statuses = implode( "','", $statuses );
1019 $results = $wpdb->get_col( "
1020 SELECT MAX(ID) FROM {$wpdb->prefix}posts
1021 WHERE post_type LIKE 'shop_order'
1022 AND post_status IN ('$statuses')" );
1023 return reset( $results );
1024 }
1025
1026 public function order_thank_you( $order ) {
1027 $settings = $this->get_settings_for_display();
1028 $order_received_text = $settings['thankyou_order_received_text'];
1029
1030 ?>
1031 <div class="usk-page-order-heading">
1032 <?php
1033 if ( $settings['thankyou_show_order_id'] === 'yes' ):
1034 printf( '<h3 class="thankyou-order-heading">%1$s # %2$s</h3>', esc_html__( 'Order', 'ultimate-store-kit' ), esc_html( $order->get_order_number() ) );
1035 endif; ?>
1036 <p class="thankyou-order-desc">
1037 <?php
1038 if ( $order->has_status( 'failed' ) ):
1039 echo esc_html__( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'ultimate-store-kit' );
1040 ?>
1041 <?php else:
1042 echo wp_kses_post( apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( $order_received_text, 'ultimate-store-kit' ), $order ) );
1043 endif; ?>
1044 </p>
1045 </div>
1046 <?php
1047 }
1048
1049 public function thank_your_order_details( $order ) {
1050 $order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) );
1051 $show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', [ 'completed', 'processing' ] ) );
1052 $downloads = $order->get_downloadable_items();
1053 $show_downloads = $order->has_downloadable_item() && $order->is_download_permitted();
1054 ?>
1055 <?php
1056
1057 if ( $show_downloads ) {
1058 wc_get_template(
1059 'order/order-downloads.php',
1060 [
1061 'downloads' => $downloads,
1062 'show_title' => true,
1063 ]
1064 );
1065 }
1066
1067 ?>
1068 <div class="woocommerce-order-details">
1069 <?php do_action( 'woocommerce_order_details_before_order_table', $order ); ?>
1070
1071 <h2 class="woocommerce-order-details__title"><?php esc_html_e( 'Order details', 'ultimate-store-kit' ); ?></h2>
1072
1073 <table class="woocommerce-table woocommerce-table--order-details shop_table order_details">
1074
1075 <thead>
1076 <tr>
1077 <th class="woocommerce-table__product-name product-name"><?php esc_html_e( 'Product', 'ultimate-store-kit' ); ?>
1078 </th>
1079 <th class="woocommerce-table__product-table product-total"><?php esc_html_e( 'Total', 'ultimate-store-kit' ); ?>
1080 </th>
1081 </tr>
1082 </thead>
1083
1084 <tbody>
1085 <?php
1086 do_action( 'woocommerce_order_details_before_order_table_items', $order );
1087
1088 foreach ( $order_items as $item_id => $item ) {
1089 $product = $item->get_product();
1090
1091 wc_get_template(
1092 'order/order-details-item.php',
1093 [
1094 'order' => $order,
1095 'item_id' => $item_id,
1096 'item' => $item,
1097 'show_purchase_note' => $show_purchase_note,
1098 'purchase_note' => $product ? $product->get_purchase_note() : '',
1099 'product' => $product,
1100 ]
1101 );
1102 }
1103
1104 do_action( 'woocommerce_order_details_after_order_table_items', $order );
1105 ?>
1106 </tbody>
1107
1108 <tfoot>
1109 <?php
1110
1111 foreach ( $order->get_order_item_totals() as $key => $total ) {
1112 ?>
1113 <tr>
1114 <th scope="row"><?php echo esc_html( $total['label'] ); ?></th>
1115 <td><?php echo( 'payment_method' === $key ) ? esc_html( $total['value'] ) : wp_kses_post( $total['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1116 ?></td>
1117 </tr>
1118 <?php
1119 }
1120
1121 ?>
1122 <?php
1123 if ( $order->get_customer_note() ): ?>
1124 <tr>
1125 <th><?php esc_html_e( 'Note:', 'ultimate-store-kit' ); ?></th>
1126 <td><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?></td>
1127 </tr>
1128 <?php endif; ?>
1129 </tfoot>
1130 </table>
1131 <?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?>
1132 </div>
1133
1134 <?php
1135 /**
1136 * Action hook fired after the order details.
1137 *
1138 * @since 4.4.0
1139 * @param WC_Order $order Order data.
1140 */
1141 do_action( 'woocommerce_after_order_details', $order );
1142 }
1143
1144 public function thank_you_order_confirmation( $order ) {?>
1145 <ul class="order_details">
1146 <li class="order">
1147 <svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1148 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
1149 d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" />
1150 </svg>
1151 <span class="usk-label"><?php esc_html_e( 'Order number:', 'ultimate-store-kit' ); ?></span>
1152 <strong class="usk-value"><?php echo esc_html( $order->get_order_number() ); ?></strong>
1153 </li>
1154 <li class="date">
1155 <svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1156 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
1157 d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
1158 </svg>
1159 <span class="usk-label"><?php esc_html_e( 'Order Date:', 'ultimate-store-kit' ); ?></span>
1160 <strong class="usk-value"><?php echo esc_html( wc_format_datetime( $order->get_date_created() ) ); ?></strong>
1161 </li>
1162 <li class="order-status">
1163 <svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1164 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
1165 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
1166 </svg>
1167 <span class="usk-label"><?php echo esc_html__( 'Order status', 'ultimate-store-kit' ); ?></span>
1168 <strong class="usk-value"><?php echo wp_kses_post( wc_get_order_status_name( $order->get_status() ) ); ?></strong>
1169 </li>
1170 <li class="total">
1171 <svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1172 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
1173 d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
1174 </svg>
1175 <span class="usk-label"><?php esc_html_e( 'Total:', 'ultimate-store-kit' ); ?></span>
1176 <strong class="usk-value"><?php echo wp_kses_post( $order->get_formatted_order_total() ); ?></strong>
1177 </li>
1178 <?php
1179 if ( $order->get_payment_method_title() ): ?>
1180 <li class="method">
1181 <svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
1182 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
1183 d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" />
1184 </svg>
1185 <span class="usk-label"><?php esc_html_e( 'Payment method:', 'ultimate-store-kit' ); ?></span>
1186 <strong class="usk-value"><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
1187 </li>
1188 <?php endif; ?>
1189 </ul>
1190 <?php
1191 }
1192
1193 public function thank_you_customer_address( $order ) {
1194 $show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id();
1195
1196 if ( $show_customer_details ) {
1197 $show_shipping = !wc_ship_to_billing_address_only() && $order->needs_shipping_address();
1198 ?>
1199 <div class="woocommerce-customer-details">
1200 <?php
1201 if ( $show_shipping ): ?>
1202
1203 <div class="woocommerce-columns woocommerce-columns--2 woocommerce-columns--addresses col2-set addresses">
1204 <div class="woocommerce-column woocommerce-column--1 woocommerce-column--billing-address col-1">
1205 <?php endif; ?>
1206
1207 <h2 class="woocommerce-column__title"><?php esc_html_e( 'Billing address', 'ultimate-store-kit' ); ?></h2>
1208
1209 <address>
1210 <?php echo wp_kses_post( $order->get_formatted_billing_address( esc_html__( 'N/A', 'ultimate-store-kit' ) ) ); ?>
1211
1212 <?php
1213 if ( $order->get_billing_phone() ): ?>
1214 <p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_billing_phone() ); ?></p>
1215 <?php endif; ?>
1216
1217 <?php
1218 if ( $order->get_billing_email() ): ?>
1219 <p class="woocommerce-customer-details--email"><?php echo esc_html( $order->get_billing_email() ); ?></p>
1220 <?php endif; ?>
1221 </address>
1222
1223 <?php
1224 if ( $show_shipping ): ?>
1225
1226 </div><!-- /.col-1 -->
1227
1228 <div class="woocommerce-column woocommerce-column--2 woocommerce-column--shipping-address col-2">
1229 <h2 class="woocommerce-column__title"><?php esc_html_e( 'Shipping address', 'ultimate-store-kit' ); ?></h2>
1230 <address>
1231 <?php echo wp_kses_post( $order->get_formatted_shipping_address( esc_html__( 'N/A', 'ultimate-store-kit' ) ) ); ?>
1232 <?php
1233 if ( $order->get_shipping_phone() ): ?>
1234 <p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_shipping_phone() ); ?></p>
1235 <?php endif; ?>
1236 </address>
1237 </div><!-- /.col-2 -->
1238 </div><!-- /.col2-set -->
1239
1240 <?php endif; ?>
1241
1242 <?php do_action( 'woocommerce_order_details_after_customer_details', $order ); ?>
1243
1244 </div>
1245 <?php
1246 }
1247
1248 }
1249
1250 public function render() {
1251
1252 // Check if we're in Elementor editor
1253 if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
1254 // Get last order for preview
1255 $orders = wc_get_orders( [ 'limit' => 1 ] );
1256
1257 if ( !empty( $orders ) ) {
1258 $order = $orders[0];
1259 } else {
1260 echo esc_html__( 'No orders found. Please create a test order to preview this widget.', 'ultimate-store-kit' );
1261 return;
1262 }
1263
1264 } else {
1265 // Normal frontend rendering
1266 global $wp;
1267 $order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : $this->get_last_order_id();
1268
1269 if ( !$order_id ) {
1270 return;
1271 }
1272
1273 $order = wc_get_order( $order_id );
1274 }
1275
1276 if ( !$order ) {
1277 return;
1278 }
1279
1280 ?>
1281 <div class="usk-page-order">
1282 <?php
1283 $this->order_thank_you( $order );
1284 $this->thank_you_order_confirmation( $order );
1285 $this->thank_your_order_details( $order );
1286 $this->thank_you_customer_address( $order );
1287 ?>
1288 </div>
1289 <?php
1290 }
1291
1292 }
1293