Vinoteca: модуль, шаблон и компоненты интернет-магазина вина на 1С-Битрикс

This commit is contained in:
jimagie committed 2026-10-22 03:32:28 +05:00
commit f6ba0d2174
470 files changed
+26454

No files matched your search

@@ -0,0 +1,11 @@
<?php
$MESS["VINO_SEARCH_PAGE_H1"] = "Search";
$MESS["VINO_SEARCH_PAGE_LABEL"] = "What to find";
$MESS["VINO_SEARCH_PAGE_PLACEHOLDER"] = "Wine, brand, region…";
$MESS["VINO_SEARCH_PAGE_SUBMIT"] = "Search";
$MESS["VINO_SEARCH_PAGE_EMPTY_QUERY"] = "Enter the name of a wine, brand, region or grape variety.";
$MESS["VINO_SEARCH_PAGE_ERROR"] = "The query could not be read. Try wording it differently.";
$MESS["VINO_SEARCH_PAGE_NOTHING"] = "Nothing found for \"#QUERY#\". Check the spelling or browse the catalogue.";
$MESS["VINO_SEARCH_PAGE_CATALOG"] = "Go to the catalogue";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_0"] = "#COUNT# result for \"#QUERY#\"";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_1"] = "#COUNT# results for \"#QUERY#\"";
@@ -0,0 +1,12 @@
<?php
$MESS["VINO_SEARCH_PAGE_H1"] = "Wyszukiwanie";
$MESS["VINO_SEARCH_PAGE_LABEL"] = "Czego szukać";
$MESS["VINO_SEARCH_PAGE_PLACEHOLDER"] = "Wino, marka, region…";
$MESS["VINO_SEARCH_PAGE_SUBMIT"] = "Szukaj";
$MESS["VINO_SEARCH_PAGE_EMPTY_QUERY"] = "Wpisz nazwę wina, marki, regionu lub szczepu winorośli.";
$MESS["VINO_SEARCH_PAGE_ERROR"] = "Nie udało się odczytać zapytania. Spróbuj sformułować je inaczej.";
$MESS["VINO_SEARCH_PAGE_NOTHING"] = "Brak wyników dla „#QUERY#”. Sprawdź pisownię lub przejrzyj katalog.";
$MESS["VINO_SEARCH_PAGE_CATALOG"] = "Przejdź do katalogu";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_0"] = "#COUNT# wynik dla „#QUERY#”";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_1"] = "#COUNT# wyniki dla „#QUERY#”";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_2"] = "#COUNT# wyników dla „#QUERY#”";
@@ -0,0 +1,12 @@
<?php
$MESS["VINO_SEARCH_PAGE_H1"] = "Поиск";
$MESS["VINO_SEARCH_PAGE_LABEL"] = "Что найти";
$MESS["VINO_SEARCH_PAGE_PLACEHOLDER"] = "Вино, бренд, регион…";
$MESS["VINO_SEARCH_PAGE_SUBMIT"] = "Найти";
$MESS["VINO_SEARCH_PAGE_EMPTY_QUERY"] = "Введите название вина, бренда, региона или сорта винограда.";
$MESS["VINO_SEARCH_PAGE_ERROR"] = "Запрос не удалось разобрать. Попробуйте написать его иначе.";
$MESS["VINO_SEARCH_PAGE_NOTHING"] = "По запросу «#QUERY#» ничего не найдено. Проверьте написание или посмотрите каталог.";
$MESS["VINO_SEARCH_PAGE_CATALOG"] = "Перейти в каталог";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_0"] = "По запросу «#QUERY#» найден #COUNT# результат";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_1"] = "По запросу «#QUERY#» найдено #COUNT# результата";
$MESS["VINO_SEARCH_PAGE_FOUND_PLURAL_2"] = "По запросу «#QUERY#» найдено #COUNT# результатов";
@@ -0,0 +1,12 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$hits = array();
foreach ((array)($arResult["SEARCH"] ?? array()) as $item) {
$item["BODY"] = (string)($item["BODY_FORMATED"] ?? "");
$hits[] = $item;
}
$arResult["VINO_ITEMS"] = \Jinove\Vinoteca\Search::describe($hits);
$arResult["VINO_TOTAL"] = is_object($arResult["NAV_RESULT"] ?? null) ? (int)$arResult["NAV_RESULT"]->NavRecordCount : count($arResult["VINO_ITEMS"]);
@@ -0,0 +1,111 @@
.vino-search-page__form {
display: flex;
max-width: var(--measure);
margin-top: var(--space-6);
}
.vino-search-page {
--vino-search-page-pic-width: 72px;
--vino-search-page-pic-height: 90px;
--vino-pager-gap: 0;
padding: var(--space-head) var(--gutter) var(--space-section);
}
.vino-search-page__status {
margin: 0 0 var(--space-6);
color: var(--color-text-muted);
font-size: var(--text-base);
line-height: var(--leading-long);
}
.vino-search-page__list {
display: grid;
margin: 0;
padding: 0;
border-top: 1px solid var(--color-line);
list-style: none;
}
.vino-search-page__item {
position: relative;
display: flex;
align-items: center;
gap: var(--space-5);
padding: var(--space-5) 0;
border-bottom: 1px solid var(--color-line);
}
.vino-search-page__item:last-child {
border-bottom: 0;
}
.vino-search-page__pic {
display: flex;
flex: none;
align-items: center;
justify-content: center;
width: var(--vino-search-page-pic-width);
height: var(--vino-search-page-pic-height);
overflow: hidden;
background: var(--color-bg-soft);
}
.vino-search-page__img {
width: 100%;
height: 100%;
object-fit: cover;
}
.vino-search-page__body {
display: flex;
flex: 1;
flex-direction: column;
gap: var(--space-1);
min-width: 0;
}
.vino-search-page__kind {
color: var(--color-text-faint);
font-size: var(--fs-caption);
letter-spacing: var(--tracking-ui);
text-transform: uppercase;
}
.vino-search-page__link {
color: var(--color-text);
font-family: var(--font-serif);
font-size: var(--fs-h4);
line-height: var(--leading-title);
transition: color var(--duration-fast) var(--ease-base);
}
.vino-search-page__link::after {
content: "";
position: absolute;
inset: 0;
}
.vino-search-page__text {
display: -webkit-box;
overflow: hidden;
color: var(--color-text-muted);
font-size: var(--text-15);
line-height: var(--leading-text);
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.vino-search-page__price {
flex: none;
color: var(--color-accent);
font-family: var(--font-sans);
font-size: var(--text-19);
font-weight: 600;
}
@media (hover:hover) {
.vino-search-page__item:hover .vino-search-page__link {
color: var(--color-accent);
}
}
@media (max-width:560px) {
.vino-search-page {
--vino-search-page-pic-width: 56px;
--vino-search-page-pic-height: 70px;
}
.vino-search-page__item {
flex-wrap: wrap;
gap: var(--space-4);
}
.vino-search-page__price {
width: 100%;
padding-left: calc(var(--vino-search-page-pic-width) + var(--space-4));
font-size: var(--text-17);
}
}
@@ -0,0 +1,54 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$query = (string)($arResult["REQUEST"]["~QUERY"] ?? "");
$items = $arResult["VINO_ITEMS"];
?>
<section class="vino-razdel-hero">
<div class="vino-wrap">
<?php \Jinove\Vinoteca\Breadcrumbs::show(array(array(Loc::getMessage("VINO_SEARCH_PAGE_H1")))); ?>
<h1 class="vino-razdel-hero__title"><?= Loc::getMessage("VINO_SEARCH_PAGE_H1") ?></h1>
<form class="vino-search-page__form vino-query" action="<?= htmlspecialcharsbx(\Jinove\Vinoteca\Search::folder()) ?>" method="get" role="search">
<label class="vino-query__field">
<span class="vino-sr-only"><?= Loc::getMessage("VINO_SEARCH_PAGE_LABEL") ?></span>
<svg class="vino-query__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"></circle><path d="m20 20-3.6-3.6"></path></svg>
<input class="vino-query__input" type="search" name="q" value="<?= htmlspecialcharsbx($query) ?>" placeholder="<?= htmlspecialcharsbx((string)Loc::getMessage("VINO_SEARCH_PAGE_PLACEHOLDER")) ?>" autocomplete="off" enterkeyhint="search" required>
</label>
<button class="vino-btn vino-query__submit" type="submit"><?= Loc::getMessage("VINO_SEARCH_PAGE_SUBMIT") ?></button>
</form>
</div>
</section>
<section class="vino-search-page">
<div class="vino-wrap">
<?php if ($query === ""): ?>
<p class="vino-search-page__status"><?= Loc::getMessage("VINO_SEARCH_PAGE_EMPTY_QUERY") ?></p>
<?php elseif ((int)$arResult["ERROR_CODE"] !== 0): ?>
<p class="vino-search-page__status"><?= Loc::getMessage("VINO_SEARCH_PAGE_ERROR") ?></p>
<?php elseif (!$items): ?>
<p class="vino-search-page__status"><?= Loc::getMessage("VINO_SEARCH_PAGE_NOTHING", array("#QUERY#" => htmlspecialcharsbx($query))) ?></p>
<a class="vino-btn vino-search-page__catalog" href="<?= SITE_DIR ?>catalog/"><?= Loc::getMessage("VINO_SEARCH_PAGE_CATALOG") ?></a>
<?php else: ?>
<p class="vino-search-page__status" role="status"><?= Loc::getMessagePlural("VINO_SEARCH_PAGE_FOUND", $arResult["VINO_TOTAL"], array("#COUNT#" => $arResult["VINO_TOTAL"], "#QUERY#" => htmlspecialcharsbx($query))) ?></p>
<ul class="vino-search-page__list">
<?php foreach ($items as $item): ?>
<li class="vino-search-page__item">
<span class="vino-search-page__pic">
<?php if ($item["image"] !== ""): ?><img class="vino-search-page__img" src="<?= htmlspecialcharsbx($item["image"]) ?>" alt="" loading="lazy" decoding="async"><?php endif; ?>
</span>
<span class="vino-search-page__body">
<span class="vino-search-page__kind"><?= htmlspecialcharsbx($item["label"]) ?></span>
<a class="vino-search-page__link" href="<?= htmlspecialcharsbx($item["url"]) ?>"><?= htmlspecialcharsbx($item["name"]) ?></a>
<?php if ($item["meta"] !== ""): ?><span class="vino-search-page__text"><?= htmlspecialcharsbx($item["meta"]) ?></span><?php endif; ?>
</span>
<?php if ($item["price"] !== ""): ?><span class="vino-search-page__price"><?= htmlspecialcharsbx($item["price"]) ?></span><?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?= $arResult["NAV_STRING"] ?>
<?php endif; ?>
</div>
</section>