Untitled

 avatar
unknown
plain_text
2 years ago
44 kB
3
Indexable
<?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 woocommerce_output_all_notices - 10
 */
?>
<?php

if(get_field('czy_preorder')=="Tak"){
	remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
	add_action('woocommerce_single_product_summary',function(){
		echo '<div class="preorderprice"><span class="preorderpreprice">NIŻSZA CENA W PREORDERZE</span>'. wc_get_product(get_the_ID() )->get_price_html().'<small>Oferta łączy się z kodami promocyjnymi. </small></div>';
	},10);
}



if ( post_password_required() ) {
	echo get_the_password_form(); // WPCS: XSS ok.
	return;
}
$typ='';
if(isset($_GET['switch-subscription']))
	$typ.='switch-sub ';
	if($product->get_type()=='variable-subscription')
		$typ.='variable-sub '
?> 
<div id="product-
	<?php the_ID(); ?>" <?php wc_product_class( $typ, $product ); ?>>

	<div class="container"><?php
do_action( 'woocommerce_before_single_product' );
?>
</div>
  <div class="container firstcont"> <?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
		 */
		if(!get_field('wybierz_produkt_subskrypcyjny')&&!has_term('subskrypcje','product_cat')){

		add_action('woocommerce_single_product_summary',function(){
			if(get_field('czy_preorder')!='Tak')
			echo do_shortcode('[omnibus_price_message]');
			?>
		
			<?php

		},10);
	}



		add_action('woocommerce_single_product_summary',function(){?> <div class="entry-summary__descbefore"> <?php the_field('krotki_opis_nad'); ?> </div> <?php if(isset($_GET["switch-subscription"])) echo '<div class="changesub">Zmiana subskrypcji:</div>'; ?><?php ;},20); 


if(has_term('subskrypcje','product_cat'))
	remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );

if(get_field('wybierz_produkt_subskrypcyjny')){

	remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

	add_action('woocommerce_single_product_summary',function(){
		global $product;
		?>
		<div class="zakupy">
<div id="zakup-wrapper-jednorazowy" class="rodzajzakupu rodzajzakupu-active">
	<div class="nameprice"><label><input type="radio" checked name="zakup" value="jednorazowy"> Zakup jednorazowy</label>
	<?php woocommerce_template_single_price(); 
				
		?>
		</div>
		
		<div class="cena-za-sztuke">
		<?php 
			global $product;
			$cena_sztuka = get_field('cena_za_sztuke');
			$cena_sztuka = wmc_get_price( $cena_sztuka, get_woocommerce_currency() );
			if ($cena_sztuka != 0) {
				echo 'Cena za sztukę: <span class="cena-za-sztuke-value"><p class="price">' . wc_price($cena_sztuka, array('currency' => '')) . '</p></span>';
			}
		?>
		</div>
		<?php  echo '<div class="singleomnibus">'.do_shortcode('[omnibus_price_message]').'</div>';?>
	
	<div class="zakup-wrapper toHide" id="zakup-jednorazowy">
		<?php echo do_shortcode('[add_to_cart_form id='.$product->get_id().']'); ?> 
			<div class="entry-summary_paypo"> 
				<div class="paypocart paypocart-white">
					<form class="cart" method="post" enctype="multipart/form-data">
						<button type="submit" name="add-to-cart" value="<?php echo get_the_ID();?>" class="single_add_to_cart_button button alt wp-element-button"></button>
					</form>
				</div>
			</div>
	</div>
</div>
<div  id="zakup-wrapper-subskrypcja"  class="rodzajzakupu">
		<div class="nameprice"><label><input type="radio" name="zakup" id="zakupsub" value="subskrypcja"> Subskrypcja</label>
			<span class="varprice">
			<?php $sub = wc_get_product(get_field('wybierz_produkt_subskrypcyjny'));

			echo $sub->get_price_html(); 
				//echo do_shortcode('[omnibus_price_message]');
		?></span></div>
		
		<div class="cena-za-sztuke">
		<?php 
			global $product;
			$cena_sztuka = get_field('cena_za_sztuke_subskrypcja');
			$cena_sztuka = wmc_get_price( $cena_sztuka, get_woocommerce_currency() );
			if ($cena_sztuka != 0) {
				echo 'Cena za sztukę: <span class="cena-za-sztuke-value"><p class="price">' . wc_price($cena_sztuka, array('currency' => '')) . '</p></span>';
			}
		?>
		</div>
		
				<?php  echo '<div class="singleomnibus varomnbius">'.do_shortcode('[omnibus_price_message id='.get_field('wybierz_produkt_subskrypcyjny').']').'</div>';?>
	<div class="zakup-wrapper toHide" style="display:none;" id="zakup-subskrypcja">
		<?php echo do_shortcode('[add_to_cart_form id='.get_field('wybierz_produkt_subskrypcyjny',$product->get_id()).']'); ?>
		<div class="sub-adv">
			<img src="https://mybestpharm.com/wp-content/uploads/2023/03/zaleta1.svg"><p>stała, niższa cena</p>
		</div>
		<div class="sub-adv">
			<img src="https://mybestpharm.com/wp-content/uploads/2023/03/zaleta2.svg"><p>anuluj lub zawieś subskrypcję w dowolnym momencie</p>
		</div>
		<div class="sub-adv">
			<img src="https://mybestpharm.com/wp-content/uploads/2023/03/zaleta3.svg"><p>zmień adres dostawy w dowolnym momencie</p>
		</div>
	</div>

</div>
</div>
<script>
		jQuery(document).ready(function($) {
			$(function() {
		$("option[value='3-miesiace'").text($("option[value='3-miesiace'").text()+' (-13%)');
				$("option[value='6-miesiecy'").text($("option[value='6-miesiecy'").text()+' (-16%)');
				$('#pa_okres').on('change', function() {
				if($(this).find(":selected").val()!='')
					setTimeout(() => {
						jQuery('#realizacjawysylki').hide();
  jQuery('#realizacjawysylki-cykli').show(); },1000);
else{
				jQuery('#realizacjawysylki').hide();
	jQuery('#realizacjawysylki-cykli').hide();
}
});
    $("[name=zakup]").click(function(){
            $('.toHide').hide();
            $("#zakup-"+$(this).val()).show();
            	var oppo = 'jednorazowy';
            if($(this).val()=='jednorazowy'){
            	var oppo = 'subskrypcja';
            }

             $("#zakup-wrapper-"+$(this).val()).addClass("rodzajzakupu-active")
             $("#zakup-wrapper-"+oppo).removeClass("rodzajzakupu-active")
		
    });
	let url = window.location.href;
	if(url.includes('sub=true')){
				$("#zakupsub").click();
				$('html, body').animate({
        scrollTop: $(".zakupy").offset().top-300
    }, 0);
			 }
 });
		});

	</script>
		<?php
	},30);


}


		add_action('woocommerce_single_product_summary',function(){
			if(get_field('czy_preorder')=='Tak') echo '<div class="preorder-product"><b>PREORDER: </b>'.get_field('tekst_kolo_przycisku').'</div>';
		},34);




