PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.0.3
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.0.3
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.3, at modules/page-order/widgets/page-order.php

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