@extends('layouts.app') @php $storeName = $shopSettings['shop_name'] ?? 'Orange Groceries'; $productTitle = !empty($product->meta_title) ? $product->meta_title : ($product->name . ($product->weight ? ' (' . $product->weight . ')' : '') . ' - ' . $storeName); $productPrice = $product->discount_price ? $product->discount_price : $product->selling_price; $cleanDesc = Str::limit(strip_tags($product->description ?? ''), 150); $productDesc = !empty($product->meta_description) ? $product->meta_description : ('Buy ' . $product->name . ' online at best price of ₹' . $productPrice . ' from ' . $storeName . '.' . ($cleanDesc ? ' ' . $cleanDesc : ' Fast 30-minute delivery to your doorstep.')); $productKeywords = !empty($product->meta_keywords) ? $product->meta_keywords : implode(', ', array_filter([ $product->name, 'buy ' . $product->name . ' online', $product->category->name ?? null, $product->subcategory->name ?? null, $product->brand ?? null, 'grocery online', $storeName ])); $canonicalUrl = !empty($product->canonical_url) ? $product->canonical_url : route('products.show', $product->slug); $productImage = $product->image ? (Str::startsWith($product->image, 'http') ? $product->image : asset($product->image)) : ''; $schemaData = [ "@context" => "https://schema.org/", "@type" => "Product", "name" => $product->name, "image" => $productImage, "description" => $cleanDesc ?: $productDesc, "sku" => $product->sku ?? ('SKU-' . $product->id), "offers" => [ "@type" => "Offer", "url" => route('products.show', $product->slug), "priceCurrency" => "INR", "price" => (string)$productPrice, "availability" => $product->stock_quantity > 0 ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", "itemCondition" => "https://schema.org/NewCondition" ] ]; if (!empty($product->brand)) { $schemaData["brand"] = [ "@type" => "Brand", "name" => $product->brand ]; } @endphp @section('title', $productTitle) @section('meta_description', $productDesc) @section('meta_keywords', $productKeywords) @section('canonical', $canonicalUrl) @section('og_type', 'product') @section('og_image', $productImage) @section('structured_data') @endsection @php $firstVariant = $product->variants->first(); $defaultWeight = $firstVariant ? ($firstVariant->weight ?: $firstVariant->variant_name) : ($product->weight ?? ''); $defaultDiscount = $firstVariant ? $firstVariant->discount_percent : $product->discount_percent; $defaultSku = $firstVariant && $firstVariant->sku ? $firstVariant->sku : ($product->sku ?? 'GROC-PROD'); $defaultBarcode = $firstVariant && $firstVariant->barcode ? $firstVariant->barcode : ($product->barcode ?? ''); @endphp @section('content')
SKU:
| Barcode:
{{ $product->description ?? 'High-grade grocery product directly sourced from verified brands and quality suppliers. Guaranteed purity and freshness delivered to your door.' }}