if(!get_field('wybierz_produkt_subskrypcyjny')&&!has_term('subskrypcje','product_cat')){
		add_action('woocommerce_single_product_summary',function(){?> 
			<div class="entry-summary_paypo"> 
				<div class="paypocart">
					<form class="cart" method="post" enctype="multipart/form-data">
						<button type="submit" name="add-to-cart" value="<?php echo get_the_ID();?>" class="single_add_to_cart_button button alt wp-element-button"></button>
					</form>
				</div>
			</div>
		<?php ;},35);
	}
		add_action('woocommerce_single_product_summary',function(){?> <div class="entry-summary__descafter"> <?php the_field('krotki_opis'); ?> </div> <?php ;},40); 

		add_action('woocommerce_single_product_summary',function(){?> <div class="entry-summary__accords"> <?php
					if(have_rows('rozwijalne_1')):
						echo '
				<div class="accordion" id="accordionPanels1">';
						$i=0;
						while(have_rows('rozwijalne_1')) : the_row();
							$i+=1;
							echo '  
					<div class="accordion-item">
						<h2 class="accordion-header" id="panels-heading'.$i.'">
							<div class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panels-collapse'.$i.'" aria-expanded="false" aria-controls="panels-collapse'.$i.'"> '.get_sub_field('tytul_rozwijalnej_sekcji').'</div>
						</h2>';
							echo '
						<div id="panels-collapse'.$i.'" class="accordion-collapse collapse" aria-labelledby="panels-heading'.$i.'">
							<div class="accordion-body">'.get_sub_field('tresc_sekcji').'  </div>';
							if(str_contains(get_sub_field('tytul_rozwijalnej_sekcji'),'Składniki')||str_contains(get_sub_field('tytul_rozwijalnej_sekcji'),'SKŁADNIKI')){
								echo '<div class="indglink"><a href="#indgtable">TABELA SKŁADNIKÓW I DAWKOWNIE </a></div>';

							}
						echo '</div>
					</div>';
						endwhile;
						echo '
				</div>';
					endif;
					if(get_field('sekcja_z_wynikami')['galeria']){
						echo '<div id="gotoresults" class="showresults">Wyniki badań</div>';
					}
				?> </div> <?php ;},50); 


		remove_action('woocommerce_single_product_summary','woocommerce_template_single_meta',40);
		remove_action('woocommerce_single_product_summary','woocommerce_template_single_rating',10);
		remove_action('woocommerce_single_product_summary','woocommerce_template_single_sharing',50);
		do_action( 'woocommerce_single_product_summary' );
		?> </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
	 */

	add_action('woocommerce_after_single_product_summary',function(){
		if(have_rows('ikony_1')):
		?> 
		<div class="container product-content__icons py-8">
			<div class="row">
				<?php
					$i=0;
					while(have_rows('ikony_1')) : 
						the_row();?>
						<div class="col-md-3 align-items-center d-flex text-center flex-column position-relative">
						<?php if ( str_contains(get_sub_field('tytul_ikony'),'lekarzy')){?>
							<a href="#experttip" class="overlay-link">
						<?php
							}
							$icon = get_sub_field('ikona');
							if ( !empty( $icon ) ):
								$url = $icon['url'] ;
								$ext = pathinfo( $url, PATHINFO_EXTENSION ); ?> 
								<div class="icons"> 
									<?php 
									if ( $ext == 'svg' ):
										$test =  file_get_contents( $url ) ;
										$i+=1;
										echo $test;
									else: ?> 
										<img src="<?php echo $url; ?>" alt="<?php echo $alt; ?>"> 
									<?php endif; ?> 
								</div> 
							<?php endif;?>
							<h4><?php echo get_sub_field('tytul_ikony');?></h4>
							<?php  if ( str_contains(get_sub_field('tytul_ikony'),'lekarzy')){
								?></a>
								<?php } ?>
						</div>
					<?php endwhile;?>
			</div> 
		</div> 
<?php endif; ;},0); 

