отображение ненужных цен за кг

This commit is contained in:
Alisa
2026-06-05 22:50:13 +03:00
parent 8f9bc92271
commit 4776769782
10 changed files with 969 additions and 89 deletions
+13 -2
View File
@@ -6,6 +6,8 @@ declare(strict_types=1);
/** @var int $depth */
/** @var string $currentSlug */
require_once __DIR__ . '/category-icons.php';
if (!function_exists('category_tree_has_current')) {
/**
* @param array<string, mixed> $category
@@ -35,10 +37,14 @@ if (!function_exists('category_tree_has_current')) {
<?php $isCurrent = ($currentSlug ?? '') === $category['slug']; ?>
<?php $hasChildren = !empty($category['children']); ?>
<?php $shouldOpen = category_tree_has_current($category, $currentSlug ?? ''); ?>
<li class="<?= $isCurrent ? 'is-current' : '' ?>">
<?php $iconName = $depth === 0 ? category_tree_icon((string) $category['name']) : ''; ?>
<li class="<?= $isCurrent ? 'is-current' : '' ?><?= $hasChildren ? ' has-children' : '' ?>">
<?php if ($hasChildren): ?>
<details class="category-details" <?= $shouldOpen ? 'open' : '' ?>>
<summary>
<?php if ($depth === 0): ?>
<span class="category-icon is-<?= e($iconName) ?>" aria-hidden="true"><?= category_tree_icon_svg($iconName) ?></span>
<?php endif; ?>
<a class="<?= $isCurrent ? 'is-current-link' : '' ?>" href="/catalog/<?= e($category['slug']) ?>"><?= e($category['name']) ?></a>
</summary>
<?php
@@ -51,7 +57,12 @@ if (!function_exists('category_tree_has_current')) {
?>
</details>
<?php else: ?>
<a href="/catalog/<?= e($category['slug']) ?>"><?= e($category['name']) ?></a>
<a href="/catalog/<?= e($category['slug']) ?>">
<?php if ($depth === 0): ?>
<span class="category-icon is-<?= e($iconName) ?>" aria-hidden="true"><?= category_tree_icon_svg($iconName) ?></span>
<?php endif; ?>
<span><?= e($category['name']) ?></span>
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>