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

1,062 lines 42.0 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')) exit; // Exit if accessed directly
16
17 // class Add_To_Cart extends Widget_Button {
18 class Page_Order extends Module_Base {
19
20 public function get_show_in_panel_tags() {
21 return ['shop_single'];
22 }
23
24 public function get_name() {
25 return 'usk-page-order';
26 }
27
28 public function get_title() {
29 return BDTUSK . esc_html__('Order Page', 'ultimate-store-kit');
30 }
31
32 public function get_icon() {
33 return 'usk-widget-icon usk-icon-page-order usk-new';
34 }
35
36 public function get_categories() {
37 return ['ultimate-store-kit'];
38 }
39
40 public function get_keywords() {
41 return ['add', 'to', 'cart', 'woocommerce', 'wc', 'additional', 'info'];
42 }
43
44 public function get_style_depends() {
45 if ($this->usk_is_edit_mode()) {
46 return ['usk-all-styles'];
47 } else {
48 return ['ultimate-store-kit-font', 'usk-add-to-cart'];
49 }
50 }
51 protected function register_controls() {
52 $this->start_controls_section(
53 'section_layout_thankyou_orders',
54 [
55 'label' => __('ThankYou Order', 'ultimate-store-kit-pro'),
56 'tab' => Controls_Manager::TAB_CONTENT,
57 ]
58 );
59 $this->add_group_control(
60 Group_Control_Border::get_type(),
61 [
62 'name' => 'thankyou_padding',
63 'label' => __('Padding', 'ultimate-store-kit'),
64 'selector' => '{{WRAPPER}} .usk-page-order .usk-page-order-heading',
65 ]
66 );
67 $this->add_control(
68 'thankyou_show_order_id',
69 [
70 'label' => __('Show Order ID', 'ultimate-store-kit-pro'),
71 'type' => Controls_Manager::SWITCHER,
72 'default' => 'yes',
73 'separator' => 'after'
74 ]
75 );
76 $this->add_control(
77 'thankyou_order_received_text',
78 [
79 'label' => __('Description', 'ultimate-store-kit-pro'),
80 'type' => Controls_Manager::TEXTAREA,
81 'rows' => 5,
82 'default' => __('Thank you. Your order has been received.', 'ultimate-store-kit-pro'),
83 'placeholder' => __('Thank you. Your order has been received.', 'ultimate-store-kit-pro'),
84 ]
85 );
86 $this->add_control(
87 'thankyour_order_alignment',
88 [
89 'label' => __('Alignment', 'ultimate-store-kit-pro'),
90 'type' => Controls_Manager::CHOOSE,
91 'options' => [
92 'left' => [
93 'title' => __('Left', 'ultimate-store-kit-pro'),
94 'icon' => 'eicon-h-align-left',
95 ],
96 'center' => [
97 'title' => __('Center', 'ultimate-store-kit-pro'),
98 'icon' => 'eicon-h-align-center',
99 ],
100 'right' => [
101 'title' => __('Right', 'ultimate-store-kit-pro'),
102 'icon' => 'eicon-h-align-right',
103 ],
104 ],
105 'default' => 'center',
106 'toggle' => false,
107 'selectors' => [
108 '{{WRAPPER}} .usk-page-order .usk-page-order-heading' => 'text-align:{{VALUE}}; display:block;'
109 ]
110 ]
111 );
112
113 $this->end_controls_section();
114 $this->start_controls_section(
115 'section_style_thankyou_orders_style',
116 [
117 'label' => __('Style', 'ultimate-store-kit-pro'),
118 'tab' => Controls_Manager::TAB_STYLE,
119 ]
120 );
121 $this->start_controls_tabs(
122 'tabs_style_thankyou_order'
123 );
124 $this->start_controls_tab(
125 'tab_style_thankyou_order_heading',
126 [
127 'label' => __('H E A D I N G', 'ultimate-store-kit-pro'),
128 ]
129 );
130 $this->add_control(
131 'heading_color',
132 [
133 'label' => __('Color', 'ultimate-store-kit-pro'),
134 'type' => Controls_Manager::COLOR,
135 'selectors' => [
136 '{{WRAPPER}} .usk-page-order .thankyou-order-heading ' => 'color: {{VALUE}}',
137 ],
138 ]
139 );
140 $this->add_responsive_control(
141 'heading_margin',
142 [
143 'label' => __('Margin', 'ultimate-store-kit-pro'),
144 'type' => Controls_Manager::DIMENSIONS,
145 'size_units' => ['px', '%', 'em'],
146 'selectors' => [
147 '{{WRAPPER}} .usk-page-order .thankyou-order-heading' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
148 ],
149 ]
150 );
151 $this->add_group_control(
152 Group_Control_Typography::get_type(),
153 [
154 'name' => 'heading_typography',
155 'label' => __('Typography', 'ultimate-store-kit-pro'),
156 'selector' => '{{WRAPPER}} .usk-page-order .thankyou-order-heading',
157 ]
158 );
159 $this->end_controls_tab();
160 $this->start_controls_tab(
161 'tab_style_thankyou_order_desc',
162 [
163 'label' => __('D E S C R I P T I O N', 'ultimate-store-kit-pro'),
164 ]
165 );
166 $this->add_control(
167 'desc_color',
168 [
169 'label' => __('Color', 'ultimate-store-kit-pro'),
170 'type' => Controls_Manager::COLOR,
171 'selectors' => [
172 '{{WRAPPER}} .usk-page-order .thankyou-order-desc ' => 'color: {{VALUE}}',
173 ],
174 ]
175 );
176 $this->add_responsive_control(
177 'desc_margin',
178 [
179 'label' => __('Margin', 'ultimate-store-kit-pro'),
180 'type' => Controls_Manager::DIMENSIONS,
181 'size_units' => ['px', '%', 'em'],
182 'selectors' => [
183 '{{WRAPPER}} .usk-page-order .thankyou-order-desc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
184 ],
185 ]
186 );
187 $this->add_group_control(
188 Group_Control_Typography::get_type(),
189 [
190 'name' => 'desc_typography',
191 'label' => __('Typography', 'ultimate-store-kit-pro'),
192 'selector' => '{{WRAPPER}} .usk-page-order .thankyou-order-desc',
193 ]
194 );
195 $this->end_controls_tab();
196 $this->end_controls_tabs();
197 $this->end_controls_section();
198
199 // order detals
200
201 $this->start_controls_section(
202 'style_section_header',
203 [
204 'label' => esc_html__('Header', 'ultimate-store-kit-pro'),
205 'tab' => Controls_Manager::TAB_STYLE,
206 ]
207 );
208 $this->add_control(
209 'header_color',
210 [
211 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
212 'type' => Controls_Manager::COLOR,
213 'selectors' => [
214 '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title, {{WRAPPER}} .usk-page-order .woocommerce-order-downloads__title' => 'color: {{VALUE}}',
215 ],
216 ]
217 );
218 $this->add_responsive_control(
219 'header_padding',
220 [
221 'label' => esc_html__('Padding', 'ultimate-store-kit-pro'),
222 'type' => Controls_Manager::DIMENSIONS,
223 'size_units' => ['px', '%', 'em'],
224 'selectors' => [
225 '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title, {{WRAPPER}} .usk-page-order .woocommerce-order-downloads__title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
226 ],
227 ]
228 );
229 $this->add_responsive_control(
230 'header_margin',
231 [
232 'label' => esc_html__('Margin', 'ultimate-store-kit-pro'),
233 'type' => Controls_Manager::DIMENSIONS,
234 'size_units' => ['px', '%', 'em'],
235 'selectors' => [
236 '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title, {{WRAPPER}} .usk-page-order .woocommerce-order-downloads__title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
237 ],
238 ]
239 );
240 $this->add_control(
241 'header_alignment',
242 [
243 'label' => __('Alignment', 'ultimate-store-kit-pro'),
244 'type' => Controls_Manager::CHOOSE,
245 'options' => [
246 'left' => [
247 'title' => __('Left', 'ultimate-store-kit-pro'),
248 'icon' => 'eicon-h-align-left',
249 ],
250 'center' => [
251 'title' => __('Center', 'ultimate-store-kit-pro'),
252 'icon' => 'eicon-h-align-center',
253 ],
254 'right' => [
255 'title' => __('Right', 'ultimate-store-kit-pro'),
256 'icon' => 'eicon-h-align-right',
257 ],
258 ],
259 'selectors' => [
260 '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title, {{WRAPPER}} .usk-page-order .woocommerce-order-downloads__title' => 'text-align:{{VALUE}}'
261 ],
262 'default' => 'left',
263 ]
264 );
265
266 $this->add_group_control(
267 Group_Control_Typography::get_type(),
268 [
269 'name' => 'header_typography',
270 'label' => esc_html__('Typography', 'ultimate-store-kit-pro'),
271 'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title, {{WRAPPER}} .usk-page-order .woocommerce-order-downloads__title',
272 ]
273 );
274
275 $this->end_controls_section();
276 $this->start_controls_section(
277 'section_style_table',
278 [
279 'label' => __('Table', 'ultimate-store-kit-pro'),
280 'tab' => Controls_Manager::TAB_STYLE,
281 ]
282 );
283
284 $this->add_control(
285 'stripe_style',
286 [
287 'label' => __('Stripe Style', 'ultimate-store-kit-pro'),
288 'type' => Controls_Manager::SWITCHER,
289 ]
290 );
291 $this->add_responsive_control(
292 'table_padding',
293 [
294 'label' => __('Padding', 'ultimate-store-kit-pro'),
295 'type' => Controls_Manager::DIMENSIONS,
296 'size_units' => ['px', 'em', '%'],
297 'selectors' => [
298 '{{WRAPPER}} .usk-page-order ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
299 ]
300 ]
301 );
302 $this->add_responsive_control(
303 'table_margin',
304 [
305 'label' => __('Margin', 'ultimate-store-kit-pro'),
306 'type' => Controls_Manager::DIMENSIONS,
307 'size_units' => ['px', 'em', '%'],
308 'selectors' => [
309 '{{WRAPPER}} .usk-page-order ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
310 ]
311 ]
312 );
313
314 $this->add_group_control(
315 Group_Control_Border::get_type(),
316 [
317 'name' => 'table_border',
318 'label' => __('Border', 'ultimate-store-kit-pro'),
319 'selector' => '{{WRAPPER}} .usk-page-order ',
320 ]
321 );
322
323 $this->add_responsive_control(
324 'table_radius',
325 [
326 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
327 'type' => Controls_Manager::DIMENSIONS,
328 'size_units' => ['px', 'em', '%'],
329 'selectors' => [
330 '{{WRAPPER}} .usk-page-order ' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
331 ]
332 ]
333 );
334 $this->end_controls_section();
335 $this->start_controls_section(
336 'style_section_table_header',
337 [
338 'label' => esc_html__('Table : Header', 'ultimate-store-kit-pro'),
339 'tab' => Controls_Manager::TAB_STYLE,
340 ]
341 );
342 $this->add_control(
343 'heading_text_color',
344 [
345 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
346 'type' => Controls_Manager::COLOR,
347 'selectors' => [
348 '{{WRAPPER}} .usk-page-order thead th' => 'color: {{VALUE}}',
349 ],
350 ]
351 );
352 $this->add_control(
353 'heading_background',
354 [
355 'label' => esc_html__('Background Color', 'ultimate-store-kit-pro'),
356 'type' => Controls_Manager::COLOR,
357 'selectors' => [
358 '{{WRAPPER}} .usk-page-order thead' => 'background: {{VALUE}}',
359 ],
360 ]
361 );
362 // $this->add_group_control(
363 // Group_Control_Background::get_type(),
364 // [
365 // 'name' => 'heading_background',
366 // 'label' => esc_html__('Background', 'ultimate-store-kit-pro'),
367 // 'types' => ['classic', 'gradient'],
368 // 'selector' => '{{WRAPPER}} .usk-page-order thead th',
369 // ]
370 // );
371 $this->add_responsive_control(
372 'table_header_padding',
373 [
374 'label' => __('Padding', 'ultimate-store-kit-pro'),
375 'type' => Controls_Manager::DIMENSIONS,
376 'size_units' => ['px', 'em', '%'],
377 'selectors' => [
378 '{{WRAPPER}} .usk-page-order thead th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
379 ],
380 'condition' => [
381 'table_heading_border_width!' => 'none'
382 ]
383 ]
384 );
385 $this->add_group_control(
386 Group_Control_Border::get_type(),
387 [
388 'name' => 'table_heading_border',
389 'label' => __('Border', 'ultimate-store-kit'),
390 'selector' => '{{WRAPPER}} .usk-page-order thead th',
391 ]
392 );
393 $this->add_responsive_control(
394 'table_header_radius',
395 [
396 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
397 'type' => Controls_Manager::DIMENSIONS,
398 'size_units' => ['px', 'em', '%'],
399 'selectors' => [
400 '{{WRAPPER}} .usk-page-order thead th' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
401 ],
402 'condition' => [
403 'table_heading_border_width!' => 'none'
404 ]
405 ]
406 );
407
408 $this->add_group_control(
409 Group_Control_Typography::get_type(),
410 [
411 'name' => 'table_heading_typography',
412 'label' => esc_html__('Typography', 'ultimate-store-kit-pro'),
413 'selector' => '{{WRAPPER}} .usk-page-order thead th',
414 ]
415 );
416 $this->end_controls_section();
417 $this->start_controls_section(
418 'style_section_table_body',
419 [
420 'label' => esc_html__('Table : Body', 'ultimate-store-kit-pro'),
421 'tab' => Controls_Manager::TAB_STYLE,
422 ]
423 );
424
425 $this->add_group_control(
426 Group_Control_Border::get_type(),
427 [
428 'name' => 'cell_border',
429 'label' => __('Border', 'ultimate-store-kit-pro'),
430 'selector' => '{{WRAPPER}} .usk-page-order tr',
431 ]
432 );
433
434 $this->add_responsive_control(
435 'cell_padding',
436 [
437 'label' => __('Cell Padding', 'ultimate-store-kit-pro'),
438 'type' => Controls_Manager::DIMENSIONS,
439 'size_units' => ['px', 'em', '%'],
440 'selectors' => [
441 '{{WRAPPER}} .usk-page-order tr' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
442 ]
443 ]
444 );
445
446 $this->add_group_control(
447 Group_Control_Typography::get_type(),
448 [
449 'name' => 'body_text_typography',
450 'selector' => '{{WRAPPER}} .usk-page-order td',
451 ]
452 );
453
454 $this->start_controls_tabs('tabs_body_style');
455
456 $this->start_controls_tab(
457 'tab_normal',
458 [
459 'label' => __('Normal', 'ultimate-store-kit-pro'),
460 ]
461 );
462 $this->add_control(
463 'normal_background',
464 [
465 'label' => __('Background', 'ultimate-store-kit-pro'),
466 'type' => Controls_Manager::COLOR,
467 'selectors' => [
468 '{{WRAPPER}} .usk-page-order table tbody tr:nth-child(odd)' => 'background-color: {{VALUE}};',
469 ],
470 ]
471 );
472 $this->add_control(
473 'normal_color',
474 [
475 'label' => __('Text Color', 'ultimate-store-kit-pro'),
476 'type' => Controls_Manager::COLOR,
477 'selectors' => [
478 '{{WRAPPER}} .usk-page-order table tbody tr:nth-child(odd) :is(th, td, span, .amount)' => 'color: {{VALUE}};',
479 ],
480 ]
481 );
482
483 $this->add_control(
484 'link_color',
485 [
486 'label' => esc_html__('Link Color', 'ultimate-store-kit-pro'),
487 'type' => Controls_Manager::COLOR,
488 'selectors' => [
489 '{{WRAPPER}} .usk-page-order table tbody tr:nth-child(odd) :is(th, td, span, .amount) a' => 'color: {{VALUE}}',
490 ],
491 ]
492 );
493
494
495
496 $this->end_controls_tab();
497
498
499 $this->start_controls_tab(
500 'tab_stripe',
501 [
502 'label' => __('Stripe', 'ultimate-store-kit-pro'),
503 'condition' => [
504 'stripe_style' => 'yes',
505 ],
506 ]
507 );
508
509 $this->add_control(
510 'stripe_background',
511 [
512 'label' => __('Background', 'ultimate-store-kit-pro'),
513 'type' => Controls_Manager::COLOR,
514 'selectors' => [
515 '{{WRAPPER}} .usk-page-order table tbody tr:nth-child(even)' => 'background-color: {{VALUE}};',
516 ],
517 'condition' => [
518 'stripe_style' => 'yes',
519 ],
520 ]
521 );
522
523 $this->add_control(
524 'stripe_color',
525 [
526 'label' => __('Text Color', 'ultimate-store-kit-pro'),
527 'type' => Controls_Manager::COLOR,
528 'selectors' => [
529 '{{WRAPPER}} .usk-page-order table tbody tr:nth-child(even) :is(th, td, span, .amount)' => 'color: {{VALUE}};',
530 ],
531 'condition' => [
532 'stripe_style' => 'yes',
533 ],
534 ]
535 );
536 $this->add_control(
537 'stripe_link_color',
538 [
539 'label' => __('Link Color', 'ultimate-store-kit-pro'),
540 'type' => Controls_Manager::COLOR,
541 'selectors' => [
542 '{{WRAPPER}} .usk-page-order table tbody tr:nth-child(even) :is(th, td, span, .amount) a' => 'color: {{VALUE}};',
543 ],
544 'condition' => [
545 'stripe_style' => 'yes',
546 ],
547 ]
548 );
549
550 $this->end_controls_tab();
551 $this->end_controls_tabs();
552 $this->end_controls_section();
553 $this->start_controls_section(
554 'style_section_table_footer',
555 [
556 'label' => esc_html__('Table : Footer', 'ultimate-store-kit-pro'),
557 'tab' => Controls_Manager::TAB_STYLE,
558 ]
559 );
560 $this->start_controls_tabs(
561 'tabs_style_table_footer'
562 );
563 $this->start_controls_tab(
564 'table_footer_tab_normal',
565 [
566 'label' => __('Normal', 'ultimate-store-kit-pro'),
567 ]
568 );
569 $this->add_control(
570 'table_footer_color',
571 [
572 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
573 'type' => Controls_Manager::COLOR,
574 'selectors' => [
575 '{{WRAPPER}} .usk-page-order table tfoot tr:nth-child(odd) :is(th, td, span, .amount)' => 'color: {{VALUE}}',
576 ],
577 ]
578 );
579 $this->add_control(
580 'table_footer_bg_color',
581 [
582 'label' => esc_html__('Background', 'ultimate-store-kit-pro'),
583 'type' => Controls_Manager::COLOR,
584 'selectors' => [
585 '{{WRAPPER}} .usk-page-order table tfoot tr:nth-child(odd)' => 'background: {{VALUE}}',
586 ],
587 ]
588 );
589 $this->add_group_control(
590 Group_Control_Border::get_type(),
591 [
592 'name' => 'table_footer_border',
593 'label' => __('Border', 'ultimate-store-kit-pro'),
594 'selector' => '{{WRAPPER}} .usk-page-order tfoot tr',
595 ]
596 );
597 $this->add_group_control(
598 Group_Control_Typography::get_type(),
599 [
600 'name' => 'table_footer_typography',
601 'label' => esc_html__('Typography', 'ultimate-store-kit-pro'),
602 'selector' => '{{WRAPPER}} .usk-page-order tfoot tr > *',
603 ]
604 );
605 $this->end_controls_tab();
606 $this->start_controls_tab(
607 'table_footer_tab_striped',
608 [
609 'label' => __('Striped', 'ultimate-store-kit-pro'),
610 ]
611 );
612 $this->add_control(
613 'table_footer_striped_color',
614 [
615 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
616 'type' => Controls_Manager::COLOR,
617 'selectors' => [
618 '{{WRAPPER}} .usk-page-order table tfoot tr:nth-child(even) :is(th, td, span, .amount)' => 'color: {{VALUE}}',
619 ],
620 ]
621 );
622 $this->add_control(
623 'table_footer_striped_bg_color',
624 [
625 'label' => esc_html__('Background', 'ultimate-store-kit-pro'),
626 'type' => Controls_Manager::COLOR,
627 'selectors' => [
628 '{{WRAPPER}} .usk-page-order table tfoot tr:nth-child(even)' => 'background: {{VALUE}}',
629 ],
630 ]
631 );
632
633 $this->end_controls_tab();
634 $this->end_controls_tabs();
635 $this->end_controls_section();
636
637 $this->start_controls_section(
638 'style_section_order_again',
639 [
640 'label' => esc_html__('Order Again Button', 'ultimate-store-kit-pro'),
641 'tab' => Controls_Manager::TAB_STYLE,
642 ]
643 );
644 $this->start_controls_tabs(
645 'order_again_tabs'
646 );
647 $this->start_controls_tab(
648 'order_again_tab_normal',
649 [
650 'label' => esc_html__('Normal', 'ultimate-store-kit-pro'),
651 ]
652 );
653 $this->add_control(
654 'order_again_color',
655 [
656 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
657 'type' => Controls_Manager::COLOR,
658 'selectors' => [
659 '{{WRAPPER}} .usk-page-order .order-again a' => 'color: {{VALUE}}',
660 ],
661 ]
662 );
663 $this->add_control(
664 'order_again_bg_color',
665 [
666 'label' => esc_html__('Background', 'ultimate-store-kit-pro'),
667 'type' => Controls_Manager::COLOR,
668 'selectors' => [
669 '{{WRAPPER}} .usk-page-order .order-again a' => 'background: {{VALUE}}',
670 ],
671 ]
672 );
673 $this->end_controls_tab();
674 $this->start_controls_tab(
675 'order_again_tab_hover',
676 [
677 'label' => esc_html__('Hover', 'ultimate-store-kit-pro'),
678 ]
679 );
680 $this->add_control(
681 'order_again_hover_color',
682 [
683 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
684 'type' => Controls_Manager::COLOR,
685 'selectors' => [
686 '{{WRAPPER}} .usk-page-order .order-again a:hover' => 'color: {{VALUE}}',
687 ],
688 ]
689 );
690 $this->add_control(
691 'order_again_hover_bg_color',
692 [
693 'label' => esc_html__('Background', 'ultimate-store-kit-pro'),
694 'type' => Controls_Manager::COLOR,
695 'selectors' => [
696 '{{WRAPPER}} .usk-page-order .order-again a:hover' => 'background: {{VALUE}}',
697 ],
698 ]
699 );
700 $this->end_controls_tab();
701 $this->end_controls_tabs();
702 $this->add_responsive_control(
703 'order_again_padding',
704 [
705 'label' => esc_html__('Padding', 'ultimate-store-kit-pro'),
706 'type' => Controls_Manager::DIMENSIONS,
707 'size_units' => ['px', '%', 'em'],
708 'selectors' => [
709 '{{WRAPPER}} .usk-page-order .order-again a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
710 ],
711 'separator' => 'before'
712 ]
713 );
714 $this->add_responsive_control(
715 'order_again_margin',
716 [
717 'label' => esc_html__('Margin', 'ultimate-store-kit-pro'),
718 'type' => Controls_Manager::DIMENSIONS,
719 'size_units' => ['px', '%', 'em'],
720 'selectors' => [
721 '{{WRAPPER}} .usk-page-order .order-again a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
722 ],
723 ]
724 );
725 $this->add_responsive_control(
726 'order_again_radius',
727 [
728 'label' => esc_html__('Radius', 'ultimate-store-kit-pro'),
729 'type' => Controls_Manager::DIMENSIONS,
730 'size_units' => ['px', '%', 'em'],
731 'selectors' => [
732 '{{WRAPPER}} .usk-page-order .order-again a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
733 ],
734 ]
735 );
736 $this->add_group_control(
737 Group_Control_Typography::get_type(),
738 [
739 'name' => 'order_again_typography',
740 'label' => esc_html__('Typography', 'ultimate-store-kit-pro'),
741 'selector' => '{{WRAPPER}} .usk-page-order .order-again a',
742 ]
743 );
744
745 $this->end_controls_section();
746 $this->start_controls_section(
747 'styles_section_thankyou_address_details',
748 [
749 'label' => esc_html__('Address Details', 'ultimate-store-kit-pro'),
750 'tab' => Controls_Manager::TAB_STYLE,
751 ]
752 );
753
754 $this->add_control(
755 'thankyou_address_details_wrapper',
756 [
757 'label' => esc_html__('Wrapper', 'ultimate-store-kit-pro'),
758 'type' => Controls_Manager::HEADING,
759 ]
760 );
761
762 $this->add_control(
763 'thankyou_addrss_details_alignment',
764 [
765 'label' => __('Alignment', 'ultiamte-store-kit-pro'),
766 'type' => Controls_Manager::CHOOSE,
767 'options' => [
768 'left' => [
769 'title' => __('Left', 'ultiamte-store-kit-pro'),
770 'icon' => 'eicon-h-align-left',
771 ],
772 'center' => [
773 'title' => __('Center', 'ultiamte-store-kit-pro'),
774 'icon' => 'eicon-h-align-center',
775 ],
776 'right' => [
777 'title' => __('Right', 'ultiamte-store-kit-pro'),
778 'icon' => 'eicon-h-align-right',
779 ],
780 ],
781 'default' => 'left',
782 'selectors' => [
783 '{{WRAPPER}} .usk-page-order' => 'text-align: {{VALUE}};',
784 ],
785 ]
786 );
787
788
789 $this->add_control(
790 'thankyou_address_details_title_heading',
791 [
792 'label' => esc_html__('Title', 'ultimate-store-kit-pro'),
793 'type' => Controls_Manager::HEADING,
794 'separator' => 'before',
795 ]
796 );
797
798 $this->add_control(
799 'thankyou_address_details_title_color',
800 [
801 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
802 'type' => Controls_Manager::COLOR,
803 'selectors' => [
804 '{{WRAPPER}} .usk-page-order :is(h2, .woocommerce-column__title)' => 'color: {{VALUE}};',
805 ],
806 ]
807 );
808
809 $this->add_group_control(
810 Group_Control_Typography::get_type(),
811 array(
812 'name' => 'thankyou_address_details_title_typography',
813 'label' => esc_html__('Typography', 'ultimate-store-kit-pro'),
814 'selector' => '{{WRAPPER}} .usk-page-order :is(h2, .woocommerce-column__title)',
815 )
816 );
817
818 // Style Heading - Address
819 $this->add_control(
820 'thankyou_address_details_address_heading',
821 [
822 'label' => esc_html__('Address', 'ultimate-store-kit-pro'),
823 'type' => Controls_Manager::HEADING,
824 'separator' => 'before',
825 ]
826 );
827
828 $this->add_control(
829 'thankyou_address_details_address_color',
830 [
831 'label' => esc_html__('Color', 'ultimate-store-kit-pro'),
832 'type' => Controls_Manager::COLOR,
833 'selectors' => [
834 '{{WRAPPER}} .usk-page-order :not(.woocommerce-column__title)' => 'color: {{VALUE}};',
835 ],
836 ]
837 );
838
839 $this->add_group_control(
840 Group_Control_Typography::get_type(),
841 array(
842 'name' => 'thankyou_address_details_address_typography',
843 'label' => esc_html__('Typography', 'ultimate-store-kit-pro'),
844 'selector' => '{{WRAPPER}} .usk-page-order :not(.woocommerce-column__title)',
845 )
846 );
847 }
848 protected function get_last_order_id() {
849 global $wpdb;
850 $statuses = array_keys(wc_get_order_statuses());
851 $statuses = implode("','", $statuses);
852 $results = $wpdb->get_col("
853 SELECT MAX(ID) FROM {$wpdb->prefix}posts
854 WHERE post_type LIKE 'shop_order'
855 AND post_status IN ('$statuses')");
856 return reset($results);
857 }
858
859
860 public function order_thank_you($order) {
861 $settings = $this->get_settings_for_display();
862 $order_received_text = $settings['thankyou_order_received_text'];
863
864 ?>
865 <div class="usk-page-order-heading">
866 <?php if ($settings['thankyou_show_order_id'] === 'yes') :
867 printf('<h3 class="thankyou-order-heading">%1$s # %2$s</h3>', esc_html__('Order', 'ultimate-store-kit-pro'), esc_html($order->get_order_number()));
868 endif; ?>
869 <p class="thankyou-order-desc">
870 <?php if ($order->has_status('failed')) :
871 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-pro');
872 ?>
873 <?php else :
874 echo wp_kses_post(apply_filters('woocommerce_thankyou_order_received_text', esc_html__($order_received_text, 'ultimate-store-kit-pro'), $order));
875 endif; ?>
876 </p>
877 </div>
878 <?php
879 }
880 public function thank_your_order_details($order) {
881 $order_items = $order->get_items(apply_filters('woocommerce_purchase_order_item_types', 'line_item'));
882 $show_purchase_note = $order->has_status(apply_filters('woocommerce_purchase_note_order_statuses', array('completed', 'processing')));
883 $downloads = $order->get_downloadable_items();
884 $show_downloads = $order->has_downloadable_item() && $order->is_download_permitted();
885 ?>
886 <?php
887 if ($show_downloads) {
888 wc_get_template(
889 'order/order-downloads.php',
890 array(
891 'downloads' => $downloads,
892 'show_title' => true,
893 )
894 );
895 }
896 ?>
897 <div class="woocommerce-order-details">
898 <?php do_action('woocommerce_order_details_before_order_table', $order); ?>
899
900 <h2 class="woocommerce-order-details__title"><?php esc_html_e('Order details', 'woocommerce'); ?></h2>
901
902 <table class="woocommerce-table woocommerce-table--order-details shop_table order_details">
903
904 <thead>
905 <tr>
906 <th class="woocommerce-table__product-name product-name"><?php esc_html_e('Product', 'woocommerce'); ?></th>
907 <th class="woocommerce-table__product-table product-total"><?php esc_html_e('Total', 'woocommerce'); ?></th>
908 </tr>
909 </thead>
910
911 <tbody>
912 <?php
913 do_action('woocommerce_order_details_before_order_table_items', $order);
914
915 foreach ($order_items as $item_id => $item) {
916 $product = $item->get_product();
917
918 wc_get_template(
919 'order/order-details-item.php',
920 array(
921 'order' => $order,
922 'item_id' => $item_id,
923 'item' => $item,
924 'show_purchase_note' => $show_purchase_note,
925 'purchase_note' => $product ? $product->get_purchase_note() : '',
926 'product' => $product,
927 )
928 );
929 }
930
931 do_action('woocommerce_order_details_after_order_table_items', $order);
932 ?>
933 </tbody>
934
935 <tfoot>
936 <?php
937 foreach ($order->get_order_item_totals() as $key => $total) {
938 ?>
939 <tr>
940 <th scope="row"><?php echo esc_html($total['label']); ?></th>
941 <td><?php echo ('payment_method' === $key) ? esc_html($total['value']) : wp_kses_post($total['value']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
942 ?></td>
943 </tr>
944 <?php
945 }
946 ?>
947 <?php if ($order->get_customer_note()) : ?>
948 <tr>
949 <th><?php esc_html_e('Note:', 'woocommerce'); ?></th>
950 <td><?php echo wp_kses_post(nl2br(wptexturize($order->get_customer_note()))); ?></td>
951 </tr>
952 <?php endif; ?>
953 </tfoot>
954 </table>
955 <?php do_action('woocommerce_order_details_after_order_table', $order); ?>
956 </div>
957
958 <?php
959 /**
960 * Action hook fired after the order details.
961 *
962 * @since 4.4.0
963 * @param WC_Order $order Order data.
964 */
965 do_action('woocommerce_after_order_details', $order);
966 }
967
968 public function thank_you_order_confirmation($order) { ?>
969 <ul class="order_details">
970 <li class="order">
971 <span class="usk-label"> <?php esc_html_e('Order number:', 'woocommerce'); ?></span>
972 <strong class="usk-value"><?php echo esc_html($order->get_order_number()); ?></strong>
973 </li>
974 <li class="date">
975 <span class="usk-label"><?php esc_html_e('Order Date:', 'woocommerce'); ?></span>
976 <strong class="usk-value"><?php echo esc_html(wc_format_datetime($order->get_date_created())); ?></strong>
977 </li>
978 <li class="order-status">
979 <span class="usk-label"><?php echo esc_html__('Order status', 'ultimate-store-kit-pro'); ?></span>
980 <strong class="usk-value"><?php echo wp_kses_post(wc_get_order_status_name($order->get_status())); ?></strong>
981 </li>
982 <li class="total">
983 <span class="usk-label"><?php esc_html_e('Total:', 'woocommerce'); ?></span>
984 <strong class="usk-value"><?php echo wp_kses_post($order->get_formatted_order_total()); ?></strong>
985 </li>
986 <?php if ($order->get_payment_method_title()) : ?>
987 <li class="method">
988 <span class="usk-label"><?php esc_html_e('Payment method:', 'woocommerce'); ?></span>
989 <strong class="usk-value"><?php echo wp_kses_post($order->get_payment_method_title()); ?></strong>
990 </li>
991 <?php endif; ?>
992 </ul>
993 <?php do_action('woocommerce_receipt_' . $order->get_payment_method(), $order->get_id()); ?>
994 <?php
995 }
996 public function thank_you_customer_address($order) {
997 $show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id();
998 if ($show_customer_details) {
999 $show_shipping = !wc_ship_to_billing_address_only() && $order->needs_shipping_address();
1000 ?>
1001 <div class="woocommerce-customer-details">
1002 <?php if ($show_shipping) : ?>
1003
1004 <div class="woocommerce-columns woocommerce-columns--2 woocommerce-columns--addresses col2-set addresses">
1005 <div class="woocommerce-column woocommerce-column--1 woocommerce-column--billing-address col-1">
1006 <?php endif; ?>
1007
1008 <h2 class="woocommerce-column__title"><?php esc_html_e('Billing address', 'woocommerce'); ?></h2>
1009
1010 <address>
1011 <?php echo wp_kses_post($order->get_formatted_billing_address(esc_html__('N/A', 'woocommerce'))); ?>
1012
1013 <?php if ($order->get_billing_phone()) : ?>
1014 <p class="woocommerce-customer-details--phone"><?php echo esc_html($order->get_billing_phone()); ?></p>
1015 <?php endif; ?>
1016
1017 <?php if ($order->get_billing_email()) : ?>
1018 <p class="woocommerce-customer-details--email"><?php echo esc_html($order->get_billing_email()); ?></p>
1019 <?php endif; ?>
1020 </address>
1021
1022 <?php if ($show_shipping) : ?>
1023
1024 </div><!-- /.col-1 -->
1025
1026 <div class="woocommerce-column woocommerce-column--2 woocommerce-column--shipping-address col-2">
1027 <h2 class="woocommerce-column__title"><?php esc_html_e('Shipping address', 'woocommerce'); ?></h2>
1028 <address>
1029 <?php echo wp_kses_post($order->get_formatted_shipping_address(esc_html__('N/A', 'woocommerce'))); ?>
1030 <?php if ($order->get_shipping_phone()) : ?>
1031 <p class="woocommerce-customer-details--phone"><?php echo esc_html($order->get_shipping_phone()); ?></p>
1032 <?php endif; ?>
1033 </address>
1034 </div><!-- /.col-2 -->
1035 </div><!-- /.col2-set -->
1036
1037 <?php endif; ?>
1038
1039 <?php do_action('woocommerce_order_details_after_customer_details', $order); ?>
1040
1041 </div>
1042 <?php
1043 }
1044 }
1045 public function render() {
1046 global $wp;
1047 $order_id = isset($wp->query_vars['order-received']) ? $wp->query_vars['order-received'] : $this->get_last_order_id();
1048 $order = wc_get_order($order_id);
1049 ?>
1050 <div class="usk-page-order">
1051 <?php
1052 $this->order_thank_you($order);
1053 $this->thank_you_order_confirmation($order);
1054 $this->thank_your_order_details($order);
1055 $this->thank_you_customer_address($order);
1056 ?>
1057 </div>
1058 <?php
1059
1060 }
1061 }
1062