add_action('woocommerce_after_single_product_summary',function(){?> <?php if( have_rows('pierwsza_sekcja_opisowa') ): while ( have_rows('pierwsza_sekcja_opisowa') ) : the_row(); ?> <div class="product-content__adv">
    <div class="row">
      <div class="col-md-6 imgcol">
        <img src="<?php the_sub_field('zdjecie_produktowe'); ?>"  width=100%></img>
      </div>
      <div class="col-md-6 contentcol justify-content-center d-flex flex-column">
		<div class="overlay"></div>
		<div class="content">
        <h4 class="section-subtitle"> <?php the_sub_field('podtytul'); ?> </h4>
        <h3 class="section-title"> <?php the_sub_field('tytul'); ?> </h3> <?php if(have_rows('lista_zalet')):
					echo '
					<ul>';
					while(have_rows('lista_zalet')) : the_row();
						echo '
						<li><span class="list-icon"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><rect x="10.0005" y="6.46436" width="5" height="5" transform="rotate(45 10.0005 6.46436)" fill="#C29B36"></rect><rect x="10.0005" y="0.706618" width="13.1427" height="13.1427" transform="rotate(45 10.0005 0.706618)" stroke="#C29B36"></rect></svg></span><span class="list-text">'.get_sub_field('tresc_punktu').'</span></li>';
					endwhile;
					echo '
					</ul>';
				endif;
				?>
		</div>
      </div>
			</div>
    </div> <?php endwhile; endif; },10); 

<?php if (!empty(get_field('sekcja_pierwsza_cudaki')['tekst_cudaki'])) : ?>
  <section class="standard-section sub-first">
    <div class="container">
      <div class="row">
        <div class="col-md-6 img-col">
          <?php echo wp_get_attachment_image(get_field('sekcja_pierwsza_cudaki')['obraz_cudaki'], 'full'); ?>
        </div>
        <div class="col-md-6 content-col">
          <h3 class="section-title"><?php echo get_field('sekcja_pierwsza_cudaki')['tekst_cudaki']; ?></h3>
          <p class="section-content"><?php echo get_field('sekcja_pierwsza_cudaki')['opis_cudaki']; ?></p>
        </div>
      </div>
    </div>
  </section>
<?php endif; ?>


