PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 2.0.0
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v2.0.0
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 2.0.0, at modules/page-cart/widgets/page-cart.php

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