шаг 4 завершен
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user