add_action('woocommerce_after_single_product_summary',function(){
if( get_field('badania')['liczby_z_badan']||get_field('badania')['typ_sekcji']=='zest'): 
	if( have_rows('badania') ): 
		while ( have_rows('badania') ) : 
			the_row(); 
			 	if (get_field('badania')['typ_sekcji']=='poj'){ ?>
					<div id="counter" class="product-content__counters py-8">
						<div class="container">
							<div class="row">
								<div class="col-md-12 justify-content-center d-flex">
									<h3> <?php the_sub_field('tytul_sekcji');?> </h3>
								</div>
							</div>
							<?php if(have_rows('liczby_z_badan')):?>
								<div class="row">
									<?php while(have_rows('liczby_z_badan')) : 
										the_row();?>
										<div class="col-md-3 align-items-center d-flex flex-column">
											<div class="d-flex flex-row count-value">
												<span class="counter-value" data-count="<?php the_sub_field('liczba')?>">
													<?php the_sub_field('liczba');?>
												</span>
												<?php the_sub_field('jednostka'); ?>
											</div>
													<p class="text-center"><?php the_sub_field('tytul');?></p>
										</div>
									<?php endwhile ;?>
								</div>
							<?php endif; ?>
							<div class="row smallinfo">
								<?php the_sub_field('dopisek');?>
							</div>
						</div>
					</div> 
				<?php }
				else {
		 			if( have_rows('sekcje_licznikow') ): 
						$i=0;
						while ( have_rows('sekcje_licznikow') ) : 
							$i+=1;
							the_row(); ?>
							<?php if($i==1){?>
								<div id="counter" class="product-content__counters counters-multiple py-8">
								<?php } else { ?>
							<div id="counter<?php  echo $i;?>" class="product-content__counters counters-multiple py-8">
							<?php } ?>
								<div class="container">
									<div class="row">
										<div class="col-md-12">
											<h3><?php the_sub_field('tytul_sekcji');?></h3>
											<div class="counter-sep"><img decoding="async" width="535" height="5" src="https://mybestpharm.com/wp-content/uploads/2022/12/sep.jpg" class="attachment-large size-large wp-image-9330" alt="" srcset="https://mybestpharm.com/wp-content/uploads/2022/12/sep.jpg 535w, https://mybestpharm.com/wp-content/uploads/2022/12/sep-300x3.jpg 300w" sizes="(max-width: 535px) 100vw, 535px" data-xoowscfly="fly"></div>
											<h4><?php the_sub_field('slogan_sekcji');?></h4>
										</div>
									</div>
											<?php if(have_rows('liczby_z_badan')):?>
												<div class="row">
													<?php while(have_rows('liczby_z_badan')) : 
														the_row();?>
														<div class="col-md-3 align-items-center d-flex flex-column">
															<div class="d-flex flex-row count-value">
																<span class="counter-value" data-count="<?php the_sub_field('liczba')?>">
																	<?php the_sub_field('liczba');?>
																</span>
																<?php the_sub_field('jednostka'); ?>
															</div>
																	<p class="text-center"><?php the_sub_field('tytul');?></p>
														</div>
													<?php endwhile ;?>
												</div>
												
												<div class="row smallinfo">
								<?php the_sub_field('dopisek');?>
							</div>
													</div>
							</div>
											<?php endif; ?>
		 				<?php endwhile; 
					endif;
				}
	 		endwhile;
		?>
	<script>
	
			jQuery(document).ready(function($) {
				var a = 0;
				$(window).scroll(function() {
  					var oTop = $('#counter').offset().top - window.innerHeight;
  					if (a == 0 && $(window).scrollTop() > oTop) {
						$('.counter-value').each(function () {
    $(this).prop('Counter',0).animate({
        Counter: $(this).text()
    }, {
        duration: 4000,
        easing: 'swing',
        step: function (now) {
            $(this).text(Math.ceil(now));
        }
    });
});
 
    				a = 1;
  					}
				});  
			});  

</script>
	<?php endif; endif; },20); 

add_action('woocommerce_after_single_product_summary',function(){if(get_field('efekty')){?> <div id="effects" class="effects product-content__effects py-8">
      <div class="container">
        <div class="row">
          <div class="col-md-8">
            <h2 class="section-title"> <?php echo get_field('tytul_sekcji_prawdziwe_efekty');?>  </h2>

          </div>
          <div class="col-md-4">
            <div class="effects-nav custom-nav">
              <a class="prev-effect">
                <i class="fas fa-chevron-left"></i>
              </a>
              <a class="next-effect">
                <i class="fas fa-chevron-right"></i>
              </a>
            </div>
          </div>
        </div>

        <div class="effects-slider">  
			<?php foreach(get_field('efekty') as $efekt){?>
          <div class="slider-item">
            <div class="row">
				<div class="col-md-6 effect-single__content">
					<p>
					<span><?php echo get_post_field('post_title',$efekt);?></span> <?php echo get_post_field('post_content',$efekt);?>
					</p>
					<?php if(get_field('nazwa_ig',$efekt)){?>
					<div class="effect-ig">
					<i class="fab fa-instagram"></i>
					<a href="<?php echo get_field('url_ig',$efekt);?>" target="_blank"><?php echo get_field('nazwa_ig',$efekt);?></a>
					</div>
					<?php }?>
				</div>
				<div class="col-md-6 effect-single__img">
					<a href="<?php echo get_field('url_ig',$efekt);?>" target="_blank">
						<?php echo get_the_post_thumbnail($efekt,'large');?>
					</a>
				</div>
            </div>
          </div>
		  <?php } ?>
        </div>
	
      </div>
</div>
      <script>
        jQuery(document).ready(function($) {
          $('.effects-slider').slick({
            slidesToShow: 1,
            appendArrows: $('.effects-nav'),
            prevArrow: $('.prev-effect'),
            nextArrow: $('.next-effect'),
            slidesToScroll: 1,
            dots: false,
            autoplay: true,
            autoplaySpeed: 2000,
            ifinite: true,
            responsive: [{
              breakpoint: 800,
              settings: {
                slidesToShow: 1,
                slidesToScroll: 1,
                dots: true,
              }
            }]
          });
        });
      </script>
	</div> <?php } },30); 

