@php $gtm_ite_list_details = []; @endphp @foreach($products as $product) @php $details = [ 'id' => $product->id, 'name' => $product->name, 'list_name' => 'Search Results' ]; if(!empty($brand)) { $details['brand'] = $brand->name; } if(!empty($category)) { $details['category'] = $category->name; } $details['list_position'] = 1; $details['price'] = $product->selling_price; $gtm_ite_list_details[] = $details; @endphp @if(!empty($store_slug)) @php $product->store_slug = $store_slug; @endphp @endif @if(!empty($category) || !empty($product->category_slug)) @if(!empty($category)) @php $link = route('product-in-collection', [$product->store_slug, $category->slug, $product->slug]); @endphp @else @php $link = route('product-in-collection', [$product->store_slug, $product->category_slug, $product->slug]); @endphp @endif @else @php $link = route('product', [$product->store_slug, $product->slug]); @endphp @endif
@endforeach @section('before-gtm') @endsection