PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.0.3
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.0.3
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 / traits / global-widget-template.php

global-widget-template.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 3.0.3, at traits/global-widget-template.php

682 lines 25.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\Traits;
4
5 use Elementor\Plugin;
6
7 // use WP_Query;
8
9
10 defined('ABSPATH') || die();
11
12 trait Global_Widget_Template
13 {
14
15 protected function register_templates_grid_columns_markup($settings)
16 { ?>
17 <ul class="usk-grid-header-tabs">
18 <?php if (in_array("list-2", $settings['filter_column_lists'])): ?>
19 <li class="usk-grid-tabs-list">
20 <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-1 usk-list-layout">
21 <span class="usk-icon-grid-list"></span>
22 </a>
23 </li>
24 <?php
25 endif;
26 if (in_array('grid-2', $settings['filter_column_lists'])):
27 ?>
28 <li class="usk-grid-tabs-list">
29 <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-2">
30 <span class="usk-icon-grid-2"></span>
31 </a>
32 </li>
33 <?php
34 endif;
35 if (in_array('grid-3', $settings['filter_column_lists'])):
36 ?>
37 <li class="usk-grid-tabs-list">
38 <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-3">
39 <span class="usk-icon-grid-3"></span>
40 </a>
41 </li>
42 <?php
43 endif;
44 if (in_array('grid-4', $settings['filter_column_lists'])):
45 ?>
46 <li class="usk-grid-tabs-list">
47 <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-4">
48 <span class="usk-icon-grid-4"></span>
49 </a>
50 </li>
51 <?php
52 endif;
53 if (in_array('grid-5', $settings['filter_column_lists'])):
54 ?>
55 <li class="usk-grid-tabs-list">
56 <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-5">
57 <span class="usk-icon-grid-5"></span>
58 </a>
59 </li>
60 <?php
61 endif;
62 if (in_array('grid-6', $settings['filter_column_lists'])):
63 ?>
64 <li class="usk-grid-tabs-list">
65 <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-6">
66 <span class="usk-icon-grid-6"></span>
67 </a>
68 </li>
69 <?php
70 endif;
71 ?>
72 </ul>
73 <?php
74 }
75
76 protected function register_global_template_wc_rating($rating, $count = 0)
77 {
78 $html = '';
79 if (
80 0 <= $rating
81 ) {
82 /* translators: %s: rating */
83 // $label = sprintf(__('Rated %s out of 5', 'woocommerce'), $rating);
84 $html = '<div class="star-rating" role="img">' . wc_get_star_rating_html($rating, $count) . '</div>';
85 }
86
87 return apply_filters('woocommerce_product_get_rating_html', $html, $rating, $count);
88 }
89 public function register_global_template_add_to_wishlist($tooltip_position, $settings)
90 {
91 global $product;
92 $user_id = get_current_user_id();
93 $product_id = $product->get_ID();
94 $wishlist = ultimate_store_kit_get_wishlist($user_id);
95 $is_wishlisted = in_array($product_id, $wishlist);
96 if (!empty($is_wishlisted)) {
97 $selected = ' usk-active';
98 $tooltip = __('View Wishlist', 'ultimate-store-kit');
99 $redirect_url = wc_get_account_endpoint_url('wishlist');
100 } else {
101 $selected = '';
102 $tooltip = __('Add to Wishlist', 'ultimate-store-kit');
103 $redirect_url = "javascript:void(0);";
104 } ?>
105 <?php if (isset($settings['show_wishlist']) ? $settings['show_wishlist'] : true): ?>
106 <a href="<?php echo esc_url($redirect_url); ?>"
107 class="usk-action-btn ajax_add_to_wishlist usk-shoping-icon-wishlist usk-btn usk-wishlist<?php echo esc_attr($selected); ?>"
108 data-product_id="<?php echo absint($product_id); ?>" aria-label="<?php echo esc_html($tooltip); ?>"
109 data-aria_label="<?php echo esc_html__('View Wishlist', 'ultimate-store-kit'); ?>"
110 data-redirect_url="<?php echo esc_url(wc_get_account_endpoint_url('wishlist')); ?>"
111 data-microtip-position="<?php echo esc_attr($tooltip_position); ?>" role="tooltip">
112 <i class="icon usk-icon-heart-full"></i>
113 </a>
114 <?php endif; ?>
115 <?php
116 }
117
118 function register_global_template_add_to_compare($tooltip_position, $settings)
119 {
120 global $product;
121 $user_id = get_current_user_id();
122 $product_id = $product->get_ID();
123 $compare_products = usk_get_compare_products($user_id);
124 $is_compared = in_array($product_id, $compare_products);
125
126 $compare_page_id = '';
127 if (function_exists('ultimate_store_kit_compare_product_page') && $comparePage = ultimate_store_kit_compare_product_page()) {
128 $compare_page_id = $comparePage;
129 }
130
131 $compare_redirect_link = home_url();
132 if ($compare_page_id) {
133 $compare_redirect_link = get_page_link($compare_page_id);
134 }
135
136 if (!empty($is_compared)) {
137 $tooltip = __('View Compare', 'ultimate-store-kit');
138 $selected = 'usk-active';
139 $compare_page_link = home_url();
140 if ($compare_page_id) {
141 $compare_page_link = get_page_link($compare_page_id);
142 }
143 } else {
144 $tooltip = __('Add to Compare', 'ultimate-store-kit');
145 $selected = '';
146 $compare_page_link = "javascript:void(0);";
147 } ?>
148 <?php if (isset($settings['show_compare']) && $settings['show_compare'] == 'yes'): ?>
149 <a href="<?php echo esc_url($compare_page_link); ?>"
150 class="usk-action-btn ajax_add_to_compare usk-compare <?php echo esc_attr($selected); ?>"
151 data-product_id="<?php echo esc_attr($product_id); ?>"
152 data-redirect_url="<?php echo esc_url($compare_redirect_link); ?>" aria-label="<?php echo esc_html($tooltip); ?>"
153 data-aria_label="<?php echo esc_html__('View Compare', 'ultimate-store-kit'); ?>"
154 data-microtip-position="<?php echo esc_attr($tooltip_position); ?>" role="tooltip">
155 <i class="icon usk-icon-compare"></i>
156 </a>
157 <?php
158 ?>
159 <?php endif; ?>
160 <?php
161
162 }
163
164 protected function register_global_template_quick_view($product_id, $tooltip_position, $settings)
165 {
166 // $settings = $this->get_settings_for_display();
167 if (isset($settings['show_quick_view']) ? $settings['show_quick_view'] : true): ?>
168 <?php wp_nonce_field('ajax-usk-quick-view-nonce', 'usk-quick-view-modal-sc');
169 ?>
170 <a class="usk-action-btn usk-shoping-icon-quickview quick_view usk-view usk-btn" href="javascript:void(0)"
171 data-id="<?php echo absint($product_id); ?>"
172 aria-label="<?php echo esc_html__('Quick View', 'ultimate-store-kit'); ?>"
173 data-microtip-position="<?php echo esc_attr($tooltip_position); ?>" role="tooltip">
174 <i class="icon usk-icon-preview"></i>
175 </a>
176 <?php endif;
177 }
178 protected function register_global_template_add_to_cart($tooltip_position, $settings)
179 {
180 global $product;
181 if (isset($settings['show_cart']) ? $settings['show_cart'] : true): ?>
182 <?php if ($product) {
183 $defaults = [
184 'quantity' => 1,
185 'class' => implode(
186 ' ',
187 array_filter(
188 [
189 'usk-cart',
190 'usk-action-btn',
191 'product_type_' . $product->get_type(),
192 $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
193 $product->supports('ajax_add_to_cart') && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
194 ]
195 )
196 ),
197 'attributes' => [
198 'data-product_id' => $product->get_id(),
199 'data-product_sku' => $product->get_sku(),
200 'data-microtip-position' => $tooltip_position,
201 'aria-label' => $product->add_to_cart_text(),
202 'rel' => 'nofollow',
203 'role' => 'tooltip',
204 ],
205 ];
206 $args = apply_filters('woocommerce_loop_add_to_cart_args', wp_parse_args($defaults), $product);
207 if (isset($args['attributes']['aria-label'])) {
208 $args['attributes']['aria-label'] = wp_strip_all_tags($args['attributes']['aria-label']);
209 }
210 echo wp_kses_post(apply_filters(
211 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.
212 sprintf(
213 '<a href="%s" data-quantity="%s" class="%s" %s><i class="icon usk-icon-cart"></i></a>',
214 esc_url($product->add_to_cart_url()),
215 esc_attr(isset($args['quantity']) ? $args['quantity'] : 1),
216 esc_attr(isset($args['class']) ? $args['class'] : 'button'),
217 isset($args['attributes']) ? wc_implode_html_attributes($args['attributes']) : ''
218 ),
219 $product,
220 $args
221 ));
222 }
223 ; ?>
224 <?php endif;
225 }
226 protected function register_global_template_badge_label($settings)
227 {
228 // print_r($settings);
229 global $product;
230 if ($product->is_on_sale() && (isset($settings['show_sale_badge']) ? $settings['show_sale_badge'] : true)):
231 printf('<div class="usk-badge-wrap usk-sale-badge"><span class="usk-badge">%1$s</span></div>', esc_html__('Sale', 'ultimate-store-kit'));
232 endif;
233 if (isset($settings['show_discount_badge']) ? $settings['show_discount_badge'] : true):
234 $this->usk_get_badge_label_percentage();
235 endif;
236 if (isset($settings['show_stock_status']) && $settings['show_stock_status'] === 'yes'):
237 if ($product->get_stock_status() === 'instock') {
238 $stock_status = esc_html__('In Stock', 'ultimate-store-kit');
239 } else {
240 $stock_status = esc_html__('Out of Stock', 'ultimate-store-kit');
241 }
242
243 printf('<div class="usk-badge-wrap usk-stock-status-badge"><span class="usk-badge">%1$s</span></div>', esc_html($stock_status));
244 endif;
245 if ($product->is_featured() && (isset($settings['show_trending_badge']) ? $settings['show_trending_badge'] : true)):
246 printf('<div class="usk-badge-wrap usk-trending-badge"><span class="usk-badge">%1$s</span></div>', esc_html__('Trending', 'ultimate-store-kit'));
247 endif;
248 if (isset($settings['show_new_badge']) ? $settings['show_new_badge'] : true):
249 $newness_days = isset($settings['newness_days']) ? $settings['newness_days'] : 60;
250 $created_date = strtotime($product->get_date_created());
251 $valid_date = time() - (60 * 60 * 24 * $newness_days);
252 if ($valid_date < $created_date) {
253 printf('<div class="usk-badge-wrap usk-new-badge"><span class="usk-badge">%s</span></div>', esc_html__('New', 'ultimate-store-kit'));
254 }
255 endif;
256 }
257 protected function register_global_template_navigation()
258 {
259 $settings = $this->get_settings_for_display();
260 $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? ' usk-visible@m' : '';
261
262 if ('arrows' == $settings['navigation']): ?>
263 <div style="direction: ltr;"
264 class="usk-position-z-index usk-position-<?php echo esc_html($settings['arrows_position'] . $hide_arrow_on_mobile); ?>">
265 <div class="usk-arrows-container usk-slidenav-container">
266 <a href="" class="usk-navigation-prev usk-slidenav-previous usk-icon usk-slidenav">
267 <i class="usk-icon-arrow-left-<?php echo esc_html($settings['nav_arrows_icon']); ?>" aria-hidden="true"></i>
268 </a>
269 <a href="" class="usk-navigation-next usk-slidenav-next usk-icon usk-slidenav">
270 <i class="usk-icon-arrow-right-<?php echo esc_html($settings['nav_arrows_icon']); ?>"
271 aria-hidden="true"></i>
272 </a>
273 </div>
274 </div>
275 <?php endif;
276 }
277 protected function register_global_template_pagination()
278 {
279 $settings = $this->get_settings_for_display();
280
281 if ('dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation']): ?>
282 <div class="usk-position-z-index usk-position-<?php echo esc_html($settings['dots_position']); ?>">
283 <div class="usk-dots-container">
284 <div class="swiper-pagination"></div>
285 </div>
286 </div>
287
288 <?php elseif ('progressbar' == $settings['navigation']): ?>
289 <div
290 class="swiper-pagination usk-position-z-index usk-position-<?php echo esc_html($settings['progress_position']); ?>">
291 </div>
292 <?php endif;
293 }
294 protected function register_global_template_both_navigation()
295 {
296 $settings = $this->get_settings_for_display();
297 $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'usk-visible@m usk-flex' : 'usk-flex';
298
299 ?>
300 <div class="usk-position-z-index usk-position-<?php echo esc_html($settings['both_position']); ?>">
301 <div class="usk-arrows-dots-container usk-slidenav-container ">
302
303 <div class="usk-flex usk-flex-middle">
304 <div class="<?php echo esc_html($hide_arrow_on_mobile); ?>">
305 <a href="" class="usk-navigation-prev usk-slidenav-previous usk-icon usk-slidenav">
306 <i class="usk-icon-arrow-left-<?php echo esc_html($settings['nav_arrows_icon']); ?>"
307 aria-hidden="true"></i>
308 </a>
309 </div>
310
311 <?php if ('center' !== $settings['both_position']): ?>
312 <div class="swiper-pagination"></div>
313 <?php endif; ?>
314
315 <div class="<?php echo esc_html($hide_arrow_on_mobile); ?>">
316 <a href="" class="usk-navigation-next usk-slidenav-next usk-icon usk-slidenav">
317 <i class="usk-icon-arrow-right-<?php echo esc_html($settings['nav_arrows_icon']); ?>"
318 aria-hidden="true"></i>
319 </a>
320 </div>
321
322 </div>
323 </div>
324 </div>
325 <?php
326 }
327 protected function register_global_template_arrows_fraction()
328 {
329 $settings = $this->get_settings_for_display();
330 $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'usk-visible@m' : ''; ?>
331 <div class="usk-position-z-index usk-position-<?php echo esc_html($settings['arrows_fraction_position']); ?>">
332 <div class="usk-arrows-fraction-container usk-slidenav-container ">
333
334 <div class="usk-flex usk-flex-middle">
335 <div class="<?php echo esc_html($hide_arrow_on_mobile); ?>">
336 <a href="" class="usk-navigation-prev usk-slidenav-previous usk-icon usk-slidenav">
337 <i class="usk-icon-arrow-left-<?php echo esc_html($settings['nav_arrows_icon']); ?>"
338 aria-hidden="true"></i>
339 </a>
340 </div>
341
342 <?php if ('center' !== $settings['arrows_fraction_position']): ?>
343 <div class="swiper-pagination"></div>
344 <?php endif; ?>
345
346 <div class="<?php echo esc_html($hide_arrow_on_mobile); ?>">
347 <a href="" class="usk-navigation-next usk-slidenav-next usk-icon usk-slidenav">
348 <i class="usk-icon-arrow-right-<?php echo esc_html($settings['nav_arrows_icon']); ?>"
349 aria-hidden="true"></i>
350 </a>
351 </div>
352
353 </div>
354 </div>
355 </div>
356 <?php
357 }
358 protected function usk_register_global_template_carousel_footer()
359 {
360 $settings = $this->get_settings_for_display(); ?>
361 </div>
362 <?php if ('yes' === $settings['show_scrollbar']): ?>
363 <div class="swiper-scrollbar"></div>
364 <?php endif; ?>
365 </div>
366 <?php if ('both' == $settings['navigation']): ?>
367 <?php $this->register_global_template_both_navigation(); ?>
368 <?php if ('center' === $settings['both_position']): ?>
369 <div class="usk-position-z-index usk-position-bottom">
370 <div class="usk-dots-container">
371 <div class="swiper-pagination"></div>
372 </div>
373 </div>
374 <?php endif; ?>
375 <?php elseif ('arrows-fraction' == $settings['navigation']): ?>
376 <?php $this->register_global_template_arrows_fraction(); ?>
377 <?php if ('center' === $settings['arrows_fraction_position']): ?>
378 <div class="usk-dots-container">
379 <div class="swiper-pagination"></div>
380 </div>
381 <?php endif; ?>
382 <?php else: ?>
383 <?php $this->register_global_template_pagination() ?>
384 <?php $this->register_global_template_navigation() ?>
385 <?php endif; ?>
386 </div>
387 </div>
388 </div>
389
390 <?php
391 }
392 protected function register_global_template_carousel_header()
393 {
394 $settings = $this->get_settings_for_display();
395 $this->add_render_attribute('usk-carousel-wrapper', 'class', ['' . $this->get_name() . '', 'usk-grid-carousel']);
396 $id = 'ultimate-store-kit-' . $this->get_id();
397 $elementor_vp_lg = get_option('elementor_viewport_lg');
398 $elementor_vp_md = get_option('elementor_viewport_md');
399 $viewport_lg = !empty($elementor_vp_lg) ? $elementor_vp_lg - 1 : 1023;
400 $viewport_md = !empty($elementor_vp_md) ? $elementor_vp_md - 1 : 767;
401 $this->add_render_attribute('carousel', 'id', $id);
402 $this->add_render_attribute('carousel', 'class', ['usk-carousel', 'usk-carousel-layout', 'elementor-swiper']);
403 if ('arrows' == $settings['navigation']) {
404 $this->add_render_attribute('carousel', 'class', 'usk-arrows-align-' . $settings['arrows_position']);
405 } elseif ('dots' == $settings['navigation']) {
406 $this->add_render_attribute('carousel', 'class', 'usk-dots-align-' . $settings['dots_position']);
407 } elseif ('both' == $settings['navigation']) {
408 $this->add_render_attribute('carousel', 'class', 'usk-arrows-dots-align-' . $settings['both_position']);
409 } elseif ('arrows-fraction' == $settings['navigation']) {
410 $this->add_render_attribute('carousel', 'class', 'usk-arrows-dots-align-' . $settings['arrows_fraction_position']);
411 }
412
413 if ('arrows-fraction' == $settings['navigation']) {
414 $pagination_type = 'fraction';
415 } elseif ('both' == $settings['navigation'] or 'dots' == $settings['navigation']) {
416 $pagination_type = 'bullets';
417 } elseif ('progressbar' == $settings['navigation']) {
418 $pagination_type = 'progressbar';
419 } else {
420 $pagination_type = '';
421 }
422
423 $this->add_render_attribute(
424 [
425 'carousel' => [
426 'data-settings' => [
427 wp_json_encode(array_filter([
428 "autoplay" => ("yes" == $settings["autoplay"]) ? ["delay" => $settings["autoplay_speed"]] : false,
429 "loop" => ($settings["loop"] == "yes") ? true : false,
430 "speed" => $settings["speed"]["size"],
431 "pauseOnHover" => ("yes" == $settings["pauseonhover"]) ? true : false,
432 "slidesPerView" => isset($settings["columns_mobile"]) ? (int) $settings["columns_mobile"] : 1,
433 "slidesPerGroup" => isset($settings["slides_to_scroll_mobile"]) ? (int) $settings["slides_to_scroll_mobile"] : 1,
434 "spaceBetween" => !empty($settings["items_gap_mobile"]["size"]) ? (int)$settings["items_gap_mobile"]["size"] : 0,
435 "centeredSlides" => ($settings["centered_slides"] === "yes") ? true : false,
436 "grabCursor" => ($settings["grab_cursor"] === "yes") ? true : false,
437 "effect" => $settings["skin"],
438 "observer" => ($settings["observer"]) ? true : false,
439 "observeParents" => ($settings["observer"]) ? true : false,
440 // "direction" => $settings['direction'],
441 "watchSlidesVisibility" => true,
442 "watchSlidesProgress" => true,
443 "breakpoints" => [
444 (int) $viewport_md => [
445 "slidesPerView" => isset($settings["columns_tablet"]) ? (int) $settings["columns_tablet"] : 2,
446 "spaceBetween" => !empty($settings["items_gap_tablet"]["size"]) ? (int)$settings["items_gap_tablet"]["size"] : 0,
447 "slidesPerGroup" => isset($settings["slides_to_scroll_tablet"]) ? (int) $settings["slides_to_scroll_tablet"] : 1,
448 ],
449 (int) $viewport_lg => [
450 "slidesPerView" => isset($settings["columns"]) ? (int) $settings["columns"] : 3,
451 "spaceBetween" => !empty($settings["items_gap"]["size"]) ? (int)$settings["items_gap"]["size"] : 0,
452 "slidesPerGroup" => isset($settings["slides_to_scroll"]) ? (int) $settings["slides_to_scroll"] : 1,
453 ]
454 ],
455 "navigation" => [
456 "nextEl" => "#" . $id . " .usk-navigation-next",
457 "prevEl" => "#" . $id . " .usk-navigation-prev",
458 ],
459 "pagination" => [
460 "el" => "#" . $id . " .swiper-pagination",
461 "type" => $pagination_type,
462 "clickable" => "true",
463 'dynamicBullets' => ("yes" == $settings["dynamic_bullets"]) ? true : false,
464 ],
465 "scrollbar" => [
466 "el" => "#" . $id . " .swiper-scrollbar",
467 "hide" => "true",
468 ],
469 'coverflowEffect' => [
470 'rotate' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_rotate"]["size"] : 50,
471 'stretch' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_stretch"]["size"] : 0,
472 'depth' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_depth"]["size"] : 100,
473 'modifier' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_modifier"]["size"] : 1,
474 'slideShadows' => true,
475 ],
476
477 ]))
478 ]
479 ]
480 ]
481 );
482
483 $this->add_render_attribute('swiper', 'class', 'swiper-carousel swiper');
484
485 ?>
486
487 <div class="ultimate-store-kit">
488 <div <?php $this->print_render_attribute_string('usk-carousel-wrapper'); ?>>
489 <div <?php $this->print_render_attribute_string('carousel'); ?>>
490 <div <?php echo wp_kses_post($this->get_render_attribute_string('swiper')); ?>>
491 <div class="swiper-wrapper">
492 <?php
493 }
494 protected function usk_get_badge_label_percentage()
495 {
496 global $product;
497 if ($product->is_on_sale()) {
498 $percentage = '';
499 if ($product->get_type() == 'variable') {
500 $available_variations = $product->get_variation_prices();
501 $max_percentage = 0;
502 foreach ($available_variations['regular_price'] as $key => $regular_price) {
503 $sale_price = $available_variations['sale_price'][$key];
504 if ($sale_price < $regular_price) {
505 $percentage = round((($regular_price - $sale_price) / $regular_price) * 100);
506 if ($percentage > $max_percentage) {
507 $max_percentage = $percentage;
508 }
509 }
510 }
511 $percentage = $max_percentage;
512 } elseif (($product->get_type() == 'simple' || $product->get_type() == 'external')) {
513 $percentage = round((($product->get_regular_price() - $product->get_sale_price()) / $product->get_regular_price()) * 100);
514 }
515 if ($percentage) {
516 printf('<div class="usk-badge-wrap usk-percantage-badge"><span class="usk-badge">%1$s%2$s</span></div>', esc_html($percentage), esc_html__('% off', 'ultimate-store-kit'));
517 }
518 }
519 }
520 protected function render_navigation()
521 {
522 $settings = $this->get_settings_for_display();
523 $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? ' bdt-visible@m' : '';
524
525 if ('arrows' == $settings['navigation']): ?>
526 <div
527 class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['arrows_position'] . $hide_arrow_on_mobile); ?>">
528 <div class="bdt-arrows-container bdt-slidenav-container">
529 <a href="" class="bdt-navigation-prev bdt-slidenav-previous bdt-icon bdt-slidenav">
530 <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>"
531 aria-hidden="true"></i>
532 </a>
533 <a href="" class="bdt-navigation-next bdt-slidenav-next bdt-icon bdt-slidenav">
534 <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>"
535 aria-hidden="true"></i>
536 </a>
537 </div>
538 </div>
539 <?php
540 endif;
541 }
542
543 protected function render_pagination()
544 {
545 $settings = $this->get_settings_for_display();
546
547 if ('dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation']): ?>
548 <div class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['dots_position']); ?>">
549 <div class="bdt-dots-container">
550 <div class="swiper-pagination"></div>
551 </div>
552 </div>
553
554 <?php
555 elseif ('progressbar' == $settings['navigation']): ?>
556 <div
557 class="swiper-pagination bdt-position-z-index bdt-position-<?php echo esc_attr($settings['progress_position']); ?>">
558 </div>
559 <?php
560 endif;
561 }
562
563 protected function render_both_navigation()
564 {
565 $settings = $this->get_settings_for_display();
566 $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'bdt-visible@m' : '';
567
568 ?>
569 <div class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['both_position']); ?>">
570 <div class="bdt-arrows-dots-container bdt-slidenav-container ">
571
572 <div class="bdt-flex bdt-flex-middle">
573 <div class="<?php
574 echo esc_attr($hide_arrow_on_mobile); ?>">
575 <a href="" class="bdt-navigation-prev bdt-slidenav-previous bdt-icon bdt-slidenav">
576 <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>"
577 aria-hidden="true"></i>
578 </a>
579 </div>
580
581 <?php
582 if ('center' !== $settings['both_position']): ?>
583 <div class="swiper-pagination"></div>
584 <?php
585 endif; ?>
586
587 <div class="<?php
588 echo esc_attr($hide_arrow_on_mobile); ?>">
589 <a href="" class="bdt-navigation-next bdt-slidenav-next bdt-icon bdt-slidenav">
590 <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>"
591 aria-hidden="true"></i>
592 </a>
593 </div>
594
595 </div>
596 </div>
597 </div>
598 <?php
599 }
600 protected function render_arrows_fraction()
601 {
602 $settings = $this->get_settings_for_display();
603 $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'bdt-visible@m' : ''; ?>
604 <div
605 class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['arrows_fraction_position']); ?>">
606 <div class="bdt-arrows-fraction-container bdt-slidenav-container ">
607
608 <div class="bdt-flex bdt-flex-middle">
609 <div class="<?php
610 echo esc_attr($hide_arrow_on_mobile); ?>">
611 <a href="" class="bdt-navigation-prev bdt-slidenav-previous bdt-icon bdt-slidenav">
612 <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>"
613 aria-hidden="true"></i>
614 </a>
615 </div>
616
617 <?php
618 if ('center' !== $settings['arrows_fraction_position']): ?>
619 <div class="swiper-pagination"></div>
620 <?php
621 endif; ?>
622
623 <div class="<?php
624 echo esc_attr($hide_arrow_on_mobile); ?>">
625 <a href="" class="bdt-navigation-next bdt-slidenav-next bdt-icon bdt-slidenav">
626 <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>"
627 aria-hidden="true"></i>
628 </a>
629 </div>
630
631 </div>
632 </div>
633 </div>
634 <?php
635 }
636 protected function render_footer()
637 {
638 $settings = $this->get_settings_for_display(); ?>
639 </div>
640 <?php
641 if ('yes' === $settings['show_scrollbar']): ?>
642 <div class="swiper-scrollbar"></div>
643 <?php
644 endif; ?>
645 </div>
646
647 <?php
648 if ('both' == $settings['navigation']): ?>
649 <?php $this->render_both_navigation(); ?>
650 <?php
651 if ('center' === $settings['both_position']): ?>
652 <div class="bdt-position-z-index bdt-position-bottom">
653 <div class="bdt-dots-container">
654 <div class="swiper-pagination"></div>
655 </div>
656 </div>
657 <?php
658 endif; ?>
659 <?php
660 elseif ('arrows-fraction' == $settings['navigation']): ?>
661 <?php $this->render_arrows_fraction(); ?>
662 <?php
663 if ('center' === $settings['arrows_fraction_position']): ?>
664 <div class="bdt-dots-container">
665 <div class="swiper-pagination"></div>
666 </div>
667 <?php
668 endif; ?>
669 <?php
670 else: ?>
671 <?php $this->render_pagination(); ?>
672 <?php $this->render_navigation(); ?>
673 <?php
674 endif; ?>
675
676 </div>
677 </div>
678
679 <?php
680 }
681 }
682