add_action('woocommerce_after_single_product_summary',function(){
	if(get_field('sekcja_wideo')['tytul']){
$tytul = get_field('sekcja_wideo')['tytul'];
$podtytul = get_field('sekcja_wideo')['podtytul'];
$tresc = get_field('sekcja_wideo')['tresc'];
$wideo = get_field('sekcja_wideo')['wideo'];
$plakat = get_field('sekcja_wideo')['plakat_wideo'];
?>
<div id="video" class="video py-8">
      <div class="container">
        <div class="row">
        	<div class="col-md-6 contentcol">
        		<div class="content">
        		              <h4 class="section-subtitle"> <?php echo $podtytul; ?> </h4>
              <h3 class="section-title"> <?php echo $tytul;?></h3>
              <p><?php echo $tresc;?></p>
</div>
        	</div>
        	<div class="col-md-6 video-col">
        		<div id="playvideo" class="active">

<svg fill="#000000" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
	 viewBox="0 0 60 60" xml:space="preserve">
<g>
	<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"/>
</g>
</svg></div>
        		<video id="instruction-video" preload="auto" width="100%"  poster="<?php echo $plakat;?>">
        			<source src="<?php echo $wideo;?>" type="video/mp4">
        		</video>
        		<script>
        			        jQuery(document).ready(function($) {
        			$( document ).ready(function() {
						var ctrlVideo = document.getElementById("instruction-video"); 
						$('#playvideo').click(function(){
							console.log('test');
						  if ($('#playvideo').hasClass("active")){
						    ctrlVideo.play();
						    ctrlVideo.setAttribute('controls','');
						    $('#playvideo').hide();
						    $('#playvideo').toggleClass("active");
						  } 
						});
 
					});
        		});
        		</script>
      
        	</div>
        </div>
    </div>
</div>
<?php
	}
});
add_action('woocommerce_after_single_product_summary',function(){?> <?php
	$wybor = get_field('skladniki');
	if($wybor){
	?> <div class="product-content__ingredients ">
        <div class="container py-8">
          <h3><?php the_field('tytul_kafelki_skladnikow');?></h3>
          <div class="intiles"> <?php
						foreach($wybor as $wybor1){
						$wybor0 = getskladnikdata($wybor1);
						$nazwa = explode("#",$wybor0['nazwa_skladnika'])[0];
					?> <div class='intile'>
              <div class="intitle"> <?php echo $nazwa;?> </div>
              <div class="indesc"> <?php echo $wybor0['opis_skladnika'];?> </div>
              <div class="inimg">
                <img src="
										<?php echo $wybor0['zdjecie_skladnika']['url'];?>" alt="
										<?php echo $wybor0['nazwa_skladnika'];?>">
              </div>
              <div class="btimg">
                <img src="https://mybestpharm.com/wp-content/uploads/2022/11/pazlote-1.png" />
              </div>
            </div> <?php 
						} 
					?> </div>
          <div class="showmorebtn"><div class="button primary-button" id="moreindg">Pokaż więcej </div></div>
        </div>
      </div>
      <script>
        jQuery(document).ready(function($) {
          const button = $("#moreindg");
          const indgs = $(".intile");
          var counter = 2;
          if (indgs.length < 4) 
		  	button.hide();
          indgs.each(function(i) {
            if (i > counter) 
				$(this).hide(50);
          });
          button.click(function() {
            indgs.each(function(i) {
              if (i <= counter + 3) $(this).show(200);
            });
            counter = counter + 3;
            if (counter >= indgs.length - 1) {
              button.hide(50);
            }
          });
        });
      </script> <?php	
	}
},40); 

add_action('woocommerce_after_single_product_summary',function(){ if(get_field('tytul_sekcji_spolecznosc')){?>

 <div class="product-content__gallery py-8">
        <div class="container">
          <div class="row py-4">
            <div class="col-md-8">
              <h2 class="section-title"> <?php echo get_field('tytul_sekcji_spolecznosc');?> </h2>
            </div>
            <div class="col-md-4">
              <div class="clients-nav custom-nav">
                <a class="prev-effect">
                  <i class="fas fa-chevron-left"></i>
                </a>
                <a class="next-effect">
                  <i class="fas fa-chevron-right"></i>
                </a>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="clients-gallery"> <?php 
		
		foreach (get_field('galeria_spolecznosci') as $image){
			?> <div class="gallery-item">
				<a class="glightbox" href="<?php echo $image['url'];?>" data-gallery="spolecznosc">
                	<img src="<?php echo $image['sizes']['medium']; ?>" alt="<?php echo $image['alt'];?>" />
				</a>
              </div> <?php 
		}
		?> </div>
          </div>
        </div>
      </div>
      <script>
        jQuery(document).ready(function($) {
          $('.clients-gallery').slick({
            slidesToShow: 5,
            slidesToScroll: 1,
            responsive: [{
              breakpoint: 800,
              settings: {
                slidesToShow: 1,
                slidesToScroll: 1,
                dots: true,
              }
            }, {
              breakpoint: 1024,
              settings: {
                slidesToShow: 3,
                slidesToScroll: 1,
              }
            }, {
              breakpoint: 800,
              settings: {
                slidesToShow: 2,
                slidesToScroll: 1,
              }
            },{
              breakpoint: 1300,
              settings: {
                slidesToShow: 3,
                slidesToScroll: 1,
              }
            }],
            dots: false,
            autoplay: true,
            autoplaySpeed: 2000,
            ifinite: false,
            appendArrows: $('.clients-nav'),
            prevArrow: $('.prev-effect'),
            nextArrow: $('.next-effect'),
          });
        });
      </script> <?php
	}
},50); 



