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

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

1,198 lines 35.6 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\MiniCart\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_Box_Shadow;
10 use Elementor\Group_Control_Background;
11
12 use Elementor\Plugin;
13 use Elementor\Utils;
14 use UltimateStoreKit\Modules\Woocommerce\Module;
15
16 if (!defined('ABSPATH')) {
17 exit; // Exit if accessed directly.
18 }
19
20 class Mini_Cart extends Module_Base {
21
22 public function get_name() {
23 return 'usk-mini-cart';
24 }
25
26 public function get_title() {
27 return esc_html__('Mini Cart', 'ultimate-store-kit');
28 }
29
30 public function get_icon() {
31 return 'usk-widget-icon usk-icon-mini-cart';
32 }
33
34 public function get_categories() {
35 return ['ultimate-store-kit'];
36 }
37
38 public function get_keywords() {
39 return ['mini cart', 'cart', 'wc', 'woocommerce', 'add to cart'];
40 }
41
42 public function get_style_depends() {
43 if ($this->usk_is_edit_mode()) {
44 return ['usk-all-styles'];
45 } else {
46 return ['ultimate-store-kit-font', 'usk-mini-cart', 'toolslide-css'];
47 }
48 }
49
50 public function get_script_depends() {
51 if ($this->usk_is_edit_mode()) {
52 return ['toolslide-js', 'usk-all-styles'];
53 } else {
54 return ['toolslide-js', 'usk-mini-cart'];
55 }
56 }
57
58 protected function render_layout_controls_offcanvas() {
59 $this->start_controls_section(
60 'section_content_layout',
61 [
62 'label' => esc_html__('Offcanvas', 'ultimate-store-kit'),
63 ]
64 );
65
66 $this->add_control(
67 'custom_widget_cart_title',
68 [
69 'label' => esc_html__('Cart Title', 'ultimate-store-kit'),
70 'type' => Controls_Manager::TEXT,
71 'dynamic' => ['active' => true],
72 'default' => esc_html__('Shopping Cart', 'ultimate-store-kit'),
73 ]
74 );
75 $this->end_controls_section();
76 }
77 protected function render_controls_settings() {
78 $this->start_controls_section(
79 'section_content_mini_cart_settings',
80 [
81 'label' => esc_html__('Settings', 'ultimate-store-kit'),
82 'tab' => Controls_Manager::TAB_CONTENT,
83 ]
84 );
85 $this->add_control(
86 'usk_mini_cart_position',
87 [
88 'label' => esc_html__('Position', 'ultimate-store-kit'),
89 'type' => Controls_Manager::SELECT,
90 'options' => [
91 'left' => esc_html__('Left', 'ultimate-store-kit'),
92 'right' => esc_html__('Right (Default)', 'ultimate-store-kit'),
93 'bottom' => esc_html__('Bottom', 'ultimate-store-kit'),
94 'top' => esc_html__('Top', 'ultimate-store-kit'),
95 ],
96 'default' => 'right',
97 'dynamic' => ['active' => true],
98 'render_type' => 'template',
99 'frontend_available' => true,
100 ]
101 );
102
103 $this->add_control(
104 'usk_mini_cart_height',
105 [
106 'label' => esc_html__('Height', 'ultimate-store-kit'),
107 'type' => Controls_Manager::SLIDER,
108 'size_units' => ['px', '%', 'vh'],
109 'range' => [
110 'px' => [
111 'min' => 0,
112 'max' => 1200,
113 'step' => 1,
114 ],
115 ],
116 'default' => [
117 'unit' => '%',
118 'size' => 100,
119 ],
120 'render_type' => 'none',
121 'frontend_available' => true,
122 ]
123 );
124
125 $this->add_control(
126 'usk_mini_cart_width',
127 [
128 'label' => esc_html__('Width', 'ultimate-store-kit'),
129 'type' => Controls_Manager::SLIDER,
130 'size_units' => ['px', '%', 'vh'],
131 'range' => [
132 'px' => [
133 'min' => 0,
134 'max' => 1200,
135 'step' => 1,
136 ],
137 ],
138 'default' => [
139 'unit' => 'px',
140 'size' => 340,
141 ],
142 'render_type' => 'none',
143 'frontend_available' => true,
144 ]
145 );
146 // $this->add_control(
147 // 'usk_mini_cart_closeable',
148 // [
149 // 'label' => esc_html__('Closeable', 'ultimate-store-kit'),
150 // 'type' => Controls_Manager::SWITCHER,
151 // 'label_on' => esc_html__('Yes', 'ultimate-store-kit'),
152 // 'label_off' => esc_html__('No', 'ultimate-store-kit'),
153 // 'render_type' => 'none',
154 // 'frontend_available' => true,
155 // ]
156 // );
157
158 $this->add_control(
159 'usk_mini_cart_startOpen',
160 [
161 'label' => esc_html__('Start Open', 'ultimate-store-kit'),
162 'type' => Controls_Manager::SWITCHER,
163 'label_on' => esc_html__('Yes', 'ultimate-store-kit'),
164 'label_off' => esc_html__('No', 'ultimate-store-kit'),
165 'render_type' => 'none',
166 'frontend_available' => true,
167 ]
168 );
169
170 $this->add_control(
171 'usk_mini_cart_autoclose',
172 [
173 'label' => esc_html__('Auto close', 'ultimate-store-kit'),
174 'type' => Controls_Manager::SWITCHER,
175 'label_on' => esc_html__('Yes', 'ultimate-store-kit'),
176 'label_off' => esc_html__('No', 'ultimate-store-kit'),
177 'render_type' => 'none',
178 'frontend_available' => true,
179 ]
180 );
181
182 $this->add_control(
183 'usk_mini_cart_clickOutsideToClose',
184 [
185 'label' => esc_html__('Click Outside To Close', 'ultimate-store-kit'),
186 'type' => Controls_Manager::SWITCHER,
187 'label_on' => esc_html__('Yes', 'ultimate-store-kit'),
188 'label_off' => esc_html__('No', 'ultimate-store-kit'),
189 'render_type' => 'none',
190 'default' => 'yes',
191 'frontend_available' => true,
192 ]
193 );
194
195 $this->add_control(
196 'usk_mini_cart_autocloseDelay',
197 [
198 'label' => esc_html__('Auto Close Delay', 'ultimate-store-kit'),
199 'description' => esc_html__('Description', 'ultimate-store-kit'),
200 'type' => Controls_Manager::NUMBER,
201 'min' => 0,
202 'max' => 10000,
203 'step' => 1,
204 'default' => 5000,
205 'dynamic' => ['active' => true],
206 'render_type' => 'none',
207 'frontend_available' => true,
208 ]
209 );
210 $this->end_controls_section();
211 }
212 protected function render_controls_mini_cart() {
213 $this->start_controls_section(
214 'section_content_mini_cart',
215 [
216 'label' => esc_html__('Mini Cart', 'ultimate-store-kit'),
217 ]
218 );
219
220 $this->add_control(
221 'show_price_amount',
222 [
223 'label' => esc_html__('Show Price Amount', 'ultimate-store-kit'),
224 'type' => Controls_Manager::SWITCHER,
225 ]
226 );
227
228 $this->add_control(
229 'show_cart_icon',
230 [
231 'label' => esc_html__('Show Cart Icon', 'ultimate-store-kit'),
232 'type' => Controls_Manager::SWITCHER,
233 'default' => 'yes',
234
235 ]
236 );
237 $this->add_responsive_control(
238 'mini_cart_align',
239 [
240 'label' => esc_html__('Alignment', 'ultimate-store-kit'),
241 'type' => Controls_Manager::CHOOSE,
242 'options' => [
243 'left' => [
244 'title' => esc_html__('Left', 'ultimate-store-kit'),
245 'icon' => 'eicon-h-align-left',
246 ],
247 'center' => [
248 'title' => esc_html__('Center', 'ultimate-store-kit'),
249 'icon' => 'eicon-h-align-center',
250 ],
251 'right' => [
252 'title' => esc_html__('Right', 'ultimate-store-kit'),
253 'icon' => 'eicon-h-align-right',
254 ],
255 ],
256 'prefix_class' => 'elementor%s-align-',
257 'default' => 'left',
258 ]
259 );
260
261 $this->add_control(
262 'mini_cart_icon_indent',
263 [
264 'label' => esc_html__('Icon Spacing', 'ultimate-store-kit'),
265 'type' => Controls_Manager::SLIDER,
266 'default' => [
267 'size' => 8,
268 ],
269 'range' => [
270 'px' => [
271 'max' => 50,
272 ],
273 ],
274 'selectors' => [
275 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner' => 'grid-gap: {{SIZE}}{{UNIT}};',
276 ],
277 'condition' => [
278 'show_cart_icon' => 'yes',
279 'show_price_amount' => 'yes'
280 ]
281 ]
282 );
283
284 $this->end_controls_section();
285 }
286
287 public function render_style_controls_mini_cart() {
288 $this->start_controls_section(
289 'section_style_mini_cart_content',
290 [
291 'label' => esc_html__('Mini Cart', 'ultimate-store-kit'),
292 'tab' => Controls_Manager::TAB_STYLE,
293 ]
294 );
295
296 $this->add_control(
297 'mini_cart_price_amount_color',
298 [
299 'label' => esc_html__('Amount Color', 'ultimate-store-kit'),
300 'type' => Controls_Manager::COLOR,
301 'selectors' => [
302 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .bdt-mini-cart-price-amount *' => 'color: {{VALUE}};',
303 ],
304 'condition' => [
305 'show_price_amount' => 'yes'
306 ]
307 ]
308 );
309
310 $this->add_control(
311 'mini_cart_icon_color',
312 [
313 'label' => esc_html__('Icon Color', 'ultimate-store-kit'),
314 'type' => Controls_Manager::COLOR,
315 'selectors' => [
316 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .usk-cart-icon i' => 'color: {{VALUE}};',
317 ],
318 ]
319 );
320
321 $this->add_control(
322 'mini_cart_background_color',
323 [
324 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
325 'type' => Controls_Manager::COLOR,
326 'selectors' => [
327 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner' => 'background: {{VALUE}};',
328 ],
329 ]
330 );
331
332 $this->add_group_control(
333 Group_Control_Border::get_type(),
334 [
335 'name' => 'mini_cart_border',
336 'label' => esc_html__('Border', 'ultimate-store-kit'),
337 'selector' => '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner',
338 ]
339 );
340
341 $this->add_control(
342 'mini_cart_border_radius',
343 [
344 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
345 'type' => Controls_Manager::DIMENSIONS,
346 'size_units' => ['px', '%'],
347 'selectors' => [
348 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
349 ],
350 ]
351 );
352
353 $this->add_responsive_control(
354 'mini_cart_padding',
355 [
356 'label' => esc_html__('Padding', 'ultimate-store-kit'),
357 'type' => Controls_Manager::DIMENSIONS,
358 'size_units' => ['px', 'em', '%'],
359 'selectors' => [
360 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
361 ],
362 ]
363 );
364
365 $this->add_group_control(
366 Group_Control_Typography::get_type(),
367 [
368 'name' => 'price_amount_typography',
369 'selector' => '{{WRAPPER}} .bdt-mini-cart-inner .woocommerce-Price-amount.amount, {{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .usk-cart-icon i',
370 ]
371 );
372
373 $this->add_control(
374 'mini_cart_badge_style',
375 [
376 'label' => esc_html__('Cart Badge', 'ultimate-store-kit'),
377 'type' => Controls_Manager::HEADING,
378 'separator' => 'before',
379 ]
380 );
381
382 $this->add_control(
383 'mini_cart_badge_color',
384 [
385 'label' => esc_html__('Color', 'ultimate-store-kit'),
386 'type' => Controls_Manager::COLOR,
387 'selectors' => [
388 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .usk-cart-badge' => 'color: {{VALUE}};',
389 ],
390 ]
391 );
392
393 $this->add_control(
394 'mini_cart_badge_background_color',
395 [
396 'label' => esc_html__('Background', 'ultimate-store-kit'),
397 'type' => Controls_Manager::COLOR,
398 'selectors' => [
399 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .usk-cart-badge' => 'background: {{VALUE}};',
400 ],
401 ]
402 );
403 $this->add_responsive_control(
404 'mini_cart_badge_padding',
405 [
406 'label' => esc_html__('Padding', 'ultimate-store-kit'),
407 'type' => Controls_Manager::DIMENSIONS,
408 'size_units' => ['px', '%', 'em'],
409 'selectors' => [
410 '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .usk-cart-badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
411 ],
412 ]
413 );
414
415 $this->add_group_control(
416 Group_Control_Typography::get_type(),
417 [
418 'name' => 'cart_badge_typography',
419 'selector' => '{{WRAPPER}} .usk-mini-cart-toggle-btn .bdt-mini-cart-inner .usk-cart-badge',
420 ]
421 );
422
423 $this->end_controls_section();
424 }
425 protected function render_style_controls_offcanvas() {
426 $this->start_controls_section(
427 'section_style_offcanvas_content',
428 [
429 'label' => esc_html__('Offcanvas', 'ultimate-store-kit'),
430 'tab' => Controls_Manager::TAB_STYLE,
431 ]
432 );
433
434 $this->start_controls_tabs('tabs_style_offcanvas_content');
435
436 $this->start_controls_tab(
437 'tab_style_product_cart',
438 [
439 'label' => esc_html__('Product List', 'ultimate-store-kit'),
440 ]
441 );
442
443 $this->add_control(
444 'product_cart_main_title_color',
445 [
446 'label' => esc_html__('Cart Title Color', 'ultimate-store-kit'),
447 'type' => Controls_Manager::COLOR,
448 'selectors' => [
449 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-widget-title' => 'color: {{VALUE}}',
450 ],
451 ]
452 );
453
454 $this->add_control(
455 'product_cart_main_title_border_color',
456 [
457 'label' => esc_html__('Cart Border Color', 'ultimate-store-kit'),
458 'type' => Controls_Manager::COLOR,
459 'selectors' => [
460 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-widget-title' => 'border-color: {{VALUE}}',
461 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-product-item' => 'border-bottom-color: {{VALUE}}'
462 ],
463 ]
464 );
465
466 $this->add_group_control(
467 Group_Control_Typography::get_type(),
468 [
469 'name' => 'product_cart_main_title_typography',
470 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-widget-title',
471 ]
472 );
473
474 $this->add_control(
475 'product_cart_style',
476 [
477 'label' => esc_html__('Product Cart', 'ultimate-store-kit'),
478 'type' => Controls_Manager::HEADING,
479 'separator' => 'before',
480 ]
481 );
482
483 $this->add_control(
484 'product_cart_title_color',
485 [
486 'label' => esc_html__('Title Color', 'ultimate-store-kit'),
487 'type' => Controls_Manager::COLOR,
488 'selectors' => [
489 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-name a' => 'color: {{VALUE}};',
490 ],
491 ]
492 );
493
494 $this->add_control(
495 'product_cart_title_hover_color',
496 [
497 'label' => esc_html__('Title Hover Color', 'ultimate-store-kit'),
498 'type' => Controls_Manager::COLOR,
499 'selectors' => [
500 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-name a:hover' => 'color: {{VALUE}};',
501 ],
502 ]
503 );
504
505 $this->add_group_control(
506 Group_Control_Typography::get_type(),
507 [
508 'name' => 'product_cart_title_typography',
509 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-name a',
510 ]
511 );
512
513 // $this->add_control(
514 // 'product_cart_item_border_color',
515 // [
516 // 'label' => esc_html__('Item Border Color', 'ultimate-store-kit'),
517 // 'type' => Controls_Manager::COLOR,
518 // 'selectors' => [
519 // '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item' => 'border-color: {{VALUE}};',
520 // ],
521 // 'separator' => 'before',
522 // ]
523 // );
524
525 $this->add_control(
526 'product_cart_quantity_price_style',
527 [
528 'label' => esc_html__('Price', 'ultimate-store-kit'),
529 'type' => Controls_Manager::HEADING,
530 'separator' => 'before',
531 ]
532 );
533
534 $this->add_control(
535 'product_cart_quantity_color',
536 [
537 'label' => esc_html__('Quantity Color', 'ultimate-store-kit'),
538 'type' => Controls_Manager::COLOR,
539 'selectors' => [
540 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-price' => 'color: {{VALUE}};',
541 ],
542 ]
543 );
544
545 $this->add_control(
546 'product_cart_price_color',
547 [
548 'label' => esc_html__('Amount Color', 'ultimate-store-kit'),
549 'type' => Controls_Manager::COLOR,
550 'selectors' => [
551 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .woocommerce-Price-amount .amount *' => 'color: {{VALUE}} !important;',
552 ],
553 ]
554 );
555
556 $this->add_group_control(
557 Group_Control_Typography::get_type(),
558 [
559 'name' => 'product_cart_price_typography',
560 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-price',
561 ]
562 );
563
564 $this->add_control(
565 'product_cart_image_style',
566 [
567 'label' => esc_html__('Image', 'ultimate-store-kit'),
568 'type' => Controls_Manager::HEADING,
569 'separator' => 'before',
570 ]
571 );
572
573 $this->add_group_control(
574 Group_Control_Border::get_type(),
575 [
576 'name' => 'product_cart_image_border',
577 'label' => esc_html__('Image Border', 'ultimate-store-kit'),
578 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-thumbnail img',
579 ]
580 );
581
582 $this->add_responsive_control(
583 'product_cart_image_radius',
584 [
585 'label' => esc_html__('Image Border Radius', 'ultimate-store-kit'),
586 'type' => Controls_Manager::DIMENSIONS,
587 'size_units' => ['px', '%'],
588 'selectors' => [
589 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-thumbnail img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
590 ],
591 ]
592 );
593
594 $this->add_control(
595 'product_cart_subtotal_style',
596 [
597 'label' => esc_html__('Subtotal', 'ultimate-store-kit'),
598 'type' => Controls_Manager::HEADING,
599 'separator' => 'before',
600 ]
601 );
602
603 $this->add_control(
604 'product_cart_subtotal_color',
605 [
606 'label' => esc_html__('Subtotal Color', 'ultimate-store-kit'),
607 'type' => Controls_Manager::COLOR,
608 'selectors' => [
609 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-subtotal strong' => 'color: {{VALUE}};',
610 ],
611 ]
612 );
613
614 $this->add_control(
615 'product_cart_subtotal_tax_color',
616 [
617 'label' => esc_html__('Tax Color', 'ultimate-store-kit'),
618 'type' => Controls_Manager::COLOR,
619 'selectors' => [
620 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-subtotal .woocommerce-Price-amount.amount' => 'color: {{VALUE}};',
621 ],
622 ]
623 );
624
625 $this->add_group_control(
626 Group_Control_Typography::get_type(),
627 [
628 'name' => 'product_cart_subtotal_typography',
629 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-subtotal',
630 ]
631 );
632
633 $this->add_control(
634 'product_cart_viewcart_button_style',
635 [
636 'label' => esc_html__('View Cart Button', 'ultimate-store-kit'),
637 'type' => Controls_Manager::HEADING,
638 'separator' => 'before',
639 ]
640 );
641
642 $this->add_control(
643 'pc_viewcart_text_color',
644 [
645 'label' => esc_html__('Color', 'ultimate-store-kit'),
646 'type' => Controls_Manager::COLOR,
647 'default' => '',
648 'selectors' => [
649 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons a.bdt-button-view-cart ' => 'color: {{VALUE}};',
650 ],
651 ]
652 );
653
654 $this->add_control(
655 'pc_viewcart_button_hover_color',
656 [
657 'label' => esc_html__('Hover Color', 'ultimate-store-kit'),
658 'type' => Controls_Manager::COLOR,
659 'selectors' => [
660 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons a.bdt-button-view-cart :hover' => 'color: {{VALUE}};',
661 ],
662 ]
663 );
664 $this->add_control(
665 'heading_viewcart_background_color',
666 [
667 'label' => __('Background', 'ultimate-store-kit'),
668 'type' => Controls_Manager::HEADING,
669 'separator' => 'before',
670 ]
671 );
672 $this->add_group_control(
673 Group_Control_Background::get_type(),
674 [
675 'name' => 'pc_viewcart_background_color',
676 'label' => __('Background', 'ultimate-store-kit'),
677 'types' => ['classic', 'gradient'],
678 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons .bdt-button-view-cart'
679 ]
680 );
681
682 $this->add_group_control(
683 Group_Control_Background::get_type(),
684 [
685 'name' => 'pc_viewcart_background_hover_color',
686 'label' => __('Background', 'ultimate-store-kit'),
687 'types' => ['classic', 'gradient'],
688 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons .bdt-button-view-cart:hover'
689 ]
690 );
691
692 // $this->add_control(
693 // 'pc_viewcart_background_hover_color',
694 // [
695 // 'label' => esc_html__('Hover Background Color', 'ultimate-store-kit'),
696 // 'type' => Controls_Manager::COLOR,
697 // 'selectors' => [
698 // '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart:hover' => 'background-color: {{VALUE}};',
699 // ],
700 // ]
701 // );
702
703 $this->add_group_control(
704 Group_Control_Border::get_type(),
705 [
706 'name' => 'pc_viewcart_border',
707 'label' => esc_html__('Border', 'ultimate-store-kit'),
708 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart',
709 ]
710 );
711
712 $this->add_control(
713 'pc_viewcart_hover_border_color',
714 [
715 'label' => esc_html__('Hover Border Color', 'ultimate-store-kit'),
716 'type' => Controls_Manager::COLOR,
717 'condition' => [
718 'pc_viewcart_border_border!' => '',
719 ],
720 'selectors' => [
721 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart:hover' => 'border-color: {{VALUE}};',
722 ],
723 ]
724 );
725
726 $this->add_control(
727 'pc_viewcart_border_radius',
728 [
729 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
730 'type' => Controls_Manager::DIMENSIONS,
731 'size_units' => ['px', '%'],
732 'selectors' => [
733 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
734 ],
735 ]
736 );
737
738 $this->add_control(
739 'pc_viewcart_padding',
740 [
741 'label' => esc_html__('Padding', 'ultimate-store-kit'),
742 'type' => Controls_Manager::DIMENSIONS,
743 'size_units' => ['px', 'em', '%'],
744 'selectors' => [
745 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
746 ],
747 ]
748 );
749
750 $this->add_group_control(
751 Group_Control_Box_Shadow::get_type(),
752 [
753 'name' => 'pc_viewcart_shadow',
754 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart',
755 ]
756 );
757
758 $this->add_group_control(
759 Group_Control_Typography::get_type(),
760 [
761 'name' => 'pc_viewcart_typography',
762 'label' => esc_html__('Typography', 'ultimate-store-kit'),
763 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-view-cart .bdt-button-text',
764 ]
765 );
766
767 $this->add_control(
768 'product_cart_checkout_button_style',
769 [
770 'label' => esc_html__('Checkout Button', 'ultimate-store-kit'),
771 'type' => Controls_Manager::HEADING,
772 'separator' => 'before',
773 ]
774 );
775
776 $this->add_control(
777 'pc_checkout_text_color',
778 [
779 'label' => esc_html__('Color', 'ultimate-store-kit'),
780 'type' => Controls_Manager::COLOR,
781 'default' => '',
782 'selectors' => [
783 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons .bdt-button-checkout' => 'color: {{VALUE}};',
784 ],
785 ]
786 );
787
788 $this->add_control(
789 'pc_checkout_button_hover_color',
790 [
791 'label' => esc_html__('Hover Color', 'ultimate-store-kit'),
792 'type' => Controls_Manager::COLOR,
793 'selectors' => [
794 '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons .bdt-button-checkout:hover' => 'color: {{VALUE}};',
795 ],
796 ]
797 );
798
799 $this->add_group_control(
800 Group_Control_Background::get_type(),
801 [
802 'name' => 'pc_checkout_background_color',
803 'label' => __('Background', 'ultimate-store-kit'),
804 'types' => ['classic', 'gradient'],
805 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .bdt-mini-cart-footer-buttons .bdt-button-checkout',
806 ]
807 );
808
809 $this->add_control(
810 'pc_checkout_background_hover_color',
811 [
812 'label' => esc_html__('Hover Background Color', 'ultimate-store-kit'),
813 'type' => Controls_Manager::COLOR,
814 'selectors' => [
815 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout:hover::before' => 'background-color: {{VALUE}};',
816 // '.usk-mini-cart .bdt-mini-cart-footer-buttons .bdt-button-checkout::before'
817 ],
818 ]
819 );
820
821 $this->add_group_control(
822 Group_Control_Border::get_type(),
823 [
824 'name' => 'pc_checkout_border',
825 'label' => esc_html__('Border', 'ultimate-store-kit'),
826 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout',
827 ]
828 );
829
830 $this->add_control(
831 'pc_checkout_hover_border_color',
832 [
833 'label' => esc_html__('Hover Border Color', 'ultimate-store-kit'),
834 'type' => Controls_Manager::COLOR,
835 'condition' => [
836 'pc_checkout_border_border!' => '',
837 ],
838 'selectors' => [
839 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout:hover' => 'border-color: {{VALUE}};',
840 ],
841 ]
842 );
843
844 $this->add_control(
845 'pc_checkout_border_radius',
846 [
847 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
848 'type' => Controls_Manager::DIMENSIONS,
849 'size_units' => ['px', '%'],
850 'selectors' => [
851 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
852 ],
853 ]
854 );
855
856 $this->add_control(
857 'pc_checkout_padding',
858 [
859 'label' => esc_html__('Padding', 'ultimate-store-kit'),
860 'type' => Controls_Manager::DIMENSIONS,
861 'size_units' => ['px', 'em', '%'],
862 'selectors' => [
863 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
864 ],
865 ]
866 );
867
868 $this->add_group_control(
869 Group_Control_Box_Shadow::get_type(),
870 [
871 'name' => 'pc_checkout_shadow',
872 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout',
873 ]
874 );
875
876 $this->add_group_control(
877 Group_Control_Typography::get_type(),
878 [
879 'name' => 'pc_checkout_typography',
880 'label' => esc_html__('Typography', 'ultimate-store-kit'),
881 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-footer-buttons .bdt-button-checkout .bdt-button-text',
882 ]
883 );
884
885 $this->add_control(
886 'product_cart_remove_button_style',
887 [
888 'label' => esc_html__('Product Remove Button', 'ultimate-store-kit'),
889 'type' => Controls_Manager::HEADING,
890 'separator' => 'before',
891 ]
892 );
893
894 $this->add_control(
895 'pc_remove_text_color',
896 [
897 'label' => esc_html__('Color', 'ultimate-store-kit'),
898 'type' => Controls_Manager::COLOR,
899 'default' => '',
900 'selectors' => [
901 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a svg *' => 'stroke: {{VALUE}};',
902 ],
903 ]
904 );
905
906 $this->add_control(
907 'pc_remove_button_hover_color',
908 [
909 'label' => esc_html__('Hover Color', 'ultimate-store-kit'),
910 'type' => Controls_Manager::COLOR,
911 'selectors' => [
912 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a:hover svg *' => 'stroke: {{VALUE}};',
913 ],
914 ]
915 );
916
917 $this->add_control(
918 'pc_remove_background_color',
919 [
920 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
921 'type' => Controls_Manager::COLOR,
922 'selectors' => [
923 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a' => 'background-color: {{VALUE}};',
924 ],
925 ]
926 );
927
928 $this->add_control(
929 'pc_remove_background_hover_color',
930 [
931 'label' => esc_html__('Hover Background Color', 'ultimate-store-kit'),
932 'type' => Controls_Manager::COLOR,
933 'selectors' => [
934 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a:hover' => 'background-color: {{VALUE}};',
935 ],
936 ]
937 );
938
939 $this->add_group_control(
940 Group_Control_Border::get_type(),
941 [
942 'name' => 'pc_remove_border',
943 'label' => esc_html__('Border', 'ultimate-store-kit'),
944 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a',
945 ]
946 );
947
948 $this->add_control(
949 'pc_remove_hover_border_color',
950 [
951 'label' => esc_html__('Hover Border Color', 'ultimate-store-kit'),
952 'type' => Controls_Manager::COLOR,
953 'condition' => [
954 'pc_remove_border_border!' => '',
955 ],
956 'selectors' => [
957 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a:hover' => 'border-color: {{VALUE}};',
958 ],
959 ]
960 );
961
962 $this->add_control(
963 'pc_remove_border_radius',
964 [
965 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
966 'type' => Controls_Manager::DIMENSIONS,
967 'size_units' => ['px', '%'],
968 'selectors' => [
969 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
970 ],
971 ]
972 );
973
974 $this->add_control(
975 'pc_remove_padding',
976 [
977 'label' => esc_html__('Padding', 'ultimate-store-kit'),
978 'type' => Controls_Manager::DIMENSIONS,
979 'size_units' => ['px', 'em', '%'],
980 'selectors' => [
981 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
982 ],
983 ]
984 );
985
986 $this->add_group_control(
987 Group_Control_Box_Shadow::get_type(),
988 [
989 'name' => 'pc_remove_shadow',
990 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item .bdt-mini-cart-product-remove a',
991 ]
992 );
993
994 $this->end_controls_tab();
995
996 $this->start_controls_tab(
997 'tab_style_offcanvas_content',
998 [
999 'label' => esc_html__('Offcanvas', 'ultimate-store-kit'),
1000 ]
1001 );
1002 $this->add_control(
1003 'heading_offcanvas_content_background',
1004 [
1005 'label' => __('Content Background', 'ultimate-store-kit'),
1006 'type' => Controls_Manager::HEADING,
1007 'separator' => 'before',
1008 ]
1009 );
1010 $this->add_group_control(
1011 Group_Control_Background::get_type(),
1012 [
1013 'name' => 'offcanvas_content_background_color',
1014 'label' => __('Background', 'ultimate-store-kit'),
1015 'types' => ['classic', 'gradient'],
1016 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container',
1017 ]
1018 );
1019 $this->add_control(
1020 'heading_offcanvas_item_background',
1021 [
1022 'label' => __('Item Background', 'ultimate-store-kit'),
1023 'type' => Controls_Manager::HEADING,
1024 'separator' => 'before',
1025 ]
1026 );
1027
1028 $this->add_group_control(
1029 Group_Control_Background::get_type(),
1030 [
1031 'name' => 'offcanvas_item_background_color',
1032 'label' => __('Background', 'ultimate-store-kit'),
1033 'types' => ['classic', 'gradient'],
1034 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item',
1035 ]
1036 );
1037
1038 $this->add_control(
1039 'heading_offcanvas_item_hover_background',
1040 [
1041 'label' => __('Item Hover Background', 'ultimate-store-kit'),
1042 'type' => Controls_Manager::HEADING,
1043 'separator' => 'before',
1044 ]
1045 );
1046 $this->add_group_control(
1047 Group_Control_Background::get_type(),
1048 [
1049 'name' => 'offcanvas_item_hover_background_color',
1050 'label' => __('Background', 'ultimate-store-kit'),
1051 'types' => ['classic', 'gradient'],
1052 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .bdt-mini-cart-product-item:hover',
1053 ]
1054 );
1055 $this->add_group_control(
1056 Group_Control_Box_Shadow::get_type(),
1057 [
1058 'name' => 'offcanvas_content_shadow',
1059 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container',
1060 'separator' => 'before',
1061 ]
1062 );
1063
1064 $this->add_responsive_control(
1065 'offcanvas_content_padding',
1066 [
1067 'label' => esc_html__('Padding', 'ultimate-store-kit'),
1068 'type' => Controls_Manager::DIMENSIONS,
1069 'size_units' => ['px', 'em', '%'],
1070 'selectors' => [
1071 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1072 ],
1073 'separator' => 'before',
1074 ]
1075 );
1076
1077 $this->add_responsive_control(
1078 'offcanvas_margin',
1079 [
1080 'label' => esc_html__('Margin', 'ultimate-store-kit'),
1081 'type' => Controls_Manager::DIMENSIONS,
1082 'size_units' => ['px', 'em', '%'],
1083 'selectors' => [
1084 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1085 ],
1086 'separator' => 'after'
1087 ]
1088 );
1089 $this->add_control(
1090 'offcanvas_heading_footer',
1091 [
1092 'label' => __('Footer', 'ultimate-store-kit'),
1093 'type' => Controls_Manager::HEADING,
1094 'separator' => 'before',
1095 ]
1096 );
1097 $this->add_group_control(
1098 Group_Control_Background::get_type(),
1099 [
1100 'name' => 'footer_backgrouind',
1101 'label' => __('Background', 'ultimate-store-kit'),
1102 'types' => ['classic', 'gradient'],
1103 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-content-footer',
1104 ]
1105 );
1106 $this->end_controls_tab();
1107 $this->end_controls_tabs();
1108
1109 $this->end_controls_section();
1110 }
1111 protected function register_controls() {
1112 $this->render_layout_controls_offcanvas();
1113 $this->render_controls_mini_cart();
1114 $this->render_controls_settings();
1115
1116 //Style
1117 $this->render_style_controls_mini_cart();
1118 $this->render_style_controls_offcanvas();
1119 }
1120
1121 public function render() {
1122
1123 $settings = $this->get_settings_for_display();
1124 $id = 'usk-mini-cart-' . $this->get_id();
1125 $toggleID = 'usk-mini-cart-toggle-' . $this->get_id();
1126 if (null === WC()->cart) {
1127 return;
1128 }
1129 $product_count = WC()->cart->get_cart_contents_count();
1130 // $this->add_render_attribute('mini-cart', 'type', 'button');
1131 $this->add_render_attribute('mini-cart', 'id', $toggleID);
1132 $this->add_render_attribute('mini-cart', [
1133 'class' => ['usk-mini-cart-toggle-btn'],
1134 'data-settings' => [
1135 wp_json_encode(array_filter([
1136 'toggleButton' => '#' . $toggleID . '',
1137 // 'position' => $settings['cart_position'],
1138 // 'height' => "100%",
1139 // 'width' => "340px",
1140 // 'startOpen' => true,
1141 // 'closeable' => true,
1142 // 'autoclose' => false,
1143 // 'autocloseDelay' => 5000,
1144 // 'clickOutsideToClose' => true,
1145 ]))
1146 ]
1147 ], null, true);
1148 $this->add_render_attribute('offcanvas', [
1149 'id' => $id,
1150 'class' => ['usk-mini-cart'],
1151 ], null, true);
1152 ?>
1153 <div class="ultimate-store-kit">
1154 <div <?php $this->print_render_attribute_string('mini-cart'); ?>>
1155 <span class="bdt-mini-cart-inner">
1156 <?php if ($settings['show_price_amount'] === 'yes') : ?>
1157 <span class="bdt-cart-button-text">
1158 <span class="bdt-mini-cart-price-amount">
1159 <?php echo WC()->cart->get_cart_subtotal(); ?>
1160 </span>
1161 </span>
1162 <?php endif; ?>
1163
1164 <?php if ($settings['show_cart_icon'] === 'yes') : ?>
1165 <span class="bdt-mini-cart-button-icon">
1166 <?php //if (($product_count != 0)) :
1167 ?>
1168 <span class="usk-cart-badge"><?php echo esc_html($product_count); ?></span>
1169 <?php //endif;
1170 ?>
1171 <span class="usk-cart-icon">
1172 <i class="eicon-cart" aria-hidden="true"></i>
1173 </span>
1174 </span>
1175 <?php
1176 endif; ?>
1177 </span>
1178 </div>
1179
1180 <!-- OFFCANVAS -->
1181 <div <?php $this->print_render_attribute_string('offcanvas'); ?>>
1182 <div class="ts-container">
1183 <div class="ts-nav-container"></div>
1184 <div class="ts-content-container">
1185 <div id="first" class="ts-content-item">
1186 <div class="usk-widget-title">
1187 <?php echo wp_kses_post($settings['custom_widget_cart_title']); ?>
1188 </div>
1189 <div class="widget_shopping_cart_content"></div>
1190 </div>
1191 </div>
1192 </div>
1193 </div>
1194 </div>
1195 <?php
1196 }
1197 }
1198