@extends('frontend.main_master')
@php
$primary = $product->images->firstWhere('is_primary', true) ?? $product->images->first();
[$minPrice, $maxPrice] = $product->effectivePriceRange();
// Galeri: primary görsel her zaman ilk sırada (ana görsel + lightbox index'i eşleşsin diye)
$galleryImages = $product->images->count()
? collect([$primary])->merge($product->images->reject(fn ($img) => $primary && $img->id === $primary->id))->filter()->values()
: collect();
$galleryImagesForJs = $galleryImages->map(fn ($img) => [
'src' => asset($img->path),
'alt' => $product->name,
])->values();
// Varyant eksenleri (v1: sadece size/color) — kullanılan tüm değerleri topla
$axisLabels = ['size' => 'Beden', 'color' => 'Renk'];
$axes = [];
foreach ($product->variants as $variant) {
foreach ((array) $variant->options as $key => $value) {
$axes[$key][$value] = $value;
}
}
@endphp
@section('body-class', 'store-page-shell')
@section('title', ($product->meta_title ?: $product->name) . ' | ' . t('site-title'))
@section('meta_description', $product->meta_description ?: \Illuminate\Support\Str::limit(strip_tags((string) $product->short_description), 155))
@push('schema')
{{ $product->short_description }}
@endif