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

1,303 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 $cart_url = wc_get_cart_url();
1106
1107 //echo do_shortcode('[woocommerce_cart]');
1108 global $woocommerce;
1109 $items = $woocommerce->cart->get_cart();
1110
1111 ?>
1112
1113 <div class="usk-page-cart">
1114 <div class="woocommerce">
1115 <form class="woocommerce-cart-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
1116 <table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents">
1117 <thead>
1118 <tr>
1119 <?php if ( $settings['show_image'] == 'yes' ) : ?>
1120 <th><?php esc_html_e( 'Close', 'ultimate-store-kit' ); ?></th>
1121 <?php endif; ?>
1122
1123 <?php if ( $settings['show_image'] == 'yes' ) : ?>
1124 <th><?php esc_html_e( 'Image', 'ultimate-store-kit' ); ?></th>
1125 <?php endif; ?>
1126
1127 <?php if ( $settings['show_title'] == 'yes' ) : ?>
1128 <th><?php esc_html_e( 'Product Title', 'ultimate-store-kit' ); ?></th>
1129 <?php endif; ?>
1130
1131 <?php if ( $settings['show_price'] == 'yes' ) : ?>
1132 <th><?php esc_html_e( 'Price', 'ultimate-store-kit' ); ?></th>
1133 <?php endif; ?>
1134
1135 <?php if ( $settings['show_quantity'] == 'yes' ) : ?>
1136 <th><?php esc_html_e( 'Quantity', 'ultimate-store-kit' ); ?></th>
1137 <?php endif; ?>
1138
1139 <?php if ( $settings['show_subtotal'] == 'yes' ) : ?>
1140 <th><?php esc_html_e( 'Subtotal', 'ultimate-store-kit' ); ?></th>
1141 <?php endif; ?>
1142 </tr>
1143 </thead>
1144 <tbody>
1145 <?php
1146 $product_names = array();
1147 foreach ( $items as $item => $values ) {
1148
1149 $_product = wc_get_product( $values['data']->get_id() );
1150 // $_product2 = apply_filters( 'woocommerce_cart_item_product', $values['data'], $values, $item );
1151 // Retrieve WC_Product object from the product-id:
1152 $_woo_product = wc_get_product( $values['product_id'] );
1153
1154 // Get SKU from the WC_Product object:
1155 $product_names['sku'] = $_woo_product->get_sku();
1156 $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $values ) : '', $values, $item );
1157 ?>
1158
1159 <tr>
1160 <td class="usk-product-remove"
1161 data-title="<?php esc_html_e( 'Remove', 'ultimate-store-kit' ); ?>">
1162 <a href="<?php echo esc_url( wc_get_cart_remove_url( $item ) ); ?>" class="remove"
1163 aria-label="Remove this item"
1164 data-product_id="<?php echo esc_html( $values['product_id'] ); ?>"
1165 data-product_sku="<?php echo esc_html( $product_names['sku'] ); ?>">
1166 ×
1167 </a>
1168 </td>
1169 <?php if ( $settings['show_image'] == 'yes' ) : ?>
1170 <td class="usk-product-image"
1171 data-title="<?php esc_html_e( 'Image', 'ultimate-store-kit' ); ?>">
1172 <?php
1173 $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $values, $item );
1174
1175 if ( ! $product_permalink ) {
1176 echo wp_kses_post( $thumbnail ); // PHPCS: XSS ok.
1177 } else {
1178 printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), wp_kses_post( $thumbnail ) ); // PHPCS: XSS ok.
1179 }
1180 ?>
1181 </td>
1182 <?php endif; ?>
1183
1184 <?php if ( $settings['show_title'] == 'yes' ) : ?>
1185 <td class="usk-product-title"
1186 data-title="<?php esc_html_e( 'Product Title', 'ultimate-store-kit' ); ?>">
1187 <?php
1188 // echo $_product->get_title();
1189 if ( ! $product_permalink ) {
1190 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $values, $item ) . '&nbsp;' );
1191 } else {
1192 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 ) );
1193 }
1194
1195 do_action( 'woocommerce_after_cart_item_name', $values, $item );
1196
1197 // Meta data.
1198 echo wp_kses_post( wc_get_formatted_cart_item_data( $values ) ); // PHPCS: XSS ok.
1199
1200 // Backorder notification.
1201 if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $values['quantity'] ) ) {
1202 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>', $_product ) );
1203 }
1204 ?>
1205 </td>
1206 <?php endif; ?>
1207
1208 <?php if ( $settings['show_price'] == 'yes' ) : ?>
1209 <td class="usk-product-price" data-title="<?php esc_attr_e( 'Price', 'woocommerce' ); ?>">
1210 <?php
1211 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $values, $item ) ); // PHPCS: XSS ok.
1212 ?>
1213 </td>
1214 <?php endif; ?>
1215
1216 <?php if ( $settings['show_quantity'] == 'yes' ) : ?>
1217 <td class="usk-product-quantity"
1218 data-title="<?php esc_html_e( 'Quantity', 'ultimate-store-kit' ); ?>">
1219 <?php
1220
1221 if ( $_product->is_sold_individually() ) {
1222 $product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $item );
1223 } else {
1224 $product_quantity = woocommerce_quantity_input(
1225 array(
1226 'input_name' => "cart[{$item}][qty]",
1227 'input_value' => $values['quantity'],
1228 'max_value' => $_product->get_max_purchase_quantity(),
1229 'min_value' => '0',
1230 'product_name' => $_product->get_name(),
1231 ),
1232 $_product,
1233 false
1234 );
1235 }
1236
1237 echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $item, $values ); // PHPCS: XSS ok.
1238
1239 ?>
1240 </td>
1241 <?php endif; ?>
1242
1243 <?php if ( $settings['show_subtotal'] == 'yes' ) : ?>
1244 <td class="usk-product-subtotal"
1245 data-title="<?php esc_html_e( 'Subtotal', 'ultimate-store-kit' ); ?>">
1246 <?php
1247 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $item ) ); // PHPCS: XSS ok.
1248 ?>
1249 </td>
1250 <?php endif; ?>
1251
1252 </tr>
1253
1254 <?php
1255 }
1256
1257 ?>
1258 <tr>
1259 <td colspan="6" class="actions">
1260 <?php if ( wc_coupons_enabled() ) { ?>
1261 <div class="coupon">
1262 <label for="coupon_code"><?php esc_html_e( 'Coupon:', 'woocommerce' ); ?></label>
1263 <input type="text" name="coupon_code" class="input-text" id="coupon_code" value=""
1264 placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" />
1265 <button type="submit" class="button" name="apply_coupon"
1266 value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?></button>
1267 <?php do_action( 'woocommerce_cart_coupon' ); ?>
1268 </div>
1269 <?php } ?>
1270
1271 <button type="submit" class="button" name="update_cart"
1272 value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>"><?php esc_html_e( 'Update cart', 'woocommerce' ); ?>
1273
1274 </button>
1275
1276 <?php do_action( 'woocommerce_cart_actions' ); ?>
1277
1278 <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
1279 </td>
1280 </tr>
1281 </tbody>
1282 </table>
1283
1284 </form>
1285
1286 <div class="cart-collaterals">
1287 <?php
1288 /**
1289 * Cart collaterals hook.
1290 *
1291 * @hooked woocommerce_cross_sell_display
1292 * @hooked woocommerce_cart_totals - 10
1293 */
1294 do_action( 'woocommerce_cart_collaterals' );
1295 ?>
1296 </div>
1297
1298 </div>
1299 </div>
1300
1301 <?php }
1302 }
1303