Initial Commit N° : 001 - V.4.3.3

This commit is contained in:
2025-03-28 14:32:57 +01:00
commit 238e5d7999
809 changed files with 371149 additions and 0 deletions
@@ -0,0 +1,25 @@
<?php
/**
* External product add to cart
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 7.0.1
*/
defined('ABSPATH') || exit;
do_action('woocommerce_before_add_to_cart_form');
?>
<form class="cart" action="<?php echo esc_url($product_url); ?>" method="get">
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<button type="submit" class="ns-single-add-btn single_add_to_cart_button button alt<?php echo esc_attr(wc_wp_theme_get_element_class_name('button') ? ' ' . wc_wp_theme_get_element_class_name('button') : '' ); ?>"><?php echo esc_html($button_text); ?></button>
<?php wc_query_string_form_fields($product_url); ?>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
</form>
<?php
do_action('woocommerce_after_add_to_cart_form');
@@ -0,0 +1,127 @@
<?php
/**
* Grouped product add to cart
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 7.0.1
*/
defined('ABSPATH') || exit;
global $product, $post;
do_action('woocommerce_before_add_to_cart_form');
?>
<form class="cart grouped_form" action="<?php echo esc_url(apply_filters('woocommerce_add_to_cart_form_action', $product->get_permalink())); ?>" method="post" enctype="multipart/form-data">
<table cellspacing="0" class="woocommerce-grouped-product-list group_table">
<tbody>
<?php
$quantites_required = false;
$previous_post = $post;
$grouped_product_columns = apply_filters(
'woocommerce_grouped_product_columns',
array(
'quantity',
'label',
'price',
),
$product
);
$show_add_to_cart_button = false;
do_action('woocommerce_grouped_product_list_before', $grouped_product_columns, $quantites_required, $product);
foreach ($grouped_products as $grouped_product_child) :
$post_object = get_post($grouped_product_child->get_id());
$quantites_required = $quantites_required || ( $grouped_product_child->is_purchasable() && !$grouped_product_child->has_options() );
$post = $post_object; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
setup_postdata($post);
if ($grouped_product_child->is_in_stock()) :
$show_add_to_cart_button = true;
endif;
echo '<tr id="product-' . esc_attr($grouped_product_child->get_id()) . '" class="woocommerce-grouped-product-list-item ' . esc_attr(implode(' ', wc_get_product_class('', $grouped_product_child))) . '">';
// Output columns for each product.
foreach ($grouped_product_columns as $column_id) :
do_action('woocommerce_grouped_product_list_before_' . $column_id, $grouped_product_child);
switch ($column_id) :
case 'quantity':
ob_start();
if (!$grouped_product_child->is_purchasable() || $grouped_product_child->has_options() || !$grouped_product_child->is_in_stock()) :
woocommerce_template_loop_add_to_cart();
elseif ($grouped_product_child->is_sold_individually()) :
echo '<input type="checkbox" name="' . esc_attr('quantity[' . $grouped_product_child->get_id() . ']') . '" value="1" class="wc-grouped-product-add-to-cart-checkbox" id="' . esc_attr('quantity-' . $grouped_product_child->get_id()) . '" />';
echo '<label for="' . esc_attr('quantity-' . $grouped_product_child->get_id()) . '" class="screen-reader-text">' . esc_html__('Buy one of this item', 'elessi-theme') . '</label>';
else :
do_action('woocommerce_before_add_to_cart_quantity');
woocommerce_quantity_input(
array(
'input_name' => 'quantity[' . $grouped_product_child->get_id() . ']',
'input_value' => isset($_POST['quantity'][$grouped_product_child->get_id()]) ? wc_stock_amount(wc_clean(wp_unslash($_POST['quantity'][$grouped_product_child->get_id()]))) : '', // phpcs:ignore WordPress.Security.NonceVerification.Missing
'min_value' => apply_filters('woocommerce_quantity_input_min', 0, $grouped_product_child),
'max_value' => apply_filters('woocommerce_quantity_input_max', $grouped_product_child->get_max_purchase_quantity(), $grouped_product_child),
'placeholder' => '0',
)
);
do_action('woocommerce_after_add_to_cart_quantity');
endif;
$value = ob_get_clean();
break;
case 'label':
$value = '<label for="product-' . esc_attr($grouped_product_child->get_id()) . '">';
$value .= $grouped_product_child->is_visible() ? '<a href="' . esc_url(apply_filters('woocommerce_grouped_product_list_link', $grouped_product_child->get_permalink(), $grouped_product_child->get_id())) . '">' . $grouped_product_child->get_name() . '</a>' : $grouped_product_child->get_name();
$value .= '</label>';
break;
case 'price':
$value = $grouped_product_child->get_price_html() . wc_get_stock_html($grouped_product_child);
break;
default:
$value = '';
break;
endswitch;
echo '<td class="woocommerce-grouped-product-list-item__' . esc_attr($column_id) . '">' . apply_filters('woocommerce_grouped_product_list_column_' . $column_id, $value, $grouped_product_child) . '</td>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
do_action('woocommerce_grouped_product_list_after_' . $column_id, $grouped_product_child);
endforeach;
echo '</tr>';
endforeach;
$post = $previous_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
setup_postdata($post);
do_action('woocommerce_grouped_product_list_after', $grouped_product_columns, $quantites_required, $product);
?>
</tbody>
</table>
<input type="hidden" name="add-to-cart" value="<?php echo esc_attr($product->get_id()); ?>" />
<?php if ($quantites_required && $show_add_to_cart_button) : ?>
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<button type="submit" class="ns-single-add-btn single_add_to_cart_button button alt<?php echo esc_attr(wc_wp_theme_get_element_class_name('button') ? ' ' . wc_wp_theme_get_element_class_name('button') : ''); ?>"><?php echo esc_html($product->single_add_to_cart_text()); ?></button>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
<?php endif; ?>
</form>
<?php
do_action('woocommerce_after_add_to_cart_form');
@@ -0,0 +1,53 @@
<?php
/**
* Simple product add to cart
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 7.0.1
*/
defined('ABSPATH') || exit;
global $product, $nasa_opt;
if (!$product->is_purchasable()) {
return;
}
echo wc_get_stock_html($product); // WPCS: XSS ok.
$disable_add_to_cart = isset($nasa_opt['disable-cart']) && $nasa_opt['disable-cart'] ? true : false;
if (!$disable_add_to_cart && $product->is_in_stock()) :
?>
<?php do_action('woocommerce_before_add_to_cart_form'); ?>
<form class="cart" action="<?php echo esc_url(apply_filters('woocommerce_add_to_cart_form_action', $product->get_permalink())); ?>" method="post" enctype='multipart/form-data'>
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<?php
do_action('woocommerce_before_add_to_cart_quantity');
woocommerce_quantity_input(
array(
'min_value' => apply_filters('woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product),
'max_value' => apply_filters('woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product),
'input_value' => isset($_POST['quantity']) ? wc_stock_amount(wp_unslash($_POST['quantity'])) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok.
)
);
do_action('woocommerce_after_add_to_cart_quantity');
?>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr($product->get_id()); ?>" class="ns-single-add-btn single_add_to_cart_button button alt<?php echo esc_attr(wc_wp_theme_get_element_class_name('button') ? ' ' . wc_wp_theme_get_element_class_name('button') : ''); ?>">
<?php echo esc_html($product->single_add_to_cart_text()); ?>
</button>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
</form>
<?php do_action('woocommerce_after_add_to_cart_form'); ?>
<?php
endif;
@@ -0,0 +1,45 @@
<?php
/**
* Single variation cart button
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 7.0.1
*/
defined('ABSPATH') || exit;
global $nasa_opt, $product;
?>
<div class="woocommerce-variation-add-to-cart variations_button">
<?php
do_action('woocommerce_before_add_to_cart_button');
do_action('woocommerce_before_add_to_cart_quantity');
if (!isset($nasa_opt['disable-cart']) || !$nasa_opt['disable-cart']) :
woocommerce_quantity_input(array(
'min_value' => apply_filters('woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product),
'max_value' => apply_filters('woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product),
'input_value' => isset($_POST['quantity']) ? wc_stock_amount(wp_unslash($_POST['quantity'])) : $product->get_min_purchase_quantity(),
));
endif;
do_action('woocommerce_after_add_to_cart_quantity');
if (!isset($nasa_opt['disable-cart']) || !$nasa_opt['disable-cart']) :
?>
<button type="submit" class="ns-single-add-btn single_add_to_cart_button button alt<?php echo esc_attr(wc_wp_theme_get_element_class_name('button') ? ' ' . wc_wp_theme_get_element_class_name('button') : ''); ?>">
<?php echo esc_html($product->single_add_to_cart_text()); ?>
</button>
<input type="hidden" name="add-to-cart" value="<?php echo absint($product->get_id()); ?>" />
<input type="hidden" name="product_id" value="<?php echo absint($product->get_id()); ?>" />
<input type="hidden" name="variation_id" class="variation_id" value="0" />
<?php
endif;
do_action('woocommerce_after_add_to_cart_button');
?>
</div>
+36
View File
@@ -0,0 +1,36 @@
<?php
/**
* Single Product Meta
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 3.0.0
*/
if (!defined('ABSPATH')) :
exit; // Exit if accessed directly
endif;
global $product;
?>
<div class="product_meta">
<?php do_action('woocommerce_product_meta_start'); ?>
<?php if (wc_product_sku_enabled()) :
$sku = $product->get_sku();
if ($sku || $product->is_type('variable')) : ?>
<span class="sku_wrapper">
<strong><?php esc_html_e('SKU:', 'elessi-theme'); ?></strong> <span class="sku"><?php echo $sku ? $sku : esc_html__('N/A', 'elessi-theme'); ?></span>
</span>
<?php endif; ?>
<?php endif; ?>
<?php echo wc_get_product_category_list($product->get_id(), ', ', '<span class="posted_in">' . _n('<strong>Category:</strong>', '<strong>Categories:</strong>', count($product->get_category_ids()), 'elessi-theme') . '&nbsp;', '</span>'); ?>
<?php echo wc_get_product_tag_list($product->get_id(), ', ', '<span class="tagged_as">' . _n('<strong>Tag:</strong>', '<strong>Tags:</strong>', count($product->get_tag_ids()), 'elessi-theme') . '&nbsp;', '</span>'); ?>
<?php do_action('woocommerce_product_meta_end'); ?>
</div>
@@ -0,0 +1,265 @@
<?php
/**
* Custom Product image
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 9.0.0
*/
if (!defined('ABSPATH')) :
exit; // Exit if accessed directly
endif;
global $product, $nasa_opt;
$product_id = $product->get_id();
$post_thumbnail_id = $product->get_image_id();
$product_post = get_post($product_id);
$attachment_ids = $product->get_gallery_image_ids();
$attach_video_id = elessi_get_product_meta_value($product_id, '_product_video_upload');
$video_url = $attach_video_id ? wp_get_attachment_url($attach_video_id) : false;
$attach_video_poster_id = elessi_get_product_meta_value($product_id, '_product_video_poster_upload');
$video_title = $attach_video_id ? get_the_title($attach_video_id) : '';
// $data_rel = '';
$image_size = apply_filters('woocommerce_gallery_image_size', 'woocommerce_single');
$full_size = apply_filters('woocommerce_gallery_full_size', apply_filters('woocommerce_product_thumbnails_large_size', 'full'));
if ($post_thumbnail_id) :
$image_title = esc_attr(get_the_title($post_thumbnail_id));
$alt_text = trim(wp_strip_all_tags(get_post_meta($post_thumbnail_id, '_wp_attachment_image_alt', true)));
$image_full = wp_get_attachment_image_src($post_thumbnail_id, $full_size);
$image_link = isset($image_full[0]) ? $image_full[0] : wp_get_attachment_url($post_thumbnail_id);
$image_large = wp_get_attachment_image_src($post_thumbnail_id, $image_size);
$src_large = isset($image_large[0]) ? $image_large[0] : $image_link;
$video_poster_url = $attach_video_poster_id ? wp_get_attachment_url($attach_video_poster_id) : $image_link;
$image = wp_get_attachment_image(
$post_thumbnail_id,
$image_size,
false,
apply_filters(
'woocommerce_gallery_image_html_attachment_image_params',
array(
'title' => _wp_specialchars(get_post_field('post_title', $post_thumbnail_id), ENT_QUOTES, 'UTF-8', true),
'alt' => $alt_text,
'data-caption' => _wp_specialchars(get_post_field('post_excerpt', $post_thumbnail_id), ENT_QUOTES, 'UTF-8', true),
'data-src' => esc_url($image_full[0]),
'data-large_image' => esc_url($image_full[0]),
'data-large_image_width' => esc_attr($image_full[1]),
'data-large_image_height' => esc_attr($image_full[2]),
'class' => 'wp-post-image skip-lazy attachment-shop_single size-shop_single',
),
$post_thumbnail_id,
$image_size,
true
)
);
endif;
$attachment_count = count($attachment_ids);
$slideHoz = false;
if (isset($nasa_opt['product_detail_layout']) && in_array($nasa_opt['product_detail_layout'], array('classic', 'modern-2', 'modern-3')) && isset($nasa_opt['product_thumbs_style']) && $nasa_opt['product_thumbs_style'] === 'hoz') :
$slideHoz = true;
endif;
if (isset($nasa_opt['product_detail_layout']) && in_array($nasa_opt['product_detail_layout'], array('new')) && isset($nasa_opt['product_thumbs_style']) && $nasa_opt['product_thumbs_style'] === 'hoz' && isset($nasa_opt['product_image_style']) && $nasa_opt['product_image_style'] === 'slide') :
$slideHoz = true;
endif;
if (in_array($nasa_opt['product_detail_layout'], array('modern-1', 'new-3'))) :
$slideHoz = true;
endif;
$imageMobilePadding = 'mobile-padding-left-5 mobile-padding-right-5';
if (isset($nasa_opt['product_detail_layout']) && $nasa_opt['product_detail_layout'] == 'new' && isset($nasa_opt['product_image_style']) && $nasa_opt['product_image_style'] == 'scroll') :
$imageMobilePadding = 'mobile-padding-left-0 mobile-padding-right-0 nasa-flex align-start';
endif;
$class_main_imgs = 'main-images nasa-single-product-main-image nasa-main-image-default';
$class_wrapimg = 'row nasa-mobile-row woocommerce-product-gallery__wrapper';
$show_thumbnail = true;
if (isset($nasa_opt['product_detail_layout']) && in_array($nasa_opt['product_detail_layout'], array('full'))) :
$show_thumbnail = false;
$class_wrapimg = 'nasa-row nasa-mobile-row woocommerce-product-gallery__wrapper nasa-columns-padding-0';
$imageMobilePadding = 'mobile-padding-left-0 mobile-padding-right-0';
if (isset($nasa_opt['half_full_slide']) && $nasa_opt['half_full_slide']) :
$class_main_imgs .= ' no-easyzoom';
endif;
endif;
if (isset($nasa_opt['product_detail_layout']) && $nasa_opt['product_detail_layout'] === 'modern-4'):
$show_thumbnail = false;
endif;
$sliders_arrow = isset($nasa_opt['product_slide_arrows']) && $nasa_opt['product_slide_arrows'] && $nasa_opt['product_image_style'] === 'slide' ? true : false;
$in_mobile = isset($nasa_opt['nasa_in_mobile']) && $nasa_opt['nasa_in_mobile'] ? true : false;
$mobile_app = $in_mobile && isset($nasa_opt['mobile_layout']) && $nasa_opt['mobile_layout'] == 'app' ? true : false;
$wrapper_classes = apply_filters(
'woocommerce_single_product_image_gallery_classes',
array(
'woocommerce-product-gallery',
'woocommerce-product-gallery--' . ($post_thumbnail_id ? 'with-images' : 'without-images'),
'images',
)
);
?>
<div class="<?php echo esc_attr(implode(' ', array_map('sanitize_html_class', $wrapper_classes))); ?>">
<div class="<?php echo esc_attr($class_wrapimg); ?>">
<div class="large-12 columns <?php echo $imageMobilePadding; ?>">
<?php if ($show_thumbnail && !$slideHoz && !$in_mobile) : ?>
<div class="nasa-thumb-wrap rtl-right">
<?php do_action('woocommerce_product_thumbnails'); ?>
</div>
<?php endif; ?>
<div class="nasa-main-wrap rtl-left<?php echo $slideHoz ? ' nasa-thumbnail-hoz' : ''; ?>">
<div class="product-images-slider images-popups-gallery">
<div class="nasa-main-image-default-wrap">
<?php if ($mobile_app && $attachment_count) : ?>
<div class="ns-img-count nasa-flex jc fs-13">
<span class="ns-img-now">1</span>/<span class="ns-img-total"><?php echo $video_url ? $attachment_count + 2 : $attachment_count + 1; ?></span>
</div>
<?php endif; ?>
<?php if ($sliders_arrow) : ?>
<div class="nasa-single-slider-arrows">
<a class="nasa-single-arrow nasa-disabled" data-action="prev" href="javascript:void(0);" rel="nofollow">
<svg width="42" height="42" viewBox="0 0 32 32" fill="currentColor"><path d="M12.792 15.233l-0.754 0.754 6.035 6.035 0.754-0.754-5.281-5.281 5.256-5.256-0.754-0.754-3.013 3.013z"/></svg>
</a>
<a class="nasa-single-arrow nasa-disabled" data-action="next" href="javascript:void(0);" rel="nofollow">
<svg width="42" height="42" viewBox="0 0 32 32" fill="currentColor"><path d="M19.159 16.767l0.754-0.754-6.035-6.035-0.754 0.754 5.281 5.281-5.256 5.256 0.754 0.754 3.013-3.013z"/></svg>
</a>
</div>
<?php endif; ?>
<div class="<?php echo esc_attr($class_main_imgs); ?>">
<div class="item-wrap first">
<div class="nasa-item-main-image-wrap" data-key="0">
<?php if ($post_thumbnail_id) : ?>
<div class="easyzoom first">
<?php
echo apply_filters(
'woocommerce_single_product_image_thumbnail_html',
sprintf(
'<a href="%s" class="woocommerce-main-image product-image woocommerce-product-gallery__image" data-o_href="%s" data-full_href="%s" title="%s">%s</a>',
$image_link,
$src_large,
$image_link,
$image_title,
$image
),
$post_thumbnail_id
);
?>
</div>
<?php else : ?>
<?php echo apply_filters(
'woocommerce_single_product_image_thumbnail_html',
sprintf(
'<div class="woocommerce-product-gallery__image--placeholder"><img src="%s" alt="%s" class="wp-post-image" /></div>',
esc_url(wc_placeholder_img_src('woocommerce_single')),
esc_html__('Awaiting product image', 'elessi-theme')
),
$post_thumbnail_id
); ?>
<?php endif; ?>
</div>
</div>
<?php
$_i = 0;
if ($attachment_count > 0) :
foreach ($attachment_ids as $attachment_id) :
$image_full = wp_get_attachment_image_src($attachment_id, $full_size);
if (!$image_full) :
continue;
endif;
$image_link = wp_get_attachment_url($attachment_id);
$image_title = esc_attr(get_the_title($attachment_id));
$alt_text = trim(wp_strip_all_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
$image = wp_get_attachment_image(
$attachment_id,
$image_size,
false,
apply_filters(
'woocommerce_gallery_image_html_attachment_image_params',
array(
'title' => _wp_specialchars(get_post_field('post_title', $attachment_id), ENT_QUOTES, 'UTF-8', true),
'alt' => $alt_text,
'data-caption' => _wp_specialchars(get_post_field('post_excerpt', $attachment_id), ENT_QUOTES, 'UTF-8', true),
'data-src' => esc_url($image_full[0]),
'data-large_image' => esc_url($image_full[0]),
'data-large_image_width' => esc_attr($image_full[1]),
'data-large_image_height' => esc_attr($image_full[2]),
'class' => 'skip-lazy attachment-shop_single size-shop_single',
),
$post_thumbnail_id,
$image_size,
false
)
);
$_i++;
?>
<div class="item-wrap">
<div class="nasa-item-main-image-wrap" data-key="<?php echo (int) $_i; ?>">
<div class="easyzoom">
<?php
echo sprintf(
'<a href="%s" class="woocommerce-additional-image product-image" title="%s">%s</a>',
$image_link,
$image_title,
$image
);
?>
</div>
</div>
</div>
<?php
endforeach;
endif;
?>
<?php if ($video_url) : ?>
<div class="item-wrap">
<div class="nasa-item-main-video-wrap nasa-item-main-image-wrap" data-key="<?php echo (int) $_i+1; ?>">
<?php $video_poster_url = $video_poster_url ? $video_poster_url : wc_placeholder_img_src();?>
<?php echo do_shortcode('[video src="' . esc_url($video_url) . '" preload="auto" poster="'.$video_poster_url.'"]'); ?>
<img class="ns-video-size" src="<?php echo esc_url($video_poster_url); ?>" alt="<?php echo esc_attr($video_title); ?>" />
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="product-image-btn">
<?php do_action('nasa_single_buttons'); ?>
</div>
</div>
</div>
<?php if ($show_thumbnail && $slideHoz) : ?>
<div class="nasa-thumb-wrap nasa-thumbnail-hoz">
<?php do_action('woocommerce_product_thumbnails'); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
@@ -0,0 +1,73 @@
<?php
/**
* Single Product Thumbnails
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 9.5.0
*/
if (!defined('ABSPATH')) :
exit; // Exit if accessed directly
endif;
global $product;
$product_id = $product->get_id();
$attachment_ids = $product->get_gallery_image_ids();
$attach_video_id = elessi_get_product_meta_value($product_id, '_product_video_upload');
$video_url = $attach_video_id ? wp_get_attachment_url($attach_video_id) : false;
$attach_video_poster_id = elessi_get_product_meta_value($product_id, '_product_video_poster_upload');
$video_load = '';
?>
<div class="nasa-thumbnail-default-wrap">
<div class="product-thumbnails images-popups-gallery nasa-single-product-thumbnails nasa-thumbnail-default">
<?php
if ($product->get_image_id()) :
$thumbId = get_post_thumbnail_id();
$image_title = esc_attr(get_the_title($thumbId));
$image_thumb = wp_get_attachment_image_src($thumbId, 'thumbnail');
$thumb_src = isset($image_thumb['0']) ? $image_thumb['0'] : wc_placeholder_img_src();
$image = get_the_post_thumbnail($product_id, apply_filters('single_product_small_thumbnail_size', 'thumbnail'), array('alt' => $image_title, 'class' => 'skip-lazy attachment-thumbnail size-thumbnail'));
$video_load = $thumb_src;
echo sprintf('<div class="nasa-wrap-item-thumb nasa-active" data-key="0" data-thumb_org="%s"><a href="javascript:void(0);" title="%s" class="active-thumbnail" rel="nofollow">%s</a></div>', $thumb_src, $image_title, $image);
else :
$noimage = wc_placeholder_img_src();
$video_load = $noimage;
echo sprintf('<div class="nasa-wrap-item-thumb nasa-active" data-key="0" data-thumb_org="%s"><a href="javascript:void(0);" class="active-thumbnail" rel="nofollow"><img src="%s" /></a></div>', $noimage, $noimage);
endif;
$loop = 0;
if (!empty($attachment_ids)) :
foreach ($attachment_ids as $attachment_id) :
$image = wp_get_attachment_image($attachment_id, apply_filters('single_product_small_thumbnail_size', 'thumbnail'), false, array('alt' => $image_title, 'class' => 'skip-lazy attachment-thumbnail size-thumbnail'));
if (!$image) :
continue;
endif;
$key = $loop + 1;
echo '<div class="nasa-wrap-item-thumb" data-key="' . (int) $key . '">';
echo apply_filters('single_product_small_thumbnail_size_html', sprintf('%s', $image), $attachment_id);
echo '</div>';
$loop++;
endforeach;
endif;
if ($video_url) :
$key_video = $loop + 1;
$video_poster_url = $attach_video_poster_id ? wp_get_attachment_url($attach_video_poster_id) : $video_load;
echo '<div class="nasa-wrap-item-thumb ns-video-poster" datwer="' . wp_get_attachment_url($attach_video_poster_id) . '" data-key="' . ((int) $key_video) . '"><img class="skip-lazy attachment-thumbnail size-thumbnail ns-video-load" src="' . esc_url($video_poster_url) . '" alt="' . esc_attr('Video Thumbnail', 'elessi-theme') . '" /><svg fill="currentColor" viewBox="-2.4 -2.4 64.80 64.80" stroke="currentColor" stroke-width="3"><path d="M45.563,29.174l-22-15c-0.307-0.208-0.703-0.231-1.031-0.058C22.205,14.289,22,14.629,22,15v30 c0,0.371,0.205,0.711,0.533,0.884C22.679,45.962,22.84,46,23,46c0.197,0,0.394-0.059,0.563-0.174l22-15 C45.836,30.64,46,30.331,46,30S45.836,29.36,45.563,29.174z M24,43.107V16.893L43.225,30L24,43.107z"/><path d="M30,0C13.458,0,0,13.458,0,30s13.458,30,30,30s30-13.458,30-30S46.542,0,30,0z M30,58C14.561,58,2,45.439,2,30 S14.561,2,30,2s28,12.561,28,28S45.439,58,30,58z" /></svg></div>';
endif;
?>
</div>
</div>
+106
View File
@@ -0,0 +1,106 @@
<?php
/**
* Single Product - Related Products
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 9.6.0
*/
if (!defined('ABSPATH')) :
exit;
endif;
if ($related_products) :
global $nasa_opt;
$_delay = 0;
$_delay_item = (isset($nasa_opt['delay_overlay']) && (int) $nasa_opt['delay_overlay']) ? (int) $nasa_opt['delay_overlay'] : 100;
$layout_buttons_class = '';
if (isset($nasa_opt['loop_layout_buttons']) && $nasa_opt['loop_layout_buttons'] != '') :
$layout_buttons_class = ' nasa-' . $nasa_opt['loop_layout_buttons'];
endif;
$columns_desk = !isset($nasa_opt['relate_columns_desk']) || !(int) $nasa_opt['relate_columns_desk'] ? 5 : (int) $nasa_opt['relate_columns_desk'];
$columns_tablet = !isset($nasa_opt['relate_columns_tablet']) || !(int) $nasa_opt['relate_columns_tablet'] ? 3 : (int) $nasa_opt['relate_columns_tablet'];
$columns_small = isset($nasa_opt['relate_columns_small']) ? $nasa_opt['relate_columns_small'] : 2;
$columns_small_slide = $columns_small == '1.5-cols' ? 1 : (int) $columns_small;
if (!$columns_small) :
$columns_small_slide = 2;
endif;
$ex_class = 'row related-product nasa-slider-wrap related products grid nasa-relative mobile-margin-bottom-20';
$head_class = 'nasa-title-relate';
if (isset($nasa_opt['product_detail_layout']) && $nasa_opt['product_detail_layout'] == 'new-3') :
$layout_buttons_class .= ' nasa-nav-top';
$ex_class .= ' title-align-left';
$head_class .= ' padding-left-0 padding-right-0';
else :
$layout_buttons_class .= ' nasa-nav-radius';
$ex_class .= ' margin-bottom-30';
$head_class .= ' text-center';
endif;
$data_attrs = array(
'data-columns="' . esc_attr($columns_desk) . '"',
'data-columns-small="' . esc_attr($columns_small_slide) . '"',
'data-columns-tablet="' . esc_attr($columns_tablet) . '"',
'data-switch-tablet="' . elessi_switch_tablet() . '"',
'data-switch-desktop="' . elessi_switch_desktop() . '"',
);
if ($columns_small == '1.5-cols') :
$data_attrs[] = 'data-padding-small="20%"';
endif;
if (isset($nasa_opt['relate_slide_auto']) && $nasa_opt['relate_slide_auto']) :
$data_attrs[] = 'data-autoplay="true"';
endif;
if (isset($nasa_opt['relate_slide_loop']) && $nasa_opt['relate_slide_loop']) :
$data_attrs[] = 'data-loop="true"';
endif;
$arr_attrs = apply_filters('nasa_attrs_relate_wrap', $data_attrs);
$attrs_str = !empty($arr_attrs) ? ' ' . implode(' ', $arr_attrs) : '';
$class_slider = 'ns-items-gap nasa-slick-slider nasa-slick-nav products grid' . $layout_buttons_class;
$heading = apply_filters('woocommerce_product_related_products_heading', __('Related Products', 'elessi-theme'));
?>
<div class="<?php echo esc_attr($ex_class); ?>">
<?php if ($heading) : ?>
<div class="large-12 columns">
<h3 class="<?php echo esc_attr($head_class); ?>">
<?php echo esc_html($heading); ?>
</h3>
</div>
<?php endif; ?>
<div class="large-12 columns">
<div class="<?php echo esc_attr($class_slider); ?>"<?php echo $attrs_str; ?>>
<?php
foreach ($related_products as $related_product) :
$post_object = get_post($related_product->get_id());
setup_postdata($GLOBALS['post'] = $post_object);
// Product Item
wc_get_template('content-product.php', array(
'_delay' => $_delay,
'wrapper' => 'div'
));
// End Product Item
$_delay += $_delay_item;
endforeach;
?>
</div>
</div>
</div>
<?php
endif;
wp_reset_postdata();
+102
View File
@@ -0,0 +1,102 @@
<?php
/**
* Single Product Sale Flash
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 1.6.4
*/
if (!defined('ABSPATH')) :
exit; // Exit if accessed directly
endif;
global $nasa_opt, $post, $product;
if (!$product) :
return;
endif;
$badges = '';
/**
* Featured
*/
if (isset($nasa_opt['featured_badge']) && $nasa_opt['featured_badge'] && $product->is_featured()):
$badges .= '<span class="badge featured-label">' . esc_html__('Featured', 'elessi-theme') . '</span>';
endif;
/**
* New
*/
if (isset($nasa_opt['at_badge_new']) && $nasa_opt['at_badge_new']) :
$product_id = $product->get_type() == 'variation' ? $product->get_parent_id() : $product->get_id();
$published_on = get_the_date('d-m-Y', $product_id);
$current_date = strtotime(date('Y-m-d'));
$target_date = strtotime($published_on);
$diff_days = abs(floor(($target_date - $current_date) / (60 * 60 * 24)));
$max_time = isset($nasa_opt['max_ns_time_at_badge_new']) && (int) $nasa_opt['max_ns_time_at_badge_new'] ? (int) $nasa_opt['max_ns_time_at_badge_new'] : 10;
$badges .= $diff_days <= $max_time ? '<span class="badge new-label">' . esc_html__('New', 'elessi-theme') . '</span>' : '';
endif;
/**
* On Sale Badge
*/
if ($product->is_on_sale()) :
$badges_sale = '';
if ($product->get_type() == 'variable') :
$badges_sale = '<span class="badge sale-label sale-variable">' . esc_html__('Sale', 'elessi-theme') . '</span>';
else :
$maximumper = 0;
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
if (is_numeric($sale_price)) :
$percentage = $regular_price ? round(((($regular_price - $sale_price) / $regular_price) * 100), 0) : 0;
if ($percentage > $maximumper) :
$maximumper = $percentage;
endif;
$badges_sale = '<span class="badge sale-label">' . sprintf(esc_html__('&#45;%s&#37;', 'elessi-theme'), $maximumper) . '</span>';
endif;
endif;
/**
* Hook onsale WooCommerce
*/
$badges .= apply_filters('woocommerce_sale_flash', $badges_sale, $post, $product);
/**
* Style show with Deal product
*/
$badges .= '<span class="badge deal-label">' . esc_html__('Limited', 'elessi-theme') . '</span>';
endif;
/**
* Out of stock
*/
if ("outofstock" === $product->get_stock_status()):
$badges .= elessi_badge_outofstock();
endif;
/**
* Backorders - Allowed
*/
if (isset($nasa_opt['backorder_badge']) && $nasa_opt['backorder_badge'] && $product->backorders_allowed()) :
$badges .= '<span class="badge backorders-label">' . esc_html__('Backorders', 'elessi-theme') . '</span>';
endif;
/**
* Hook to Badges
*/
$badges_content = apply_filters('nasa_badges', $badges);
if ('' !== $badges_content) :
echo '<div class="nasa-badges-wrap">' . $badges_content . '</div>';
endif;
@@ -0,0 +1,15 @@
<?php
/**
* Additional Information tab
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 3.0.0
*/
if (!defined('ABSPATH')) :
exit; // Exit if accessed directly
endif;
global $product;
do_action('woocommerce_product_additional_information', $product);
+180
View File
@@ -0,0 +1,180 @@
<?php
/**
* Single Product tabs / and sections
*
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 9.6.0
*/
if (!defined('ABSPATH')) :
exit; // Exit if accessed directly
endif;
/**
* Filter tabs and allow third parties to add their own
*
* Each tab is an array containing title, callback and priority.
* @see woocommerce_default_product_tabs()
*/
$tabs = apply_filters('woocommerce_product_tabs', array());
if (!empty($tabs)) :
global $nasa_opt, $product;
$tab_style = apply_filters('nasa_single_product_tabs_style', '2d-no-border');
$off_canvas_mobile = $tab_style != 'scroll-down' && isset($nasa_opt['woo_tabs_off_canvas']) && $nasa_opt['woo_tabs_off_canvas'] ? true : false;
$class_wrap = 'nasa-tabs-content woocommerce-tabs wc-tabs-wrapper';
$class_ul = 'nasa-tabs';
switch ($tab_style) :
case 'accordion':
case 'accordion-2':
$class_wrap = 'nasa-accordions-content fullwidth woocommerce-tabs nasa-no-global';
$class_wrap .= $tab_style == 'accordion-2' ? ' nasa-arrow' : '';
break;
case 'small-accordion':
$class_wrap = 'nasa-accordions-content nasa-no-border nasa-arrow woocommerce-tabs';
break;
case '2d':
$class_ul .= ' nasa-classic-style nasa-classic-2d';
break;
case '2d-radius':
$class_ul .= ' nasa-classic-style nasa-classic-2d nasa-tabs-no-border nasa-tabs-radius';
break;
case '2d-radius-dashed':
$class_ul .= ' nasa-classic-style nasa-classic-2d nasa-tabs-radius-dashed';
break;
case '3d':
$class_ul .= ' nasa-classic-style';
break;
case 'slide':
$class_ul .= ' nasa-slide-style';
break;
case 'scroll-down':
$class_wrap .= ' nasa-scroll-content';
break;
case 'ver-1':
$class_wrap .= ' nasa-vertical-style';
break;
case 'ver-2':
$class_wrap .= ' nasa-vertical-notabs';
break;
case '2d-no-border':
default:
$class_ul .= ' nasa-classic-style nasa-classic-2d nasa-tabs-no-border';
break;
endswitch;
$class_wrap .= $off_canvas_mobile ? ' mobile-tabs-off-canvas nasa-transition-800' : '';
?>
<div class="product-details" id="nasa-single-product-tabs">
<?php
echo $off_canvas_mobile ? '<a href="javascript:void(0);" class="nasa-toggle-woo-tabs hidden-tag" rel="nofollow">' . esc_html__('View Product Information', 'elessi-theme') . '</a>' : '';
if (!isset($nasa_opt['ns_rm_sl']) || $nasa_opt['ns_rm_sl']) :
echo '<script type="text/tempalte" id="tmp-read-more-tab">' .
'<div class="ns-read-more">' .
'<a href="javascript:void(0);" data-show-less="' . esc_attr__("Show less", "elessi-theme") . '" data-show-more="' . esc_attr__("Read more", "elessi-theme") . '" class="ns-btn-read-more primary-color" rel="nofollow">' .
'<span class="ns-btn-read-more-text"> ' . esc_html__("Read more", "elessi-theme") . ' </span>'.
'<svg width="30" height="30" viewBox="0 0 32 32" fill="currentColor"><path d="M15.233 19.175l0.754 0.754 6.035-6.035-0.754-0.754-5.281 5.281-5.256-5.256-0.754 0.754 3.013 3.013z" /></svg>' .
'</a>' .
'</div>' .
'</script>';
endif;
?>
<div class="<?php echo esc_attr($class_wrap); ?>">
<?php
echo $off_canvas_mobile ? '<a href="javascript:void(0);" class="nasa-toggle-woo-tabs nasa-stclose hidden-tag" rel="nofollow"></a>' : '';
switch ($tab_style) :
/**
* Accordion layout style
*/
case 'accordion':
case 'accordion-2':
$file = ELESSI_CHILD_PATH . '/includes/nasa-single-product-tabs_accordion_layout.php';
if(!is_file($file)) :
$file = ELESSI_THEME_PATH . '/includes/nasa-single-product-tabs_accordion_layout.php';
endif;
break;
/**
* Accordion layout style
*/
case 'small-accordion':
$file = ELESSI_CHILD_PATH . '/includes/nasa-single-product-tabs_accordion_small_layout.php';
if(!is_file($file)) :
$file = ELESSI_THEME_PATH . '/includes/nasa-single-product-tabs_accordion_small_layout.php';
endif;
break;
/**
* Scroll Down layout style
*/
case 'scroll-down':
$file = ELESSI_CHILD_PATH . '/includes/nasa-single-product-tabs_scroll_layout.php';
if(!is_file($file)) :
$file = ELESSI_THEME_PATH . '/includes/nasa-single-product-tabs_scroll_layout.php';
endif;
break;
/**
* Vertical layout style #1
*/
case 'ver-1':
$file = ELESSI_CHILD_PATH . '/includes/nasa-single-product-tabs_ver-1_layout.php';
if(!is_file($file)) :
$file = ELESSI_THEME_PATH . '/includes/nasa-single-product-tabs_ver-1_layout.php';
endif;
break;
/**
* Vertical layout style #2
*/
case 'ver-2':
$file = ELESSI_CHILD_PATH . '/includes/nasa-single-product-tabs_ver-2_layout.php';
if(!is_file($file)) :
$file = ELESSI_THEME_PATH . '/includes/nasa-single-product-tabs_ver-2_layout.php';
endif;
break;
/**
* Tabs layout style
*/
default :
$file = ELESSI_CHILD_PATH . '/includes/nasa-single-product-tabs_tab_layout.php';
if(!is_file($file)) :
$file = ELESSI_THEME_PATH . '/includes/nasa-single-product-tabs_tab_layout.php';
endif;
break;
endswitch;
/**
* Content WooCommerce Tabs
*/
include $file;
/**
* Since WooCommerce v9.6.0
*/
do_action('woocommerce_product_after_tabs');
?>
</div>
</div>
<?php
endif;
+110
View File
@@ -0,0 +1,110 @@
<?php
/**
* Single Product Up-Sells
*
* This template can be overridden by copying it to elessi-theme/woocommerce/single-product/up-sells.php.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author NasaTheme
* @package Elessi-theme/WooCommerce
* @version 9.6.0
*/
if (!defined('ABSPATH')) :
exit;
endif;
if ($upsells) :
global $nasa_opt;
$_delay = 0;
$_delay_item = (isset($nasa_opt['delay_overlay']) && (int) $nasa_opt['delay_overlay']) ? (int) $nasa_opt['delay_overlay'] : 100;
$layout_buttons_class = '';
if (isset($nasa_opt['loop_layout_buttons']) && $nasa_opt['loop_layout_buttons'] != '') :
$layout_buttons_class = ' nasa-' . $nasa_opt['loop_layout_buttons'];
endif;
$columns_desk = !isset($nasa_opt['relate_columns_desk']) || !(int) $nasa_opt['relate_columns_desk'] ? 5 : (int) $nasa_opt['relate_columns_desk'];
$columns_tablet = !isset($nasa_opt['relate_columns_tablet']) || !(int) $nasa_opt['relate_columns_tablet'] ? 3 : (int) $nasa_opt['relate_columns_tablet'];
$columns_small = isset($nasa_opt['relate_columns_small']) ? $nasa_opt['relate_columns_small'] : 2;
$columns_small_slide = $columns_small == '1.5-cols' ? 1 : (int) $columns_small;
if (!$columns_small) :
$columns_small_slide = 2;
endif;
$ex_class = 'row related-product nasa-slider-wrap related up-sell products grid nasa-relative mobile-margin-bottom-20';
$head_class = 'nasa-title-relate';
if (isset($nasa_opt['product_detail_layout']) && $nasa_opt['product_detail_layout'] == 'new-3') :
$layout_buttons_class .= ' nasa-nav-top';
$ex_class .= ' title-align-left margin-bottom-20';
$head_class .= ' padding-left-0 padding-right-0';
else :
$layout_buttons_class .= ' nasa-nav-radius';
$ex_class .= ' margin-bottom-30';
$head_class .= ' text-center';
endif;
$data_attrs = array(
'data-columns="' . esc_attr($columns_desk) . '"',
'data-columns-small="' . esc_attr($columns_small_slide) . '"',
'data-columns-tablet="' . esc_attr($columns_tablet) . '"',
'data-switch-tablet="' . elessi_switch_tablet() . '"',
'data-switch-desktop="' . elessi_switch_desktop() . '"',
);
if ($columns_small == '1.5-cols') :
$data_attrs[] = 'data-padding-small="20%"';
endif;
if (isset($nasa_opt['relate_slide_auto']) && $nasa_opt['relate_slide_auto']) :
$data_attrs[] = 'data-autoplay="true"';
endif;
if (isset($nasa_opt['relate_slide_loop']) && $nasa_opt['relate_slide_loop']) :
$data_attrs[] = 'data-loop="true"';
endif;
$arr_attrs = apply_filters('nasa_attrs_relate_wrap', $data_attrs);
$attrs_str = !empty($arr_attrs) ? ' ' . implode(' ', $arr_attrs) : '';
$class_slider = 'ns-items-gap nasa-slick-slider nasa-slick-nav products grid' . $layout_buttons_class;
$heading = apply_filters('woocommerce_product_upsells_products_heading', __('You may also like&hellip;', 'elessi-theme'));
?>
<div class="<?php echo esc_attr($ex_class); ?>">
<?php if ($heading) : ?>
<div class="large-12 columns">
<h3 class="<?php echo esc_attr($head_class); ?>">
<?php echo esc_html($heading); ?>
</h3>
</div>
<?php endif; ?>
<div class="large-12 columns">
<div class="<?php echo esc_attr($class_slider); ?>"<?php echo $attrs_str; ?>>
<?php
foreach ($upsells as $upsell):
$post_object = get_post($upsell->get_id());
setup_postdata($GLOBALS['post'] = & $post_object);
// Product Item
wc_get_template('content-product.php', array(
'_delay' => $_delay,
'wrapper' => 'div'
));
// End Product Item
$_delay += $_delay_item;
endforeach;
?>
</div>
</div>
</div>
<?php
endif;
wp_reset_postdata();