1
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
ssww23
2026-03-17 01:59:00 +03:00
parent 93a655235a
commit 0ee9f05416
48 changed files with 1193 additions and 413 deletions

View File

@@ -1,6 +1,8 @@
@extends('layouts.shop')
@php
$translatedCategoryName = __($category->name);
$translatedCategoryDescription = $category->description ? __($category->description) : __('Категория товаров :category', ['category' => $translatedCategoryName]);
$hasSeoFilters = request()->filled('q')
|| request()->filled('sort')
|| request()->filled('page')
@@ -24,9 +26,9 @@
$categorySchema = [
'@context' => 'https://schema.org',
'@type' => 'CollectionPage',
'name' => $category->name,
'name' => $translatedCategoryName,
'url' => route('catalog.category', $category),
'description' => $category->description ?: 'Категория товаров ' . $category->name,
'description' => $translatedCategoryDescription,
'mainEntity' => [
'@type' => 'ItemList',
'numberOfItems' => $products->total(),
@@ -35,9 +37,9 @@
];
@endphp
@section('meta_title', $category->name)
@section('meta_description', ($category->description ?: 'Товары категории ' . $category->name . '.') . ' Фильтры и сортировка для быстрого подбора.')
@section('meta_keywords', $category->name . ', комплектующие, купить, фильтры товаров')
@section('meta_title', $translatedCategoryName)
@section('meta_description', __('Товары категории :category. Фильтры и сортировка для быстрого подбора.', ['category' => $translatedCategoryName]))
@section('meta_keywords', __(':category, комплектующие, купить, фильтры товаров', ['category' => $translatedCategoryName]))
@section('meta_canonical', route('catalog.category', $category))
@section('meta_robots', $hasSeoFilters ? 'noindex,follow' : 'index,follow')
@@ -50,15 +52,15 @@
@section('content')
@include('partials.breadcrumbs', [
'items' => [
['label' => 'Главная', 'url' => route('home')],
['label' => 'Каталог', 'url' => route('catalog.index')],
['label' => $category->name, 'url' => null],
['label' => __('Главная'), 'url' => route('home')],
['label' => __('Каталог'), 'url' => route('catalog.index')],
['label' => $translatedCategoryName, 'url' => null],
],
])
<section class="pc-section pc-category-page">
<div class="pc-section-title">
<h2>{{ $category->name }}</h2>
<h2>{{ $translatedCategoryName }}</h2>
</div>
@php
@@ -69,7 +71,7 @@
if (request()->filled('price_from') || request()->filled('price_to')) {
$priceFromLabel = trim((string) request('price_from', ''));
$priceToLabel = trim((string) request('price_to', ''));
$activeFilters->push("Цена: {$priceFromLabel} - {$priceToLabel}");
$activeFilters->push(__('Цена: :from - :to', ['from' => $priceFromLabel, 'to' => $priceToLabel]));
}
foreach ((array) ($filters ?? []) as $filter) {
@@ -90,12 +92,16 @@
$fromLabel = trim((string) request($fromParam, ''));
$toLabel = trim((string) request($toParam, ''));
$activeFilters->push(($filter['label'] ?? $rangeKey) . ": {$fromLabel} - {$toLabel}");
$activeFilters->push(__(':label: :from - :to', [
'label' => __($filter['label'] ?? $rangeKey),
'from' => $fromLabel,
'to' => $toLabel,
]));
}
@endphp
<div class="pc-category-toolbar">
<p class="pc-muted">Найдено товаров: <strong>{{ $products->total() }}</strong></p>
<p class="pc-muted">{{ __('Найдено товаров:') }} <strong>{{ $products->total() }}</strong></p>
<div class="pc-category-toolbar-controls">
<form class="pc-sort-form" method="get">
@foreach ((array) ($appliedFilters ?? []) as $key => $value)
@@ -124,12 +130,12 @@
@if (request()->filled('q'))
<input type="hidden" name="q" value="{{ request('q') }}">
@endif
<label for="sort">Сортировка:</label>
<label for="sort">{{ __('Сортировка:') }}</label>
<select id="sort" name="sort" onchange="this.form.submit()">
<option value="newest" @selected($sort === 'newest')>Сначала новые</option>
<option value="price_asc" @selected($sort === 'price_asc')>Сначала дешевле</option>
<option value="price_desc" @selected($sort === 'price_desc')>Сначала дороже</option>
<option value="name_asc" @selected($sort === 'name_asc')>По названию</option>
<option value="newest" @selected($sort === 'newest')>{{ __('Сначала новые') }}</option>
<option value="price_asc" @selected($sort === 'price_asc')>{{ __('Сначала дешевле') }}</option>
<option value="price_desc" @selected($sort === 'price_desc')>{{ __('Сначала дороже') }}</option>
<option value="name_asc" @selected($sort === 'name_asc')>{{ __('По названию') }}</option>
</select>
</form>
<button
@@ -142,7 +148,7 @@
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M4 6h16v2H4V6zm3 5h10v2H7v-2zm3 5h4v2h-4v-2z"></path>
</svg>
<span>Фильтр</span>
<span>{{ __('Фильтр') }}</span>
@if ($activeFilters->isNotEmpty())
<span class="pc-filter-toggle-count">{{ $activeFilters->count() }}</span>
@endif
@@ -161,7 +167,7 @@
<aside class="pc-filters">
<div id="pc-category-filters" class="pc-filter-details {{ $activeFilters->isNotEmpty() ? 'is-open' : '' }}">
<form method="get">
<div class="pc-filter-title">Фильтры</div>
<div class="pc-filter-title">{{ __('Фильтры') }}</div>
@if ($sort !== 'newest')
<input type="hidden" name="sort" value="{{ $sort }}">
@endif
@@ -169,7 +175,7 @@
<input type="hidden" name="q" value="{{ request('q') }}">
@endif
<label class="pc-filter-block">
<span>Цена</span>
<span>{{ __('Цена') }}</span>
<div class="pc-range-fields">
<input
type="number"
@@ -178,7 +184,7 @@
value="{{ $priceFilter['from'] ?? '' }}"
@if (!empty($priceFilter['min'])) min="{{ $priceFilter['min'] }}" @endif
@if (!empty($priceFilter['max'])) max="{{ $priceFilter['max'] }}" @endif
placeholder="От"
placeholder="{{ __('От') }}"
>
<input
type="number"
@@ -187,7 +193,7 @@
value="{{ $priceFilter['to'] ?? '' }}"
@if (!empty($priceFilter['min'])) min="{{ $priceFilter['min'] }}" @endif
@if (!empty($priceFilter['max'])) max="{{ $priceFilter['max'] }}" @endif
placeholder="До"
placeholder="{{ __('До') }}"
>
</div>
</label>
@@ -200,7 +206,7 @@
@continue($filterKey === '')
@if ($isRangeFilter)
<label class="pc-filter-block">
<span>{{ $filter['label'] }}</span>
<span>{{ __($filter['label']) }}</span>
<div class="pc-range-fields">
<input
type="number"
@@ -209,7 +215,7 @@
value="{{ $rangeData['from'] ?? '' }}"
@if (!empty($rangeData['min'])) min="{{ $rangeData['min'] }}" @endif
@if (!empty($rangeData['max'])) max="{{ $rangeData['max'] }}" @endif
placeholder="От"
placeholder="{{ __('От') }}"
>
<input
type="number"
@@ -218,33 +224,33 @@
value="{{ $rangeData['to'] ?? '' }}"
@if (!empty($rangeData['min'])) min="{{ $rangeData['min'] }}" @endif
@if (!empty($rangeData['max'])) max="{{ $rangeData['max'] }}" @endif
placeholder="До"
placeholder="{{ __('До') }}"
>
</div>
</label>
@else
<label class="pc-filter-block">
<span>{{ $filter['label'] }}</span>
<span>{{ __($filter['label']) }}</span>
<select name="filters[{{ $filterKey }}]">
<option value="">Все</option>
<option value="">{{ __('Все') }}</option>
@foreach ($filterOptions[$filterKey] ?? [] as $option)
@php
$optionValue = trim((string) $option);
@endphp
@continue($optionValue === '')
<option value="{{ $optionValue }}" @selected(($appliedFilters[$filterKey] ?? '') === $optionValue)>
{{ $optionValue }}
{{ __($optionValue) }}
</option>
@endforeach
</select>
</label>
@endif
@empty
<p class="pc-muted">Для этой категории фильтры пока не заданы.</p>
<p class="pc-muted">{{ __('Для этой категории фильтры пока не заданы.') }}</p>
@endforelse
<div class="pc-filter-actions">
<button type="submit" class="pc-btn primary">Показать</button>
<a class="pc-btn ghost" href="{{ route('catalog.category', $category) }}">Сбросить</a>
<button type="submit" class="pc-btn primary">{{ __('Показать') }}</button>
<a class="pc-btn ghost" href="{{ route('catalog.category', $category) }}">{{ __('Сбросить') }}</a>
</div>
</form>
</div>
@@ -254,7 +260,7 @@
@forelse ($products as $product)
@include('partials.product-card', ['product' => $product])
@empty
<div class="pc-card">Пока нет товаров в этой категории.</div>
<div class="pc-card">{{ __('Пока нет товаров в этой категории.') }}</div>
@endforelse
</div>
</div>