@php $hasDiscount = !is_null($product->discount_price) && $product->discount_price > 0; $basePrice = $product->price ?: 0; $finalPrice = $hasDiscount ? $product->discount_price : $basePrice; $imageUrl = $product->thumbnail_url ?? (!empty($product->thumbnail) ? asset('storage/'.$product->thumbnail) : asset('assets/img/default-product.jpg')); $brandName = 'SEF Card'; $itemGroup = $product->product_code ?? $product->id; $description = Str::limit(strip_tags($product->short_description ?? $product->description ?? ''), 160); @endphp {{-- Open Graph Product Meta --}} {{-- JSON-LD Product Schema --}} @php $productJsonLd = [ '@context' => 'https://schema.org', '@type' => 'Product', 'productID' => (string) $product->id, 'name' => $product->name, 'description'=> $description, 'url' => url()->current(), 'image' => $imageUrl, 'brand' => $brandName, 'offers' => [[ '@type' => 'Offer', 'price' => number_format($finalPrice, 2, '.', ''), 'priceCurrency' => 'BDT', 'itemCondition' => 'https://schema.org/NewCondition', 'availability' => $product->stock > 0 ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock', ]], 'additionalProperty' => [[ '@type' => 'PropertyValue', 'propertyID' => 'item_group_id', 'value' => $itemGroup, ]], ]; @endphp