add_action('woocommerce_after_single_product_summary',function(){?> <?php if( have_rows('sekcja_ekspert_kopia') ): while ( have_rows('sekcja_ekspert_kopia') ) : the_row(); ?> 
<div id="experttip" class="product-content__exp py-8">
        <div class="container">
          <div class="row">
            <div class="col-md-6 imgcol">
				<?php if (get_sub_field('zdjecie_eksperta')){?>
              <img src="<?php echo get_sub_field('zdjecie_eksperta')['url']; ?>" width="100%"></img>
			  <?php } ?>
            </div>
            <div class="col-md-6 contentcol">
				<div class="content">
              <h4 class="section-subtitle"> <?php the_sub_field('podtytul_ekspert'); ?> </h4>
              <h3 class="section-title"> <?php the_sub_field('tytul_ekspert'); ?> </h3> <?php if(have_rows('lista_rad')):
						echo '
											<ul>';
						while(have_rows('lista_rad')) : the_row();
							echo '
							<li><span class="list-icon"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><rect x="10.0005" y="6.46436" width="5" height="5" transform="rotate(45 10.0005 6.46436)" fill="#C29B36"></rect><rect x="10.0005" y="0.706618" width="13.1427" height="13.1427" transform="rotate(45 10.0005 0.706618)" stroke="#C29B36"></rect></svg></span><span class="list-text">'.get_sub_field('rada').'</span></li>';
						endwhile;
						echo '
											</ul>';
					endif;
					?> <div class="exp-sign"> <?php the_sub_field('podpis_lekarza');?> </div>
              <div class="exp-desc"> <?php the_sub_field('opis_lekarza');?> </div>
				</div>
            </div>
          </div>
        </div>
		<?php if(get_sub_field('zdjecie_ig')){?>
        <div class="row row-sep mt-7">
          <div class="bg-animation separator" style="background-image:url('<?php echo get_sub_field('zdjecie_ig')['url'];?>');">
            <a href="
											<?php echo the_sub_field('link_ig');?>" target="_blank">
            </a>
          </div>
        </div>
		<?php }?>
      </div>
    </div>
  </div> <?php endwhile; endif; },60); 

add_action('woocommerce_after_single_product_summary',function(){?>
<div class="product-content__mbpcol pb-8" id="mbp3col">
<div class="container">
	<div class="row">
	<img decoding="async" width="180" height="84" class="logo-mbp" src="/wp-content/uploads/2022/10/logodark.svg" class="attachment-large size-large wp-image-5383" alt="">
	</div>
	<div class="row">
		<div class="col-md-4 mbp-col">
			<img decoding="async" width="448" height="545" src="/wp-content/uploads/2022/11/efekt.jpg" class="attachment-large size-large wp-image-5609" alt="" srcset="/wp-content/uploads/2022/11/efekt.jpg 448w, /wp-content/uploads/2022/11/efekt-247x300.jpg 247w" sizes="(max-width: 448px) 100vw, 448px">
			<a href="/efekty/" class="mbp-col__title">Efekt<a>
			<p class="mbp-col__content">
			MyBestPharm z obietnic tworzy efekty. Efekt to jest pierwsza rzecz, którą widzimy oczami wyobraźni tworząc nasze preparaty. Rezultat ma być widoczny, zaskakujący i spektakularny. Mamy tysiące dowodów na to, że to nie są puste obietnice.
			</p>
			<a href="/efekty/" class="button-underline" role="button" title="Efekty"> Zobacz przemiany </a>
		</div>
		<div class="col-md-4 mbp-col">
		<img decoding="async" width="672" height="818" src="/wp-content/uploads/2022/12/bezpieczenstwo-min.jpg" class="attachment-large size-large wp-image-6713" alt="" srcset="/wp-content/uploads/2022/12/bezpieczenstwo-min.jpg 672w, /wp-content/uploads/2022/12/bezpieczenstwo-min-600x730.jpg 600w, /wp-content/uploads/2022/12/bezpieczenstwo-min-246x300.jpg 246w" sizes="(max-width: 672px) 100vw, 672px">
		<a href="/eksperci//" class="mbp-col__title">Bezpieczeństwo<a>
			<p class="mbp-col__content">
			Wybieramy tylko składniki bezpieczne, klinicznie sprawdzone, o udowodnionym działaniu i chronione patentami, które posiadają silne dowody medyczne. Naszym zadaniem jest stworzyć naturalne, bezpieczne i skuteczne formuły.
			</p>
			<a href="/efekty/" class="button-underline" role="button" title="Nasi eksperci"> Poznaj zespół </a>
		</div>
		<div class="col-md-4 mbp-col">
		<img decoding="async" width="672" height="818" src="/wp-content/uploads/2023/01/wiarygodnosc-min.jpg" class="attachment-large size-large wp-image-10497" alt="" srcset="/wp-content/uploads/2023/01/wiarygodnosc-min.jpg 672w, /wp-content/uploads/2023/01/wiarygodnosc-min-246x300.jpg 246w, /wp-content/uploads/2023/01/wiarygodnosc-min-600x730.jpg 600w" sizes="(max-width: 672px) 100vw, 672px">
			<a class="mbp-col__title" href="/eksperci/#wyniki">Niezależne badania</a>
			<p class="mbp-col__content">
			Preparaty MyBestPharm są poddawane wysokiej standaryzacji. Dodatkowo są badane przez niezależne, akredytowane laboratorium Eurofins Polska, potwierdzającym każdorazowo czysty skład pozbawiony zanieczyszczeń.
			</p>
			<a href="/efekty/" class="button-underline" role="button" title="Wyniki badań"> Wyniki badań </a>
		</div>
	</div>
</div>
</div>
 <?php },70); 

