@extends('layouts.app') @section('title', $product->name) @section('description', \Illuminate\Support\Str::limit(strip_tags((string) ($product->short_description ?: $product->name)), 155)) @section('og_type', 'product') @if (!empty($product->images[0]->url))@section('og_image', url($product->images[0]->url))@endif @section('content') @php $m = $shop->money; $variants = collect($product->variants)->map(fn ($v) => [ 'id' => $v->id, 'color' => $v->color_code, 'size' => $v->size_code, 'stock' => $v->stock, 'price' => $m->format($v->unit_price), 'compare' => ($v->compare_at && $v->compare_at > $v->unit_price) ? $m->format($v->compare_at) : null, ])->values(); $images = collect($product->images); $gallery = $images->map(fn ($i) => ['url' => $i->url, 'alt' => $i->alt_text ?: $product->name, 'color' => $i->color_code])->values(); $wished = $shop->wished((int) $product->id); @endphp
{{-- Gallery: the photos switch to the chosen colour's photos (see the script below) --}}
@if ($images->isNotEmpty()) {{ $images[0]->alt_text ?: $product->name }} @endif
@if ($images->count() > 1) @foreach ($images as $i => $img) @endforeach @endif
{{-- Buy box --}}
@if ($product->is_new_arrival){{ __('New') }}@endif

{{ $product->name }}

@if ($product->review_count > 0)
@endif

{{ $m->format($product->price) }} {{ $product->compare_at ? $m->format($product->compare_at) : '' }}

@if ($product->short_description)

{{ $product->short_description }}

@endif
@csrf @if (count($product->colors) > 0)
{{ __('Color') }}:
@foreach ($product->colors as $c) @endforeach
@endif @if (count($product->sizes) > 0)
{{ __('Size') }}
@foreach ($product->sizes as $s) @endforeach
@endif
{{ __('Add to bag') }}

@auth
@csrf
@endauth
@if ($product->material)
{{ __('Material') }}
{{ $product->material }}
@endif @if ($product->care_instructions)
{{ __('Care') }}
{{ $product->care_instructions }}
@endif
@if ($product->description)
{!! nl2br(e($product->description)) !!}
@endif
@if ($reviews)
@foreach ($reviews as $r)
@if ($r->title)

{{ $r->title }}

@endif @if ($r->body)

{{ $r->body }}

@endif

{{ $r->first_name }} @if ($r->verified){{ __('Verified purchase') }}@endif

@endforeach
@include('partials.pagination', ['result' => $reviewPage, 'param' => 'reviews', 'anchor' => '#reviews'])
@endif @if ($related)
@foreach ($related as $p)@endforeach
@endif @push('scripts') @endpush @endsection