<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
if ( qtranxf_getLanguage() == ‚en‘ ) {
$kulinarik_headline = „Culinary creations“;
$slider_headline = „Flavours you may also be interested in“;
$zum_produkt_uebersetzung = „go to product“;
$rezept_uebersetzung = „Recipe“;
$aroma_uebersetzung = „Discover flavours“;
$retail_headline = „Experience our products up close“;
$erfolgsmeldung = „Product successfully added to your cart.“;
$btn_einkaufen =“Continue shopping“;
$btn_warenkorb =“view cart“;
$lieferbedingung =“Terms of delivery“;
$produktinformationen = „Product information“;
$btn_warenkorb_hinzufuegen = „add to cart“;
$btn_anfragen = „Request product“;
$cta_blog = „learn more“;
$blog_uebersetzung = „Recipes & Storys“;
$quantity_text =“Quantity“;
$auf_anfrage = „on Request“;
$backorder_meldung = „Longer delivery times are to be expected“;
}
elseif ( qtranxf_getLanguage() == ‚de‘ ) {
$kulinarik_headline = „Kulinarische Kreationen“;
$slider_headline = „Genuss, der Sie auch interessieren könnte“;
$zum_produkt_uebersetzung = „zum Produkt“;
$rezept_uebersetzung = „Rezept“;
$aroma_uebersetzung = „Aromen entdecken“;
$retail_headline = „Erleben Sie unsere Produkte hautnah“;
$erfolgsmeldung = „Produkt erfolgreich in den Warenkorb gelegt.“;
$btn_einkaufen =“Weiter einkaufen“;
$btn_warenkorb =“zum warenkorb“;
$lieferbedingung =“Lieferbedingungen“;
$produktinformationen = „Produktinformationen“;
$btn_warenkorb_hinzufuegen = „In den Warenkorb“;
$btn_anfragen = „Produkt anfragen“;
$blog_uebersetzung = „Rezepte & Geschichten“;
$cta_blog = „mehr erfahren“;
$quantity_text =“Menge“;
$auf_anfrage = „auf Anfrage“;
$backorder_meldung = „Es ist mit längeren Lieferzeiten zu rechnen“;
}
?>
<?php $product_stock = $product->is_in_stock(); ?>
<section class=“product_head_buy wow fadeInUp <?php if(get_field(’schwarzer_hintergrund‘)){echo ‚black_background‘; } ?>“>
<div class=“product_head_cat_big wow fadeInUp“ data-wow-delay=“0.2s“>
<?php // echo $product->get_categories(); ?>
</div>
<div class=“product_head_bg wow fadeInUp“ data-wow-delay=“0.3s“ style=“background-image: url();“ data-1x=“<?php echo wp_get_attachment_image_url(get_field(„produkt_bild“), ‚medium‘ ); ?>“ data-2x=“<?php echo wp_get_attachment_image_url(get_field(„produkt_bild“), ‚full‘ ); ?>“></div>
<div class=“product_head_data“>
<div class=“cat wow fadeInUp“ data-wow-delay=“0.4s“><?php the_field(„subline“); ?></div>
<div class=“name wow fadeInUp“ data-wow-delay=“0.5s“><?php echo get_the_title(); ?></div>
<div class=“desc wow fadeInUp“ data-wow-delay=“0.6s“><?php echo apply_filters(‚translate_text‘, $product->get_description()); ?></div>
</div>
<div class=“product_buy_box“>
<?php
if ($product->get_type() == „variable“) {
do_action( ‚woocommerce_single_product_summary‘ );
}
?>
<?php
if ($product->get_type() == „simple“) {
$attributes = $product->get_attributes(); ?>
<div class=“data_price wow fadeInUp“>
<div class=“currency“>CHF</div>
<div class=“price“>
<?php
$current_user = wp_get_current_user();
$roles = $current_user->roles;
$current_user_role = $roles[0];
$not_taxed_roles = array(„b2b_level_01″,“b2b_level_02″,“b2b_level_03“);
if (is_user_logged_in() && in_array($current_user_role, $not_taxed_roles)) {
echo number_format((float)$product->get_price(), 2, ‚.‘, “);
}
else
{
echo wc_price( wc_get_price_including_tax( $product ) );
}
?>
</div>
</div>
<div class=“data_quantity wow fadeInUp“>
<div class=“data_name“><?php echo $quantity_text; ?></div>
<div class=“data_option“>
<button class=“minus inactive“><img src=“/wp-content/themes/medi/img/minus.svg“ alt=““></button>
<input type=“number“ class=“quantity“ value=“1″ min=“1″ max=“100″>
<button class=“plus“><img src=“/wp-content/themes/medi/img/plus.svg“ alt=““></button>
</div>
</div>
<div class=“data_size wow fadeInUp“>
<?php foreach ( $attributes as $attribute ) { ?>
<?php $name = $attribute->get_name(); ?>
<?php $options = $attribute->get_options(); ?>
<div class=“data_name“><?php echo wc_attribute_label($name); ?></div>
<div class=“data_option“><?php // echo $options[0]; ?>
<?php
$attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( ‚fields‘ => ‚all‘ ) );
if ( $attribute->is_taxonomy() ) {
foreach ( $attribute_values as $attribute_value ) {
$value_name = esc_html( $attribute_value->name );
echo $value_name;
}
}
else
{
$values = $attribute->get_options();
foreach ( $values as &$value ) {
$value = make_clickable( esc_html( $value ) );
echo $value;
}
}
?></div>
<?php } ?>
</div>
<?php
if ( $product_stock == null)
{
?><a id=“btn_product_request_de“ href=“/produkt-anfragen/?produktname=<?php echo get_the_title(); ?>“><button class=“btn_add_to_bag wow fadeInUp“><span><img src=“/wp-content/themes/medi/img/icon_bag.svg“ class=“bag_icon“ alt=““><?php echo $btn_anfragen; ?></span></button></a>
<style type=“text/css“>
.data_price, .data_quantity, .data_quantity
{
display: none !important;
}
</style>
<?php
}
else
{
?><a id=“btn_product_request_de“ href=“/shop/?add-to-cart=<?php echo $product->get_id(); ?>&quantity=1″><button class=“btn_add_to_bag wow fadeInUp“><span><img src=“/wp-content/themes/medi/img/icon_bag.svg“ class=“bag_icon“ alt=““><?php echo $btn_warenkorb_hinzufuegen; ?></span></button></a><?php
}
?>
<?php }
?>
<?php
if ($product->is_on_backorder()) {?>
<div class=“rueckstandmeldung“><?php echo $backorder_meldung; ?></div>
<?php
}
?>
<span class=“link_agb link_iframe“ data-iframelink=“https://mediterre.com/lieferbedingungen/“><?php echo $lieferbedingung ;?></span>
<?php if (get_field(‚produktinformationen‘)): ?>
<span class=“link_agb link_produktinformationen“><?php echo $produktinformationen; ?></span>
<?php endif ?>
</div>
<div class=“clear“></div>
</section>
<section id=“produktinformationen“ data-open=“false“>
<div class=“produktinformationen_lightbox“>
<div class=“produktinformationen_lightbox_content full_text_content_text“>
<?php the_field(‚produktinformationen‘); ?>
</div>
<img class=“iframe_close“ src=“/wp-content/themes/medi/img/icon_cart_remove.svg“ alt=““ />
</div>
</section>
<?php
$get_warnhinweis = get_field(„warnhinweis“);
if ($get_warnhinweis != „“) {
?>
<div class=“warnhinweis wow fadeInUp“>
<?php echo $get_warnhinweis; ?>
</div>
<?php
}
?>
<section class=“home_rezepte“>
<div class=“home_rezepte_title wow fadeInUp“><?php echo $blog_uebersetzung; ?></div>
<div class=“slider_holder_overflow_rezepte wow fadeInUp“>
<div class=“rezepte_slider“>
<?php $loop = new WP_Query( array( ‚post_type‘ => ‚blog‘, ‚posts_per_page‘ => 3));
if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class=“rezept3_holder“>
<div class=“cover_bg“ style=“background-image: url(<?php the_field(„blog_beitragsbild“); ?>) !important;“></div>
<div class=“rezept3_text“>
<div class=“rezept_nr“><?php the_field(„datum“); ?></div>
<?php the_field(„headline“); ?>
<a href=“<?php the_permalink(); ?>“><button><span><?php echo $cta_blog; ?></span></button></a>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
</div>
</section>
<section class=“popular_products rezept“>
<div class=“pp_title wow fadeInUp“><?php echo $slider_headline; ?></div>
<div class=“slider_holder_overflow wow fadeInUp“>
<div class=“product_slider“>
<?php $loop = new WP_Query( array( ‚post_type‘ => ‚product‘, ‚posts_per_page‘ => -1));
if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class=“single_product“>
<div class=“product_info_holder“>
<?php
if ( !$product->is_type( ‚variable‘ ) && $product->is_in_stock() != NULL ) {
?><img src=“/wp-content/themes/medi/img/icon_bag_dark.svg“ class=“bag_dark“ data-add-to-cart-link=“/shop/?add-to-cart=<?php echo $product->id; ?>&quantity=1″ alt=““ /><?php
}
?>
<div class=“product_info“>
<div class=“left_side“>
<!–<img class=“heart“ src=“/img/icon_heart.svg“>–>
<!– <div class=“name_hidden“><?php echo $product->get_categories(); ?></div> –>
<div class=“single_category“><?php echo get_the_title(); ?></div>
<div class=“product_name“><?php the_field(„subline“); ?></div>
<div class=“product_desc“><?php echo apply_filters(‚translate_text‘, $product->get_short_description()); ?></div>
</div>
<div class=“right_side“><img src=““ data-img-1x=“<?php echo wp_get_attachment_image_url(get_field(„produkt_thumbnail“), ’shop_single‘ ); ?>“ data-img-2x=“<?php echo wp_get_attachment_image_url(get_field(„produkt_thumbnail“), ‚full‘ ); ?>“></div>
</div>
<div class=“price_bar“>
<div class=“price_left“>
<?php $attributes = $product->get_attributes(); ?>
<?php foreach ( $attributes as $attribute ) { ?>
<?php $name = $attribute->get_name(); ?>
<?php $options = $attribute->get_options(); ?>
<?php // echo wc_attribute_label($name); ?>
<?php
$attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( ‚fields‘ => ‚all‘ ) );
if ( $attribute->is_taxonomy() ) {
$countfor = 0;
foreach ( $attribute_values as $attribute_value ) {
$value_name = esc_html( $attribute_value->name );
if ($countfor != 0) {echo „, „;}
echo $value_name;
$countfor++;
}
}
else
{
$values = $attribute->get_options();
foreach ( $values as &$value ) {
$value = make_clickable( esc_html( $value ) );
echo $value;
}
}
?>
<?php } ?>
</div>
<?php
$product_stock = $product->is_in_stock();
if ( $product_stock == null) { ?> <div class=“price_right“><?php echo $auf_anfrage; ?></div> <?php }
else { ?>
<div class=“price_right“>CHF <span class=“price“>
<?php
$current_user = wp_get_current_user();
$roles = $current_user->roles;
$current_user_role = $roles[0];
$not_taxed_roles = array(„b2b_level_01″,“b2b_level_02″,“b2b_level_03“);
if (is_user_logged_in() && in_array($current_user_role, $not_taxed_roles)) {
echo number_format((float)$product->get_price(), 2, ‚.‘, “);
}
else
{
echo wc_price( wc_get_price_including_tax( $product ) );
}
?>
</span></div>
<?php } ?>
</div>
<a id=“btn_product_detail_de“ href=“<?php the_permalink(); ?>“><button class=“btn_add_to_bag“><span><?php echo $zum_produkt_uebersetzung; ?><img src=“/wp-content/themes/medi/img/right-arrow.svg“ class=“arrow_icon“ alt=““></span></button></a>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
</div>
</section>
<?php
// js_log( get_queried_object_id() );
// 16 = tax olivenöl & balsamico
$this_kategorie = get_the_terms( get_queried_object_id(), ‚product_cat‘ );
// js_log( array_column( $this_kategorie, ‚term_id‘ ) );
if (
!empty( $this_kategorie[ 0 ]->term_id ) &&
in_array( 16, array_column( $this_kategorie, ‚term_id‘ ) )
) {
include __DIR__ . ‚/templates/comp_awards.php‘;
}
?>
<section class=“standorte“>
<div class=“pp_title wow fadeInUp“><?php echo $retail_headline; ?></div>
<div class=“standorte_holder“>
<?php $loop = new WP_Query( array( ‚post_type‘ => ‚retailer‘, ‚posts_per_page‘ => -1, ‚orderby‘ => ‚menu_order‘, ‚order‘ => ‚ASC‘));
if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class=“standort wow fadeInUp“>
<strong><?php echo get_the_title(); ?></strong><br/>
<?php the_field(„adresse“); ?>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
</section>
<?php // the_content(); ?>
<?php endwhile; endif; ?>
<?php get_footer(); ?>