File: /storage/v4513/ivenusin/public_html/wp-content/themes/ivenus/woocommerce/content-single-product.php
<?php
/**
* The template for displaying product content in the single-product.php template
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.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://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.6.0
*/
defined( 'ABSPATH' ) || exit;
global $product;
/**
* Hook: woocommerce_before_single_product.
*
* @hooked wc_print_notices - 10
*/
do_action( 'woocommerce_before_single_product' );
if ( post_password_required() ) {
echo get_the_password_form(); // WPCS: XSS ok.
return;
}
$product_id = $product->ID;
$product_type = get_field('product_type',$product_id);
$terms = get_the_terms ( $product_id, 'product_cat' );
foreach($terms as $term) {
$prod_cat_name = $term->name;
$prod_cat_link = get_term_link( $term );
$prod_cat_id = $term->term_id;
$prod_cat_parent = get_term_by( 'id', $term->parent, 'product_cat' );
$prod_cat_parent_slug = $prod_cat_parent->slug;
}
$product_detail_page_link = get_field('product_detail_page_link',$product_id);
$technical_details_page_link = get_field('technical_details_page_link',$product_id);
?>
<span id="product_detail_page_link" class="d-none"><?php echo $product_detail_page_link; ?></span>
<span id="technical_details_page_link" class="d-none"><?php echo $technical_details_page_link; ?></span>
<nav aria-label="breadcrumb" class="breadcrumb-nav border-0 mb-2">
<div class="container d-flex align-items-center">
<?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?>
<?php /* Change on 27 June <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<?php echo SITE_URL; ?>">Home</a></li>
<li class="breadcrumb-item"><a href="<?php echo $prod_cat_link; ?>"><?php echo $prod_cat_name; ?></a></li>
<li class="breadcrumb-item active" aria-current="page"><?php the_title(); ?></li>
</ol> */ ?>
<?php /* <nav class="product-pager ml-auto" aria-label="Product">
<?php
$next_post = get_next_post(); ?>
<?php if (strlen(get_next_post()->post_title) > 0) { ?>
<a class="product-pager-link product-pager-prev" href="<?php echo get_permalink( $next_post->ID ); ?>" aria-label="Previous" tabindex="-1">
<i class="fal fa-chevron-left"></i>
<span>Prev</span>
</a>
<?php }
$previous_post = get_previous_post(); ?>
<?php if (strlen(get_previous_post()->post_title) > 0) { ?>
<a class="product-pager-link product-pager-next" href="<?php echo get_permalink( $previous_post->ID ); ?>" aria-label="Next" tabindex="-1">
<span>Next</span>
<i class="fal fa-chevron-right"></i>
</a>
<?php } ?>
</nav> */ ?><!-- End .pager-nav -->
</div><!-- End .container -->
</nav>
<div class="page-content">
<div class="container">
<div class="product-details-top">
<div class="row">
<div id="product-<?php the_ID(); ?>" <?php wc_product_class( '', $product ); ?>>
<?php
/**
* Hook: woocommerce_before_single_product_summary.
*
* @hooked woocommerce_show_product_sale_flash - 10
* @hooked woocommerce_show_product_images - 20
*/
do_action( 'woocommerce_before_single_product_summary' );
?>
<div class="summary entry-summary">
<?php
/**
* Hook: woocommerce_single_product_summary.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
* @hooked WC_Structured_Data::generate_product_data() - 60
*/
do_action( 'woocommerce_single_product_summary' );
?>
</div>
<?php
/**
* Hook: woocommerce_after_single_product_summary.
*
* @hooked woocommerce_output_product_data_tabs - 10
* @hooked woocommerce_upsell_display - 15
* @hooked woocommerce_output_related_products - 20
*/
do_action( 'woocommerce_after_single_product_summary' );
?>
</div>
</div>
<div class="row">
<?php if($product_type!='Accessories') { ?>
<div class="product-desc col-md-12">
<?php echo $product->get_description(); ?>
<?php $product_overview = get_field('product_overview',$product->ID);
if(!empty($product_overview)) { ?>
<div id="faq" class="accordion mt-5 mb-5">
<div class="card">
<div id="faqhead3" class="card-header"><a class="btn btn-header-link" href="#" data-toggle="collapse" data-target="#faq3" aria-expanded="true" aria-controls="faq3">Product Overview </a></div>
<div id="faq3" class="collapse show" aria-labelledby="faqhead3" data-parent="#faq">
<div class="card-body">
<section class="product_overview bg-white">
<div class="row">
<?php echo $product_overview; ?>
</div>
</section>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<?php $technical_details = get_field('technical_details',$product->ID);
if(!empty($technical_details)) { ?>
<section class="technical-details bg-white d-none">
<div class="container">
<h3 class="title text-center mb-4">Technical Details</h3>
<div class="row">
<?php echo $technical_details; ?>
</div>
</div>
</section>
<?php } ?>
<?php
$compare_section = get_field('compare_section',$product->ID);
$section_title = $compare_section['section_title'];
//$compare_link = $compare_section['compare_link'];
$hero_image = $compare_section['hero_image'];
$video_thumbnail_image = $compare_section['video_thumbnail_image'];
$video_thumbnail_image_url = $video_thumbnail_image['url'];
$video_youtube_url = $compare_section['video_youtube_url'];
if(!empty($section_title) || !empty($hero_image) ) { ?>
<section class="p-0 d-none">
<div class="row no-gutters">
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="hero-content-wrap">
<div class="hero-content text-center">
<h1 class="mt-5">Compare</h1>
<?php if(!empty($section_title)) { ?>
<h3 class="mt-2 mb-4"><?php echo $section_title; ?></h3>
<?php } ?>
<div class="slider-action-btn">
<?php echo do_shortcode('[yith_compare_button product="'.$product->ID.'"]'); ?>
</div>
</div>
</div>
<?php if(!empty($hero_image)) { ?>
<div class="hero-product-img pt-3 pb-5 wow fadeInLeft" data-wow-duration="1s" data-wow-delay="1s">
<div class="hero-img-1 no-animation">
<img src="<?php echo $hero_image['url']; ?>" alt="<?php echo $hero_image['alt']; ?>" class="img-responsive">
</div>
</div>
<?php } ?>
</div>
<div class="col-sm-12 col-md-12 col-lg-6 d-none">
<div class="product-intro-video h-100" style="background-image: url('<?php echo $video_thumbnail_image_url; ?>');" data-overlay="dark" data-opacity="5">
<a class="video-play-button popup-video" href="<?php if(!empty($video_youtube_url)) { echo $video_youtube_url; } else { echo '#'; } ?>">
<span></span>
</a>
</div>
</div>
</div>
</section>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
<section class="similar-products bg-white v_ivenus-custom-related pt-5">
<style type="text/css">
/*.v_ivenus-custom-related .btn-product i {font-size: 12px;}
.v_ivenus-custom-related .product-action-dark .btn-product:not(:hover):not(:focus) span {font-size: 10px;}
.v_ivenus-custom-related .product.product-2 .product-body {padding-left: 2px;padding-right: 2px;}
.v_ivenus-custom-related .product.product-2 .product-body h3.product-title {font-size: 12px;}
.v_ivenus-custom-related .label-circle{width: 2rem;height: 2rem;}
.v_ivenus-custom-related .btn-expandable span {font-size: 12px;}*/
</style>
<?php
$related_accessories = get_field('related_accessories',$product->ID);
if( isset($related_accessories) && !empty($related_accessories) ){
$rargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'post__in' => $related_accessories,
'orderby' => 'post__in'
);
$related_products = new WP_Query($rargs);
$related_p = new WC_Product_Factory();
$related_title = "Related Accessories";
} else {
$rargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'DESC',
'post__not_in' => array($post->ID),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $prod_cat_id,
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
),
array(
'taxonomy' => 'product_visibility',
'field' => 'slug',
'terms' => 'exclude-from-catalog', // Possibly 'exclude-from-search' too
'operator' => 'NOT IN'
)
)
);
$related_products = new WP_Query($rargs);
$related_p = new WC_Product_Factory();
$related_title = "Similar Products";
}
?>
<div class="container">
<h3 class="title text-center mb-4"><?php echo $related_title; ?></h3>
<div class="row">
<?php
if ( $related_products->have_posts() ) {
while ( $related_products->have_posts() ) : $related_products->the_post();
$r_product_queried_object = get_queried_object();
$product = $related_p->get_product($post->ID);
$attachment_ids = $product->get_gallery_attachment_ids();
$currency_symbol = get_woocommerce_currency_symbol();
$product_to_be_labeled_as_new = get_field('product_to_be_labeled_as_new',$post->ID);
$product_detail_page_link = get_field('product_detail_page_link',$post->ID);
if(!empty($product_detail_page_link)) {
$product_page_link = $product_detail_page_link.'?op='.$post->post_name;
} else {
$product_page_link = get_permalink( $product->ID );
}
$i = 0;
?>
<div class="col-12 col-sm-6 col-md-6 col-lg-2 d-none">
<div class="product product-2">
<figure class="product-media">
<?php if( $product->is_on_sale() ) { ?>
<span class="product-label label-circle label-sale">Sale</span>
<?php } else { ?>
<?php if($product_to_be_labeled_as_new == 'Yes') { ?>
<span class="product-label label-circle label-new">New</span>
<?php } ?>
<?php } ?>
<a href="<?php echo $product_page_link; ?>">
<?php
$product_featured_image = wp_get_attachment_image_url( $product->get_image_id(),'product-listing-size' );
if(!empty($product_featured_image)) { ?>
<img src="<?php echo $product_featured_image; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image">
<?php }
if(!empty($attachment_ids)) {
foreach( $attachment_ids as $attachment_id ) {
$Original_image_url = wp_get_attachment_image_url( $attachment_id,'product-listing-size' );
if( $i == 0 ) { ?>
<img src="<?php echo $Original_image_url; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image-hover">
<?php }
$i++; }
} else { ?>
<img src="<?php echo $product_featured_image; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image-hover">
<?php } ?>
</a>
<div class="product-action-vertical">
<?php
echo do_shortcode('[yith_wcwl_add_to_wishlist product_id="'.$post->ID.'"]'); ?>
</div><!-- End .product-action -->
<div class="product-action product-action-dark d-none">
<a href="<?php echo $product_page_link; ?>" class="btn-product btn-cart" title="Add to cart"><i class="fal fa-lightbulb-on"></i> <span>More Info</span></a>
<?php echo do_shortcode('[yith_compare_button product="'.$product->ID.'"]'); ?>
<!--<a href="#" class="btn-product btn-compare" title="Compare"><i class="fal fa-exchange"></i> <span>compare</span></a>-->
</div><!-- End .product-action -->
</figure><!-- End .product-media -->
<div class="product-body">
<h3 class="product-title" title="<?php echo get_the_title($product->ID); ?>"><a href="<?php echo $product_page_link; ?>"><?php echo get_the_title($product->ID); ?></a></h3><!-- End .product-title -->
<div class="product-price">
<?php
if( $product->is_type( 'simple' ) ) {
if( $product->is_on_sale() ) { ?>
<span class="new-price"><?php echo $currency_symbol.number_format($product->get_sale_price()); ?></span>
<span class="old-price"><?php echo $currency_symbol.number_format($product->get_regular_price()); ?></span>
<?php } else { ?>
<span class="new-price"><?php echo $currency_symbol.number_format($product->get_price()); ?></span>
<?php }
} elseif( $product->is_type( 'variable' ) ){
echo $product->get_price_html();
} ?>
</div><!-- End .product-price -->
<!--<a href="<?php echo $product_page_link; ?>" class="btn ivenus-solid-btn"><i class="fal fa-shopping-cart"></i> Buy Now</a>-->
</div><!-- End .product-body -->
</div>
</div>
<?php
endwhile;
} else {
echo _e('<p>Thank you for your interest, but currently there are no related products available.</p>');
}
wp_reset_postdata();
?>
<?php
$related_accessories = get_field('related_accessories',$product->ID);
if( isset($related_accessories) && !empty($related_accessories) ){
$rargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'post__in' => $related_accessories,
'orderby' => 'post__in',
);
$featured_products = new WP_Query($rargs);
//$related_p = new WC_Product_Factory();
//$related_title = "Related Accessories";
} else {
$rargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'DESC',
'post__not_in' => array($post->ID),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $prod_cat_id,
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
),
array(
'taxonomy' => 'product_visibility',
'field' => 'slug',
'terms' => 'exclude-from-catalog', // Possibly 'exclude-from-search' too
'operator' => 'NOT IN'
)
)
);
$featured_products = new WP_Query($rargs);
//$related_p = new WC_Product_Factory();
}
/* $fargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => '-1',
'orderby' => 'date',
'order' => 'DESC',
'post__in' => wc_get_featured_product_ids()
);
$featured_products = new WP_Query($fargs);*/
$featured_p = new WC_Product_Factory(); ?>
<?php
if ( $featured_products->have_posts() ) {
?>
<div class="owl-carousel owl-simple carousel-equal-height carousel-with-shadow" data-toggle="owl"
data-owl-options='{
"dots": true,
"margin": 20,
"loop": false,
"responsive": {
"0": {
"items":1,
"nav": false
},
"480": {
"items":2,
"nav": false
},
"768": {
"items":3,
"nav": false
},
"992": {
"items":4,
"nav": false
},
"1200": {
"items":5,
"nav": true
},
"1600": {
"items":6,
"nav": true
}
}
}'>
<?php
while ( $featured_products->have_posts() ) : $featured_products->the_post();
$f_product_queried_object = get_queried_object();
$product = $featured_p->get_product($post->ID);
$attachment_ids = $product->get_gallery_attachment_ids();
$currency_symbol = get_woocommerce_currency_symbol();
$product_to_be_labeled_as_new = get_field('product_to_be_labeled_as_new',$post->ID);
$product_detail_page_link = get_field('product_detail_page_link',$post->ID);
if(!empty($product_detail_page_link)) {
$product_page_link = $product_detail_page_link.'?op='.$post->post_name;
} else {
$product_page_link = get_permalink( $product->ID );
}
$i = 0;
?>
<div class="product product-2">
<figure class="product-media">
<?php if( $product->is_on_sale() ) { ?>
<span class="product-label label-circle label-sale">Sale</span>
<?php } else { ?>
<?php if($product_to_be_labeled_as_new == 'Yes') { ?>
<span class="product-label label-circle label-new">New</span>
<?php } ?>
<?php } ?>
<a href="<?php echo $product_page_link; ?>">
<?php
$product_featured_image = wp_get_attachment_image_url( $product->get_image_id(),'product-listing-size' );
if(!empty($product_featured_image)) { ?>
<img src="<?php echo $product_featured_image; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image">
<?php }
if(!empty($attachment_ids)) {
foreach( $attachment_ids as $attachment_id ) {
$Original_image_url = wp_get_attachment_image_url( $attachment_id,'product-listing-size' );
if( $i == 0 ) { ?>
<img src="<?php echo $Original_image_url; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image-hover">
<?php }
$i++; }
} else { ?>
<img src="<?php echo $product_featured_image; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image-hover">
<?php } ?>
</a>
<div class="product-action-vertical">
<?php echo do_shortcode('[yith_wcwl_add_to_wishlist product_id="'.$product->get_id().'"]'); ?>
</div><!-- End .product-action -->
<div class="product-action product-action-dark d-none">
<a href="<?php echo $product_page_link; ?>" class="btn-product btn-cart" title="Add to cart"><i class="fal fa-lightbulb-on"></i> <span>More Info</span></a>
<?php echo do_shortcode('[yith_compare_button product="'.$product->ID.'"]'); ?>
<!--<a href="#" class="btn-product btn-compare" title="Compare"><i class="fal fa-exchange"></i> <span>compare</span></a>-->
</div><!-- End .product-action -->
</figure><!-- End .product-media -->
<div class="product-body">
<h3 class="product-title" title="<?php echo get_the_title($product->ID); ?>"><a href="<?php echo $product_page_link; ?>"><?php echo get_the_title($product->ID); ?></a></h3><!-- End .product-title -->
<div class="product-price">
<?php
if( $product->is_type( 'simple' ) ) {
if( $product->is_on_sale() ) { ?>
<span class="new-price"><?php echo $currency_symbol.number_format($product->get_sale_price()); ?></span>
<span class="old-price"><?php echo $currency_symbol.number_format($product->get_regular_price()); ?></span>
<?php } else { ?>
<span class="new-price"><?php echo $currency_symbol.number_format($product->get_price()); ?></span>
<?php }
} elseif( $product->is_type( 'variable' ) ){
echo $product->get_price_html();
} ?>
</div><!-- End .product-price -->
<!--<a href="<?php echo $product_page_link; ?>" class="btn ivenus-solid-btn"><i class="fal fa-shopping-cart"></i> Buy Now</a>-->
</div><!-- End .product-body -->
</div>
<?php
endwhile;
?>
</div>
<?php
} else {
echo _e('<p>Thank you for your interest, but currently there are no featured products available. Please check back later.</p>');
}
wp_reset_postdata();
?>
</div>
</div>
</section>
</div>
<?php do_action( 'woocommerce_after_single_product' ); ?>