@extends('layouts.public')
@section('title', $product->title . ' | UsedStore.ca')
@section(
'meta_description',
\Illuminate\Support\Str::limit(
strip_tags($product->description ?? 'View this product on UsedStore.ca.'),
155
)
)
@section('content')
@php
$lang = session('locale', 'en');
$translations = [
'en' => [
'categories' => 'Categories',
'products' => 'Products',
'why_us' => 'Why Us',
'contact' => 'Contact',
'dashboard' => 'Dashboard',
'login' => 'Login',
'start_selling' => 'Start Selling',
'back' => 'Back to products',
'premium_listing' => 'Premium Listing',
'available' => 'Available',
'sold' => 'Sold',
'views' => 'views',
'size' => 'Size',
'condition' => 'Condition',
'location' => 'Location',
'posted' => 'Posted',
'brand' => 'Brand',
'category' => 'Category',
'description' => 'Description',
'no_description' => 'No description was added for this product.',
'product_video' => 'Product Video',
'video_subtitle' => 'See the product in more detail.',
'seller_information' => 'Seller Information',
'seller' => 'Seller',
'member_since' => 'Member since',
'contact_seller' => 'Contact Seller',
'contact_description' => 'Contact the seller directly for availability, pickup or delivery details.',
'call_seller' => 'Call Seller',
'whatsapp' => 'WhatsApp',
'send_email' => 'Send Email',
'share' => 'Share',
'copy_link' => 'Copy Link',
'link_copied' => 'Product link copied.',
'email_not_available' => 'Email not available',
'phone_not_available' => 'Phone not available',
'contact_not_available' => 'The seller has not added public contact information.',
'safety_title' => 'Safe Shopping Tips',
'safety_1' => 'Meet in a public place.',
'safety_2' => 'Inspect the product before paying.',
'safety_3' => 'Never send deposits to unknown sellers.',
'modern_marketplace' => 'Modern second-hand clothing marketplace.',
'rights' => 'All rights reserved.',
'no_image' => 'No Image',
'close' => 'Close',
],
'fr' => [
'categories' => 'Catégories',
'products' => 'Produits',
'why_us' => 'Pourquoi nous',
'contact' => 'Contact',
'dashboard' => 'Tableau de bord',
'login' => 'Connexion',
'start_selling' => 'Commencer à vendre',
'back' => 'Retour aux produits',
'premium_listing' => 'Annonce premium',
'available' => 'Disponible',
'sold' => 'Vendu',
'views' => 'vues',
'size' => 'Taille',
'condition' => 'État',
'location' => 'Localisation',
'posted' => 'Publié',
'brand' => 'Marque',
'category' => 'Catégorie',
'description' => 'Description',
'no_description' => 'Aucune description ajoutée pour ce produit.',
'product_video' => 'Vidéo du produit',
'video_subtitle' => 'Découvrez le produit plus en détail.',
'seller_information' => 'Informations du vendeur',
'seller' => 'Vendeur',
'member_since' => 'Membre depuis',
'contact_seller' => 'Contacter le vendeur',
'contact_description' => 'Contactez directement le vendeur pour la disponibilité, la livraison ou la récupération.',
'call_seller' => 'Appeler',
'whatsapp' => 'WhatsApp',
'send_email' => 'Envoyer un courriel',
'share' => 'Partager',
'copy_link' => 'Copier le lien',
'link_copied' => 'Lien du produit copié.',
'email_not_available' => 'Courriel non disponible',
'phone_not_available' => 'Téléphone non disponible',
'contact_not_available' => 'Le vendeur n’a pas ajouté de coordonnées publiques.',
'safety_title' => 'Conseils de sécurité',
'safety_1' => 'Rencontrez-vous dans un lieu public.',
'safety_2' => 'Inspectez le produit avant de payer.',
'safety_3' => 'N’envoyez jamais de dépôt à un vendeur inconnu.',
'modern_marketplace' => 'Marché moderne de vêtements d’occasion.',
'rights' => 'Tous droits réservés.',
'no_image' => 'Aucune image',
'close' => 'Fermer',
],
];
$tr = $translations[$lang] ?? $translations['en'];
$images = is_array($product->images)
? $product->images
: json_decode($product->images ?? '[]', true);
$images = is_array($images) ? $images : [];
/*
|--------------------------------------------------------------------------
| Resolve product media URLs
|--------------------------------------------------------------------------
| Supports both Laravel storage paths and full online URLs (https/http).
*/
$resolveMediaUrl = function ($path) {
if (!$path) {
return null;
}
$path = trim((string) $path);
if (\Illuminate\Support\Str::startsWith($path, ['https://', 'http://'])) {
return $path;
}
if (\Illuminate\Support\Str::startsWith($path, '//')) {
return 'https:' . $path;
}
return asset('storage/' . ltrim($path, '/'));
};
$imageUrls = array_values(array_filter(array_map($resolveMediaUrl, $images)));
$mainImageUrl = $imageUrls[0] ?? null;
$videoPathUrl = $product->video_path
? $resolveMediaUrl($product->video_path)
: null;
$currentPrice = $product->discount_price
?: $product->price;
$discountPercentage = null;
if (
$product->discount_price &&
$product->price > 0 &&
$product->discount_price < $product->price
) {
$discountPercentage = round(
(($product->price - $product->discount_price) / $product->price) * 100
);
}
$seller = $product->user;
$sellerName = $seller->name ?? $tr['seller'];
$sellerInitial = strtoupper(
mb_substr($sellerName, 0, 1)
);
/*
|--------------------------------------------------------------------------
| Contact information
|--------------------------------------------------------------------------
|
| First use contact information saved on the product.
| If it is empty, optionally use information from the user model.
|
*/
$phoneNumber = $product->phone_number
?? $seller->phone_number
?? null;
$whatsappNumber = $product->whatsapp
?? $seller->whatsapp
?? null;
$sellerEmail = $seller->email ?? null;
$cleanPhone = $phoneNumber
? preg_replace('/[^0-9+]/', '', $phoneNumber)
: null;
$cleanWhatsapp = $whatsappNumber
? preg_replace('/[^0-9]/', '', $whatsappNumber)
: null;
$whatsappMessage = urlencode(
($lang === 'fr'
? 'Bonjour, je suis intéressé par votre produit : '
: 'Hello, I am interested in your product: ')
. $product->title
. ' - '
. url()->current()
);
$youtubeId = null;
if ($product->video_url) {
preg_match(
'/(?:youtube\.com\/(?:watch\?v=|shorts\/|embed\/)|youtu\.be\/)([^&?\/]+)/',
$product->video_url,
$youtubeMatches
);
$youtubeId = $youtubeMatches[1] ?? null;
}
$status = strtolower($product->status ?? 'available');
$isSold = $status === 'sold';
$postedDate = $product->created_at
? $product->created_at->diffForHumans()
: '-';
@endphp
{{-- Product gallery --}}
✦
{{ $tr['premium_listing'] }}
@if($discountPercentage)
-{{ $discountPercentage }}%
@endif
@if($mainImageUrl)

@else
{{ $tr['no_image'] }}
@endif
@if(count($imageUrls) > 1)
@foreach($imageUrls as $index => $imageUrl)
@endforeach
@endif
{{-- Product information --}}
{{-- Product video --}}
@if($videoPathUrl || $youtubeId)
▶
{{ $tr['product_video'] }}
{{ $tr['video_subtitle'] }}
@if($videoPathUrl)
@elseif($youtubeId)
@endif
@endif
{{-- Seller and contact information --}}
{{-- Safety tips --}}
⚠
{{ $tr['safety_title'] }}
✓
{{ $tr['safety_1'] }}
✓
{{ $tr['safety_2'] }}
✓
{{ $tr['safety_3'] }}
{{-- Image zoom modal --}}
{{ $tr['link_copied'] }}
@endsection