PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 1.6.2
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v1.6.2
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-cart / widgets / page-cart.php

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

1,291 lines 47.9 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\PageCart\Widgets;
4
5 use UltimateStoreKit\Base\Module_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Background;
10
11 if (!defined('ABSPATH')) exit; // Exit if accessed directly
12
13 class Page_Cart extends Module_Base {
14
15 public function get_name() {
16 return 'usk-page-cart';
17 }
18
19 public function get_title() {
20 return BDTUSK . esc_html__('Cart Page', 'ultimate-store-kit');
21 }
22
23 public function get_icon() {
24 return 'usk-widget-icon usk-icon-page-cart usk-new';
25 }
26
27 public function get_categories() {
28 return ['ultimate-store-kit'];
29 }
30
31 public function get_style_depends() {
32 if ($this->usk_is_edit_mode()) {
33 return ['usk-all-styles'];
34 } else {
35 return ['usk-page-cart'];
36 }
37 }
38 public function get_keywords() {
39 return ['post', 'cart'];
40 }
41
42 protected function register_controls() {
43
44 $this->start_controls_section(
45 'section_cart_layout',
46 [
47 'label' => __('Cart Layout', 'ultimate-store-kit-pro'),
48 'tab' => Controls_Manager::TAB_CONTENT,
49 ]
50 );
51
52 $this->add_control(
53 'show_image',
54 [
55 'label' => __('Show Image', 'ultimate-store-kit-pro'),
56 'type' => Controls_Manager::SWITCHER,
57 'default' => 'yes',
58 ]
59 );
60
61 $this->add_control(
62 'show_title',
63 [
64 'label' => __('Show Title', 'ultimate-store-kit-pro'),
65 'type' => Controls_Manager::SWITCHER,
66 'default' => 'yes',
67 ]
68 );
69
70 $this->add_control(
71 'show_price',
72 [
73 'label' => __('Show Price', 'ultimate-store-kit-pro'),
74 'type' => Controls_Manager::SWITCHER,
75 'default' => 'yes',
76 ]
77 );
78
79 $this->add_control(
80 'show_quantity',
81 [
82 'label' => __('Show Quantity', 'ultimate-store-kit-pro'),
83 'type' => Controls_Manager::SWITCHER,
84 'default' => 'yes',
85 ]
86 );
87
88 $this->add_control(
89 'show_subtotal',
90 [
91 'label' => __('Show Subtotal', 'ultimate-store-kit-pro'),
92 'type' => Controls_Manager::SWITCHER,
93 'default' => 'yes',
94 ]
95 );
96
97 $this->end_controls_section();
98
99 $this->start_controls_section(
100 'cart_heading_style_section',
101 [
102 'label' => __('Cart Heading', 'ultimate-store-kit-pro'),
103 'tab' => Controls_Manager::TAB_STYLE,
104 ]
105 );
106
107 $this->add_responsive_control(
108 'cart_heading_align',
109 [
110 'label' => __('Alignment', 'ultimate-store-kit-pro'),
111 'type' => Controls_Manager::CHOOSE,
112 'options' => [
113 'left' => [
114 'title' => __('Left', 'ultimate-store-kit-pro'),
115 'icon' => 'eicon-text-align-left',
116 ],
117 'center' => [
118 'title' => __('Center', 'ultimate-store-kit-pro'),
119 'icon' => 'eicon-text-align-center',
120 ],
121 'right' => [
122 'title' => __('Right', 'ultimate-store-kit-pro'),
123 'icon' => 'eicon-text-align-right',
124 ],
125 ],
126 // 'desktop_default' => 'left',
127 // 'tablet_default' => 'left',
128 // 'mobile_default' => 'left',
129 'toggle' => true,
130 'selectors' => [
131 '{{WRAPPER}} .usk-page-cart .woocommerce thead th' => 'text-align: {{VALUE}};',
132 ],
133 ]
134 );
135
136 $this->add_control(
137 'cart_heading_color',
138 [
139 'label' => __('Color', 'ultimate-store-kit-pro'),
140 'type' => Controls_Manager::COLOR,
141 'selectors' => [
142 '{{WRAPPER}} .usk-page-cart .woocommerce thead th' => 'color: {{VALUE}};',
143 ],
144 ]
145 );
146
147 $this->add_group_control(
148 Group_Control_Background::get_type(),
149 [
150 'name' => 'cart_heading_background',
151 'label' => esc_html__('Background', 'ultimate-store-kit'),
152 'types' => ['classic', 'gradient'],
153 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce-cart-form .shop_table th',
154 'exclude' => [
155 'image'
156 ]
157 ]
158 );
159 //border
160 $this->add_group_control(
161 Group_Control_Border::get_type(),
162 [
163 'name' => 'cart_heading_border',
164 'label' => esc_html__('Border', 'ultimate-store-kit'),
165 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce-cart-form .shop_table th',
166 ]
167 );
168 //padding
169 $this->add_responsive_control(
170 'cart_heading_padding',
171 [
172 'label' => esc_html__('Padding', 'ultimate-store-kit'),
173 'type' => Controls_Manager::DIMENSIONS,
174 'size_units' => ['px', '%', 'em'],
175 'selectors' => [
176 '{{WRAPPER}} .usk-page-cart .woocommerce-cart-form .shop_table th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
177 ],
178 ]
179 );
180
181
182 $this->add_group_control(
183 Group_Control_Typography::get_type(),
184 [
185 'name' => 'cart_heading_typo',
186 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce thead th',
187 ]
188 );
189
190 $this->end_controls_section();
191
192
193 $this->start_controls_section(
194 'product_item_style_section',
195 [
196 'label' => __('Cart Item', 'ultimate-store-kit-pro'),
197 'tab' => Controls_Manager::TAB_STYLE,
198 ]
199 );
200
201 $this->add_control(
202 'product_title_heading',
203 [
204 'label' => esc_html__('Product Title', 'ultimate-store-kit-pro'),
205 'type' => Controls_Manager::HEADING,
206 'condition' => [
207 'show_title' => 'yes',
208 ]
209 ]
210 );
211
212 $this->add_control(
213 'product_title_color',
214 [
215 'label' => __('Color', 'ultimate-store-kit-pro'),
216 'type' => Controls_Manager::COLOR,
217 'selectors' => [
218 '{{WRAPPER}} .usk-page-cart .woocommerce tbody .usk-product-title a' => 'color: {{VALUE}};',
219 ],
220 'condition' => [
221 'show_title' => 'yes',
222 ]
223 ]
224 );
225
226 $this->add_group_control(
227 Group_Control_Typography::get_type(),
228 [
229 'name' => 'product_title_typo',
230 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce tbody .usk-product-title a',
231 'condition' => [
232 'show_title' => 'yes',
233 ]
234 ]
235 );
236
237 // price
238 $this->add_control(
239 'product_price_heading',
240 [
241 'label' => esc_html__('Product Price', 'ultimate-store-kit-pro'),
242 'type' => Controls_Manager::HEADING,
243 'condition' => [
244 'show_price' => 'yes',
245 ]
246 ]
247 );
248
249 $this->add_control(
250 'product_price_color',
251 [
252 'label' => __('Color', 'ultimate-store-kit-pro'),
253 'type' => Controls_Manager::COLOR,
254 'selectors' => [
255 '{{WRAPPER}} .usk-page-cart .woocommerce tbody .usk-product-price' => 'color: {{VALUE}};',
256 ],
257 'condition' => [
258 'show_price' => 'yes',
259 ]
260 ]
261 );
262
263 $this->add_group_control(
264 Group_Control_Typography::get_type(),
265 [
266 'name' => 'product_price_typo',
267 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce tbody .usk-product-price',
268 'condition' => [
269 'show_price' => 'yes',
270 ]
271 ]
272 );
273
274 // quantity
275 $this->add_control(
276 'product_quantity_heading',
277 [
278 'label' => esc_html__('Product Quantity', 'ultimate-store-kit-pro'),
279 'type' => Controls_Manager::HEADING,
280 'condition' => [
281 'show_quantity' => 'yes',
282 ]
283 ]
284 );
285
286 $this->add_responsive_control(
287 'product_quantity_width',
288 [
289 'label' => __('Width', 'ultimate-store-kit-pro'),
290 'type' => Controls_Manager::SLIDER,
291 'range' => [
292 'px' => [
293 'min' => 0,
294 'max' => 100,
295 ],
296 ],
297 'selectors' => [
298 '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty' => 'width: {{SIZE}}{{UNIT}};',
299 ],
300 'condition' => [
301 'show_quantity' => 'yes',
302 ]
303 ]
304 );
305
306 $this->add_control(
307 'product_quantity_color',
308 [
309 'label' => __('Color', 'ultimate-store-kit-pro'),
310 'type' => Controls_Manager::COLOR,
311 'selectors' => [
312 '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty' => 'color: {{VALUE}};',
313 ],
314 'condition' => [
315 'show_quantity' => 'yes',
316 ]
317 ]
318 );
319
320 $this->add_responsive_control(
321 'product_quantity_align',
322 [
323 'label' => __('Alignment', 'ultimate-store-kit-pro'),
324 'type' => Controls_Manager::CHOOSE,
325 'options' => [
326 'left' => [
327 'title' => __('Left', 'ultimate-store-kit-pro'),
328 'icon' => 'eicon-text-align-left',
329 ],
330 'center' => [
331 'title' => __('Center', 'ultimate-store-kit-pro'),
332 'icon' => 'eicon-text-align-center',
333 ],
334 'right' => [
335 'title' => __('Right', 'ultimate-store-kit-pro'),
336 'icon' => 'eicon-text-align-right',
337 ],
338 ],
339 'toggle' => true,
340 'selectors' => [
341 '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty' => 'text-align: {{VALUE}};',
342 ],
343 'condition' => [
344 'show_quantity' => 'yes',
345 ]
346 ]
347 );
348
349 $this->add_group_control(
350 Group_Control_Typography::get_type(),
351 [
352 'name' => 'product_quantity_typo',
353 'selector' => '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty',
354 'condition' => [
355 'show_quantity' => 'yes',
356 ]
357 ]
358 );
359
360 $this->add_responsive_control(
361 'product_quantity_padding',
362 [
363 'label' => __('Padding', 'ultimate-store-kit-pro'),
364 'type' => Controls_Manager::DIMENSIONS,
365 'size_units' => ['px', 'em', '%'],
366 'selectors' => [
367 '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
368 ],
369 'condition' => [
370 'show_quantity' => 'yes',
371 ]
372 ]
373 );
374
375 $this->add_group_control(
376 Group_Control_Border::get_type(),
377 [
378 'name' => 'product_quantity_border',
379 'selector' => '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty',
380 'condition' => [
381 'show_quantity' => 'yes',
382 ]
383 ]
384 );
385
386 $this->add_responsive_control(
387 'product_quantity_border_radius',
388 [
389 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
390 'type' => Controls_Manager::DIMENSIONS,
391 'size_units' => ['px', '%'],
392 'selectors' => [
393 '{{WRAPPER}} .usk-page-cart .usk-product-quantity .input-text.qty' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
394 ],
395 'condition' => [
396 'show_quantity' => 'yes',
397 ]
398 ]
399 );
400
401 // sub total
402 $this->add_control(
403 'product_subtotal_heading',
404 [
405 'label' => esc_html__('Product Sub Total', 'ultimate-store-kit-pro'),
406 'type' => Controls_Manager::HEADING,
407 'condition' => [
408 'show_subtotal' => 'yes',
409 ]
410 ]
411 );
412
413 $this->add_control(
414 'product_subtotal_color',
415 [
416 'label' => __('Color', 'ultimate-store-kit-pro'),
417 'type' => Controls_Manager::COLOR,
418 'selectors' => [
419 '{{WRAPPER}} .usk-page-cart .woocommerce tbody .usk-product-subtotal' => 'color: {{VALUE}};',
420 ],
421 'condition' => [
422 'show_subtotal' => 'yes',
423 ]
424 ]
425 );
426
427 $this->add_group_control(
428 Group_Control_Typography::get_type(),
429 [
430 'name' => 'product_subtotal_typo',
431 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce tbody .usk-product-subtotal',
432 'condition' => [
433 'show_subtotal' => 'yes',
434 ]
435 ]
436 );
437
438
439 $this->end_controls_section();
440
441
442 $this->start_controls_section(
443 'product_coupon_style_section',
444 [
445 'label' => __('Coupon Style', 'ultimate-store-kit-pro'),
446 'tab' => Controls_Manager::TAB_STYLE,
447 ]
448 );
449
450 //label color
451 $this->add_control(
452 'coupon_label_heading',
453 [
454 'label' => esc_html__('Coupon Label', 'ultimate-store-kit-pro') . BDTUSK_NC,
455 'type' => Controls_Manager::HEADING,
456 ]
457 );
458
459 //color
460 $this->add_control(
461 'coupon_label_color',
462 [
463 'label' => __('Color', 'ultimate-store-kit-pro'),
464 'type' => Controls_Manager::COLOR,
465 'selectors' => [
466 '{{WRAPPER}} .usk-page-cart .coupon label' => 'color: {{VALUE}};',
467 ],
468 ]
469 );
470
471 //typography
472 $this->add_group_control(
473 Group_Control_Typography::get_type(),
474 [
475 'name' => 'coupon_label_typo',
476 'selector' => '{{WRAPPER}} .usk-page-cart .coupon label',
477 ]
478 );
479
480 // coupon field
481 $this->add_control(
482 'coupon_field_heading',
483 [
484 'label' => esc_html__('Coupon Field', 'ultimate-store-kit-pro'),
485 'type' => Controls_Manager::HEADING,
486 'separator' => 'before'
487 ]
488 );
489
490 $this->add_control(
491 'coupon_field_color',
492 [
493 'label' => __('Color', 'ultimate-store-kit-pro'),
494 'type' => Controls_Manager::COLOR,
495 'selectors' => [
496 '{{WRAPPER}} .usk-page-cart .coupon #coupon_code::placeholder' => 'color: {{VALUE}};',
497 ],
498 ]
499 );
500
501 $this->add_group_control(
502 Group_Control_Typography::get_type(),
503 [
504 'name' => 'coupon_field_typo',
505 'selector' => '{{WRAPPER}} .usk-page-cart .coupon #coupon_code',
506 ]
507 );
508
509 $this->add_responsive_control(
510 'coupon_field_padding',
511 [
512 'label' => __('Padding', 'ultimate-store-kit-pro'),
513 'type' => Controls_Manager::DIMENSIONS,
514 'size_units' => ['px', 'em', '%'],
515 'selectors' => [
516 '{{WRAPPER}} .usk-page-cart .coupon #coupon_code' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
517 ],
518 ]
519 );
520
521 $this->add_group_control(
522 Group_Control_Border::get_type(),
523 [
524 'name' => 'coupon_field_border',
525 'selector' => '{{WRAPPER}} .usk-page-cart .coupon #coupon_code',
526 ]
527 );
528
529 $this->add_responsive_control(
530 'coupon_field_border_radius',
531 [
532 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
533 'type' => Controls_Manager::DIMENSIONS,
534 'size_units' => ['px', '%'],
535 'selectors' => [
536 '{{WRAPPER}} .usk-page-cart .coupon #coupon_code' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
537 ],
538 ]
539 );
540
541
542 // coupon button
543 $this->add_control(
544 'coupon_button_heading',
545 [
546 'label' => esc_html__('Coupon Button', 'ultimate-store-kit-pro'),
547 'type' => Controls_Manager::HEADING,
548 'separator' => 'before',
549 ]
550 );
551
552 $this->add_group_control(
553 Group_Control_Typography::get_type(),
554 [
555 'name' => 'coupon_button_typo',
556 'selector' => '{{WRAPPER}} .usk-page-cart .coupon .button',
557 ]
558 );
559
560 $this->add_responsive_control(
561 'coupon_button_padding',
562 [
563 'label' => __('Padding', 'ultimate-store-kit-pro'),
564 'type' => Controls_Manager::DIMENSIONS,
565 'size_units' => ['px', 'em', '%'],
566 'selectors' => [
567 '{{WRAPPER}} .usk-page-cart .coupon .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
568 ],
569 ]
570 );
571
572 $this->add_group_control(
573 Group_Control_Border::get_type(),
574 [
575 'name' => 'coupon_button_border',
576 'selector' => '{{WRAPPER}} .usk-page-cart .coupon .button',
577 ]
578 );
579
580 $this->add_responsive_control(
581 'coupon_button_border_radius',
582 [
583 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
584 'type' => Controls_Manager::DIMENSIONS,
585 'size_units' => ['px', '%'],
586 'selectors' => [
587 '{{WRAPPER}} .usk-page-cart .coupon .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
588 ],
589 ]
590 );
591
592 $this->start_controls_tabs('coupon_button_tabs');
593
594 $this->start_controls_tab(
595 'coupon_button_normal',
596 [
597 'label' => __('Normal', 'ultimate-store-kit-pro'),
598 ]
599 );
600
601 $this->add_control(
602 'coupon_button_color',
603 [
604 'label' => __('Color', 'ultimate-store-kit-pro'),
605 'type' => Controls_Manager::COLOR,
606 'selectors' => [
607 '{{WRAPPER}} .usk-page-cart .coupon .button' => 'color: {{VALUE}};',
608 ],
609 ]
610 );
611
612 $this->add_group_control(
613 Group_Control_Background::get_type(),
614 [
615 'name' => 'coupon_button_bg',
616 'selector' => '{{WRAPPER}} .usk-page-cart .coupon .button'
617 ]
618 );
619
620 $this->end_controls_tab();
621
622 $this->start_controls_tab(
623 'coupon_button_hover',
624 [
625 'label' => __('Hover', 'ultimate-store-kit-pro'),
626 ]
627 );
628
629 $this->add_control(
630 'coupon_button_color_hover',
631 [
632 'label' => __('Color', 'ultimate-store-kit-pro'),
633 'type' => Controls_Manager::COLOR,
634 'selectors' => [
635 '{{WRAPPER}} .usk-page-cart .coupon .button:hover' => 'color: {{VALUE}};',
636 ],
637 ]
638 );
639
640 $this->add_group_control(
641 Group_Control_Background::get_type(),
642 [
643 'name' => 'coupon_button_bg_hover',
644 'selector' => '{{WRAPPER}} .usk-page-cart .coupon .button:hover'
645 ]
646 );
647
648 $this->add_control(
649 'coupon_button_border_color_hover',
650 [
651 'label' => __('Border Color', 'ultimate-store-kit-pro'),
652 'type' => Controls_Manager::COLOR,
653 'selectors' => [
654 '{{WRAPPER}} .usk-page-cart .coupon .button:hover' => 'border-color: {{VALUE}};',
655 ],
656 'condition' => [
657 'coupon_button_border_border!' => '',
658 ]
659 ]
660 );
661
662 $this->end_controls_tab();
663
664 $this->end_controls_tabs();
665
666
667 $this->end_controls_section();
668
669
670 $this->start_controls_section(
671 'update_cart_style_section',
672 [
673 'label' => __('Cart Update Button', 'ultimate-store-kit-pro'),
674 'tab' => Controls_Manager::TAB_STYLE,
675 ]
676 );
677
678 $this->add_group_control(
679 Group_Control_Typography::get_type(),
680 [
681 'name' => 'update_cart_typo',
682 'selector' => '{{WRAPPER}} .usk-page-cart .actions>.button',
683 ]
684 );
685
686 $this->add_responsive_control(
687 'update_cart_padding',
688 [
689 'label' => __('Padding', 'ultimate-store-kit-pro'),
690 'type' => Controls_Manager::DIMENSIONS,
691 'size_units' => ['px', 'em', '%'],
692 'selectors' => [
693 '{{WRAPPER}} .usk-page-cart .actions>.button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
694 ],
695 ]
696 );
697
698 $this->add_group_control(
699 Group_Control_Border::get_type(),
700 [
701 'name' => 'update_cart_border',
702 'selector' => '{{WRAPPER}} .usk-page-cart .actions>.button',
703 ]
704 );
705
706 $this->add_responsive_control(
707 'update_cart_border_radius',
708 [
709 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
710 'type' => Controls_Manager::DIMENSIONS,
711 'size_units' => ['px', '%'],
712 'selectors' => [
713 '{{WRAPPER}} .usk-page-cart .actions>.button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
714 ],
715 ]
716 );
717
718 $this->start_controls_tabs('update_cart_tabs');
719
720 $this->start_controls_tab(
721 'update_cart_normal',
722 [
723 'label' => __('Normal', 'ultimate-store-kit-pro'),
724 ]
725 );
726
727 $this->add_control(
728 'update_cart_color',
729 [
730 'label' => __('Color', 'ultimate-store-kit-pro'),
731 'type' => Controls_Manager::COLOR,
732 'selectors' => [
733 '{{WRAPPER}} .usk-page-cart .actions>.button' => 'color: {{VALUE}};',
734 ],
735 ]
736 );
737
738 $this->add_group_control(
739 Group_Control_Background::get_type(),
740 [
741 'name' => 'update_cart_bg',
742 'selector' => '{{WRAPPER}} .usk-page-cart .actions>.button'
743 ]
744 );
745
746 $this->end_controls_tab();
747
748 $this->start_controls_tab(
749 'update_cart_hover',
750 [
751 'label' => __('Hover', 'ultimate-store-kit-pro'),
752 ]
753 );
754
755 $this->add_control(
756 'update_cart_color_hover',
757 [
758 'label' => __('Color', 'ultimate-store-kit-pro'),
759 'type' => Controls_Manager::COLOR,
760 'selectors' => [
761 '{{WRAPPER}} .usk-page-cart .actions>.button:hover' => 'color: {{VALUE}};',
762 ],
763 ]
764 );
765
766 $this->add_group_control(
767 Group_Control_Background::get_type(),
768 [
769 'name' => 'update_cart_bg_hover',
770 'selector' => '{{WRAPPER}} .usk-page-cart .actions>.button:hover'
771 ]
772 );
773
774 $this->add_control(
775 'update_cart_border_color_hover',
776 [
777 'label' => __('Border Color', 'ultimate-store-kit-pro'),
778 'type' => Controls_Manager::COLOR,
779 'selectors' => [
780 '{{WRAPPER}} .usk-page-cart .actions>.button:hover' => 'border-color: {{VALUE}};',
781 ],
782 'condition' => [
783 'update_cart_border_border!' => '',
784 ]
785 ]
786 );
787
788 $this->end_controls_tab();
789
790 $this->end_controls_tabs();
791
792 $this->end_controls_section();
793
794
795
796 $this->start_controls_section(
797 'cart_collaterals_style_section',
798 [
799 'label' => __('Cart Collaterals', 'ultimate-store-kit-pro'),
800 'tab' => Controls_Manager::TAB_STYLE,
801 ]
802 );
803
804 $this->add_control(
805 'cart_total_heading',
806 [
807 'label' => esc_html__('Heading', 'ultimate-store-kit-pro'),
808 'type' => Controls_Manager::HEADING,
809 ]
810 );
811
812 $this->add_control(
813 'cart_total_color',
814 [
815 'label' => __('Color', 'ultimate-store-kit-pro'),
816 'type' => Controls_Manager::COLOR,
817 'selectors' => [
818 '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart_totals h2' => 'color: {{VALUE}};',
819 ],
820 ]
821 );
822
823 $this->add_group_control(
824 Group_Control_Typography::get_type(),
825 [
826 'name' => 'cart_total_typo',
827 'selector' => '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart_totals h2',
828 ]
829 );
830
831 $this->add_control(
832 'cart_total_bottom_spacing',
833 [
834 'label' => esc_html__('Bottom Spacing', 'ultimate-store-kit-pro'),
835 'type' => Controls_Manager::SLIDER,
836 'size_units' => ['px', ''],
837 'range' => [
838 'px' => [
839 'min' => 0,
840 'max' => 100,
841 ],
842 ],
843 'selectors' => [
844 '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart_totals h2' => 'margin-bottom: {{SIZE}}{{UNIT}};',
845 ],
846 ]
847 );
848
849
850 $this->add_control(
851 'cart_sub_total_heading',
852 [
853 'label' => esc_html__('Sub Total', 'ultimate-store-kit-pro'),
854 'type' => Controls_Manager::HEADING,
855 'separator' => 'before',
856 ]
857 );
858
859 $this->add_control(
860 'cart_sub_total_color',
861 [
862 'label' => __('Color', 'ultimate-store-kit-pro'),
863 'type' => Controls_Manager::COLOR,
864 'selectors' => [
865 '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart-subtotal th' => 'color: {{VALUE}};',
866 ],
867 ]
868 );
869
870 $this->add_group_control(
871 Group_Control_Typography::get_type(),
872 [
873 'name' => 'cart_sub_total_typo',
874 'selector' => '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart-subtotal th',
875 ]
876 );
877
878 $this->add_control(
879 'cart_sub_total_amount_heading',
880 [
881 'label' => esc_html__('Sub Total Amount', 'ultimate-store-kit-pro'),
882 'type' => Controls_Manager::HEADING,
883 'separator' => 'before',
884 ]
885 );
886
887 $this->add_control(
888 'cart_sub_total_amount_color',
889 [
890 'label' => __('Color', 'ultimate-store-kit-pro'),
891 'type' => Controls_Manager::COLOR,
892 'selectors' => [
893 '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart-subtotal .woocommerce-Price-amount.amount' => 'color: {{VALUE}};',
894 ],
895 ]
896 );
897
898 $this->add_group_control(
899 Group_Control_Typography::get_type(),
900 [
901 'name' => 'cart_sub_total_amount_typo',
902 'selector' => '{{WRAPPER}} .usk-page-cart .cart-collaterals .cart-subtotal .woocommerce-Price-amount.amount',
903 ]
904 );
905
906 $this->add_control(
907 'cart_final_total_heading',
908 [
909 'label' => esc_html__('Total', 'ultimate-store-kit-pro'),
910 'type' => Controls_Manager::HEADING,
911 'separator' => 'before',
912 ]
913 );
914
915 $this->add_control(
916 'cart_final_total_color',
917 [
918 'label' => __('Color', 'ultimate-store-kit-pro'),
919 'type' => Controls_Manager::COLOR,
920 'selectors' => [
921 '{{WRAPPER}} .usk-page-cart .cart-collaterals .order-total th' => 'color: {{VALUE}};',
922 ],
923 ]
924 );
925
926 $this->add_group_control(
927 Group_Control_Typography::get_type(),
928 [
929 'name' => 'cart_final_total_typo',
930 'selector' => '{{WRAPPER}} .usk-page-cart .cart-collaterals .order-total th',
931 ]
932 );
933
934 $this->add_control(
935 'cart_final_total_amount_heading',
936 [
937 'label' => esc_html__('Total Amount', 'ultimate-store-kit-pro'),
938 'type' => Controls_Manager::HEADING,
939 'separator' => 'before',
940 ]
941 );
942
943 $this->add_control(
944 'cart_final_total_amount_color',
945 [
946 'label' => __('Color', 'ultimate-store-kit-pro'),
947 'type' => Controls_Manager::COLOR,
948 'selectors' => [
949 '{{WRAPPER}} .usk-page-cart .cart-collaterals .order-total .woocommerce-Price-amount.amount' => 'color: {{VALUE}};',
950 ],
951 ]
952 );
953
954 $this->add_group_control(
955 Group_Control_Typography::get_type(),
956 [
957 'name' => 'cart_final_total_amount_typo',
958 'selector' => '{{WRAPPER}} .usk-page-cart .cart-collaterals .order-total .woocommerce-Price-amount.amount',
959 ]
960 );
961
962 $this->end_controls_section();
963
964 $this->start_controls_section(
965 'checkout_button_style_section',
966 [
967 'label' => __('Checkout Button', 'ultimate-store-kit-pro'),
968 'tab' => Controls_Manager::TAB_STYLE,
969 ]
970 );
971
972 $this->add_group_control(
973 Group_Control_Typography::get_type(),
974 [
975 'name' => 'checkout_button_typo',
976 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a',
977 ]
978 );
979
980 $this->add_responsive_control(
981 'checkout_button_padding',
982 [
983 'label' => __('Padding', 'ultimate-store-kit-pro'),
984 'type' => Controls_Manager::DIMENSIONS,
985 'size_units' => ['px', 'em', '%'],
986 'selectors' => [
987 '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
988 ],
989 ]
990 );
991
992 $this->add_responsive_control(
993 'checkout_button_margin',
994 [
995 'label' => __('Margin', 'ultimate-store-kit-pro'),
996 'type' => Controls_Manager::DIMENSIONS,
997 'size_units' => ['px', 'em', '%'],
998 'selectors' => [
999 '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1000 ],
1001 ]
1002 );
1003
1004 $this->add_group_control(
1005 Group_Control_Border::get_type(),
1006 [
1007 'name' => 'checkout_button_border',
1008 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a',
1009 ]
1010 );
1011
1012 $this->add_responsive_control(
1013 'checkout_button_border_radius',
1014 [
1015 'label' => __('Border Radius', 'ultimate-store-kit-pro'),
1016 'type' => Controls_Manager::DIMENSIONS,
1017 'size_units' => ['px', '%'],
1018 'selectors' => [
1019 '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
1020 ],
1021 ]
1022 );
1023
1024
1025 $this->start_controls_tabs('checkout_button_tabs');
1026
1027 $this->start_controls_tab(
1028 'checkout_button_normal',
1029 [
1030 'label' => __('Normal', 'ultimate-store-kit-pro'),
1031 ]
1032 );
1033
1034 $this->add_control(
1035 'checkout_button_color',
1036 [
1037 'label' => __('Color', 'ultimate-store-kit-pro'),
1038 'type' => Controls_Manager::COLOR,
1039 'selectors' => [
1040 '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a' => 'color: {{VALUE}};',
1041 ],
1042 ]
1043 );
1044
1045 $this->add_group_control(
1046 Group_Control_Background::get_type(),
1047 [
1048 'name' => 'checkout_button_bg',
1049 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a'
1050 ]
1051 );
1052
1053
1054 $this->end_controls_tab();
1055
1056 $this->start_controls_tab(
1057 'checkout_button_hover',
1058 [
1059 'label' => __('Hover', 'ultimate-store-kit-pro'),
1060 ]
1061 );
1062
1063 $this->add_control(
1064 'checkout_button_color_hover',
1065 [
1066 'label' => __('Color', 'ultimate-store-kit-pro'),
1067 'type' => Controls_Manager::COLOR,
1068 'selectors' => [
1069 '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a:hover' => 'color: {{VALUE}};',
1070 ],
1071 ]
1072 );
1073
1074 $this->add_group_control(
1075 Group_Control_Background::get_type(),
1076 [
1077 'name' => 'checkout_button_bg_hover',
1078 'selector' => '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a:hover'
1079 ]
1080 );
1081
1082 $this->add_control(
1083 'checkout_button_border_color_hover',
1084 [
1085 'label' => __('Border Color', 'ultimate-store-kit-pro'),
1086 'type' => Controls_Manager::COLOR,
1087 'selectors' => [
1088 '{{WRAPPER}} .usk-page-cart .woocommerce .wc-proceed-to-checkout a:hover' => 'border-color: {{VALUE}};',
1089 ],
1090 'condition' => [
1091 'checkout_button_border_border!' => '',
1092 ]
1093 ]
1094 );
1095
1096 $this->end_controls_tab();
1097 $this->end_controls_tabs();
1098 $this->end_controls_section();
1099 }
1100
1101
1102 protected function render() {
1103 $settings = $this->get_settings_for_display();
1104 $cart_url = wc_get_cart_url();
1105
1106 //echo do_shortcode('[woocommerce_cart]');
1107 global $woocommerce;
1108 $items = $woocommerce->cart->get_cart();
1109
1110 ?>
1111
1112 <div class="usk-page-cart">
1113 <div class="woocommerce">
1114 <form class="woocommerce-cart-form" action="<?php echo esc_url(wc_get_cart_url()); ?>" method="post">
1115 <table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents">
1116 <thead>
1117 <tr>
1118 <?php if ($settings['show_image'] == 'yes') : ?>
1119 <th><?php esc_html_e('Close', 'ultimate-store-kit-pro'); ?></th>
1120 <?php endif; ?>
1121
1122 <?php if ($settings['show_image'] == 'yes') : ?>
1123 <th><?php esc_html_e('Image', 'ultimate-store-kit-pro'); ?></th>
1124 <?php endif; ?>
1125
1126 <?php if ($settings['show_title'] == 'yes') : ?>
1127 <th><?php esc_html_e('Product Title', 'ultimate-store-kit-pro'); ?></th>
1128 <?php endif; ?>
1129
1130 <?php if ($settings['show_price'] == 'yes') : ?>
1131 <th><?php esc_html_e('Price', 'ultimate-store-kit-pro'); ?></th>
1132 <?php endif; ?>
1133
1134 <?php if ($settings['show_quantity'] == 'yes') : ?>
1135 <th><?php esc_html_e('Quantity', 'ultimate-store-kit-pro'); ?></th>
1136 <?php endif; ?>
1137
1138 <?php if ($settings['show_subtotal'] == 'yes') : ?>
1139 <th><?php esc_html_e('Subtotal', 'ultimate-store-kit-pro'); ?></th>
1140 <?php endif; ?>
1141 </tr>
1142 </thead>
1143 <tbody>
1144 <?php
1145 $product_names = array();
1146 foreach ($items as $item => $values) {
1147
1148 $_product = wc_get_product($values['data']->get_id());
1149 // $_product2 = apply_filters( 'woocommerce_cart_item_product', $values['data'], $values, $item );
1150 // Retrieve WC_Product object from the product-id:
1151 $_woo_product = wc_get_product($values['product_id']);
1152
1153 // Get SKU from the WC_Product object:
1154 $product_names['sku'] = $_woo_product->get_sku();
1155 $product_permalink = apply_filters('woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink($values) : '', $values, $item);
1156 ?>
1157
1158 <tr>
1159 <td class="usk-product-remove" data-title="<?php esc_html_e('Remove', 'ultimate-store-kit-pro'); ?>">
1160 <a href="<?php echo esc_url(wc_get_cart_remove_url($item)); ?>" class="remove" aria-label="Remove this item" data-product_id="<?php echo esc_html($values['product_id']); ?>" data-product_sku="<?php echo esc_html($product_names['sku']); ?>">
1161 ×
1162 </a>
1163 </td>
1164 <?php if ($settings['show_image'] == 'yes') : ?>
1165 <td class="usk-product-image" data-title="<?php esc_html_e('Image', 'ultimate-store-kit-pro'); ?>">
1166 <?php
1167 $thumbnail = apply_filters('woocommerce_cart_item_thumbnail', $_product->get_image(), $values, $item);
1168
1169 if (!$product_permalink) {
1170 echo wp_kses_post($thumbnail); // PHPCS: XSS ok.
1171 } else {
1172 printf('<a href="%s">%s</a>', esc_url($product_permalink), wp_kses_post($thumbnail)); // PHPCS: XSS ok.
1173 }
1174 ?>
1175 </td>
1176 <?php endif; ?>
1177
1178 <?php if ($settings['show_title'] == 'yes') : ?>
1179 <td class="usk-product-title" data-title="<?php esc_html_e('Product Title', 'ultimate-store-kit-pro'); ?>">
1180 <?php
1181 // echo $_product->get_title();
1182 if (!$product_permalink) {
1183 echo wp_kses_post(apply_filters('woocommerce_cart_item_name', $_product->get_name(), $values, $item) . '&nbsp;');
1184 } else {
1185 echo wp_kses_post(apply_filters('woocommerce_cart_item_name', sprintf('<a href="%s">%s</a>', esc_url($product_permalink), $_product->get_name()), $values, $item));
1186 }
1187
1188 do_action('woocommerce_after_cart_item_name', $values, $item);
1189
1190 // Meta data.
1191 echo wp_kses_post(wc_get_formatted_cart_item_data($values)); // PHPCS: XSS ok.
1192
1193 // Backorder notification.
1194 if ($_product->backorders_require_notification() && $_product->is_on_backorder($values['quantity'])) {
1195 echo wp_kses_post(apply_filters('woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__('Available on backorder', 'woocommerce') . '</p>', $_product));
1196 }
1197 ?>
1198 </td>
1199 <?php endif; ?>
1200
1201 <?php if ($settings['show_price'] == 'yes') : ?>
1202 <td class="usk-product-price" data-title="<?php esc_attr_e('Price', 'woocommerce'); ?>">
1203 <?php
1204 echo wp_kses_post(apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $values, $item)); // PHPCS: XSS ok.
1205 ?>
1206 </td>
1207 <?php endif; ?>
1208
1209 <?php if ($settings['show_quantity'] == 'yes') : ?>
1210 <td class="usk-product-quantity" data-title="<?php esc_html_e('Quantity', 'ultimate-store-kit-pro'); ?>">
1211 <?php
1212
1213 if ($_product->is_sold_individually()) {
1214 $product_quantity = sprintf('1 <input type="hidden" name="cart[%s][qty]" value="1" />', $item);
1215 } else {
1216 $product_quantity = woocommerce_quantity_input(
1217 array(
1218 'input_name' => "cart[{$item}][qty]",
1219 'input_value' => $values['quantity'],
1220 'max_value' => $_product->get_max_purchase_quantity(),
1221 'min_value' => '0',
1222 'product_name' => $_product->get_name(),
1223 ),
1224 $_product,
1225 false
1226 );
1227 }
1228
1229 echo wp_kses_post(apply_filters('woocommerce_cart_item_quantity', $product_quantity, $item, $values)); // PHPCS: XSS ok.
1230
1231 ?>
1232 </td>
1233 <?php endif; ?>
1234
1235 <?php if ($settings['show_subtotal'] == 'yes') : ?>
1236 <td class="usk-product-subtotal" data-title="<?php esc_html_e('Subtotal', 'ultimate-store-kit-pro'); ?>">
1237 <?php
1238 echo wp_kses_post(apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($_product, $values['quantity']), $values, $item)); // PHPCS: XSS ok.
1239 ?>
1240 </td>
1241 <?php endif; ?>
1242
1243 </tr>
1244
1245 <?php
1246 }
1247
1248 ?>
1249 <tr>
1250 <td colspan="6" class="actions">
1251 <?php if (wc_coupons_enabled()) { ?>
1252 <div class="coupon">
1253 <label for="coupon_code"><?php esc_html_e('Coupon:', 'woocommerce'); ?></label>
1254 <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e('Coupon code', 'woocommerce'); ?>" />
1255 <button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e('Apply coupon', 'woocommerce'); ?>"><?php esc_attr_e('Apply coupon', 'woocommerce'); ?></button>
1256 <?php do_action('woocommerce_cart_coupon'); ?>
1257 </div>
1258 <?php } ?>
1259
1260 <button type="submit" class="button" name="update_cart" value="<?php esc_attr_e('Update cart', 'woocommerce'); ?>"><?php esc_html_e('Update cart', 'woocommerce'); ?>
1261
1262 </button>
1263
1264 <?php do_action('woocommerce_cart_actions'); ?>
1265
1266 <?php wp_nonce_field('woocommerce-cart', 'woocommerce-cart-nonce'); ?>
1267 </td>
1268 </tr>
1269 </tbody>
1270 </table>
1271
1272 </form>
1273
1274 <div class="cart-collaterals">
1275 <?php
1276 /**
1277 * Cart collaterals hook.
1278 *
1279 * @hooked woocommerce_cross_sell_display
1280 * @hooked woocommerce_cart_totals - 10
1281 */
1282 do_action('woocommerce_cart_collaterals');
1283 ?>
1284 </div>
1285
1286 </div>
1287 </div>
1288
1289 <?php }
1290 }
1291