add_action('woocommerce_after_single_product_summary',function(){
	if( have_rows('sekcja_z_wynikami') ): while ( have_rows('sekcja_z_wynikami') ) : the_row(); ?>
	<div class="product-content__results py-8">
		<div class="container">
			<div class="row">
				<div class="col-md-12 justify-content-center">
					<h3><?php the_sub_field('tytul');?></h3>
					<p><?php the_sub_field('opis');?></p>
					<?php if(get_sub_field('galeria')){?>
						<div class="results-gallery">
						<div class="button primary-button" id="showresults"><?php the_sub_field('tekst_przycisku');?></div>
						<div id="resultsgallery" style="display:none">
							<?php foreach(get_sub_field('galeria') as $image){ ?>
								<a href="<?php echo $image['url'];?>" class="glightbox" data-gallery="wyniki">
								<img width="100px"  src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt'];?>" />
							</a>
							<?php } ?>
						</div>
							</div>
					<?php } ?>
				</div>
			</div>
		</div>
	</div>
<?php endwhile; 
?>
<script>
    jQuery(document).ready(function($){
  	$("#gotoresults").click(function(){
  		 $("#resultsgallery").toggle(100);
  		var offset = $("#showresults").offset();
  		console.log(offset)
$('html, body').animate({
    scrollTop: offset.top-100
},100);
  		 
  	});
    $("#showresults").click(function(){
        $("#resultsgallery").toggle(100);
    })
    });
</script>
<?php
endif; },80); 

add_action('woocommerce_after_single_product_summary',function(){
	if( get_field('faq')['tytul'] ): while ( have_rows('faq') ) : the_row(); ?>
	<div class="product-content__faq py-8">
		<div class="container">
			<div class="row">
				<div class="col-md-12 justify-content-center">
					<h3><?php the_sub_field('tytul');?></h3>
					<?php 
					if(get_sub_field('typ_sekcji'))
					if(get_sub_field('typ_sekcji')=='poj')
						if( have_rows('pytania_i_odp') ): 
							$i=0;
							while ( have_rows('pytania_i_odp') ) : the_row(); 
								$i+=1;
								?>
								<div class="accordion-item">
									<h2 class="accordion-header" id="panels-heading<?php echo $i;?>">
										<div class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panels-collapse<?php echo $i;?>" aria-expanded="false" aria-controls="panels-collapse<?php echo $i;?>"> 
										<?php the_sub_field('pytanie');?>
										</div>
									</h2>
									<div id="panels-collapse<?php echo $i;?>" class="accordion-collapse collapse" aria-labelledby="panels-heading<?php echo $i;?>">
										<div class="accordion-body"><?php the_sub_field('odpowiedz');?> </div>
									</div>
								</div>
								<?php
							endwhile;
						endif;
					else{
						if( have_rows('przyciski_przekierowania') ): ?>
							</div>
							<div class="row mt-5 d-flex justify-content-center"><?php
							while ( have_rows('przyciski_przekierowania') ) : the_row(); 
							?>
							
					
									<a href="<?php the_sub_field('link');?>" class="primary-button"><?php the_sub_field('napis');?></a>
						
					
							<?php
							endwhile;
							?> </div> <?php
						endif;


					}
					?>
				</div>
			</div>
		</div>
	</div>
<?php endwhile; 
endif;},90); 


add_action('woocommerce_after_single_product_summary',function(){if(get_field('recenzje')){?> 
<div id="reviews" class="product-content__reviews mb-8">
	<div class="container">
		<div class="row">
			<div class="col-md-4">
				<h2 class="section-title"> <?php echo get_field('tytul_sekcji_recenzje');?>  </h2>
				<p><?php echo get_field('podtytul_sekcji_recenzje');?> </p>
				<div class="reviews-nav custom-nav">
					<a class="prev-arrow"><i class="fas fa-chevron-left"></i></a>
  					<a class="next-arrow"><i class="fas fa-chevron-right"></i></a>
				</div>
			</div>
			<div class="col-md-8">
				<div class="slider-container">
				<div class="reviews-slider">
					<?php foreach(get_field('recenzje') as $recenzja){ ?>
					<div class="slider-item">
						<div class="review-rating">
							<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="star" class="svg-inline--fa fa-star fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg>
							<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="star" class="svg-inline--fa fa-star fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg>
							<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="star" class="svg-inline--fa fa-star fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg>
							<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="star" class="svg-inline--fa fa-star fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg>
							<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="star" class="svg-inline--fa fa-star fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg>
						</div>
						<div class="review-content">
							<p> <?php echo get_post_field('post_content',$recenzja);?></p>
						</div>
						<div class="review-author">
						<?php echo get_field('autor',$recenzja);?>
						</div>
					</div>
					<?php } ?>
				</div>
			</div>
		</div>
	</div>
	<script>
		jQuery(document).ready(function($) {
			$('.reviews-slider').slick({
				centerMode: true,
				centerPadding: '0px',
			slidesToShow: 3,
			responsive: [
				{
			breakpoint: 800,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1,
				dots: true,
			}
			},
			{
			breakpoint: 1024,
			settings: {
				slidesToShow: 2,
				slidesToScroll: 1,
			}
			},
			{
			breakpoint: 1300,
			settings: {
				slidesToShow: 3,
				slidesToScroll: 1,
			}
			}
		],
			appendArrows:$('.reviews-nav'),
			prevArrow: $('.prev-arrow'),
				nextArrow: $('.next-arrow'),
			slidesToScroll: 1,
			dots: false,
			autoplay: true,
			autoplaySpeed: 2000,
			ifinite: true,
			settings: {
				dots: false,
			}
			});
		});
	</script>

  </div> 
	</div><?php } },110); 

