@extends('layouts.app') @php use Illuminate\Support\Str; $title = $product->meta_title ?: $product->name; $desc = $product->meta_description ?: Str::limit(strip_tags($product->short_description ?? ''), 160); // generează keywords din nume + brand + categorii (fallback elegant dacă nu avem coloană) $kwParts = []; $kwParts[] = $product->name; if ($product->brand?->name) { $kwParts[] = $product->brand->name; } foreach ($product->categories as $cat) { $kwParts[] = $cat->name; } $kw = implode(', ', array_unique(array_filter($kwParts))); @endphp @section('title', $title) @section('meta_description', $desc) @section('meta_keywords', $kw) {{-- merge cu layoutul pe care l-am pus mai devreme --}} @section('meta_canonical', route('product.show', $product->slug)) @include('partials.ld-product', ['product'=>$product]) @section('content')
@php // Galleria: immagine principale + restanti in ordine $gallery = collect(); if ($product->mainImage) { $gallery->push($product->mainImage); } if ($product->images && $product->images->count()) { $gallery = $gallery->merge($product->images->sortBy('pivot.position')); } @endphp
@forelse($gallery as $i => $img) @php $disk = $img->disk ?? 'public'; $big = Storage::disk($disk)->url($img->path); @endphp
{{ $img->alt ?? $product->name }}
@empty
{{ $product->name }}
@endforelse

{{ $product->name }}

@if($product->short_description)

{!! nl2br(e($product->short_description)) !!}

@endif

{{ number_format((float)$product->price, 2, ',', '.') }} €

{{-- Niente quantità, niente share: solo acquisto --}}
{{-- Categorie / Brand --}} @if($product->categories->count())
Categorie: @foreach($product->categories as $cat) {{ $cat->name }}@if(!$loop->last), @endif @endforeach
@endif @if($product->brand)
Marca: {{ $product->brand->name }}
@endif

Descrizione prodotto

{!! nl2br(e($product->long_description ?: $product->short_description ?: '')) !!}
{{-- Campi interni rimossi su richiesta --}}
Spedizione {{ $product->shipping_info ?: '—' }}
{{-- Prodotti correlati --}} @if($related->count())
Potrebbe interessarti

Prodotti correlati

@foreach($related as $rp) @php $rimg = $rp->mainImage; $rdisk = $rimg->disk ?? 'public'; $rthumb = $rimg ? (data_get($rimg->meta, 'thumb_312x340') ?: $rimg->path) : null; $rurl = $rimg ? Storage::disk($rdisk)->url($rthumb) : asset('assets/img/product/default.webp'); @endphp
@if($rp->brand)

{{ $rp->brand->name }}

@endif

{{ $rp->name }}

  • {{ number_format((float)$rp->price, 2, ',', '.') }} €
@endforeach
@endif @endsection @push('styles') @endpush @push('scripts') @endpush