Initial Commit N° : 001 - V.4.3.3
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Empty cart page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-empty.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://woo.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 7.0.1
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/*
|
||||
* @hooked wc_empty_cart_message - 10
|
||||
*/
|
||||
do_action('woocommerce_cart_is_empty');
|
||||
|
||||
if (wc_get_page_id('shop') > 0) : ?>
|
||||
<p class="return-to-shop margin-bottom-80">
|
||||
<a class="button wc-backward<?php echo esc_attr(wc_wp_theme_get_element_class_name('button') ? ' ' . wc_wp_theme_get_element_class_name('button') : ''); ?>" href="<?php echo esc_url(apply_filters('woocommerce_return_to_shop_redirect', wc_get_page_permalink('shop'))); ?>">
|
||||
<?php
|
||||
/**
|
||||
* Filter "Return To Shop" text.
|
||||
*
|
||||
* @since 4.6.0
|
||||
* @param string $default_text Default text.
|
||||
*/
|
||||
echo esc_html(apply_filters('woocommerce_return_to_shop_text', __('Return to shop', 'elessi-theme')));
|
||||
?>
|
||||
</a>
|
||||
</p>
|
||||
<div class="row nasa-empty-cart-recommend-product">
|
||||
<?php do_action('nasa_recommend_product'); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
do_action('nasa_carts_empty_after');
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipping Methods Display
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
*
|
||||
* @version 8.8.0
|
||||
*/
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$is_cart = is_cart();
|
||||
$class_shipping = 'woocommerce-shipping-methods';
|
||||
|
||||
if ($is_cart) :
|
||||
global $nasa_opt;
|
||||
|
||||
$hide_in_cart = defined('NASA_CHECKOUT_LAYOUT') && NASA_CHECKOUT_LAYOUT == 'modern' && (!isset($nasa_opt['cart_1_shiping']) || $nasa_opt['cart_1_shiping']) ? true : false;
|
||||
$no_check_shipping_in_cart = apply_filters('nasa_no_check_shipping_in_cart', $hide_in_cart);
|
||||
|
||||
$class_shipping .= $no_check_shipping_in_cart ? ' hide-check-shipping' : '';
|
||||
endif;
|
||||
|
||||
$formatted_destination = isset($formatted_destination) ? $formatted_destination : WC()->countries->get_formatted_address($package['destination'], ', ');
|
||||
$has_calculated_shipping = !empty($has_calculated_shipping);
|
||||
$show_shipping_calculator = !empty($show_shipping_calculator);
|
||||
$calculator_text = '';
|
||||
?>
|
||||
|
||||
<?php if ($is_cart || !defined('NASA_CHECKOUT_LAYOUT') || NASA_CHECKOUT_LAYOUT != 'modern') : ?>
|
||||
<tr class="woocommerce-shipping-totals shipping">
|
||||
<th><?php echo wp_kses_post($package_name); ?></th>
|
||||
<td data-title="<?php echo esc_attr($package_name); ?>">
|
||||
<?php else: ?>
|
||||
<div class="shipping-wrap-modern">
|
||||
<h5 class="shipping-package-name hidden-tag"><?php echo wp_kses_post($package_name); ?></h5>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($available_methods) && is_array($available_methods)) : ?>
|
||||
<ul id="shipping_method" class="<?php echo $class_shipping; ?>">
|
||||
<?php foreach ($available_methods as $method) : ?>
|
||||
<li>
|
||||
<?php
|
||||
if (1 < count($available_methods)) :
|
||||
printf('<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />', $index, esc_attr(sanitize_title($method->id)), esc_attr($method->id), checked($method->id, $chosen_method, false)); // WPCS: XSS ok.
|
||||
else :
|
||||
printf('<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" />', $index, esc_attr(sanitize_title($method->id)), esc_attr($method->id)); // WPCS: XSS ok.
|
||||
endif;
|
||||
|
||||
printf('<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr(sanitize_title($method->id)), wc_cart_totals_shipping_method_label($method)); // WPCS: XSS ok.
|
||||
do_action('woocommerce_after_shipping_rate', $method, $index);
|
||||
?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php if ($is_cart) : ?>
|
||||
<p class="woocommerce-shipping-destination">
|
||||
<?php
|
||||
if ($formatted_destination) :
|
||||
// Translators: $s shipping destination.
|
||||
printf(esc_html__('Shipping to %s.', 'elessi-theme') . ' ', '<strong>' . esc_html($formatted_destination) . '</strong>');
|
||||
$calculator_text = esc_html__('Change address', 'elessi-theme');
|
||||
else :
|
||||
echo wp_kses_post(apply_filters('woocommerce_shipping_estimate_html', __('Shipping options will be updated during checkout.', 'elessi-theme')));
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php elseif (!$has_calculated_shipping || !$formatted_destination) :
|
||||
|
||||
if ($is_cart && 'no' === get_option('woocommerce_enable_shipping_calc')) :
|
||||
echo wp_kses_post(apply_filters('woocommerce_shipping_not_enabled_on_cart_html', __('Shipping costs are calculated during checkout.', 'elessi-theme')));
|
||||
else :
|
||||
echo wp_kses_post(apply_filters('woocommerce_shipping_may_be_available_html', __('Enter your address to view shipping options.', 'elessi-theme')));
|
||||
endif;
|
||||
|
||||
elseif (!$is_cart) :
|
||||
echo wp_kses_post(apply_filters('woocommerce_no_shipping_available_html', __('There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'elessi-theme')));
|
||||
else :
|
||||
echo wp_kses_post(
|
||||
/**
|
||||
* Provides a means of overriding the default 'no shipping available' HTML string.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $html HTML message.
|
||||
* @param string $formatted_destination The formatted shipping destination.
|
||||
*/
|
||||
apply_filters(
|
||||
'woocommerce_cart_no_shipping_available_html',
|
||||
// Translators: $s shipping destination.
|
||||
sprintf(esc_html__('No shipping options were found for %s.', 'elessi-theme') . ' ', '<strong>' . esc_html($formatted_destination) . '</strong>'),
|
||||
$formatted_destination
|
||||
)
|
||||
);
|
||||
|
||||
$calculator_text = esc_html__('Enter a different address', 'elessi-theme');
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ($show_package_details) : ?>
|
||||
<?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html($package_details) . '</small></p>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($show_shipping_calculator) : ?>
|
||||
<?php woocommerce_shipping_calculator($calculator_text); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($is_cart || !defined('NASA_CHECKOUT_LAYOUT') || NASA_CHECKOUT_LAYOUT != 'modern') : ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
/**
|
||||
* Cart Page
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 7.9.0
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
global $nasa_opt;
|
||||
|
||||
do_action('woocommerce_before_cart');
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="large-8 columns rtl-right desktop-padding-right-30 rtl-desktop-padding-right-10 rtl-desktop-padding-left-30 mobile-margin-bottom-30">
|
||||
|
||||
<form class="woocommerce-cart-form nasa-shopping-cart-form<?php echo isset($nasa_opt['auto_update_cart']) && $nasa_opt['auto_update_cart'] ? ' qty-auto-update': ''; ?>" action="<?php echo esc_url(wc_get_cart_url()); ?>" method="post">
|
||||
|
||||
<?php do_action('woocommerce_before_cart_table'); ?>
|
||||
|
||||
<table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents responsive" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="product-name" colspan="3"><?php esc_html_e('Product', 'elessi-theme'); ?></th>
|
||||
<th class="product-price hide-for-small"><?php esc_html_e('Price', 'elessi-theme'); ?></th>
|
||||
<th class="product-quantity"><?php esc_html_e('Quantity', 'elessi-theme'); ?></th>
|
||||
<th class="product-subtotal hide-for-small"><?php esc_html_e('Subtotal', 'elessi-theme'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
do_action('woocommerce_before_cart_contents');
|
||||
|
||||
$cart_items = WC()->cart->get_cart();
|
||||
|
||||
foreach ($cart_items as $cart_item_key => $cart_item) :
|
||||
$_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
|
||||
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
|
||||
|
||||
/**
|
||||
* Filter the product name.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @param string $product_name Name of the product in the cart.
|
||||
* @param array $cart_item The product in the cart.
|
||||
* @param string $cart_item_key Key for the product in the cart.
|
||||
*/
|
||||
$product_name = apply_filters('woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key);
|
||||
|
||||
if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_cart_item_visible', true, $cart_item, $cart_item_key)) :
|
||||
|
||||
$product_permalink = apply_filters('woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink($cart_item) : '', $cart_item, $cart_item_key);
|
||||
|
||||
$price_product = apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key);
|
||||
?>
|
||||
|
||||
<tr class="woocommerce-cart-form__cart-item <?php echo esc_attr(apply_filters('woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key)); ?>">
|
||||
<td class="product-remove remove-product">
|
||||
<?php echo apply_filters(
|
||||
'woocommerce_cart_item_remove_link',
|
||||
sprintf('<a href="%s" class="remove nasa-stclose" aria-label="%s" data-product_id="%s" data-product_sku="%s">×</a>',
|
||||
esc_url(wc_get_cart_remove_url($cart_item_key)),
|
||||
/* translators: %s is the product name */
|
||||
esc_attr(sprintf(__('Remove %s from cart', 'elessi-theme'), $product_name)),
|
||||
esc_attr($product_id),
|
||||
esc_attr($_product->get_sku())
|
||||
), $cart_item_key
|
||||
); ?>
|
||||
</td>
|
||||
|
||||
<td class="product-thumbnail">
|
||||
<?php
|
||||
$thumbnail = apply_filters('woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key);
|
||||
if (!$product_permalink) :
|
||||
echo $thumbnail;
|
||||
else :
|
||||
printf('<a href="%s">%s</a>', esc_url($product_permalink), $thumbnail);
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-name" data-title="<?php esc_attr_e('Product', 'elessi-theme'); ?>">
|
||||
<?php
|
||||
if (!$product_permalink):
|
||||
echo wp_kses_post($product_name . ' ');
|
||||
else:
|
||||
/**
|
||||
* This filter is documented above.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
echo wp_kses_post(apply_filters('woocommerce_cart_item_name', sprintf('<a href="%s">%s</a>', esc_url($product_permalink), $_product->get_name()), $cart_item, $cart_item_key));
|
||||
endif;
|
||||
|
||||
do_action('woocommerce_after_cart_item_name', $cart_item, $cart_item_key);
|
||||
|
||||
// Meta data.
|
||||
echo wc_get_formatted_cart_item_data($cart_item); // PHPCS: XSS ok.
|
||||
|
||||
// Backorder notification
|
||||
if ($_product->backorders_require_notification() && $_product->is_on_backorder($cart_item['quantity'])) :
|
||||
echo wp_kses_post(apply_filters('woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__('Available on backorder', 'elessi-theme') . '</p>', $product_id));
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="product-price mobile-price hide-for-large hide-for-medium" data-title="<?php esc_attr_e('Price', 'elessi-theme'); ?>">
|
||||
<?php echo $price_product; ?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="product-price hide-for-small" data-title="<?php esc_attr_e('Price', 'elessi-theme'); ?>">
|
||||
<?php echo $price_product; ?>
|
||||
</td>
|
||||
|
||||
<td class="product-quantity" data-title="<?php esc_attr_e('Quantity', 'elessi-theme'); ?>">
|
||||
<?php
|
||||
if ($_product->is_sold_individually()) :
|
||||
$min_quantity = 1;
|
||||
$max_quantity = 1;
|
||||
else :
|
||||
$min_quantity = 0;
|
||||
$max_quantity = $_product->get_max_purchase_quantity();
|
||||
endif;
|
||||
|
||||
$product_quantity = woocommerce_quantity_input(
|
||||
array(
|
||||
'input_name' => 'cart[' . $cart_item_key . '][qty]',
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $max_quantity,
|
||||
'min_value' => $min_quantity,
|
||||
'product_name' => $product_name,
|
||||
),
|
||||
$_product,
|
||||
false
|
||||
);
|
||||
|
||||
echo apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-subtotal hide-for-small" data-title="<?php esc_attr_e('Total', 'elessi-theme'); ?>">
|
||||
<?php
|
||||
echo apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
do_action('woocommerce_cart_contents'); ?>
|
||||
|
||||
<tr class="nasa-no-border">
|
||||
<td colspan="6" class="actions nasa-actions">
|
||||
<div class="row desktop-margin-top-30">
|
||||
<div class="large-7 columns mobile-margin-top-20 left rtl-right nasa-min-height">
|
||||
|
||||
<?php if (wc_coupons_enabled()) : ?>
|
||||
<div class="coupon">
|
||||
<label class="hidden-tag" for="coupon_code">
|
||||
<?php esc_html_e('Coupon:', 'elessi-theme'); ?>
|
||||
</label>
|
||||
<input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e('Coupon code', 'elessi-theme'); ?>" />
|
||||
|
||||
<button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e('Apply coupon', 'elessi-theme'); ?>">
|
||||
<?php esc_attr_e('Apply coupon', 'elessi-theme'); ?>
|
||||
</button>
|
||||
|
||||
<?php do_action('woocommerce_cart_coupon'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="large-5 columns mobile-margin-top-20 text-right rtl-text-left rtl-left">
|
||||
<button type="submit" class="button" name="update_cart" value="<?php esc_attr_e('Update Cart', 'elessi-theme'); ?>">
|
||||
<?php esc_html_e('Update Cart', 'elessi-theme'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php do_action('woocommerce_cart_actions'); ?>
|
||||
|
||||
<?php wp_nonce_field('woocommerce-cart', 'woocommerce-cart-nonce'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php do_action('woocommerce_after_cart_contents'); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php do_action('woocommerce_after_cart_table'); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php do_action('woocommerce_before_cart_collaterals'); ?>
|
||||
|
||||
<div class="large-4 columns cart-collaterals rtl-left">
|
||||
<?php
|
||||
/**
|
||||
* Cart collaterals hook.
|
||||
*
|
||||
* @removed woocommerce_cross_sell_display
|
||||
* @hooked woocommerce_cart_totals - 10
|
||||
*/
|
||||
do_action('woocommerce_cart_collaterals');
|
||||
?>
|
||||
</div><!-- .large-4 -->
|
||||
|
||||
</div><!-- .row -->
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Cart after_cart hook.
|
||||
*
|
||||
* @hooked woocommerce_cross_sell_display
|
||||
*/
|
||||
do_action('woocommerce_after_cart');
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Cross-sells
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 9.6.0
|
||||
*/
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
if ($cross_sells) :
|
||||
global $nasa_opt;
|
||||
|
||||
// echo $nasa_opt['loop_layout_buttons'];
|
||||
|
||||
$_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['crs_columns_desk']) || !(int) $nasa_opt['crs_columns_desk'] ? 5 : (int) $nasa_opt['crs_columns_desk'];
|
||||
$columns_tablet = !isset($nasa_opt['crs_columns_tablet']) || !(int) $nasa_opt['crs_columns_tablet'] ? 3 : (int) $nasa_opt['crs_columns_tablet'];
|
||||
$columns_small = isset($nasa_opt['crs_columns_small']) ? $nasa_opt['crs_columns_small'] : 2;
|
||||
$columns_small_slide = $columns_small == '1.5-cols' ? 1 : (int) $columns_small;
|
||||
|
||||
$columns_desk = apply_filters('ns_crs_columns_desk', $columns_desk);
|
||||
|
||||
if (!$columns_small) :
|
||||
$columns_small_slide = 2;
|
||||
endif;
|
||||
|
||||
$start_row = '<div class="row">';
|
||||
$end_row = '</div>';
|
||||
$class_wrap = 'large-12 columns related related-product cross-sells products grid nasa-slider-wrap margin-top-50';
|
||||
|
||||
$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['crs_slide_auto']) && $nasa_opt['crs_slide_auto']) :
|
||||
$data_attrs[] = 'data-autoplay="true"';
|
||||
endif;
|
||||
|
||||
if (isset($nasa_opt['crs_slide_loop']) && $nasa_opt['crs_slide_loop']) :
|
||||
$data_attrs[] = 'data-loop="true"';
|
||||
endif;
|
||||
|
||||
$arr_attrs = apply_filters('nasa_attrs_cross_sell_wrap', $data_attrs);
|
||||
|
||||
$attrs_str = !empty($arr_attrs) ? ' ' . implode(' ', $arr_attrs) : '';
|
||||
|
||||
$heading = apply_filters('woocommerce_product_cross_sells_products_heading', __('You may be interested in…', 'elessi-theme'));
|
||||
|
||||
$class_slider = 'ns-items-gap nasa-slick-slider nasa-slick-nav nasa-nav-radius products grid' . $layout_buttons_class;
|
||||
|
||||
echo $start_row;
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr($class_wrap); ?>">
|
||||
<?php if ($heading) : ?>
|
||||
<div class="nasa-slide-style-product-carousel nasa-relative margin-bottom-20">
|
||||
<h3 class="nasa-shortcode-title-slider fs-25 mobile-fs-20 text-center">
|
||||
<?php echo esc_html($heading); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="<?php echo esc_attr($class_slider); ?>"<?php echo $attrs_str; ?>>
|
||||
<?php
|
||||
foreach ($cross_sells as $cross_sell) :
|
||||
$post_object = get_post($cross_sell->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>
|
||||
<?php
|
||||
|
||||
echo $end_row;
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Mini-cart
|
||||
*
|
||||
* @author NasaTheme
|
||||
* @package Elessi-theme/WooCommerce
|
||||
* @version 9.4.0
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
global $nasa_opt;
|
||||
|
||||
do_action('woocommerce_before_mini_cart');
|
||||
|
||||
if (WC()->cart && !WC()->cart->is_empty()) :
|
||||
$enable_button_ajax = 'yes' === get_option('woocommerce_enable_ajax_add_to_cart') ? true : false;
|
||||
|
||||
$is_change_variation_mini_cart = (isset($nasa_opt['mini_cart_change_variation_product']) && $nasa_opt['mini_cart_change_variation_product'] && $enable_button_ajax) ? true : false;
|
||||
|
||||
$extra_mini_cart_class = 'nasa-minicart-items';
|
||||
|
||||
if ($is_change_variation_mini_cart) :
|
||||
$extra_mini_cart_class .= ' nasa-change_variation_mini_cart';
|
||||
endif;
|
||||
|
||||
$in_mobile = isset($nasa_opt['nasa_in_mobile']) && $nasa_opt['nasa_in_mobile'] ? true : false;
|
||||
$mini_cart_mobile_view_hide = '';
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr($extra_mini_cart_class); ?>" data-text="<?php echo esc_attr__('Update Cart', 'elessi-theme'); ?>">
|
||||
<div class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr($args['list_class']); ?>">
|
||||
<?php
|
||||
do_action('woocommerce_before_mini_cart_contents');
|
||||
|
||||
$cart_items = WC()->cart->get_cart();
|
||||
|
||||
if ($in_mobile && isset($nasa_opt['mobile_layout']) && $nasa_opt['mobile_layout'] == 'app') :
|
||||
$mini_cart_mobile_view_hide = isset($nasa_opt['mini_cart_mobile_view_hide']) && $nasa_opt['mini_cart_mobile_view_hide'] ? ' mini_cart_mobile_view_hidden' : '';
|
||||
endif;
|
||||
|
||||
foreach ($cart_items as $cart_item_key => $cart_item) :
|
||||
$_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
|
||||
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
|
||||
|
||||
if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key)) :
|
||||
|
||||
$variations = isset($cart_item['variation']) && $cart_item['variation'] ? $cart_item['variation'] : null;
|
||||
$_data_attr = '';
|
||||
if (!empty($variations)) :
|
||||
$result = array();
|
||||
|
||||
foreach ($variations as $key => $variation) :
|
||||
$result[] = "$variation";
|
||||
endforeach;
|
||||
|
||||
$_data_attr = implode(".", $result);
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Filter the product name.
|
||||
*
|
||||
* @param string $product_name Name of the product in the cart.
|
||||
*/
|
||||
$product_name = apply_filters('woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key);
|
||||
$product_var_id = apply_filters('ns_cart_item_variation_id', $_product->get_id(), $cart_item, $cart_item_key);
|
||||
$thumbnail = apply_filters('woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key);
|
||||
$product_price = apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key);
|
||||
$product_permalink = apply_filters('woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink($cart_item) : '', $cart_item, $cart_item_key);
|
||||
?>
|
||||
|
||||
<div class="nasa-flex align-start mini-cart-item woocommerce-mini-cart-item <?php echo esc_attr(apply_filters('woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key)); ?>" data-variation-product="<?php echo esc_attr($product_var_id . '.' . $_data_attr); ?>" data-id-var-product="<?php echo esc_attr($product_var_id); ?>" data-id-product="<?php echo esc_attr($product_id); ?>">
|
||||
<div class="nasa-image-cart-item">
|
||||
<?php echo $thumbnail; ?>
|
||||
</div>
|
||||
|
||||
<div class="nasa-info-cart-item padding-left-15 rtl-padding-left-0 rtl-padding-right-15" data-variations-selected="<?php echo $is_change_variation_mini_cart && $variations != null ? htmlspecialchars(wp_json_encode($variations)): '' ?>">
|
||||
<div class="mini-cart-info">
|
||||
<div class="nasa-flex jbw align-start">
|
||||
<?php if (empty($product_permalink)) : ?>
|
||||
<span class="product-name nasa-bold"><?php echo wp_kses_post($product_name); ?></span>
|
||||
<?php else : ?>
|
||||
<a class="product-name nasa-bold" href="<?php echo esc_url($product_permalink); ?>" title="<?php echo esc_attr($product_name); ?>">
|
||||
<?php echo wp_kses_post($product_name); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="product-remove">
|
||||
<?php
|
||||
echo apply_filters(
|
||||
'woocommerce_cart_item_remove_link',
|
||||
sprintf(
|
||||
'<a href="%s" class="remove remove_from_cart_button item-in-cart nasa-stclose small ajax-sp_%s" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"></a>',
|
||||
esc_url(wc_get_cart_remove_url($cart_item_key)),
|
||||
$enable_button_ajax ? 'yes' : 'no',
|
||||
/* translators: %s is the product name */
|
||||
esc_attr(sprintf(__('Remove %s from cart', 'elessi-theme'), $product_name)),
|
||||
esc_attr($product_id),
|
||||
esc_attr($cart_item_key),
|
||||
esc_attr($_product->get_sku())
|
||||
),
|
||||
$cart_item_key
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<?php echo wc_get_formatted_cart_item_data($cart_item); ?>
|
||||
|
||||
<?php
|
||||
if ($product_price) :
|
||||
echo '<div class="nasa-flex jbw align-start mini-cart-item-price margin-top-5">';
|
||||
|
||||
$wrap = false;
|
||||
$quantily_show = true;
|
||||
|
||||
/**
|
||||
* Qty input
|
||||
* Elessi Theme Support
|
||||
*/
|
||||
if ((!isset($nasa_opt['mini_cart_qty']) || $nasa_opt['mini_cart_qty'])) :
|
||||
$quantily_show = false;
|
||||
$wrap = true;
|
||||
|
||||
if ($_product->is_sold_individually()) :
|
||||
$min_quantity = 1;
|
||||
$max_quantity = 1;
|
||||
else :
|
||||
$min_quantity = 0;
|
||||
$max_quantity = $_product->get_max_purchase_quantity();
|
||||
endif;
|
||||
|
||||
$qty_args = array(
|
||||
'input_name' => 'cart[' . $cart_item_key . '][qty]',
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $max_quantity,
|
||||
'min_value' => $min_quantity,
|
||||
'product_name' => $_product->get_name(),
|
||||
'mini_cart' => true
|
||||
);
|
||||
|
||||
$product_quantity = woocommerce_quantity_input($qty_args, $_product, false);
|
||||
|
||||
echo '<div class="quantity-wrap nasa-flex flex-wrap">';
|
||||
|
||||
echo apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item); // PHPCS: XSS ok.
|
||||
endif;
|
||||
|
||||
echo apply_filters('woocommerce_widget_cart_item_quantity', '<div class="cart_list_product_quantity">' . ($quantily_show ? sprintf('%s × %s', $cart_item['quantity'], $product_price) : sprintf('× %s', $product_price)) . '</div>', $cart_item, $cart_item_key);
|
||||
|
||||
echo $wrap ? '</div>' : '';
|
||||
|
||||
/**
|
||||
* SubTotal
|
||||
* Elessi Theme Support
|
||||
*/
|
||||
if ((!isset($nasa_opt['mini_cart_subtotal']) || $nasa_opt['mini_cart_subtotal'])) :
|
||||
echo '<div class="mini-cart-item-subtotal nasa-bold margin-left-10 rtl-margin-left-0 rtl-margin-right-10">';
|
||||
echo apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key);
|
||||
echo '</div>';
|
||||
endif;
|
||||
|
||||
echo '</div>';
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
do_action('woocommerce_mini_cart_contents');
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nasa-minicart-footer<?php echo $mini_cart_mobile_view_hide; ?>">
|
||||
<?php do_action('nasa_mini_cart_before_total'); ?>
|
||||
|
||||
<div class="minicart_total_checkout woocommerce-mini-cart__total total">
|
||||
<?php
|
||||
/**
|
||||
* Woocommerce_widget_shopping_cart_total hook.
|
||||
*
|
||||
* @removed woocommerce_widget_shopping_cart_subtotal - 10
|
||||
* @hooked elessi_widget_shopping_cart_subtotal - 10
|
||||
* @hooked elessi_subtotal_free_shipping - 20
|
||||
*/
|
||||
do_action('woocommerce_widget_shopping_cart_total');
|
||||
?>
|
||||
</div>
|
||||
<div class="btn-mini-cart inline-lists text-center">
|
||||
<?php do_action('woocommerce_widget_shopping_cart_before_buttons'); ?>
|
||||
|
||||
<p class="woocommerce-mini-cart__buttons buttons">
|
||||
<?php do_action('woocommerce_widget_shopping_cart_buttons'); ?>
|
||||
</p>
|
||||
|
||||
<?php do_action('woocommerce_widget_shopping_cart_after_buttons'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Empty cart
|
||||
*/
|
||||
else :
|
||||
$icon_empty = elessi_mini_cart_icon();
|
||||
$target_shop = apply_filters('nasa_target_return_shop', 'javascript:void(0);');
|
||||
// $str1 = array('nasa-icon cart-icon', 'width="28" height="28"');
|
||||
// $str2 = array('nasa-icon cart-icon nasa-empty-icon', ' width="100%" height="122"');
|
||||
// $icon_class = str_replace($str1, $str2, $icon_empty);
|
||||
|
||||
?>
|
||||
<p class="empty woocommerce-mini-cart__empty-message">
|
||||
<?php echo $icon_empty ?>
|
||||
<?php echo esc_html__('No products in the cart.', 'elessi-theme')?>
|
||||
<a href="<?php echo esc_attr($target_shop); ?>" class="button nasa-sidebar-return-shop" rel="nofollow">
|
||||
<?php echo esc_html__('RETURN TO SHOP', 'elessi-theme') ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
do_action('woocommerce_after_mini_cart');
|
||||
Reference in New Issue
Block a user