add_action('woocommerce_after_single_product_summary',function(){
?>
	<div id="indgtable" class="product-content__ingtable py-8">
		<div class="container">
			<div class="row">
				<h3><?php echo get_field('tytul_sekcji_skladniki');?> </h3>
			<?php $tabela = get_field('sklad');
	$dawkowanie = get_field('dawkowanie');
	$srodki = get_field('srodki');
	$przechowywanie = get_field('przechowywanie');
	$instrukcja = get_field('instrukcja');
	echo '<div id="sklad-tabela">';
	if($tabela){
		echo '<div class="sklad scndtab"><div class="row titletable"><div class="skladnik">Składnik</div><div class="dawka">Dawka</div></div>';
		foreach($tabela as $row){
			echo '<div class="row"><div class="skladnik">';

			if(array_key_exists(0,$row['podskladnik'])&&$row['podskladnik'][0]=='tak')
				echo '<span class="podskl">'.$row['skladnik'].'</span>';
			else
				echo $row['skladnik'];
			echo '</div><div class="dawka">';
			echo $row['dawka'];
			echo '</div></div>';
		}
		echo '</div>';
	}
	
	if($dawkowanie){
		echo '<div class="dawkowanie scndtab"><div class="row titletable">'.get_field('tytul_sekcji_dawkowanie').'</div>';
		echo '<div class="row"><div class="dawkowanie">'.$dawkowanie.'</div></div>';	
		echo '</div>';
	}
	
	if($srodki){
		echo '<div class="srodki scndtab"><div class="row titletable">'.get_field('tytul_sekcji_srodki_ostroznosci').'</div>';
		echo '<div class="row"><div class="srodki">'.$srodki.'</div></div>';	
		echo '</div>';
	}
	
	if($przechowywanie){
		echo '<div class="przechowywanie scndtab"><div class="row titletable">'.get_field('tytul_sekcji_przechowywanie').'</div>';
		echo '<div class="row"><div class="przechowywanie">'.$przechowywanie.'</div></div>';	
		echo '</div>';
	}
		
		if($instrukcja){
		echo '<div class="instrukcja scndtab"><div class="row titletable">'.get_field('tytul_sekcji_instrukcja').'</div>';
		echo '<div class="row"><div class="instrukcja">'.$instrukcja.'</div></div>';	
		echo '</div>';
	}
		echo '</div>';
		?>

			
			</div>
		</div>
	</div>
<?php },100); 

add_action('woocommerce_after_single_product_summary','woocommerce_output_related_products',110);


add_action('woocommerce_after_single_product_summary',function(){if(get_field('recenzje')){?> 
	<div id="moreinfo" class="product-content__moreinfo pb-8">
<div class="container">
	<div class="row">
		<div class="col-md-12">
			<div class="accordion" id="accordionPanels2">
				<div class="accordion-item">
					<h2 class="accordion-header" id="panels-heading0">
						<div class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panels-collapse0" aria-expanded="false" aria-controls="panels-collapse0"> 
							<?php echo get_field('tytul_rozwijalnego_pola_wiecej_informacji');?>
						</div>
					</h2>
					<div id="panels-collapse0" class="accordion-collapse collapse" aria-labelledby="panels-heading0">
						<div class="accordion-body">
							<?php echo get_field('wiecej_informacji');?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
	</div>
<?php  } },120); 


	remove_action('woocommerce_after_single_product_summary','woocommerce_output_product_data_tabs',10);
	remove_action('woocommerce_after_single_product_summary','woocommerce_upsell_display',15);
	remove_action('woocommerce_after_single_product_summary','woocommerce_output_related_products',20);
	if(!has_term('akcesoria','product_cat')&&!has_term('e-book','product_cat')
&&!has_term('subskrypcje','product_cat'))
	do_action( 'woocommerce_after_single_product_summary' );
	?>
 <?php do_action( 'woocommerce_after_single_product' ); ?>