@php // Lấy option mặc định nếu có $defaultOption = $item->options->firstWhere('is_default', 1); if ($defaultOption) { $price = (float) $defaultOption->sale_price ?? 0; $oldPrice = (float) $defaultOption->price ?? 0; } else { $price = (float) $item->price ?? 0; $oldPrice = (float) $item->old_price ?? 0; } $discount = 0; if ($oldPrice > 0 && $price > 0) { $discount = round(($oldPrice - $price) / $oldPrice * 100); } @endphp @if($discount > 0)
-{{ $discount }}%
@endif
{{ $item->name }}
@if($price > 0)
{{ number_format($price, 0, '.', '.') }}đ
@if($oldPrice > 0)
{{ number_format($oldPrice, 0, '.', '.') }}đ
@endif @else
Liên hệ
@endif