' . wc_get_star_rating_html($rating, $count) . '';
}
return apply_filters('woocommerce_product_get_rating_html', $html, $rating, $count);
}
public function register_global_template_add_to_wishlist($tooltip_position) {
$settings = $this->get_settings_for_display();
global $product;
$user_id = get_current_user_id();
$product_id = $product->get_ID();
$wishlist = ultimate_store_kit_get_wishlist($user_id);
$is_wishlisted = in_array($product_id, $wishlist);
if (!empty($is_wishlisted)) {
$selected = ' usk-active';
$tooltip = esc_html__('Wishlist item Added!', 'ultimate-store-kit');
} else {
$selected = '';
$tooltip = esc_html__('Add to Wishlist', 'ultimate-store-kit');
} ?>
get_settings_for_display();
$user_id = get_current_user_id();
$product_id = $product->get_ID();
$compare_products = usk_get_compare_products($user_id);
$is_compared = in_array($product_id, $compare_products);
if (!empty($is_compared)) {
$tooltip = esc_html__('Added', 'ultimate-store-kit');
$selected = 'usk-active';
} else {
$tooltip = esc_html__('Compare', 'ultimate-store-kit');
$selected = '';
} ?>
get_settings_for_display();
if ('yes' == $settings['show_quick_view']) : ?>
get_settings_for_display();
if ('yes' == $settings['show_cart']) : ?>
1,
'class' => implode(
' ',
array_filter(
[
'usk-cart',
'usk-action-btn',
'product_type_' . $product->get_type(),
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
$product->supports('ajax_add_to_cart') && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
]
)
),
'attributes' => [
'data-product_id' => $product->get_id(),
'data-product_sku' => $product->get_sku(),
'data-microtip-position' => $tooltip_position,
'aria-label' => $product->add_to_cart_text(),
'rel' => 'nofollow',
'role' => 'tooltip',
],
];
$args = apply_filters('woocommerce_loop_add_to_cart_args', wp_parse_args($defaults), $product);
if (isset($args['attributes']['aria-label'])) {
$args['attributes']['aria-label'] = wp_strip_all_tags($args['attributes']['aria-label']);
}
echo apply_filters(
'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.
sprintf(
'',
esc_url($product->add_to_cart_url()),
esc_attr(isset($args['quantity']) ? $args['quantity'] : 1),
esc_attr(isset($args['class']) ? $args['class'] : 'button'),
isset($args['attributes']) ? wc_implode_html_attributes($args['attributes']) : ''
),
$product,
$args
);
}; ?>
get_settings_for_display();
global $product;
if ($product->is_on_sale() && $settings['show_sale_badge']) :
printf('
%1$s
', esc_html__('Sale', 'ultimate-store-kit'));
endif;
if ($settings['show_discount_badge']) :
$this->usk_get_badge_label_percentage();
endif;
if (($settings['show_stock_status'] === 'yes')) :
if ($product->get_stock_status() === 'instock') {
$stock_status = esc_html__('In Stock', 'ultimate-store-kit');
} else {
$stock_status = esc_html__('Out of Stock', 'ultimate-store-kit');
}
printf('%1$s
', $stock_status);
endif;
if ($product->is_featured() && $settings['show_trending_badge']) :
printf('%1$s
', esc_html__('Trending', 'ultimate-store-kit'));
endif;
if ($settings['show_new_badge']) :
$newness_days = $settings['newness_days'];
$created_date = strtotime($product->get_date_created());
$valid_date = time() - (60 * 60 * 24 * $newness_days);
if ($valid_date < $created_date) {
printf('%s
', esc_html__('New', 'ultimate-store-kit'));
}
endif;
}
protected function register_global_template_navigation() {
$settings = $this->get_settings_for_display();
$hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? ' usk-visible@m' : '';
if ('arrows' == $settings['navigation']) : ?>
get_settings_for_display();
if ('dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation']) : ?>
get_settings_for_display();
$hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'usk-visible@m usk-flex' : 'usk-flex';
?>
get_settings_for_display();
$hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'usk-visible@m' : ''; ?>
get_settings_for_display(); ?>
register_global_template_both_navigation(); ?>
register_global_template_arrows_fraction(); ?>
register_global_template_pagination() ?>
register_global_template_navigation() ?>
get_settings_for_display();
$this->add_render_attribute('usk-carousel-wrapper', 'class', ['' . $this->get_name() . '', 'usk-content-position-' . $settings['alignment'] . '']);
$id = 'ultimate-store-kit-' . $this->get_id();
$elementor_vp_lg = get_option('elementor_viewport_lg');
$elementor_vp_md = get_option('elementor_viewport_md');
$viewport_lg = !empty($elementor_vp_lg) ? $elementor_vp_lg - 1 : 1023;
$viewport_md = !empty($elementor_vp_md) ? $elementor_vp_md - 1 : 767;
$this->add_render_attribute('carousel', 'id', $id);
$this->add_render_attribute('carousel', 'class', ['usk-carousel', 'usk-carousel-layout', 'elementor-swiper']);
if ('arrows' == $settings['navigation']) {
$this->add_render_attribute('carousel', 'class', 'usk-arrows-align-' . $settings['arrows_position']);
} elseif ('dots' == $settings['navigation']) {
$this->add_render_attribute('carousel', 'class', 'usk-dots-align-' . $settings['dots_position']);
} elseif ('both' == $settings['navigation']) {
$this->add_render_attribute('carousel', 'class', 'usk-arrows-dots-align-' . $settings['both_position']);
} elseif ('arrows-fraction' == $settings['navigation']) {
$this->add_render_attribute('carousel', 'class', 'usk-arrows-dots-align-' . $settings['arrows_fraction_position']);
}
if ('arrows-fraction' == $settings['navigation']) {
$pagination_type = 'fraction';
} elseif ('both' == $settings['navigation'] or 'dots' == $settings['navigation']) {
$pagination_type = 'bullets';
} elseif ('progressbar' == $settings['navigation']) {
$pagination_type = 'progressbar';
} else {
$pagination_type = '';
}
$this->add_render_attribute(
[
'carousel' => [
'data-settings' => [
wp_json_encode(array_filter([
"autoplay" => ("yes" == $settings["autoplay"]) ? ["delay" => $settings["autoplay_speed"]] : false,
"loop" => ($settings["loop"] == "yes") ? true : false,
"speed" => $settings["speed"]["size"],
"pauseOnHover" => ("yes" == $settings["pauseonhover"]) ? true : false,
"slidesPerView" => isset($settings["columns_mobile"]) ? (int)$settings["columns_mobile"] : 1,
"slidesPerGroup" => isset($settings["slides_to_scroll_mobile"]) ? (int)$settings["slides_to_scroll_mobile"] : 1,
"spaceBetween" => $settings["items_gap"]["size"],
"centeredSlides" => ($settings["centered_slides"] === "yes") ? true : false,
"grabCursor" => ($settings["grab_cursor"] === "yes") ? true : false,
"effect" => $settings["skin"],
"observer" => ($settings["observer"]) ? true : false,
"observeParents" => ($settings["observer"]) ? true : false,
// "direction" => $settings['direction'],
"watchSlidesVisibility" => true,
"watchSlidesProgress" => true,
"breakpoints" => [
(int) $viewport_md => [
"slidesPerView" => isset($settings["columns_tablet"]) ? (int)$settings["columns_tablet"] : 2,
"spaceBetween" => $settings["items_gap"]["size"],
"slidesPerGroup" => isset($settings["slides_to_scroll_tablet"]) ? (int)$settings["slides_to_scroll_tablet"] : 1,
],
(int) $viewport_lg => [
"slidesPerView" => isset($settings["columns"]) ? (int)$settings["columns"] : 3,
"spaceBetween" => $settings["items_gap"]["size"],
"slidesPerGroup" => isset($settings["slides_to_scroll"]) ? (int)$settings["slides_to_scroll"] : 1,
]
],
"navigation" => [
"nextEl" => "#" . $id . " .usk-navigation-next",
"prevEl" => "#" . $id . " .usk-navigation-prev",
],
"pagination" => [
"el" => "#" . $id . " .swiper-pagination",
"type" => $pagination_type,
"clickable" => "true",
'dynamicBullets' => ("yes" == $settings["dynamic_bullets"]) ? true : false,
],
"scrollbar" => [
"el" => "#" . $id . " .swiper-scrollbar",
"hide" => "true",
],
'coverflowEffect' => [
'rotate' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_rotate"]["size"] : 50,
'stretch' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_stretch"]["size"] : 0,
'depth' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_depth"]["size"] : 100,
'modifier' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_modifier"]["size"] : 1,
'slideShadows' => true,
],
]))
]
]
]
);
$swiper_class = Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container';
$this->add_render_attribute('swiper', 'class', 'swiper-carousel ' . $swiper_class);
?>
print_render_attribute_string('usk-carousel-wrapper'); ?>>
print_render_attribute_string('carousel'); ?>>
get_render_attribute_string('swiper'); ?>>
is_on_sale()) {
$percentage = '';
if ($product->get_type() == 'variable') {
$available_variations = $product->get_variation_prices();
$max_percentage = 0;
foreach ($available_variations['regular_price'] as $key => $regular_price) {
$sale_price = $available_variations['sale_price'][$key];
if ($sale_price < $regular_price) {
$percentage = round((($regular_price - $sale_price) / $regular_price) * 100);
if ($percentage > $max_percentage) {
$max_percentage = $percentage;
}
}
}
$percentage = $max_percentage;
} elseif (($product->get_type() == 'simple' || $product->get_type() == 'external')) {
$percentage = round((($product->get_regular_price() - $product->get_sale_price()) / $product->get_regular_price()) * 100);
}
if ($percentage) {
printf('
%1$s%2$s
', $percentage, __('% off', 'ultimate-store-kit'));
}
}
}
protected function render_navigation() {
$settings = $this->get_settings_for_display();
$hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? ' bdt-visible@m' : '';
if ('arrows' == $settings['navigation']) : ?>
get_settings_for_display();
if ('dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation']) : ?>
get_settings_for_display();
$hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'bdt-visible@m' : '';
?>
get_settings_for_display();
$hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'bdt-visible@m' : ''; ?>
get_settings_for_display(); ?>
render_both_navigation(); ?>
render_arrows_fraction(); ?>
render_pagination(); ?>
render_navigation(); ?>