File: /home/lesanew/anestetues2/web/app/cache/acorn/framework/views/df10ceae665c519be993ff479c8f5271.php
<?php $__env->startPush('vite-head'); ?>
<?php echo app('Illuminate\Foundation\Vite')(['resources/css/pages/single-product.scss']); ?>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('content'); ?>
<?php
// Image principale + éventuelle galerie
$featured_id = get_post_thumbnail_id();
// On prépare un tableau d'IDs d'images similaires à WooCommerce
$gallery_image_ids = [];
// Si tu as un champ ACF "galerie" (type Gallery), on le privilégie
$acf_gallery = get_field('galerie');
if (is_array($acf_gallery) && ! empty($acf_gallery)) {
foreach ($acf_gallery as $img) {
if (is_array($img) && isset($img['ID'])) {
$gallery_image_ids[] = $img['ID'];
} elseif (is_numeric($img)) {
$gallery_image_ids[] = (int) $img;
}
}
}
// Fallback : récupère toutes les images attachées au post
if (empty($gallery_image_ids)) {
$attachments = get_attached_media('image', get_the_ID());
foreach ($attachments as $attachment) {
$gallery_image_ids[] = $attachment->ID;
}
}
// Ajoute l'image mise en avant au début des miniatures si elle existe
if ($featured_id) {
$gallery_image_ids = array_values(array_unique(
array_merge([$featured_id], $gallery_image_ids)
));
}
$prix = get_field('prix', get_the_ID());
// Créateur local associé (champ ACF "createur")
$createur_field = get_field('createur', get_the_ID());
$createur_post = null;
if (! empty($createur_field)) {
if (is_array($createur_field)) {
$first = reset($createur_field);
if (is_numeric($first)) {
$createur_post = get_post((int) $first);
} elseif ($first instanceof \WP_Post) {
$createur_post = $first;
}
} elseif (is_numeric($createur_field)) {
$createur_post = get_post((int) $createur_field);
} elseif ($createur_field instanceof \WP_Post) {
$createur_post = $createur_field;
}
}
$createur_url = $createur_post ? get_permalink($createur_post) : null;
?>
<section class="container">
<?php if(! empty($createur_url)): ?>
<div class="button-container mb">
<a href="<?php echo e($createur_url); ?>" class="btn arrow-secondary">
Retour au créateur
</a>
</div>
<?php endif; ?>
<div class="columns single-product">
<div class="column column-img">
<div class="product-gallery">
<div class="product-gallery-main">
<?php if(has_post_thumbnail()): ?>
<?php echo get_the_post_thumbnail(null, 'large', ['class' => 'product-main-image wave-img']); ?>
<?php else: ?>
<div class="product-main-image placeholder"></div>
<?php endif; ?>
</div>
<?php if(! empty($gallery_image_ids)): ?>
<div class="product-gallery-thumbs">
<?php $__currentLoopData = $gallery_image_ids; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $image_id): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php
$thumb_src = wp_get_attachment_image_url($image_id, 'thumbnail');
$large_src = wp_get_attachment_image_url($image_id, 'large');
$large_srcset = wp_get_attachment_image_srcset($image_id, 'large');
$thumb_alt = get_post_meta($image_id, '_wp_attachment_image_alt', true) ?: get_the_title();
?>
<button type="button" class="product-gallery-thumb">
<img
src="<?php echo e(esc_url($thumb_src)); ?>"
alt="<?php echo e(esc_attr($thumb_alt)); ?>"
class="product-thumb-image wave-img"
data-large-src="<?php echo e(esc_url($large_src)); ?>"
<?php if($large_srcset): ?>
data-large-srcset="<?php echo e(esc_attr($large_srcset)); ?>"
<?php endif; ?>
/>
</button>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
</div>
</div>
<div class="column column-content">
<h1 class="product-title-single">
<?php echo e(get_the_title()); ?>
</h1>
<?php if(! empty($prix)): ?>
<div class="product-price-single">
<?php echo e(number_format($prix, 2, ',', ' ')); ?> €
</div>
<?php endif; ?>
<div class="product-description-single text">
<?php if(! empty(get_field('description'))): ?>
<?php echo get_field('description'); ?>
<?php else: ?>
<?php echo apply_filters('the_content', get_the_content()); ?>
<?php endif; ?>
</div>
<div class="product-add-to-cart">
<form method="post" class="cart cart-reservation">
<?php echo csrf_field(); ?>
<div class="quantity">
<input
type="number"
class="qty"
name="reservation_quantity"
min="1"
step="1"
value="1"
inputmode="numeric"
/>
</div>
<input type="hidden" name="produit_createur_id" value="<?php echo e(get_the_ID()); ?>">
<input type="hidden" name="produit_createur_reservation" value="1">
<button type="submit" class="single_add_to_cart_button btn bg-secondary arrow-primary">
Ajouter à ma liste de réservation
</button>
</form>
</div>
</div>
</div>
</section>
<script>
document.addEventListener('DOMContentLoaded', function () {
var gallery = document.querySelector('.single-product .product-gallery');
if (!gallery) return;
var mainImg = gallery.querySelector('.product-main-image');
if (!mainImg) return;
var thumbs = gallery.querySelectorAll('.product-thumb-image');
thumbs.forEach(function (thumb) {
thumb.addEventListener('click', function () {
var largeSrc = thumb.getAttribute('data-large-src') || thumb.getAttribute('src');
if (largeSrc) {
mainImg.setAttribute('src', largeSrc);
}
var largeSrcset = thumb.getAttribute('data-large-srcset');
if (largeSrcset) {
mainImg.setAttribute('srcset', largeSrcset);
} else {
mainImg.removeAttribute('srcset');
}
});
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/gaetan/www/les-anes-tetus-2.0/web/app/themes/anes-tetues/resources/views/single-produit_createur.blade.php ENDPATH**/ ?>