PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.0.5
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.0.5
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.5, at modules/showcase-slider/widgets/showcase-slider.php

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