<?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;
}
?>
<div id="product-<?php the_ID(); ?>" <?php wc_product_class( 'my_prod_wrap', $product ); ?>>
<div class="row rowSingleShopTop">
<div class="col-md-7 cl">
<?php woocommerce_breadcrumb(array('delimiter' => ' <span>></span> ')); ?>
<?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' );
?>
<?php
//same single-produkty.php
//$images = get_field('product_gallery');
//$size = 'full'; // (thumbnail, medium, large, full or custom size)
//if( $images ):
?>
<?php
$attachment_ids = $product->get_gallery_image_ids();
$images = $attachment_ids;
if(!$images) { //show only thumbnail in gallery
$images = array();
if(has_post_thumbnail()) {
array_push($images, get_post_thumbnail_id());
}
else {
array_push($images, 200); //200 - media id default
}
}
?>
<div class="wrapSliderFor1">
<div class="appArrows"></div>
<div class="slider-for slick-slider-all">
<?php foreach( $images as $image ): ?>
<div class="singleProdBigImg">
<div class="sub">
<?php //$src_img = wp_get_attachment_image_src($image['ID'], 'large')[0]; ?>
<?php //$src_img_full = wp_get_attachment_image_src($image['ID'], 'large')[0]; ?>
<?php $src_img = wp_get_attachment_image_src($image, 'large')[0]; ?>
<?php $src_img_full = wp_get_attachment_image_src($image, 'large')[0]; ?>
<?php //echo wp_get_attachment_image( $image['ID'], 'full', false, array( "class" => "" ) ); ?>
<img class="my-lens" data-big="<?php echo $src_img_full; ?>" src="<?php echo $src_img; ?>" alt="">
</div>
</div>
<?php endforeach; ?>
</div>
</div><!--wrapSliderNav-->
<div class="wrapSliderNav1">
<div class="slider-nav slick-slider-all">
<?php foreach( $images as $image ): ?>
<div class="">
<div class="sub">
<?php echo wp_get_attachment_image( $image, 'full', false, array( "class" => "" ) ); ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<div class="col-md-5 cr">
<div class="sub pl-md-8">
<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>
</div>
</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>
<?php do_action( 'woocommerce_after_single_product' ); ?>
<div class="clearfix mt-8"></div>
</div> <?php // container-woo ?>
<?php if('' !== get_post()->post_content) : ?>
<div class="container container-short mb-8">
<div class="head-title">Opis produktu</div>
<div class="desc">
<?php the_content(); ?>
</div>
</div>
<?php endif; ?>
<?php if(get_field('product_table_on')) : ?>
<div class="table-wrap-prod">
<div class="head-title"><?php the_field('product_table_name'); ?></div>
<?php if ( have_rows('product_table') ) : while( have_rows('product_table') ) : the_row(); ?>
<div class="sub-row-table-pars">
<div class="row row-table-pars">
<div class="col-6 cll"><div class="sub"><?php the_sub_field('p1'); ?></div></div>
<div class="col-6 crr"><div class="sub"><?php the_sub_field('p2'); ?></div></div>
</div>
</div>
<?php endwhile; endif; ?>
</div>
<?php endif; ?>
<?php if ( have_rows('related_products') ) : $related_products = array(); while( have_rows('related_products') ) : the_row(); ?>
<?php $related_products[] = get_sub_field('product'); ?>
<?php endwhile; endif; ?>
<?php
if(!$related_products) {
$terms = get_the_terms( get_the_ID() , 'product_cat' );
$args = array(
'showposts' => 4,
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id', //This is optional, as it defaults to 'term_id'
'terms' => array($terms[0]->term_id),
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
),
),
);
}
else {
$args = array(
'showposts' => -1,
'post_type' => 'product',
);
$args['post__in'] = $related_products;
$args['orderby'] = 'post__in';
}
$query = new WP_Query( $args );
?>
<?php if( $query->have_posts() ) : ?>
<div class="related-section mt-md-10">
<div class="container container-short">
<div class="head-title">Zobacz również</div>
<div class="row justify-content-center">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-6 col-md-3 col-woo-related">
<?php include (locate_template( 'parts/part-woo-related.php' )); ?>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
<div> <?php //empty for container-woo ?>