93 lines
4.0 KiB
PHP
93 lines
4.0 KiB
PHP
@extends('layouts.shop')
|
|
|
|
@php
|
|
$searchQuery = trim((string) request('q', ''));
|
|
$hasCatalogQuery = $searchQuery !== '' || request()->filled('category') || request()->filled('page');
|
|
$catalogCategoryList = collect($categories ?? [])
|
|
->values()
|
|
->map(fn ($category, $index) => [
|
|
'@type' => 'ListItem',
|
|
'position' => $index + 1,
|
|
'url' => route('catalog.category', $category),
|
|
'name' => __($category->name),
|
|
])
|
|
->all();
|
|
$catalogSchema = [
|
|
'@context' => 'https://schema.org',
|
|
'@type' => 'CollectionPage',
|
|
'name' => __('Каталог товаров'),
|
|
'url' => route('catalog.index'),
|
|
'description' => __('Каталог компьютерных комплектующих и техники.'),
|
|
'mainEntity' => [
|
|
'@type' => 'ItemList',
|
|
'numberOfItems' => count($catalogCategoryList),
|
|
'itemListElement' => $catalogCategoryList,
|
|
],
|
|
];
|
|
@endphp
|
|
@section('meta_title', $searchQuery !== '' ? __('Поиск: :query', ['query' => $searchQuery]) : __('Каталог товаров'))
|
|
@section(
|
|
'meta_description',
|
|
$searchQuery !== ''
|
|
? __('Результаты поиска по запросу «:query». Подберите нужные комплектующие по наименованию.', ['query' => $searchQuery])
|
|
: __('Каталог компьютерных комплектующих: процессоры, материнские платы, видеокарты, память, накопители и ноутбуки.')
|
|
)
|
|
@section('meta_keywords', __('каталог комплектующих, поиск товаров, процессоры, материнские платы, видеокарты'))
|
|
@section('meta_canonical', route('catalog.index'))
|
|
@section('meta_robots', $hasCatalogQuery ? 'noindex,follow' : 'index,follow')
|
|
|
|
@push('structured_data')
|
|
<script type="application/ld+json">
|
|
@json($catalogSchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
|
</script>
|
|
@endpush
|
|
|
|
@section('content')
|
|
@include('partials.breadcrumbs', [
|
|
'items' => [
|
|
['label' => __('Главная'), 'url' => route('home')],
|
|
['label' => __('Каталог'), 'url' => null],
|
|
],
|
|
])
|
|
|
|
<section class="pc-section">
|
|
<div class="pc-section-title">
|
|
<h2>{{ __('Категории товаров') }}</h2>
|
|
</div>
|
|
|
|
<div class="pc-grid pc-grid-4 pc-category-grid">
|
|
@forelse ($categories as $category)
|
|
<a class="pc-card pc-category-card pc-category-link" href="{{ route('catalog.category', $category) }}">
|
|
<div class="pc-category-image" role="img" aria-label="{{ __($category->name) }}"></div>
|
|
<h3 class="pc-category-title">{{ __($category->name) }}</h3>
|
|
</a>
|
|
@empty
|
|
<div class="pc-card">{{ __('Категории пока не добавлены.') }}</div>
|
|
@endforelse
|
|
</div>
|
|
</section>
|
|
|
|
@if (request()->filled('q'))
|
|
<section class="pc-section">
|
|
<div class="pc-category-toolbar">
|
|
<div class="pc-section-title">
|
|
<h2>{{ __('Результаты по запросу: ":query"', ['query' => request('q')]) }}</h2>
|
|
</div>
|
|
<p class="pc-muted">{{ __('Найдено:') }} <strong>{{ $products->total() }}</strong></p>
|
|
</div>
|
|
|
|
<div class="pc-products-grid">
|
|
@forelse ($products as $product)
|
|
@include('partials.product-card', ['product' => $product])
|
|
@empty
|
|
<div class="pc-card">{{ __('По вашему запросу ничего не найдено.') }}</div>
|
|
@endforelse
|
|
</div>
|
|
|
|
<div class="pc-pagination">
|
|
{{ $products->links('partials.pagination') }}
|
|
</div>
|
|
</section>
|
|
@endif
|
|
@endsection
|