Initial Commit N° : 001 - V.4.3.3
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Loop Add to Cart
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 9.2.0
|
||||
*/
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
global $product;
|
||||
|
||||
$aria_describedby = isset($args['aria-describedby_text']) ? sprintf('aria-describedby="woocommerce_loop_add_to_cart_link_describedby_%s"', esc_attr($product->get_id())) : '';
|
||||
|
||||
$class = isset($args['class']) ? $args['class'] : 'add-to-cart-grid btn-link nasa-tip';
|
||||
$class = isset($args['modern-8-add']) && $args['modern-8-add'] == 1 ? str_replace("nasa-quick-add", "nasa-modern-8-add", $class) : $class;
|
||||
echo apply_filters(
|
||||
'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.
|
||||
sprintf(
|
||||
'<a href="%s" %s data-quantity="%s" class="%s" %s>' .
|
||||
'<span class="add_to_cart_text">%s</span>' .
|
||||
'%s' .
|
||||
'</a>',
|
||||
esc_url($product->add_to_cart_url()),
|
||||
$aria_describedby,
|
||||
esc_attr(isset($args['quantity']) ? $args['quantity'] : 1),
|
||||
esc_attr($class),
|
||||
isset($args['attributes']) ? wc_implode_html_attributes($args['attributes']) : '',
|
||||
esc_html($product->add_to_cart_text()),
|
||||
isset($args['icon_cart']) && $args['icon_cart'] ? '<span class="nasa-icon cart-icon nasa-flex jc">' . $args['icon_cart'] . '</span>' : '<span class="nasa-icon cart-icon nasa-flex jc"><svg width="17" height="17" viewBox="0 0 24 24" stroke-width="2" fill="currentColor"><path d="M12 6V18" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/><path d="M6 12H18" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg></span>'
|
||||
),
|
||||
$product,
|
||||
$args
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Product Loop End
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 2.0.0
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Product Loop Start
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
global $nasa_opt, $woocommerce_loop;
|
||||
|
||||
$data_columns_small = 1;
|
||||
$data_columns_tablet = 2;
|
||||
|
||||
$class_wrap = '';
|
||||
|
||||
/**
|
||||
* Loop in Shop page
|
||||
*/
|
||||
if (!isset($woocommerce_loop['is_shortcode']) || !$woocommerce_loop['is_shortcode']) {
|
||||
$typeView = isset($nasa_opt['products_type_view']) && in_array($nasa_opt['products_type_view'],array('grid', 'list', 'list-2')) ? $nasa_opt['products_type_view'] : 'grid';
|
||||
|
||||
switch ($typeView) :
|
||||
case 'list' :
|
||||
$class_wrap = 'list';
|
||||
break;
|
||||
|
||||
case 'list-2' :
|
||||
$class_wrap = 'list-2 list';
|
||||
break;
|
||||
|
||||
case 'grid' :
|
||||
default:
|
||||
$class_wrap = 'grid';
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
$nasa_change_view = !isset($nasa_opt['enable_change_view']) || $nasa_opt['enable_change_view'] ? true : false;
|
||||
|
||||
$products_per_row = (isset($nasa_opt['products_type_view']) && $nasa_opt['products_type_view'] == 'list') ? 4 :
|
||||
(isset($nasa_opt['products_per_row']) && (int) $nasa_opt['products_per_row'] ? (int) $nasa_opt['products_per_row'] : 4);
|
||||
|
||||
if (isset($_GET['view-layout']) && in_array($_GET['view-layout'], array('grid-2', 'grid-3', 'grid-4', 'grid-5', 'grid-6', 'list', 'list-2'))) :
|
||||
switch ($_GET['view-layout']) :
|
||||
case 'grid-2' :
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = 2;
|
||||
break;
|
||||
|
||||
case 'grid-3' :
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = 3;
|
||||
break;
|
||||
|
||||
case 'grid-5' :
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = 5;
|
||||
break;
|
||||
|
||||
case 'grid-6' :
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = 6;
|
||||
break;
|
||||
|
||||
case 'grid-4' :
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = 4;
|
||||
break;
|
||||
case 'list' :
|
||||
$products_per_row = 4;
|
||||
$class_wrap = 'list';
|
||||
break;
|
||||
case 'list-2' :
|
||||
$products_per_row = 4;
|
||||
$class_wrap = 'list-2 list';
|
||||
break;
|
||||
default:
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = 4;
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop in Short code
|
||||
*/
|
||||
else {
|
||||
$class_wrap = 'grid';
|
||||
$products_per_row = isset($woocommerce_loop['columns']) ? $woocommerce_loop['columns'] :
|
||||
(isset($nasa_opt['products_per_row']) && (int) $nasa_opt['products_per_row'] ? (int) $nasa_opt['products_per_row'] : 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Columns for desktop
|
||||
*/
|
||||
switch ($products_per_row):
|
||||
case 2:
|
||||
$class_wrap .= ' large-block-grid-2';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$class_wrap .= ' large-block-grid-3';
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$class_wrap .= ' large-block-grid-5';
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$class_wrap .= ' large-block-grid-6';
|
||||
break;
|
||||
|
||||
case 4:
|
||||
default:
|
||||
$class_wrap .= ' large-block-grid-4';
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
/**
|
||||
* Columns for mobile
|
||||
*/
|
||||
$products_per_row_small = isset($nasa_opt['products_per_row_small']) && (int) $nasa_opt['products_per_row_small'] ? (int) $nasa_opt['products_per_row_small'] : 1;
|
||||
switch ($products_per_row_small):
|
||||
case 2:
|
||||
$class_wrap .= ' small-block-grid-2';
|
||||
$data_columns_small = 2;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
$class_wrap .= ' small-block-grid-1';
|
||||
$data_columns_small = 1;
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
/**
|
||||
* Columns for tablet
|
||||
*/
|
||||
$products_per_row_tablet = isset($nasa_opt['products_per_row_tablet']) && (int) $nasa_opt['products_per_row_tablet'] ? (int) $nasa_opt['products_per_row_tablet'] : 2;
|
||||
switch ($products_per_row_tablet):
|
||||
case 3:
|
||||
$class_wrap .= ' medium-block-grid-3';
|
||||
$data_columns_tablet = 3;
|
||||
break;
|
||||
case 4:
|
||||
$class_wrap .= ' medium-block-grid-4';
|
||||
$data_columns_tablet = 4;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
$class_wrap .= ' medium-block-grid-2';
|
||||
$data_columns_tablet = 2;
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
$loop_start_class = apply_filters('nasa_loop_start_class', $class_wrap);
|
||||
|
||||
$class_warp_all = 'nasa-content-page-products';
|
||||
if (isset($nasa_opt['loop_layout_buttons']) && $nasa_opt['loop_layout_buttons'] != '') :
|
||||
$class_warp_all .= ' nasa-' . $nasa_opt['loop_layout_buttons'];
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr($class_warp_all); ?>">
|
||||
<ul class="products <?php echo esc_attr($loop_start_class); ?>" data-columns_small="<?php echo esc_attr($data_columns_small); ?>" data-columns_medium="<?php echo esc_attr($data_columns_tablet); ?>">
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Displayed when no products are found matching the current query
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 7.8.0
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="woocommerce-info woocommerce-no-products-found">
|
||||
<img src="<?php echo apply_filters('nasa_no_products_found_src', ELESSI_THEME_URI.'/assets/images/not-found-dark-icon.png'); ?>" alt="<?php esc_attr_e('Not Found Products', 'elessi-theme'); ?>" class="not-found-img" width="100" height="115" />
|
||||
|
||||
<?php esc_html_e('No products were found matching your selection.', 'elessi-theme'); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Show options for ordering
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 3.6.0
|
||||
*/
|
||||
if (!defined('ABSPATH')) :
|
||||
exit;
|
||||
endif;
|
||||
|
||||
global $nasa_opt;
|
||||
?>
|
||||
<form class="woocommerce-ordering" method="get">
|
||||
<span class="sort-text margin-right-5 rtl-margin-right-0 rtl-margin-left-5">
|
||||
<?php esc_html_e('Sort by', 'elessi-theme'); ?>
|
||||
</span>
|
||||
|
||||
<select name="orderby" class="orderby" aria-label="<?php esc_attr_e('Shop order', 'elessi-theme'); ?>">
|
||||
<?php foreach ($catalog_orderby_options as $id => $name) : ?>
|
||||
<option value="<?php echo esc_attr($id); ?>" <?php selected($orderby, $id); ?>><?php echo esc_html($name); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<?php if (!isset($nasa_opt['nasa_in_mobile']) || !$nasa_opt['nasa_in_mobile']) : ?>
|
||||
<div class="nasa-ordering"><?php esc_html_e('...', 'elessi-theme'); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="paged" value="1" />
|
||||
<?php wc_query_string_form_fields(null, array('orderby', 'submit', 'paged', 'product-page')); ?>
|
||||
</form>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Pagination - Show numbered pagination for catalog pages.
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 9.3.0
|
||||
*/
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
global $nasa_opt, $nasa_loadmore_style;
|
||||
|
||||
if (!isset($nasa_loadmore_style) || !is_array($nasa_loadmore_style) || empty($nasa_loadmore_style)) {
|
||||
$nasa_loadmore_style = array('infinite', 'load-more');
|
||||
}
|
||||
|
||||
$nasa_ajax_product = (defined('NASA_AJAX_SHOP') && NASA_AJAX_SHOP) ? NASA_AJAX_SHOP : false;
|
||||
|
||||
$total = isset($total) ? $total : wc_get_loop_prop('total_pages');
|
||||
$current = isset($current) ? $current : wc_get_loop_prop('current_page');
|
||||
$base = isset($base) ? $base : esc_url_raw(str_replace(999999999, '%#%', remove_query_arg('add-to-cart', get_pagenum_link(999999999, false))));
|
||||
|
||||
$format = isset($format) ? $format : '';
|
||||
|
||||
$pagination_style = isset($nasa_opt['pagination_style']) ? $nasa_opt['pagination_style'] : 'style-2';
|
||||
|
||||
if (isset($_GET['paging-style']) && in_array($_GET['paging-style'], $nasa_loadmore_style)) :
|
||||
$pagination_style = $_GET['paging-style'];
|
||||
endif;
|
||||
|
||||
if (!$nasa_ajax_product) :
|
||||
$pagination_style = $pagination_style == 'style-2' ? 'style-2' : 'style-1';
|
||||
endif;
|
||||
|
||||
$loadmore = in_array($pagination_style, $nasa_loadmore_style);
|
||||
$loadmoreClass = 'text-center';
|
||||
$loadmoreClass .= $pagination_style == 'infinite' ? ' nasa-infinite-shop' : '';
|
||||
|
||||
$class_wrap = 'row nasa-paginations-warp filters-container-down';
|
||||
$class_wrap .= $loadmore ? ' paging-style-loadmore' : '';
|
||||
|
||||
if ($total <= 1) :
|
||||
return;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<!-- PAGINATION -->
|
||||
<div id="nasa-paging" class="<?php echo esc_attr($class_wrap); ?>">
|
||||
<div class="large-12 columns">
|
||||
<?php
|
||||
if ($loadmore) :
|
||||
echo '<div id="nasa-wrap-archive-loadmore" class="' . $loadmoreClass . '">';
|
||||
|
||||
if ($current >= $total) :
|
||||
echo '<p>' . esc_html__('ALL PRODUCTS LOADED !', 'elessi-theme') . '</p>';
|
||||
else :
|
||||
echo '<a class="nasa-archive-loadmore" href="javascript:void(0);" rel="nofollow">';
|
||||
echo esc_html__('LOAD MORE ...', 'elessi-theme');
|
||||
echo '</a>';
|
||||
endif;
|
||||
|
||||
echo '</div>';
|
||||
endif;
|
||||
|
||||
if ($pagination_style == 'style-1') : ?>
|
||||
<div class="nasa-pagination nasa-pagination-store clearfix style-1">
|
||||
<div class="page-sumary">
|
||||
<?php do_action('nasa_shop_category_count'); ?>
|
||||
</div>
|
||||
<nav class="woocommerce-pagination page-numbers-wrap" aria-label="<?php esc_attr_e('Product Pagination', 'elessi-theme'); ?>">
|
||||
<?php
|
||||
echo paginate_links(apply_filters('woocommerce_pagination_args', array(
|
||||
'base' => $base,
|
||||
'format' => $format,
|
||||
'current' => max(1, $current),
|
||||
'total' => $total
|
||||
)));
|
||||
?>
|
||||
</nav>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="nasa-pagination nasa-pagination-store style-2">
|
||||
<nav class="woocommerce-pagination page-numbers-wrap" aria-label="<?php esc_attr_e('Product Pagination', 'elessi-theme'); ?>">
|
||||
<?php
|
||||
echo paginate_links(apply_filters('woocommerce_pagination_args', array(
|
||||
'base' => $base,
|
||||
'format' => $format,
|
||||
'current' => max(1, $current),
|
||||
'total' => $total
|
||||
)));
|
||||
?>
|
||||
</nav>
|
||||
<!-- hr /-->
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/*!-- end PAGINATION -- */
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Result Count.
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 9.4.0
|
||||
*/
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
?>
|
||||
|
||||
<p class="woocommerce-result-count"<?php echo (empty($orderedby) || 1 === intval($total)) ? '' : ' role="alert" aria-relevant="all" data-is-sorted-by="true"'; ?>>
|
||||
<?php
|
||||
if ($total <= $per_page || -1 === $per_page) :
|
||||
echo $total == 1 ? sprintf(esc_html__('%s result', 'elessi-theme'), $total) : sprintf(esc_html__('%s results', 'elessi-theme'), $total);
|
||||
else :
|
||||
$first = ($per_page * $current) - $per_page + 1;
|
||||
$last = min($total, $per_page * $current);
|
||||
$total = $last - $first + 1;
|
||||
|
||||
echo $total == 1 ? sprintf(esc_html__('%s result', 'elessi-theme'), $total) : sprintf(esc_html__('%s results', 'elessi-theme'), $total);
|
||||
|
||||
// $first = ($per_page * $current) - $per_page + 1;
|
||||
// $last = min($total, $per_page * $current);
|
||||
|
||||
// printf(_nx('%1$d–%2$d of %3$d result', '%1$d–%2$d of %3$d results', $total, 'with first and last result', 'elessi-theme'), $first, $last, $total);
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* Product loop 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('Y-m-d', $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__('-%s%', '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;
|
||||
Reference in New Issue
Block a user