Institut Corps & Cœur {{ config('app.url') }} Flux produits Google Shopping — Institut Corps & Cœur @foreach ($products as $product) @php $price = number_format($product->currentPrice(), 2, '.', ''); $salePrice = $product->sale_price ? number_format($product->sale_price, 2, '.', '') : null; $availability = $product->stock_status === 'outofstock' ? 'out_of_stock' : 'in_stock'; $rawImage = $product->featuredImage?->url ?? ''; $imageUrl = $rawImage ? (str_starts_with($rawImage, 'http') ? $rawImage : rtrim(url('/'), '/') . $rawImage) : ''; $brand = $product->brand?->name ?? 'Institut Corps & Cœur'; $clean = fn(?string $s) => trim(preg_replace('/\s+/', ' ', preg_replace('/[\x{1F000}-\x{1FFFF}]|[\x{2600}-\x{27FF}]|[\x{2B00}-\x{2BFF}]|[\x{FE00}-\x{FE0F}]/u', '', html_entity_decode(strip_tags($s ?? ''), ENT_QUOTES, 'UTF-8') ) )); $parts = array_filter([ $clean($product->short_description), $clean($product->description), $clean($product->benefits), $clean($product->usage_instructions), $clean($product->composition), $clean($product->team_recommendation), ]); $description = implode(' ', $parts) ?: $product->name; $url = $product->url(); $cat = $product->category; $productType = $cat?->parent ? ($cat->parent->name . ' > ' . $cat->name) : $cat?->name; @endphp @if ($imageUrl) {{ $product->sku ?: 'prod-' . $product->id }} name !!}]]> {{ $url }} {{ $imageUrl }} {{ $price }} EUR @if ($salePrice) {{ $salePrice }} EUR @endif {{ $availability }} new @if ($product->sku) {{ $product->sku }} @else no @endif @if ($productType) @endif @if ($product->unit_measure) {{ $product->unit_measure }} 100 {{ Str::contains($product->unit_measure, 'ml') ? 'ml' : 'g' }} @endif @endif @endforeach