48 lines
1.8 KiB
PHP
48 lines
1.8 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
/** @var array<int, array<string, mixed>> $categories */
|
||
/** @var array<string, mixed>|null $currentCategory */
|
||
/** @var array<int, array<string, mixed>> $products */
|
||
|
||
$heading = $currentCategory['h1'] ?? $currentCategory['name'] ?? 'Каталог продукции';
|
||
?>
|
||
<section class="catalog-layout">
|
||
<aside class="catalog-sidebar">
|
||
<div class="panel sticky-panel">
|
||
<h2>Категории</h2>
|
||
<?php
|
||
$items = $categories;
|
||
$depth = 0;
|
||
$currentSlug = $currentCategory['slug'] ?? '';
|
||
require base_path('views/partials/category-tree.php');
|
||
?>
|
||
</div>
|
||
</aside>
|
||
|
||
<section class="catalog-content">
|
||
<div class="catalog-heading">
|
||
<p class="eyebrow"><?= $currentCategory === null ? 'Полный каталог' : 'Категория' ?></p>
|
||
<h1><?= e($heading) ?></h1>
|
||
<?php if (!empty($currentCategory['description'])): ?>
|
||
<p><?= e($currentCategory['description']) ?></p>
|
||
<?php else: ?>
|
||
<p class="muted">Выберите категорию слева или смотрите товары сразу в каталоге.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if ($products === []): ?>
|
||
<div class="panel">
|
||
<p class="muted">В этой категории товары появятся после переноса каталога со старого сайта.</p>
|
||
</div>
|
||
<?php else: ?>
|
||
<div class="product-grid catalog-product-grid">
|
||
<?php foreach ($products as $product): ?>
|
||
<?php require base_path('views/partials/product-card.php'); ?>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</section>
|
||
</section>
|