PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / modules / 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.1.4, at modules/showcase-slider/widgets/showcase-slider.php

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