@extends('layouts.app') @section('title', $product->name) @php $style = 'product'; @endphp @section('content')
@if($defaultVariation && $defaultVariation->sku) Артикул: {{ $defaultVariation->sku }} @endif @if($product->brand) {{ $product->brand->name }} @endif

{{ $product->name }}

rating {{ $product->rating['score'] ?? '4.9' }}
{{ $product->rating['count'] ?? '0' }} отзывов
@php $defaultVariation = $product->default_variation; $price = $defaultVariation ? $defaultVariation->price : $product->min_price; $oldPrice = $defaultVariation ? $defaultVariation->old_price : null; $hasStock = $defaultVariation ? $defaultVariation->stock > 0 : false; @endphp
@if($oldPrice && $oldPrice > $price) {{ number_format($oldPrice, 0, '.', ' ') }} ₽ {{ number_format($price, 0, '.', ' ') }} ₽ -{{ $defaultVariation->discount_percent }}% @else {{ number_format($price, 0, '.', ' ') }} ₽ @endif
@if($hasStock) В наличии @if($defaultVariation && $defaultVariation->stock < 10) (осталось {{ $defaultVariation->stock }} шт.) @endif @else Нет в наличии @endif
@if($product->variations->count() > 1)
@foreach($product->variations as $variation) @php $imageUrls = $variation->images->map(function($image) { return $image->url; })->values()->toArray(); @endphp @endforeach
@endif
@csrf
Экспресс Платно, за 1 час
Доставка Бесплатно
Самовывоз Бесплатно
{{-- Описание и характеристики товара --}}
@php $hasAttributes = $product->attributes->count() > 0; $hasDescription = !empty($product->description); @endphp @if($hasDescription || $hasAttributes)
@if($hasDescription)

{{ $product->description }}

@endif @if($hasAttributes)
@foreach($product->attributes as $attribute) @endforeach
{{ $attribute->key }} {{ $attribute->value }}
@endif

Отзывы будут здесь

@else

Отзывы ({{ $product->rating['count'] ?? '0' }})

Отзывы будут здесь

@endif
@endsection @section('script') @endsection