PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.0.2
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.0.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 / showcase-slider / widgets / showcase-slider.php

showcase-slider.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 3.0.2, at modules/showcase-slider/widgets/showcase-slider.php

1,551 lines 56.7 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\ShowcaseSlider\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Image_Size;
10 use Elementor\Group_Control_Typography;
11 use Elementor\Plugin;
12 use UltimateStoreKit\Base\Module_Base;
13 use UltimateStoreKit\Includes\Controls\GroupQuery\Group_Control_Query;
14 use UltimateStoreKit\traits\Global_Widget_Controls;
15 use UltimateStoreKit\traits\Global_Widget_Template;
16 use UltimateStoreKit\Classes\Utils;
17 use WP_Query;
18
19 if (!defined('ABSPATH')) {
20 exit;
21 }
22
23 // Exit if accessed directly
24
25 class Showcase_Slider extends Module_Base
26 {
27 use Global_Widget_Controls;
28 use Global_Widget_Template;
29 use Group_Control_Query;
30
31 /**
32 * @var \WP_Query
33 */
34 private $_query = null;
35 public function get_name()
36 {
37 return 'usk-showcase-slider';
38 }
39
40 public function get_title()
41 {
42 return esc_html__('Showcase Slider', 'ultimate-store-kit');
43 }
44
45 public function get_icon()
46 {
47 return 'usk-widget-icon usk-icon-showcase-slider';
48 }
49
50 public function get_categories()
51 {
52 return ['ultimate-store-kit'];
53 }
54
55 public function get_keywords()
56 {
57 return ['product', 'product slider', 'showcase slider', 'wc', 'carousel'];
58 }
59
60 public function get_script_depends()
61 {
62 if ($this->usk_is_edit_mode()) {
63 return ['swiper', 'micromodal', 'usk-site'];
64 } else {
65 return ['swiper', 'micromodal', 'usk-showcase-slider'];
66 }
67 }
68
69 public function get_style_depends()
70 {
71 if ($this->usk_is_edit_mode()) {
72 return ['swiper', 'usk-all-styles'];
73 } else {
74 return ['swiper', 'usk-font', 'usk-showcase-slider'];
75 }
76 }
77
78 // public function get_custom_help_url() {
79 // return 'https://youtu.be/3VkvEpVaNAM';
80 // }
81 public function get_query()
82 {
83 return $this->_query;
84 }
85
86 public function has_widget_inner_wrapper(): bool
87 {
88 return !\Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
89 }
90 protected function register_controls()
91 {
92 $this->start_controls_section(
93 'section_woocommerce_layout',
94 [
95 'label' => esc_html__('Layout', 'ultimate-store-kit'),
96 ]
97 );
98
99 $this->add_responsive_control(
100 'items_gap',
101 [
102 'label' => esc_html__('Item Gap', 'ultimate-store-kit'),
103 'type' => Controls_Manager::SLIDER,
104 'default' => [
105 'size' => 120,
106 ],
107 'range' => [
108 'px' => [
109 'min' => 0,
110 'max' => 200,
111 ],
112 ],
113 'tablet_default' => [
114 'size' => 80,
115 ],
116 'mobile_default' => [
117 'size' => 0,
118 ],
119 ]
120 );
121 $this->add_control(
122 'title_tags',
123 [
124 'label' => esc_html__('Title HTML Tag', 'ultimate-store-kit'),
125 'type' => Controls_Manager::SELECT,
126 'default' => 'h3',
127 'options' => ultimate_store_kit_title_tags(),
128 'condition' => [
129 'show_title' => 'yes',
130 ],
131 ]
132 );
133
134 $this->add_group_control(
135 Group_Control_Image_Size::get_type(),
136 [
137 'name' => 'image',
138 'label' => esc_html__('Image Size', 'ultimate-store-kit'),
139 'exclude' => ['custom'],
140 'default' => 'full',
141 ]
142 );
143 $this->add_responsive_control(
144 'items_height',
145 [
146 'label' => esc_html__('Image Height', 'ultimate-store-kit'),
147 'type' => Controls_Manager::SLIDER,
148 'size_units' => ['px', '%'],
149 'range' => [
150 'px' => [
151 'min' => 200,
152 'max' => 800,
153 ],
154 '%' => [
155 'min' => 10,
156 'max' => 100,
157 ],
158 ],
159 'selectors' => [
160 '{{WRAPPER}} .usk-showcase-slider .usk-image-wrap' => 'height: {{SIZE}}{{UNIT}}',
161 ],
162 ]
163 );
164
165 $this->end_controls_section();
166 $this->start_controls_section(
167 'section_post_query_builder',
168 [
169 'label' => __('Query', 'ultimate-store-kit'),
170 'tab' => Controls_Manager::TAB_CONTENT,
171 ]
172 );
173 $this->register_query_builder_controls();
174 $this->register_controls_wc_additional();
175 $this->end_controls_section();
176 $this->start_controls_section(
177 'section_woocommerce_additional',
178 [
179 'label' => esc_html__('Additional Options', 'ultimate-store-kit'),
180 ]
181 );
182 $this->start_controls_tabs(
183 'tabs_show_hide_content'
184 );
185 $this->start_controls_tab(
186 'show_content_tab',
187 [
188 'label' => esc_html__('Content', 'ultimate-store-kit'),
189 ]
190 );
191 $this->add_control(
192 'show_title',
193 [
194 'label' => esc_html__('Title', 'ultimate-store-kit'),
195 'type' => Controls_Manager::SWITCHER,
196 'default' => 'yes',
197 ]
198 );
199 $this->add_control(
200 'show_category',
201 [
202 'label' => esc_html__('Category', 'ultimate-store-kit'),
203 'type' => Controls_Manager::SWITCHER,
204 'default' => 'yes',
205 ]
206 );
207 $this->add_control(
208 'show_rating',
209 [
210 'label' => esc_html__('Rating', 'ultimate-store-kit'),
211 'type' => Controls_Manager::SWITCHER,
212 'default' => 'yes',
213 ]
214 );
215 $this->add_control(
216 'hide_customer_review',
217 [
218 'label' => esc_html__('Hide Review Text', 'ultimate-store-kit'),
219 'type' => Controls_Manager::SWITCHER,
220 'label_on' => esc_html__('Yes', 'ultimate-store-kit'),
221 'label_off' => esc_html__('No', 'ultimate-store-kit'),
222 // 'return_value' => 'yes',
223 'default' => 'yes',
224 'condition' => [
225 'show_rating' => 'yes',
226 ],
227 'selectors' => [
228 '{{WRAPPER}} .usk-showcase-slider .usk-rating .woocommerce-review-link' => 'display:none',
229 ],
230 ]
231 );
232 $this->add_control(
233 'show_button',
234 [
235 'label' => esc_html__('Button', 'ultimate-store-kit'),
236 'type' => Controls_Manager::SWITCHER,
237 'default' => 'yes',
238 ]
239 );
240 $this->add_control(
241 'show_price',
242 [
243 'label' => esc_html__('Price', 'ultimate-store-kit'),
244 'type' => Controls_Manager::SWITCHER,
245 'default' => 'yes',
246 ]
247 );
248
249 $this->end_controls_tab();
250 $this->start_controls_tab(
251 'show_sale_badge_tab',
252 [
253 'label' => esc_html__('Badge', 'ultimate-store-kit'),
254 ]
255 );
256 $this->add_control(
257 'show_sale_badge',
258 [
259 'label' => esc_html__('Sale', 'ultimate-store-kit'),
260 'type' => Controls_Manager::SWITCHER,
261 'default' => 'yes',
262 ]
263 );
264 $this->add_control(
265 'show_discount_badge',
266 [
267 'label' => esc_html__('Percentage', 'ultimate-store-kit'),
268 'type' => Controls_Manager::SWITCHER,
269 'default' => 'yes',
270 ]
271 );
272 $this->add_control(
273 'show_stock_status',
274 [
275 'label' => esc_html__('Stock Status', 'ultimate-store-kit'),
276 'type' => Controls_Manager::SWITCHER,
277 'default' => 'yes',
278 ]
279 );
280 $this->add_control(
281 'show_trending_badge',
282 [
283 'label' => esc_html__('Trending', 'ultimate-store-kit'),
284 'type' => Controls_Manager::SWITCHER,
285 'default' => 'yes',
286 ]
287 );
288 $this->add_control(
289 'show_new_badge',
290 [
291 'label' => esc_html__('New', 'ultimate-store-kit'),
292 'type' => Controls_Manager::SWITCHER,
293 'default' => 'yes',
294 ]
295 );
296 $this->add_control(
297 'newness_days',
298 [
299 'label' => esc_html__('Newness Days', 'ultimate-store-kit'),
300 'type' => Controls_Manager::NUMBER,
301 'default' => 30,
302 'condition' => [
303 'show_new_badge' => 'yes',
304 ],
305 ]
306 );
307 $this->end_controls_tab();
308 $this->start_controls_tab(
309 'show_action_btn_tab',
310 [
311 'label' => esc_html__('Action Button', 'ultimate-store-kit'),
312 ]
313 );
314 $this->add_control(
315 'show_cart',
316 [
317 'label' => esc_html__('Add to Cart', 'ultimate-store-kit'),
318 'type' => Controls_Manager::SWITCHER,
319 'default' => 'yes',
320 ]
321 );
322
323 $this->add_control(
324 'show_wishlist',
325 [
326 'label' => esc_html__('Wishlist', 'ultimate-store-kit'),
327 'type' => Controls_Manager::SWITCHER,
328 'default' => 'yes',
329 ]
330 );
331 $this->add_control(
332 'show_compare',
333 [
334 'label' => esc_html__('Compare', 'ultimate-store-kit'),
335 'type' => Controls_Manager::SWITCHER,
336 'default' => 'yes',
337 ]
338 );
339 $this->add_control(
340 'show_quick_view',
341 [
342 'label' => esc_html__('Quick View', 'ultimate-store-kit'),
343 'type' => Controls_Manager::SWITCHER,
344 'default' => 'yes',
345 ]
346 );
347 $this->end_controls_tab();
348 $this->end_controls_tabs();
349 $this->end_controls_section();
350 $this->register_global_controls_carousel_navigation();
351 $this->start_controls_section(
352 'section_carousel_settings',
353 [
354 'label' => __('Carousel Settings', 'ultimate-store-kit'),
355 ]
356 );
357 $this->add_control(
358 'coverflow_toggle',
359 [
360 'label' => __('Coverflow Effect', 'ultimate-store-kit'),
361 'type' => Controls_Manager::POPOVER_TOGGLE,
362 'return_value' => 'yes',
363 ]
364 );
365
366 $this->start_popover();
367
368 $this->add_control(
369 'coverflow_rotate',
370 [
371 'label' => esc_html__('Rotate', 'ultimate-store-kit'),
372 'type' => Controls_Manager::SLIDER,
373 'default' => [
374 'size' => 50,
375 ],
376 'range' => [
377 'px' => [
378 'min' => -360,
379 'max' => 360,
380 'step' => 5,
381 ],
382 ],
383 'render_type' => 'template',
384 ]
385 );
386
387 $this->add_control(
388 'coverflow_stretch',
389 [
390 'label' => __('Stretch', 'ultimate-store-kit'),
391 'type' => Controls_Manager::SLIDER,
392 'default' => [
393 'size' => 0,
394 ],
395 'range' => [
396 'px' => [
397 'min' => 0,
398 'step' => 10,
399 'max' => 100,
400 ],
401 ],
402 'render_type' => 'template',
403 ]
404 );
405
406 $this->add_control(
407 'coverflow_modifier',
408 [
409 'label' => __('Modifier', 'ultimate-store-kit'),
410 'type' => Controls_Manager::SLIDER,
411 'default' => [
412 'size' => 1,
413 ],
414 'range' => [
415 'px' => [
416 'min' => 1,
417 'step' => 1,
418 'max' => 10,
419 ],
420 ],
421 'render_type' => 'template',
422 ]
423 );
424
425 $this->add_control(
426 'coverflow_depth',
427 [
428 'label' => __('Depth', 'ultimate-store-kit'),
429 'type' => Controls_Manager::SLIDER,
430 'default' => [
431 'size' => 100,
432 ],
433 'range' => [
434 'px' => [
435 'min' => 0,
436 'step' => 10,
437 'max' => 1000,
438 ],
439 ],
440 'render_type' => 'template',
441 ]
442 );
443
444 $this->end_popover();
445
446 $this->add_control(
447 'hr_005',
448 [
449 'type' => Controls_Manager::DIVIDER,
450 ]
451 );
452
453 $this->add_control(
454 'autoplay',
455 [
456 'label' => __('Autoplay', 'ultimate-store-kit'),
457 'type' => Controls_Manager::SWITCHER,
458 'default' => 'yes',
459
460 ]
461 );
462
463 $this->add_control(
464 'autoplay_speed',
465 [
466 'label' => esc_html__('Autoplay Speed', 'ultimate-store-kit'),
467 'type' => Controls_Manager::NUMBER,
468 'default' => 5000,
469 'condition' => [
470 'autoplay' => 'yes',
471 ],
472 ]
473 );
474
475 $this->add_control(
476 'pauseonhover',
477 [
478 'label' => esc_html__('Pause on Hover', 'ultimate-store-kit'),
479 'type' => Controls_Manager::SWITCHER,
480 ]
481 );
482
483 $this->add_responsive_control(
484 'slides_to_scroll',
485 [
486 'type' => Controls_Manager::SELECT,
487 'label' => esc_html__('Slides to Scroll', 'ultimate-store-kit'),
488 'default' => 1,
489 'tablet_default' => 1,
490 'mobile_default' => 1,
491 'options' => [
492 1 => esc_html__('1', 'ultimate-store-kit'),
493 2 => esc_html__('2', 'ultimate-store-kit'),
494 3 => esc_html__('3', 'ultimate-store-kit'),
495 4 => esc_html__('4', 'ultimate-store-kit'),
496 5 => esc_html__('5', 'ultimate-store-kit'),
497 6 => esc_html__('6', 'ultimate-store-kit'),
498 ],
499 ]
500 );
501
502 $this->add_control(
503 'centered_slides',
504 [
505 'label' => __('Center Slide', 'ultimate-store-kit'),
506 'description' => __('Use even items from Layout > Columns settings for better preview.', 'ultimate-store-kit'),
507 'type' => Controls_Manager::SWITCHER,
508 ]
509 );
510
511 $this->add_control(
512 'grab_cursor',
513 [
514 'label' => __('Grab Cursor', 'ultimate-store-kit'),
515 'type' => Controls_Manager::SWITCHER,
516 ]
517 );
518
519 $this->add_control(
520 'loop',
521 [
522 'label' => __('Loop', 'ultimate-store-kit'),
523 'type' => Controls_Manager::SWITCHER,
524 'default' => 'yes',
525
526 ]
527 );
528
529 $this->add_control(
530 'speed',
531 [
532 'label' => __('Animation Speed (ms)', 'ultimate-store-kit'),
533 'type' => Controls_Manager::SLIDER,
534 'default' => [
535 'size' => 800,
536 ],
537 'range' => [
538 'px' => [
539 'min' => 100,
540 'max' => 5000,
541 'step' => 50,
542 ],
543 ],
544 ]
545 );
546
547 $this->add_control(
548 'observer',
549 [
550 'label' => __('Observer', 'ultimate-store-kit'),
551 'description' => __('When you use carousel in any hidden place (in tabs, accordion etc) keep it yes.', 'ultimate-store-kit'),
552 'type' => Controls_Manager::SWITCHER,
553 ]
554 );
555
556 $this->add_responsive_control(
557 'item_shadow_padding',
558 [
559 'label' => __('Match Padding', 'ultimate-store-kit'),
560 'description' => __('You have to add padding for matching overlaping normal/hover box shadow when you used Box Shadow option.', 'ultimate-store-kit'),
561 'type' => Controls_Manager::SLIDER,
562 'range' => [
563 'px' => [
564 'min' => 0,
565 'step' => 1,
566 'max' => 50,
567 ]
568 ],
569 'default' => [
570 'size' => 10
571 ],
572 'selectors' => [
573 '{{WRAPPER}} .swiper-carousel' => 'padding: {{SIZE}}{{UNIT}};'
574 ],
575 ]
576 );
577
578 $this->end_controls_section();
579
580 $this->start_controls_section(
581 'section_style_content',
582 [
583 'label' => esc_html__('Item', 'ultimate-store-kit'),
584 'tab' => Controls_Manager::TAB_STYLE,
585 ]
586 );
587
588 $this->start_controls_tabs('tabs_content_style');
589
590 $this->start_controls_tab(
591 'tab_content_normal',
592 [
593 'label' => esc_html__('Normal', 'ultimate-store-kit'),
594 ]
595 );
596 $this->add_group_control(
597 Group_Control_Background::get_type(),
598 [
599 'name' => 'content_background',
600 'label' => esc_html__('Background', 'ultimate-store-kit'),
601 'types' => ['classic', 'gradient'],
602 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item-box',
603 ]
604 );
605
606 $this->add_group_control(
607 Group_Control_Border::get_type(),
608 [
609 'name' => 'content_border',
610 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item',
611 'separator' => 'before',
612 ]
613 );
614
615 $this->add_responsive_control(
616 'content_radius',
617 [
618 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
619 'type' => Controls_Manager::DIMENSIONS,
620 'size_units' => ['px'],
621 'selectors' => [
622 '{{WRAPPER}} .usk-showcase-slider .usk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
623 ],
624 ]
625 );
626 $this->add_responsive_control(
627 'content_padding',
628 [
629 'label' => esc_html__('Padding', 'ultimate-store-kit'),
630 'type' => Controls_Manager::DIMENSIONS,
631 'separator' => 'after',
632 'size_units' => [
633 'px',
634 'em',
635 '%',
636 ],
637 'selectors' => [
638 '{{WRAPPER}} .usk-showcase-slider .usk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
639 ],
640 ]
641 );
642 $this->add_responsive_control(
643 'content_box_padding',
644 [
645 'label' => esc_html__('Content Padding', 'ultimate-store-kit'),
646 'type' => Controls_Manager::DIMENSIONS,
647 'size_units' => [
648 'px',
649 'em',
650 '%',
651 ],
652 'selectors' => [
653 '{{WRAPPER}} .usk-showcase-slider .usk-item-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
654 ],
655 ]
656 );
657 $this->add_group_control(
658 Group_Control_Box_Shadow::get_type(),
659 [
660 'name' => 'content_shadow',
661 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item',
662
663 ]
664 );
665 $this->end_controls_tab();
666
667 $this->start_controls_tab(
668 'tab_content_hover',
669 [
670 'label' => esc_html__('Hover', 'ultimate-store-kit'),
671 ]
672 );
673 $this->add_group_control(
674 Group_Control_Background::get_type(),
675 [
676 'name' => 'content_hover_background',
677 'label' => esc_html__('Background', 'ultimate-store-kit'),
678 'types' => ['classic', 'gradient'],
679 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item-box:hover',
680 ]
681 );
682 $this->add_control(
683 'content_hover_border_color',
684 [
685 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
686 'type' => Controls_Manager::COLOR,
687 'condition' => [
688 'content_border_border!' => '',
689 ],
690 'selectors' => [
691 '{{WRAPPER}} .usk-showcase-slider .usk-item:hover' => 'border-color: {{VALUE}};',
692 ],
693 ]
694 );
695 $this->add_group_control(
696 Group_Control_Box_Shadow::get_type(),
697 [
698 'name' => 'content_hover_shadow',
699 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item:hover',
700 ]
701 );
702 $this->end_controls_tab();
703 $this->end_controls_tabs();
704 $this->end_controls_section();
705
706 $this->register_global_controls_title();
707 $this->register_global_controls_category();
708 $this->register_global_controls_price();
709
710 $this->start_controls_section(
711 'section_style_button',
712 [
713 'label' => esc_html__('Add To Cart', 'ultimate-store-kit'),
714 'tab' => Controls_Manager::TAB_STYLE,
715 'condition' => [
716 'show_cart' => 'yes',
717 ],
718 ]
719 );
720
721 $this->start_controls_tabs('tabs_button_style');
722
723 $this->start_controls_tab(
724 'tab_button_normal',
725 [
726 'label' => esc_html__('Normal', 'ultimate-store-kit'),
727 ]
728 );
729
730 $this->add_control(
731 'button_text_color',
732 [
733 'label' => esc_html__('Color', 'ultimate-store-kit'),
734 'type' => Controls_Manager::COLOR,
735 'default' => '',
736 'selectors' => [
737 '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'color: {{VALUE}};',
738 ],
739 ]
740 );
741 $this->add_group_control(
742 Group_Control_Background::get_type(),
743 [
744 'name' => 'btn_background_color',
745 'label' => esc_html__('Background', 'ultimate-store-kit'),
746 'types' => ['classic', 'gradient'],
747 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart',
748 ]
749 );
750 $this->add_group_control(
751 Group_Control_Border::get_type(),
752 [
753 'name' => 'btn_border',
754 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart',
755 'separator' => 'before',
756 ]
757 );
758
759 $this->add_responsive_control(
760 'btn_border_radius',
761 [
762 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
763 'type' => Controls_Manager::DIMENSIONS,
764 'size_units' => ['px', '%'],
765 'selectors' => [
766 '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
767 ],
768 ]
769 );
770
771 $this->add_responsive_control(
772 'button_padding',
773 [
774 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ) . BDTUSK_NC,
775 'type' => Controls_Manager::DIMENSIONS,
776 'size_units' => [ 'px', '%', 'em' ],
777 'selectors' => [
778 '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
779 ],
780 ]
781 );
782
783 $this->add_responsive_control(
784 'button_spacing',
785 [
786 'label' => esc_html__('Right Spacing', 'ultimate-store-kit'),
787 'type' => Controls_Manager::SLIDER,
788 'size_units' => ['px', 'em'],
789 'selectors' => [
790 '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'right: {{SIZE}}{{UNIT}};',
791 ],
792 ]
793 );
794 $this->add_control(
795 'btn_size_toggle',
796 [
797 'label' => esc_html__('Size', 'ultimate-store-kit'),
798 'type' => Controls_Manager::POPOVER_TOGGLE,
799 ]
800 );
801 $this->start_popover();
802 $this->add_responsive_control(
803 'btn_height',
804 [
805 'label' => esc_html__('Height', 'ultimate-store-kit'),
806 'type' => Controls_Manager::SLIDER,
807 'size_units' => ['px', 'em'],
808 'range' => [
809 'px' => [
810 'min' => 0,
811 'max' => 100,
812 ],
813 'em' => [
814 'min' => 0,
815 'max' => 10,
816 'step' => 0.1,
817 ],
818 ],
819 'selectors' => [
820 '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'height: {{SIZE}}{{UNIT}};',
821 ],
822 'condition' => [
823 'btn_size_toggle' => 'yes',
824 ],
825 ]
826 );
827 $this->add_responsive_control(
828 'btn_width',
829 [
830 'label' => esc_html__('Width', 'ultimate-store-kit'),
831 'type' => Controls_Manager::SLIDER,
832 'size_units' => ['px', 'em', '%'],
833 'range' => [
834 'px' => [
835 'min' => 0,
836 'max' => 500,
837 ],
838 'em' => [
839 'min' => 0,
840 'max' => 50,
841 ],
842 '%' => [
843 'min' => 0,
844 'max' => 100,
845 ],
846 ],
847 'selectors' => [
848 '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'width: {{SIZE}}{{UNIT}};',
849 ],
850 'condition' => [
851 'btn_size_toggle' => 'yes',
852 ],
853 ]
854 );
855 $this->end_popover();
856
857 $this->add_group_control(
858 Group_Control_Box_Shadow::get_type(),
859 [
860 'name' => 'button_shadow',
861 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart',
862 ]
863 );
864
865 $this->add_group_control(
866 Group_Control_Typography::get_type(),
867 [
868 'name' => 'button_typography',
869 'label' => esc_html__('Typography', 'ultimate-store-kit'),
870 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart',
871 ]
872 );
873 $this->end_controls_tab();
874
875 $this->start_controls_tab(
876 'tab_button_hover',
877 [
878 'label' => esc_html__('Hover', 'ultimate-store-kit'),
879 ]
880 );
881 $this->add_control(
882 'hover_color',
883 [
884 'label' => esc_html__('Color', 'ultimate-store-kit'),
885 'type' => Controls_Manager::COLOR,
886 'selectors' => [
887 '{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover' => 'color: {{VALUE}};',
888 ],
889 ]
890 );
891
892 $this->add_group_control(
893 Group_Control_Background::get_type(),
894 [
895 'name' => 'btn_hover_bg',
896 'label' => esc_html__('Background', 'ultimate-store-kit'),
897 'types' => ['classic', 'gradient'],
898 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover',
899 ]
900 );
901
902 $this->add_control(
903 'button_hover_border_color',
904 [
905 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
906 'type' => Controls_Manager::COLOR,
907 'condition' => [
908 'btn_border_border!' => '',
909 ],
910 'selectors' => [
911 '{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover' => 'border-color: {{VALUE}};',
912 ],
913 ]
914 );
915 $this->add_group_control(
916 Group_Control_Box_Shadow::get_type(),
917 [
918 'name' => 'button_hover_shadow',
919 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover',
920 ]
921 );
922
923 $this->end_controls_tab();
924 $this->end_controls_tabs();
925 $this->end_controls_section();
926
927 $this->register_global_controls_badge();
928 $this->register_global_controls_rating();
929
930 $this->start_controls_section(
931 'style_action_btn',
932 [
933 'label' => esc_html__( 'Action Button', 'ultimate-store-kit' ),
934 'tab' => Controls_Manager::TAB_STYLE,
935 'conditions' => [
936 'relation' => 'or',
937 'terms' => [
938 [
939 'name' => 'show_wishlist',
940 'value' => 'yes',
941 ],
942 [
943 'name' => 'show_quick_view',
944 'value' => 'yes',
945 ],
946 [
947 'name' => 'show_cart',
948 'value' => 'yes',
949 ],
950 [
951 'name' => 'show_compare',
952 'value' => 'yes',
953 ],
954 ],
955 ],
956 ]
957 );
958
959 $this->add_group_control(
960 Group_Control_Border::get_type(),
961 [
962 'name' => 'action_btn_border',
963 'label' => esc_html__('Border', 'ultimate-store-kit'),
964 'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-action-btn',
965 ]
966 );
967 $this->add_responsive_control(
968 'action_btn_radius',
969 [
970 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
971 'type' => Controls_Manager::DIMENSIONS,
972 'size_units' => ['px', '%', 'em'],
973 'selectors' => [
974 '{{WRAPPER}} .usk-showcase-slider .usk-action-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
975 ],
976 ]
977 );
978 $this->add_responsive_control(
979 'action_btn_padding',
980 [
981 'label' => esc_html__('Padding', 'ultimate-store-kit'),
982 'type' => Controls_Manager::DIMENSIONS,
983 'size_units' => ['px', '%', 'em'],
984 'selectors' => [
985 '{{WRAPPER}} .usk-showcase-slider .usk-action-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
986 ],
987 ]
988 );
989
990 $this->add_responsive_control(
991 'action_btn_gap',
992 [
993 'label' => esc_html__('Gap', 'ultimate-store-kit'),
994 'type' => Controls_Manager::SLIDER,
995 'size_units' => ['px', 'em'],
996 'selectors' => [
997 '{{WRAPPER}} .usk-showcase-slider .usk-shoping' => 'gap: {{SIZE}}{{UNIT}};',
998 ],
999 ]
1000 );
1001
1002 $this->add_responsive_control(
1003 'action_btn_icon_size',
1004 [
1005 'label' => esc_html__('Icon Size', 'ultimate-store-kit'),
1006 'type' => Controls_Manager::SLIDER,
1007 'size_units' => ['px', 'em'],
1008 'selectors' => [
1009 '{{WRAPPER}} .usk-showcase-slider .usk-action-btn' => 'font-size: {{SIZE}}{{UNIT}};',
1010 ],
1011 ]
1012 );
1013
1014 $this->add_control(
1015 'font_family',
1016 [
1017 'label' => esc_html__('Tooltip Font', 'ultimate-store-kit'),
1018 'type' => Controls_Manager::FONT,
1019 'selectors' => [
1020 '{{WRAPPER}} .usk-shoping a' => 'font-family: {{VALUE}}',
1021 ],
1022 ]
1023 );
1024
1025 $this->start_controls_tabs(
1026 'action_btn_tabs'
1027 );
1028 $this->start_controls_tab(
1029 'wishlist_tab',
1030 [
1031 'label' => esc_html__('Wishlist', 'ultimate-store-kit'),
1032 'condition' => [
1033 'show_wishlist' => 'yes',
1034 ],
1035 ]
1036 );
1037 $this->add_control(
1038 'wishlist_normal_color',
1039 [
1040 'label' => esc_html__('Color', 'ultimate-store-kit'),
1041 'type' => Controls_Manager::COLOR,
1042 'selectors' => [
1043 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist' => 'color: {{VALUE}}',
1044 ],
1045 ]
1046 );
1047 $this->add_control(
1048 'wishlist_icon_bg',
1049 [
1050 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1051 'type' => Controls_Manager::COLOR,
1052 'selectors' => [
1053 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist' => 'background: {{VALUE}}',
1054 ],
1055 ]
1056 );
1057 $this->add_control(
1058 'heading_wishlist_hover',
1059 [
1060 'label' => esc_html__('Hover', 'ultimate-store-kit'),
1061 'type' => Controls_Manager::HEADING,
1062 'separator' => 'before',
1063 ]
1064 );
1065 $this->add_control(
1066 'wishlist_hover_color',
1067 [
1068 'label' => esc_html__('Color', 'ultimate-store-kit'),
1069 'type' => Controls_Manager::COLOR,
1070 'selectors' => [
1071 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist:hover' => 'color: {{VALUE}}',
1072 ],
1073 ]
1074 );
1075 $this->add_control(
1076 'wishlist_icon_hover_bg',
1077 [
1078 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1079 'type' => Controls_Manager::COLOR,
1080 'selectors' => [
1081 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist:hover' => 'background: {{VALUE}}',
1082 ],
1083 ]
1084 );
1085 $this->add_control(
1086 'heading_wishlist_active',
1087 [
1088 'label' => esc_html__('Active', 'ultimate-store-kit'),
1089 'type' => Controls_Manager::HEADING,
1090 'separator' => 'before',
1091 ]
1092 );
1093 $this->add_control(
1094 'wishlist_active_color',
1095 [
1096 'label' => esc_html__('Color', 'ultimate-store-kit'),
1097 'type' => Controls_Manager::COLOR,
1098 'selectors' => [
1099 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist.usk-active' => 'color: {{VALUE}}',
1100 ],
1101 ]
1102 );
1103 $this->add_control(
1104 'wishlist_active_bg',
1105 [
1106 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1107 'type' => Controls_Manager::COLOR,
1108 'selectors' => [
1109 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist.usk-active' => 'background: {{VALUE}}',
1110 ],
1111 ]
1112 );
1113 $this->end_controls_tab();
1114 // Compare
1115 $this->start_controls_tab(
1116 'compare_tab',
1117 [
1118 'label' => esc_html__('Compare', 'ultimate-store-kit'),
1119 'condition' => [
1120 'show_compare' => 'yes',
1121 ],
1122 ]
1123 );
1124 $this->add_control(
1125 'compare_normal_color',
1126 [
1127 'label' => esc_html__('Color', 'ultimate-store-kit'),
1128 'type' => Controls_Manager::COLOR,
1129 'selectors' => [
1130 '{{WRAPPER}} .usk-showcase-slider .usk-compare' => 'color: {{VALUE}}',
1131 ],
1132 ]
1133 );
1134 $this->add_control(
1135 'compare_icon_bg',
1136 [
1137 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1138 'type' => Controls_Manager::COLOR,
1139 'selectors' => [
1140 '{{WRAPPER}} .usk-showcase-slider .usk-compare' => 'background: {{VALUE}}',
1141 ],
1142 ]
1143 );
1144
1145 $this->add_control(
1146 'heading_compare_hover',
1147 [
1148 'label' => esc_html__('Hover', 'ultimate-store-kit'),
1149 'type' => Controls_Manager::HEADING,
1150 'separator' => 'before',
1151 ]
1152 );
1153 $this->add_control(
1154 'compare_hover_color',
1155 [
1156 'label' => esc_html__('Color', 'ultimate-store-kit'),
1157 'type' => Controls_Manager::COLOR,
1158 'selectors' => [
1159 '{{WRAPPER}} .usk-showcase-slider .usk-compare:hover' => 'color: {{VALUE}}',
1160 ],
1161 ]
1162 );
1163 $this->add_control(
1164 'compare_icon_hover_bg',
1165 [
1166 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1167 'type' => Controls_Manager::COLOR,
1168 'selectors' => [
1169 '{{WRAPPER}} .usk-showcase-slider .usk-compare:hover' => 'background: {{VALUE}}',
1170 ],
1171 ]
1172 );
1173 $this->add_control(
1174 'heading_compare_active',
1175 [
1176 'label' => esc_html__('Active', 'ultimate-store-kit'),
1177 'type' => Controls_Manager::HEADING,
1178 'separator' => 'before',
1179 ]
1180 );
1181 $this->add_control(
1182 'compare_active_color',
1183 [
1184 'label' => esc_html__('Color', 'ultimate-store-kit'),
1185 'type' => Controls_Manager::COLOR,
1186 'selectors' => [
1187 '{{WRAPPER}} .usk-showcase-slider .usk-compare.usk-active' => 'color: {{VALUE}}',
1188 ],
1189 ]
1190 );
1191 $this->add_control(
1192 'compare_icon_active_bg',
1193 [
1194 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1195 'type' => Controls_Manager::COLOR,
1196 'selectors' => [
1197 '{{WRAPPER}} .usk-showcase-slider .usk-compare.usk-active' => 'background: {{VALUE}}',
1198 ],
1199 ]
1200 );
1201 $this->end_controls_tab();
1202 $this->start_controls_tab(
1203 'quickview_tab',
1204 [
1205 'label' => esc_html__('Quickview', 'ultimate-store-kit'),
1206 'condition' => [
1207 'show_quick_view' => 'yes',
1208 ],
1209 ]
1210 );
1211 $this->add_control(
1212 'quickview_color',
1213 [
1214 'label' => esc_html__('Color', 'ultimate-store-kit'),
1215 'type' => Controls_Manager::COLOR,
1216 'selectors' => [
1217 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview' => 'color: {{VALUE}}',
1218 ],
1219 ]
1220 );
1221 $this->add_control(
1222 'quickview_icon_bg',
1223 [
1224 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1225 'type' => Controls_Manager::COLOR,
1226 'selectors' => [
1227 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview' => 'background: {{VALUE}}',
1228 ],
1229 ]
1230 );
1231 $this->add_control(
1232 'heading_quickview_hover',
1233 [
1234 'label' => esc_html__('Hover', 'ultimate-store-kit'),
1235 'type' => Controls_Manager::HEADING,
1236 'separator' => 'before',
1237 ]
1238 );
1239 $this->add_control(
1240 'quickview_color_hover',
1241 [
1242 'label' => esc_html__('Color', 'ultimate-store-kit'),
1243 'type' => Controls_Manager::COLOR,
1244 'selectors' => [
1245 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview:hover' => 'color: {{VALUE}}',
1246 ],
1247 ]
1248 );
1249 $this->add_control(
1250 'quickview_icon_bg_hover',
1251 [
1252 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
1253 'type' => Controls_Manager::COLOR,
1254 'selectors' => [
1255 '{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview:hover' => 'background: {{VALUE}}',
1256 ],
1257 ]
1258 );
1259 $this->end_controls_tab();
1260 $this->end_controls_tabs();
1261 $this->end_controls_section();
1262 $this->register_global_controls_navigation_style();
1263 }
1264
1265 public function render_image()
1266 {
1267 $tooltip_position = 'top';
1268 global $product;
1269 $settings = $this->get_settings_for_display();
1270 $product_image = wp_get_attachment_image_url(get_post_thumbnail_id(), $settings['image_size']);
1271 ?>
1272 <div class="usk-image-wrap">
1273 <img class="usk-image" src="<?php echo esc_url($product_image); ?>" alt="<?php echo esc_html(get_the_title()); ?>">
1274 <div class="usk-shoping">
1275 <?php
1276 $this->register_global_template_add_to_wishlist($tooltip_position, $settings);
1277 $this->register_global_template_add_to_compare($tooltip_position, $settings);
1278 $this->register_global_template_quick_view($product->get_id(), $tooltip_position, $settings);
1279 ?>
1280 </div>
1281 <?php $this->render_add_to_cart(); ?>
1282 </div>
1283 <?php
1284 }
1285 public function render_add_to_cart()
1286 {
1287 global $product;
1288 $settings = $this->get_settings_for_display();
1289 if ('yes' == $settings['show_cart']): ?>
1290 <?php if ($product) {
1291 $defaults = [
1292 'quantity' => 1,
1293 'class' => implode(
1294 ' ',
1295 array_filter(
1296 [
1297 'usk-button',
1298 'product_type_' . $product->get_type(),
1299 $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
1300 $product->supports('ajax_add_to_cart') && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
1301 ]
1302 )
1303 ),
1304 'attributes' => [
1305 'data-product_id' => $product->get_id(),
1306 'data-product_sku' => $product->get_sku(),
1307 'aria-label' => $product->add_to_cart_description(),
1308 'rel' => 'nofollow',
1309 ],
1310 ];
1311 $args = apply_filters('woocommerce_loop_add_to_cart_args', wp_parse_args($defaults), $product);
1312 if (isset($args['attributes']['aria-label'])) {
1313 $args['attributes']['aria-label'] = wp_strip_all_tags($args['attributes']['aria-label']);
1314 }
1315 echo wp_kses_post(apply_filters(
1316 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.
1317 sprintf(
1318 '<a href="%s" data-quantity="%s" class="%s" %s>%s <i class="button-icon usk-icon-arrow-right-8"></i></a>',
1319 esc_url($product->add_to_cart_url()),
1320 esc_attr(isset($args['quantity']) ? $args['quantity'] : 1),
1321 esc_attr(isset($args['class']) ? $args['class'] : 'button'),
1322 isset($args['attributes']) ? wc_implode_html_attributes($args['attributes']) : '',
1323 esc_html($product->add_to_cart_text())
1324 ),
1325 $product,
1326 $args
1327 ));
1328 }
1329 ; ?>
1330 <?php endif;
1331 }
1332 public function render_slider_header()
1333 {
1334 $settings = $this->get_settings_for_display();
1335 $this->add_render_attribute('slider', 'class', ['usk-showcase-slider']);
1336 $id = 'ultimate-store-kit-' . $this->get_id();
1337 $elementor_vp_lg = get_option('elementor_viewport_lg');
1338 $elementor_vp_md = get_option('elementor_viewport_md');
1339 $viewport_lg = !empty($elementor_vp_lg) ? $elementor_vp_lg - 1 : 1023;
1340 $viewport_md = !empty($elementor_vp_md) ? $elementor_vp_md - 1 : 767;
1341 $this->add_render_attribute('slider', 'id', $id);
1342 $this->add_render_attribute('slider', 'class', ['usk-carousel', 'usk-carousel-layout', 'elementor-swiper']);
1343 if ('arrows' == $settings['navigation']) {
1344 $this->add_render_attribute('slider', 'class', 'usk-arrows-align-' . $settings['arrows_position']);
1345 } elseif ('dots' == $settings['navigation']) {
1346 $this->add_render_attribute('slider', 'class', 'usk-dots-align-' . $settings['dots_position']);
1347 } elseif ('both' == $settings['navigation']) {
1348 $this->add_render_attribute('slider', 'class', 'usk-arrows-dots-align-' . $settings['both_position']);
1349 } elseif ('arrows-fraction' == $settings['navigation']) {
1350 $this->add_render_attribute('slider', 'class', 'usk-arrows-dots-align-' . $settings['arrows_fraction_position']);
1351 }
1352
1353 if ('arrows-fraction' == $settings['navigation']) {
1354 $pagination_type = 'fraction';
1355 } elseif ('both' == $settings['navigation'] or 'dots' == $settings['navigation']) {
1356 $pagination_type = 'bullets';
1357 } elseif ('progressbar' == $settings['navigation']) {
1358 $pagination_type = 'progressbar';
1359 } else {
1360 $pagination_type = '';
1361 }
1362
1363 $this->add_render_attribute(
1364 [
1365 'slider' => [
1366 'data-settings' => [
1367 wp_json_encode(array_filter([
1368 "autoplay" => ("yes" == $settings["autoplay"]) ? ["delay" => $settings["autoplay_speed"]] : false,
1369 "loop" => ($settings["loop"] == "yes") ? true : false,
1370 "speed" => $settings["speed"]["size"],
1371 "pauseOnHover" => ("yes" == $settings["pauseonhover"]) ? true : false,
1372 "slidesPerView" => 1,
1373 "slidesPerGroup" => isset($settings["slides_to_scroll_mobile"]) ? (int) $settings["slides_to_scroll_mobile"] : 1,
1374 "spaceBetween" => !empty($settings["items_gap_mobile"]["size"]) ? (int) $settings["items_gap_mobile"]["size"] : 0,
1375 "centeredSlides" => true,
1376 "grabCursor" => ($settings["grab_cursor"] === "yes") ? true : false,
1377 "effect" => 'coverflow',
1378 "observer" => ($settings["observer"]) ? true : false,
1379 "observeParents" => ($settings["observer"]) ? true : false,
1380 "breakpoints" => [
1381 (int) $viewport_md => [
1382 "slidesPerView" => 1.7,
1383 "spaceBetween" => !empty($settings["items_gap_tablet"]["size"]) ? (int) $settings["items_gap_tablet"]["size"] : 0,
1384 "slidesPerGroup" => isset($settings["slides_to_scroll_tablet"]) ? (int) $settings["slides_to_scroll_tablet"] : 1,
1385 ],
1386 (int) $viewport_lg => [
1387 "slidesPerView" => 2,
1388 "spaceBetween" => !empty($settings["items_gap"]["size"]) ? (int) $settings["items_gap"]["size"] : 0,
1389 "slidesPerGroup" => isset($settings["slides_to_scroll"]) ? (int) $settings["slides_to_scroll"] : 1,
1390 ],
1391 ],
1392 "navigation" => [
1393 "nextEl" => "#" . $id . " .usk-navigation-next",
1394 "prevEl" => "#" . $id . " .usk-navigation-prev",
1395 ],
1396 "pagination" => [
1397 "el" => "#" . $id . " .swiper-pagination",
1398 "type" => $pagination_type,
1399 "clickable" => "true",
1400 'dynamicBullets' => ("yes" == $settings["dynamic_bullets"]) ? true : false,
1401 ],
1402 "scrollbar" => [
1403 "el" => "#" . $id . " .swiper-scrollbar",
1404 "hide" => "true",
1405 ],
1406 'coverflowEffect' => [
1407 'rotate' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_rotate"]["size"] : 0,
1408 'stretch' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_stretch"]["size"] : 0,
1409 'depth' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_depth"]["size"] : 100,
1410 'modifier' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_modifier"]["size"] : 1,
1411 'slideShadows' => false,
1412 ],
1413
1414 ])),
1415 ],
1416 ],
1417 ]
1418 );
1419
1420 $this->add_render_attribute('swiper', 'class', 'usk-showcase-slider-wrapper swiper-carousel swiper');
1421 ?>
1422 <div class="ultimate-store-kit">
1423 <div <?php $this->print_render_attribute_string('slider'); ?>>
1424 <div <?php $this->print_render_attribute_string('swiper'); ?>>
1425 <div class="swiper-wrapper">
1426 <?php
1427 }
1428 public function render_slider_footer()
1429 {
1430 $settings = $this->get_settings_for_display();
1431 ?>
1432 </div>
1433 <?php if ('yes' === $settings['show_scrollbar']): ?>
1434 <div class="swiper-scrollbar"></div>
1435 <?php endif; ?>
1436 </div>
1437
1438 <?php if ('both' == $settings['navigation']): ?>
1439 <?php $this->register_global_template_both_navigation(); ?>
1440 <?php if ('center' === $settings['both_position']): ?>
1441 <div class="usk-position-z-index usk-position-bottom">
1442 <div class="usk-dots-container">
1443 <div class="swiper-pagination"></div>
1444 </div>
1445 </div>
1446 <?php endif; ?>
1447 <?php elseif ('arrows-fraction' == $settings['navigation']): ?>
1448 <?php $this->register_global_template_arrows_fraction() ?>
1449 <?php if ('center' === $settings['arrows_fraction_position']): ?>
1450 <div class="usk-dots-container">
1451 <div class="swiper-pagination"></div>
1452 </div>
1453 <?php endif; ?>
1454 <?php else: ?>
1455 <?php $this->register_global_template_pagination(); ?>
1456 <?php $this->register_global_template_navigation(); ?>
1457
1458 <?php endif; ?>
1459 </div>
1460 <?php
1461 }
1462 public function print_price_output($output)
1463 {
1464 $tags = [
1465 'del' => ['aria-hidden' => []],
1466 'span' => ['class' => []],
1467 'bdi' => [],
1468 'ins' => [],
1469 ];
1470
1471 if (isset($output)) {
1472 echo wp_kses($output, $tags);
1473 }
1474 }
1475
1476 public function render_loop_item()
1477 {
1478 $settings = $this->get_settings_for_display();
1479 $id = 'usk-wc-product-' . $this->get_id();
1480 $modal_id = wp_unique_id('modal-id-');
1481
1482 // $wp_query = $this->render_query();
1483 $this->query_product();
1484 $wp_query = $this->get_query();
1485 if ($wp_query->have_posts()) { ?>
1486 <?php while ($wp_query->have_posts()):
1487 $wp_query->the_post();
1488 global $product;
1489 $rating_count = $product->get_rating_count();
1490 $average = $product->get_average_rating();
1491 $have_rating = ('yes' === $settings['show_rating']) ? 'usk-have-rating' : '';
1492
1493 ?>
1494 <div class="swiper-slide usk-item <?php echo esc_attr($have_rating); ?>">
1495 <?php $this->render_image(); ?>
1496 <div class="usk-badge-label-wrapper">
1497 <div class="usk-badge-label-content usk-flex usk-flex-column">
1498 <?php $this->register_global_template_badge_label($settings); ?>
1499 </div>
1500 </div>
1501 <div class="usk-item-box">
1502 <div class="usk-content">
1503 <?php if ('yes' == $settings['show_category']): ?>
1504 <?php printf('<div class="usk-category">%1$s</div>', wp_kses_post(wc_get_product_category_list($product->get_id(), ' '))); ?>
1505 <?php endif; ?>
1506 <?php if ('yes' == $settings['show_title']):
1507 printf(
1508 '<%1$s class="title"><a href="%2$s" class="usk-title">%3$s</a></%1$s>',
1509 esc_attr( Utils::get_valid_html_tag( $settings['title_tags'] ) ),
1510 esc_url( $product->get_permalink() ),
1511 esc_html( $product->get_title() )
1512 );
1513 endif; ?>
1514
1515 </div>
1516
1517 <div class="usk-price-button-wrap">
1518 <?php if (('yes' == $settings['show_price'])): ?>
1519 <div class="usk-price">
1520 <?php $this->print_price_output($product->get_price_html()); ?>
1521 </div>
1522 <?php endif; ?>
1523 <?php if (('yes' == $settings['show_rating'])): ?>
1524 <div class="usk-rating">
1525 <?php echo wp_kses_post($this->register_global_template_wc_rating($average, $rating_count)); ?>
1526 </div>
1527 <?php endif; ?>
1528 </div>
1529 </div>
1530 </div>
1531 <!-- </div> -->
1532 <?php endwhile;
1533 wp_reset_postdata();
1534 } else {
1535 echo '<div class="usk-alert-warning" usk-alert>' . esc_html__('Ops! There no product to display.', 'ultimate-store-kit') . '</div>';
1536 }
1537 }
1538
1539 public function render()
1540 {
1541 $this->render_slider_header();
1542 $this->render_loop_item();
1543 $this->render_slider_footer();
1544 }
1545 public function query_product()
1546 {
1547 $default = $this->getGroupControlQueryArgs();
1548 $this->_query = $this->build_query_from_args($default);
1549 }
1550 }
1551