Vinoteca: wine shop on 1C-Bitrix (module, template, components, pages)

This commit is contained in:
jimagie committed 2026-10-22 23:22:27 +05:00
commit 52795535ae
586 files changed
+27619

No files matched your search

@@ -0,0 +1,2 @@
<?php
$MESS["VINO_BREADCRUMBS_LABEL"] = "Breadcrumbs";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_BREADCRUMBS_LABEL"] = "Ścieżka nawigacji";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_BREADCRUMBS_LABEL"] = "Хлебные крошки";
@@ -0,0 +1,28 @@
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
global $APPLICATION;
if (empty($arResult) || count($arResult) < 2) {
return "";
}
$self = (string)$APPLICATION->GetPageProperty("vino_canonical");
$self = VINO_HOST . strtok($self !== "" ? $self : $APPLICATION->GetCurPage(false), "?");
$last = count($arResult) - 1;
$strReturn = '<nav class="vino-breadcrumbs" aria-label="' . htmlspecialcharsbx(\Bitrix\Main\Localization\Loc::getMessage("VINO_BREADCRUMBS_LABEL")) . '"><ol class="vino-breadcrumbs__list">';
foreach ($arResult as $i => $item) {
$title = htmlspecialcharsex($item["TITLE"]);
$link = (string)$item["LINK"];
$strReturn .= '<li class="vino-breadcrumbs__item">';
if ($i > 0) {
$strReturn .= '<i class="vino-breadcrumbs__sep" aria-hidden="true"></i>';
}
if ($i < $last && $link !== "") {
$strReturn .= '<a class="vino-breadcrumbs__link" href="' . htmlspecialcharsbx($link) . '">' . $title . '</a>';
} else {
$strReturn .= '<span class="vino-breadcrumbs__current" aria-current="page">' . $title . '</span>';
}
$strReturn .= '</li>';
}
$strReturn .= '</ol></nav>';
if ($APPLICATION->GetPageProperty("vino_schema") !== "N") {
$strReturn .= '<script type="application/ld+json">' . json_encode(\Jinove\Vinoteca\Breadcrumbs::schema($arResult, $self), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) . '</script>';
}
return $strReturn;
@@ -0,0 +1,6 @@
<?php
$MESS["VINO_COMPARE_CHARS"] = "Characteristics";
$MESS["VINO_COMPARE_DIFF"] = "Differences only";
$MESS["VINO_COMPARE_CLEAR"] = "Clear comparison";
$MESS["VINO_COMPARE_WINES"] = "Wines being compared";
$MESS["VINO_COMPARE_SAME"] = "The characteristics do not differ.";
@@ -0,0 +1,6 @@
<?php
$MESS["VINO_COMPARE_CHARS"] = "Cechy";
$MESS["VINO_COMPARE_DIFF"] = "Tylko różnice";
$MESS["VINO_COMPARE_CLEAR"] = "Wyczyść porównanie";
$MESS["VINO_COMPARE_WINES"] = "Porównywane wina";
$MESS["VINO_COMPARE_SAME"] = "Cechy się nie różnią.";
@@ -0,0 +1,6 @@
<?php
$MESS["VINO_COMPARE_CHARS"] = "Характеристики";
$MESS["VINO_COMPARE_DIFF"] = "Только различия";
$MESS["VINO_COMPARE_CLEAR"] = "Очистить сравнение";
$MESS["VINO_COMPARE_WINES"] = "Вина в сравнении";
$MESS["VINO_COMPARE_SAME"] = "Различий в характеристиках нет.";
@@ -0,0 +1,6 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$arResult["VINO"] = \Jinove\Vinoteca\Catalog\Comparison::build((array)($arResult["ITEMS"] ?? array()));
@@ -0,0 +1,68 @@
(function (run) {
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
else run();
})(function () {
var root = document.querySelector('.vino-compare');
var table = root && root.querySelector('.vino-compare__table');
if (!table || !window.BX || !BX.ajax || !BX.ajax.runAction) return;
var KEY = 'vino-compare-diff';
function setDiff(on) {
root.classList.toggle('vino-compare--diff', on);
root.querySelectorAll('[data-compare-diff]').forEach(function (toggle) { toggle.setAttribute('aria-checked', on ? 'true' : 'false'); });
try { localStorage.setItem(KEY, on ? '1' : '0'); } catch (e) {}
}
function recompute() {
var count = table.querySelectorAll('.vino-compare__card').length;
table.querySelectorAll('.vino-compare__row').forEach(function (row) {
var values = Array.prototype.map.call(row.querySelectorAll('.vino-compare__value'), function (cell) { return cell.textContent.trim(); });
var same = values.length > 1 && values.every(function (value) { return value === values[0]; });
row.classList.toggle('vino-compare__row--same', same);
var caption = row.previousElementSibling;
if (caption && caption.classList.contains('vino-compare__caption-row')) {
caption.classList.toggle('vino-compare__caption-row--same', same);
caption.cells[0].colSpan = count + 1;
}
});
}
function removeColumn(cell) {
var index = cell.cellIndex;
Array.prototype.forEach.call(table.rows, function (row) {
if (!row.classList.contains('vino-compare__caption-row') && row.cells.length > index) row.deleteCell(index);
});
}
try { if (localStorage.getItem(KEY) === '1') setDiff(true); } catch (e) {}
document.addEventListener('click', function (event) {
var one = event.target.closest('.vino-compare__table [data-compare-toggle]');
if (one) {
event.preventDefault();
event.stopImmediatePropagation();
if (one.disabled) return;
one.disabled = true;
BX.ajax.runAction('jinove:vinoteca.compare.set', { data: { id: one.getAttribute('data-compare-toggle'), on: 'N' } }).then(function (response) {
document.dispatchEvent(new CustomEvent('vino:compare', { detail: response.data }));
removeColumn(one.closest('td'));
if (!table.querySelector('.vino-compare__card')) {
window.location.reload();
return;
}
recompute();
}, function () { one.disabled = false; });
return;
}
var diff = event.target.closest('[data-compare-diff]');
if (diff) {
setDiff(diff.getAttribute('aria-checked') !== 'true');
return;
}
var all = event.target.closest('[data-compare-clear]');
if (all) {
all.disabled = true;
BX.ajax.runAction('jinove:vinoteca.compare.clear', { data: {} }).then(function () { window.location.reload(); }, function () { all.disabled = false; });
}
}, true);
});
@@ -0,0 +1,203 @@
.vino-compare {
--vino-compare-label-width: 220px;
--vino-compare-column-width: 260px;
padding: var(--space-head) var(--gutter) var(--space-section);
}
.vino-compare__bar {
display: none;
}
.vino-compare__table .vino-compare__tools {
padding-top: 0;
vertical-align: top;
}
.vino-compare__table thead .vino-compare__corner, .vino-compare__table thead .vino-compare__head {
height: 0;
padding: 0;
}
.vino-compare__tools .vino-compare__clear {
display: block;
margin-top: var(--space-2);
padding: 0;
}
.vino-compare__switch {
display: inline-flex;
align-items: center;
gap: var(--space-3);
min-height: var(--size-tap);
padding: 0;
border: 0;
background: none;
color: var(--color-text);
font: inherit;
font-size: var(--text-13);
letter-spacing: var(--tracking-ui);
text-transform: uppercase;
cursor: pointer;
}
.vino-compare__track {
position: relative;
flex: none;
width: 40px;
height: 22px;
border: 1px solid var(--color-line);
border-radius: var(--radius-full);
background: var(--color-bg-soft);
transition: background var(--duration-fast) var(--ease-base), border-color var(--duration-fast) var(--ease-base);
}
.vino-compare__track::after {
content: "";
position: absolute;
top: 2px;
left: 2px;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--color-text-muted);
transition: transform var(--duration-fast) var(--ease-base), background var(--duration-fast) var(--ease-base);
}
.vino-compare__switch[aria-checked="true"] .vino-compare__track {
border-color: var(--color-accent);
background: var(--color-accent);
}
.vino-compare__switch[aria-checked="true"] .vino-compare__track::after {
background: var(--color-brown-950);
transform: translateX(18px);
}
.vino-compare__clear {
min-height: var(--size-tap);
padding: 0 var(--space-2);
border: 0;
background: none;
color: var(--color-text-muted);
font: inherit;
font-size: var(--text-13);
letter-spacing: var(--tracking-ui);
text-transform: uppercase;
text-decoration: underline;
text-underline-offset: 4px;
cursor: pointer;
transition: color var(--duration-fast) var(--ease-base);
}
.vino-compare__scroll {
position: relative;
overflow-x: auto;
overscroll-behavior-x: contain;
}
.vino-compare__table {
width: max-content;
border-collapse: collapse;
table-layout: fixed;
}
.vino-compare__corner, .vino-compare__label {
position: sticky;
left: 0;
z-index: 1;
width: var(--vino-compare-label-width);
padding: var(--space-4) var(--space-4) var(--space-4) 0;
background: var(--color-bg);
color: var(--color-text-faint);
font-size: var(--text-13);
font-weight: 400;
letter-spacing: var(--tracking-ui);
text-align: left;
text-transform: uppercase;
}
.vino-compare__corner {
vertical-align: bottom;
}
.vino-compare__head {
width: var(--vino-compare-column-width);
padding: 0 var(--space-3);
font-weight: 400;
text-align: left;
vertical-align: top;
}
.vino-compare__card {
padding: 0 var(--space-3) var(--space-6);
vertical-align: top;
}
.vino-compare__row {
border-top: 1px solid var(--color-line);
}
.vino-compare__caption-row {
display: none;
}
.vino-compare__caption {
padding: var(--space-3) 0 0;
color: var(--color-text-faint);
font-size: var(--fs-caption);
font-weight: 400;
letter-spacing: var(--tracking-ui);
text-align: left;
text-transform: uppercase;
}
.vino-compare__caption-text {
position: sticky;
left: 0;
}
.vino-compare__value {
padding: var(--space-4) var(--space-3);
color: var(--color-text);
font-size: var(--text-15);
line-height: var(--leading-text);
vertical-align: top;
}
.vino-compare--diff .vino-compare__row--same, .vino-compare--diff .vino-compare__caption-row--same {
display: none;
}
.vino-compare__row--same .vino-compare__value {
color: var(--color-text-muted);
}
@media (hover:hover) {
.vino-compare__switch:hover, .vino-compare__clear:hover {
color: var(--color-accent);
}
}
@media (max-width:760px) {
.vino-compare {
--vino-compare-label-width: 170px;
--vino-compare-column-width: 200px;
}
}
@media (max-width:560px) {
.vino-compare {
--vino-compare-column-width: 50cqw;
}
.vino-compare__scroll {
container-type: inline-size;
}
.vino-compare__bar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: var(--space-3);
margin-bottom: var(--space-4);
}
.vino-compare__tools > * {
display: none;
}
.vino-compare__corner, .vino-compare__label {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
padding: 0;
white-space: nowrap;
}
.vino-compare__caption-row {
display: table-row;
border-top: 1px solid var(--color-line);
}
.vino-compare__row {
border-top: 0;
}
.vino-compare__value {
padding: var(--space-1) var(--space-2) var(--space-3) 0;
}
.vino-compare__head, .vino-compare__card {
padding-right: var(--space-2);
padding-left: 0;
}
}
@@ -0,0 +1,50 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$items = $arResult["VINO"]["ITEMS"];
$rows = $arResult["VINO"]["ROWS"];
?>
<section class="vino-compare">
<div class="vino-wrap">
<?php if ($items): ?>
<div class="vino-compare__bar"><?php include __DIR__ . "/tools.php"; ?></div>
<div class="vino-compare__scroll" tabindex="0" role="region" aria-label="<?= htmlspecialcharsbx((string)Loc::getMessage("VINO_COMPARE_WINES")) ?>">
<table class="vino-compare__table">
<thead>
<tr>
<th class="vino-compare__corner" scope="col"><span class="vino-sr-only"><?= Loc::getMessage("VINO_COMPARE_CHARS") ?></span></th>
<?php foreach ($items as $item): ?>
<th class="vino-compare__head" scope="col"><span class="vino-sr-only"><?= htmlspecialcharsbx($item["~NAME"]) ?></span></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr class="vino-compare__cards">
<td class="vino-compare__label vino-compare__tools"><?php include __DIR__ . "/tools.php"; ?></td>
<?php foreach ($items as $item): ?>
<td class="vino-compare__card">
<?php $APPLICATION->IncludeComponent("bitrix:catalog.item", "vinoteca", array("RESULT" => array("ITEM" => $item, "AREA_ID" => "vino-compare-" . $item["ID"], "TYPE" => "CARD", "TITLE_TAG" => "h2", "COMPARE_ALWAYS" => "Y")), $component, array("HIDE_ICONS" => "Y")); ?>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($rows as $row): ?>
<tr class="vino-compare__caption-row<?= $row["SAME"] ? " vino-compare__caption-row--same" : "" ?>" aria-hidden="true">
<td class="vino-compare__caption" colspan="<?= count($items) + 1 ?>"><span class="vino-compare__caption-text"><?= htmlspecialcharsbx($row["LABEL"]) ?></span></td>
</tr>
<tr class="vino-compare__row<?= $row["SAME"] ? " vino-compare__row--same" : "" ?>">
<th class="vino-compare__label" scope="row"><?= htmlspecialcharsbx($row["LABEL"]) ?></th>
<?php foreach ($row["VALUES"] as $value): ?>
<td class="vino-compare__value"><?= $value !== "" ? htmlspecialcharsbx($value) : "&ndash;" ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</section>
@@ -0,0 +1,12 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
?>
<button class="vino-compare__switch" type="button" role="switch" aria-checked="false" data-compare-diff>
<span class="vino-compare__track" aria-hidden="true"></span>
<span class="vino-compare__switch-text"><?= Loc::getMessage("VINO_COMPARE_DIFF") ?></span>
</button>
<button class="vino-compare__clear" type="button" data-compare-clear><?= Loc::getMessage("VINO_COMPARE_CLEAR") ?></button>
@@ -0,0 +1,15 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$APPLICATION->SetPageProperty("og_type", "product");
if (!empty($arResult["VINO_SEO"]["IMAGE"])) {
$APPLICATION->SetPageProperty("og_image", $arResult["VINO_SEO"]["IMAGE"]);
}
if (!empty($arResult["VINO_SEO"]["TITLE"])) {
$APPLICATION->SetPageProperty("title", $arResult["VINO_SEO"]["TITLE"]);
}
if (!empty($arResult["VINO_SEO"]["DESCRIPTION"])) {
$APPLICATION->SetPageProperty("description", $arResult["VINO_SEO"]["DESCRIPTION"]);
}
@@ -0,0 +1,63 @@
<?php
$MESS["VINO_PDP_RATING_LABEL"] = "Rating #VALUE# out of 5, number of reviews #COUNT#";
$MESS["VINO_PDP_PHOTO_ALT"] = "#NAME#, additional photo";
$MESS["VINO_PDP_KIND"] = "Wine";
$MESS["VINO_PDP_KIND_RED"] = "Red wine";
$MESS["VINO_PDP_KIND_WHITE"] = "White wine";
$MESS["VINO_PDP_KIND_ROSE"] = "Rosé wine";
$MESS["VINO_PDP_KIND_SPARKLING"] = "Sparkling wine";
$MESS["VINO_PDP_KIND_DESSERT"] = "Dessert wine";
$MESS["VINO_PDP_KIND_ORANGE"] = "Orange wine";
$MESS["VINO_PDP_VOLUME_VALUE"] = "#VALUE# L";
$MESS["VINO_PDP_SPEC_TYPE"] = "Type";
$MESS["VINO_PDP_SPEC_COUNTRY"] = "Country";
$MESS["VINO_PDP_SPEC_REGION"] = "Region";
$MESS["VINO_PDP_SPEC_PRODUCER"] = "Producer";
$MESS["VINO_PDP_SPEC_GRAPE"] = "Grapes";
$MESS["VINO_PDP_SPEC_METHOD"] = "Production method";
$MESS["VINO_PDP_SPEC_PRESSURE"] = "Bottle pressure";
$MESS["VINO_PDP_SPEC_DOSAGE"] = "Dosage";
$MESS["VINO_PDP_SPEC_RESIDUAL_SUGAR"] = "Residual sugar";
$MESS["VINO_PDP_SPEC_ABV"] = "Alcohol";
$MESS["VINO_PDP_SPEC_VOLUME"] = "Volume";
$MESS["VINO_PDP_SPEC_VINTAGE"] = "Vintage";
$MESS["VINO_PDP_SPEC_AGING_LEES"] = "Ageing on lees";
$MESS["VINO_PDP_SPEC_SERVE"] = "Serving";
$MESS["VINO_PDP_SPEC_SUGAR"] = "Sweetness";
$MESS["VINO_PDP_SPEC_AGING"] = "Ageing";
$MESS["VINO_PDP_SPEC_AFTER_OPEN"] = "After opening";
$MESS["VINO_PDP_SPEC_COLOR"] = "Colour";
$MESS["VINO_PDP_SPEC_DECANT"] = "Decanting";
$MESS["VINO_PDP_SPEC_POTENTIAL"] = "Ageing potential";
$MESS["VINO_PDP_SPEC_TASTE_COLOR"] = "Colour";
$MESS["VINO_PDP_SPEC_AROMA"] = "Aroma";
$MESS["VINO_PDP_SPEC_TASTE"] = "Palate";
$MESS["VINO_PDP_SPEC_FOOD"] = "Food pairing";
$MESS["VINO_PDP_PHOTOS"] = "Product photos";
$MESS["VINO_PDP_ART"] = "SKU #VALUE#";
$MESS["VINO_PDP_STOCK"] = "In stock at the warehouse";
$MESS["VINO_PDP_LESS"] = "Decrease";
$MESS["VINO_PDP_MORE"] = "Increase";
$MESS["VINO_PDP_ADD_CART"] = "Add to cart";
$MESS["VINO_PDP_FAV"] = "Add to favourites";
$MESS["VINO_PDP_COMPARE"] = "Add to comparison";
$MESS["VINO_PDP_ASSUR_PICKUP"] = "Pick-up";
$MESS["VINO_PDP_ASSUR_PICKUP_TEXT"] = "From the warehouse at 251 Krasnaya Street";
$MESS["VINO_PDP_ASSUR_ORIGINAL"] = "Authentic";
$MESS["VINO_PDP_ASSUR_ORIGINAL_TEXT"] = "Genuine products from the producers";
$MESS["VINO_PDP_ASSUR_PAY"] = "Pay on pick-up";
$MESS["VINO_PDP_ASSUR_PAY_TEXT"] = "By card or in cash";
$MESS["VINO_PDP_ASSUR_STORAGE"] = "Storage";
$MESS["VINO_PDP_ASSUR_STORAGE_TEXT"] = "Cellar at 12 °C, 70% humidity";
$MESS["VINO_PDP_DESCRIPTION"] = "Description";
$MESS["VINO_PDP_SPECS"] = "Specifications";
$MESS["VINO_PDP_STOCK_OUT"] = "Out of stock";
$MESS["VINO_PDP_META_TITLE"] = "Buy #NAME# in Krasnodar | Vinoteca";
$MESS["VINO_PDP_NOPHOTO"] = "Photo coming soon";
$MESS["VINO_PDP_ZOOM"] = "Open photo full screen";
$MESS["VINO_PDP_NOTIFY"] = "Notify me when available";
$MESS["VINO_PDP_NOTIFY_NOTE"] = "Notify me when the wine arrives: #NAME#";
$MESS["VINO_PDP_META_TITLE_SHORT"] = "#NAME# | Vinoteca";
$MESS["VINO_PDP_META_TAIL_LONG"] = "Price, availability and details at Vinoteca, with a sommelier to help you choose.";
$MESS["VINO_PDP_META_TAIL_MEDIUM"] = "Price and availability at Vinoteca, a sommelier will help you choose.";
$MESS["VINO_PDP_META_TAIL_SHORT"] = "Price and availability at Vinoteca.";
@@ -0,0 +1,63 @@
<?php
$MESS["VINO_PDP_RATING_LABEL"] = "Ocena #VALUE# na 5, opinii: #COUNT#";
$MESS["VINO_PDP_PHOTO_ALT"] = "#NAME#, dodatkowe zdjęcie";
$MESS["VINO_PDP_KIND"] = "Wino";
$MESS["VINO_PDP_KIND_RED"] = "Wino czerwone";
$MESS["VINO_PDP_KIND_WHITE"] = "Wino białe";
$MESS["VINO_PDP_KIND_ROSE"] = "Wino różowe";
$MESS["VINO_PDP_KIND_SPARKLING"] = "Wino musujące";
$MESS["VINO_PDP_KIND_DESSERT"] = "Wino deserowe";
$MESS["VINO_PDP_KIND_ORANGE"] = "Wino pomarańczowe";
$MESS["VINO_PDP_VOLUME_VALUE"] = "#VALUE# l";
$MESS["VINO_PDP_SPEC_TYPE"] = "Typ";
$MESS["VINO_PDP_SPEC_COUNTRY"] = "Kraj";
$MESS["VINO_PDP_SPEC_REGION"] = "Region";
$MESS["VINO_PDP_SPEC_PRODUCER"] = "Producent";
$MESS["VINO_PDP_SPEC_GRAPE"] = "Szczepy";
$MESS["VINO_PDP_SPEC_METHOD"] = "Metoda produkcji";
$MESS["VINO_PDP_SPEC_PRESSURE"] = "Ciśnienie w butelce";
$MESS["VINO_PDP_SPEC_DOSAGE"] = "Dozaż";
$MESS["VINO_PDP_SPEC_RESIDUAL_SUGAR"] = "Cukier resztkowy";
$MESS["VINO_PDP_SPEC_ABV"] = "Alkohol";
$MESS["VINO_PDP_SPEC_VOLUME"] = "Pojemność";
$MESS["VINO_PDP_SPEC_VINTAGE"] = "Rocznik";
$MESS["VINO_PDP_SPEC_AGING_LEES"] = "Leżakowanie na osadzie";
$MESS["VINO_PDP_SPEC_SERVE"] = "Podawanie";
$MESS["VINO_PDP_SPEC_SUGAR"] = "Słodycz";
$MESS["VINO_PDP_SPEC_AGING"] = "Dojrzewanie";
$MESS["VINO_PDP_SPEC_AFTER_OPEN"] = "Po otwarciu";
$MESS["VINO_PDP_SPEC_COLOR"] = "Kolor";
$MESS["VINO_PDP_SPEC_DECANT"] = "Dekantacja";
$MESS["VINO_PDP_SPEC_POTENTIAL"] = "Potencjał starzenia";
$MESS["VINO_PDP_SPEC_TASTE_COLOR"] = "Kolor";
$MESS["VINO_PDP_SPEC_AROMA"] = "Aromat";
$MESS["VINO_PDP_SPEC_TASTE"] = "Smak";
$MESS["VINO_PDP_SPEC_FOOD"] = "Połączenia z jedzeniem";
$MESS["VINO_PDP_PHOTOS"] = "Zdjęcia produktu";
$MESS["VINO_PDP_ART"] = "Nr art. #VALUE#";
$MESS["VINO_PDP_STOCK"] = "Dostępne w magazynie";
$MESS["VINO_PDP_LESS"] = "Mniej";
$MESS["VINO_PDP_MORE"] = "Więcej";
$MESS["VINO_PDP_ADD_CART"] = "Do koszyka";
$MESS["VINO_PDP_FAV"] = "Dodaj do ulubionych";
$MESS["VINO_PDP_COMPARE"] = "Dodaj do porównania";
$MESS["VINO_PDP_ASSUR_PICKUP"] = "Odbiór osobisty";
$MESS["VINO_PDP_ASSUR_PICKUP_TEXT"] = "Z magazynu przy ul. Krasnej 251";
$MESS["VINO_PDP_ASSUR_ORIGINAL"] = "Oryginał";
$MESS["VINO_PDP_ASSUR_ORIGINAL_TEXT"] = "Oryginalne produkty producentów";
$MESS["VINO_PDP_ASSUR_PAY"] = "Płatność przy odbiorze";
$MESS["VINO_PDP_ASSUR_PAY_TEXT"] = "Kartą lub gotówką";
$MESS["VINO_PDP_ASSUR_STORAGE"] = "Przechowywanie";
$MESS["VINO_PDP_ASSUR_STORAGE_TEXT"] = "Piwnica 12 °C, wilgotność 70%";
$MESS["VINO_PDP_DESCRIPTION"] = "Opis";
$MESS["VINO_PDP_SPECS"] = "Specyfikacja";
$MESS["VINO_PDP_STOCK_OUT"] = "Brak w magazynie";
$MESS["VINO_PDP_META_TITLE"] = "Kup #NAME# w Krasnodarze | Vinoteca";
$MESS["VINO_PDP_NOPHOTO"] = "Zdjęcie wkrótce";
$MESS["VINO_PDP_ZOOM"] = "Otwórz zdjęcie na pełnym ekranie";
$MESS["VINO_PDP_NOTIFY"] = "Powiadom o dostępności";
$MESS["VINO_PDP_NOTIFY_NOTE"] = "Proszę o informację o dostępności wina: #NAME#";
$MESS["VINO_PDP_META_TITLE_SHORT"] = "#NAME# | Vinoteca";
$MESS["VINO_PDP_META_TAIL_LONG"] = "Cena, dostępność i szczegóły w katalogu Vinoteca, sommelier pomoże w wyborze.";
$MESS["VINO_PDP_META_TAIL_MEDIUM"] = "Cena i dostępność w katalogu Vinoteca, sommelier pomoże w wyborze.";
$MESS["VINO_PDP_META_TAIL_SHORT"] = "Cena i dostępność w katalogu Vinoteca.";
@@ -0,0 +1,63 @@
<?php
$MESS["VINO_PDP_RATING_LABEL"] = "Оценка #VALUE# из 5, отзывов: #COUNT#";
$MESS["VINO_PDP_PHOTO_ALT"] = "#NAME#, дополнительное фото";
$MESS["VINO_PDP_KIND"] = "Вино";
$MESS["VINO_PDP_KIND_RED"] = "Красное вино";
$MESS["VINO_PDP_KIND_WHITE"] = "Белое вино";
$MESS["VINO_PDP_KIND_ROSE"] = "Розовое вино";
$MESS["VINO_PDP_KIND_SPARKLING"] = "Игристое вино";
$MESS["VINO_PDP_KIND_DESSERT"] = "Десертное вино";
$MESS["VINO_PDP_KIND_ORANGE"] = "Оранжевое вино";
$MESS["VINO_PDP_VOLUME_VALUE"] = "#VALUE# л";
$MESS["VINO_PDP_SPEC_TYPE"] = "Тип";
$MESS["VINO_PDP_SPEC_COUNTRY"] = "Страна";
$MESS["VINO_PDP_SPEC_REGION"] = "Регион";
$MESS["VINO_PDP_SPEC_PRODUCER"] = "Производитель";
$MESS["VINO_PDP_SPEC_GRAPE"] = "Виноград";
$MESS["VINO_PDP_SPEC_METHOD"] = "Метод производства";
$MESS["VINO_PDP_SPEC_PRESSURE"] = "Давление в бутылке";
$MESS["VINO_PDP_SPEC_DOSAGE"] = "Дозаж";
$MESS["VINO_PDP_SPEC_RESIDUAL_SUGAR"] = "Остаточный сахар";
$MESS["VINO_PDP_SPEC_ABV"] = "Крепость";
$MESS["VINO_PDP_SPEC_VOLUME"] = "Объём";
$MESS["VINO_PDP_SPEC_VINTAGE"] = "Год";
$MESS["VINO_PDP_SPEC_AGING_LEES"] = "Выдержка на осадке";
$MESS["VINO_PDP_SPEC_SERVE"] = "Подача";
$MESS["VINO_PDP_SPEC_SUGAR"] = "Сахар";
$MESS["VINO_PDP_SPEC_AGING"] = "Выдержка";
$MESS["VINO_PDP_SPEC_AFTER_OPEN"] = "Хранение после открытия";
$MESS["VINO_PDP_SPEC_COLOR"] = "Цвет";
$MESS["VINO_PDP_SPEC_DECANT"] = "Декантация";
$MESS["VINO_PDP_SPEC_POTENTIAL"] = "Потенциал хранения";
$MESS["VINO_PDP_SPEC_TASTE_COLOR"] = "Цвет";
$MESS["VINO_PDP_SPEC_AROMA"] = "Аромат";
$MESS["VINO_PDP_SPEC_TASTE"] = "Вкус";
$MESS["VINO_PDP_SPEC_FOOD"] = "Гастрономия";
$MESS["VINO_PDP_PHOTOS"] = "Фотографии товара";
$MESS["VINO_PDP_ZOOM"] = "Открыть фото на весь экран";
$MESS["VINO_PDP_ART"] = "Арт. #VALUE#";
$MESS["VINO_PDP_STOCK"] = "В наличии на складе";
$MESS["VINO_PDP_LESS"] = "Меньше";
$MESS["VINO_PDP_MORE"] = "Больше";
$MESS["VINO_PDP_ADD_CART"] = "В корзину";
$MESS["VINO_PDP_FAV"] = "В избранное";
$MESS["VINO_PDP_COMPARE"] = "Добавить к сравнению";
$MESS["VINO_PDP_ASSUR_PICKUP"] = "Самовывоз";
$MESS["VINO_PDP_ASSUR_PICKUP_TEXT"] = "Со склада на ул. Красной, 251";
$MESS["VINO_PDP_ASSUR_ORIGINAL"] = "Оригинал";
$MESS["VINO_PDP_ASSUR_ORIGINAL_TEXT"] = "Оригинальная продукция производителей";
$MESS["VINO_PDP_ASSUR_PAY"] = "Оплата при получении";
$MESS["VINO_PDP_ASSUR_PAY_TEXT"] = "Картой или наличными";
$MESS["VINO_PDP_ASSUR_STORAGE"] = "Хранение";
$MESS["VINO_PDP_ASSUR_STORAGE_TEXT"] = "Погреб 12 °C, влажность 70%";
$MESS["VINO_PDP_DESCRIPTION"] = "Описание";
$MESS["VINO_PDP_SPECS"] = "Характеристики";
$MESS["VINO_PDP_STOCK_OUT"] = "Нет в наличии";
$MESS["VINO_PDP_NOTIFY"] = "Сообщить о поступлении";
$MESS["VINO_PDP_NOTIFY_NOTE"] = "Сообщите о поступлении вина: #NAME#";
$MESS["VINO_PDP_NOPHOTO"] = "Фото скоро появится";
$MESS["VINO_PDP_META_TITLE"] = "#NAME#: купить в Краснодаре | Vinoteca";
$MESS["VINO_PDP_META_TITLE_SHORT"] = "#NAME# | Vinoteca";
$MESS["VINO_PDP_META_TAIL_LONG"] = "Цена, наличие и характеристики в каталоге Vinoteca, сомелье поможет с выбором.";
$MESS["VINO_PDP_META_TAIL_MEDIUM"] = "Цена и наличие в каталоге Vinoteca, сомелье поможет выбрать.";
$MESS["VINO_PDP_META_TAIL_SHORT"] = "Цена и наличие в каталоге Vinoteca.";
@@ -0,0 +1,208 @@
<?php
use Bitrix\Main\Localization\Loc;
use Jinove\Vinoteca\Catalog\EnumNames;
use Jinove\Vinoteca\Catalog\LocalizedText;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__DIR__ . "/template.php");
$properties = $arResult["PROPERTIES"] ?? [];
$plain = function (string $code) use ($properties): string {
$value = $properties[$code]["~VALUE"] ?? $properties[$code]["VALUE"] ?? "";
if (is_array($value)) {
$value = implode(", ", array_filter($value));
}
return trim((string)$value);
};
$enum = fn(string $code): string => EnumNames::fromProperty($properties[$code] ?? []);
$text = fn(string $code): string => LocalizedText::property($properties, $code);
$number = fn(string $value): string => LANGUAGE_ID === "en" ? $value : str_replace(".", ",", $value);
$label = fn(string $code): string => (string)Loc::getMessage("VINO_PDP_SPEC_" . $code);
$colorCode = (string)($properties["WINE_COLOR"]["VALUE_XML_ID"] ?? "");
$color = $enum("WINE_COLOR");
$sugar = $enum("SUGAR");
$grape = $enum("GRAPE");
$region = $enum("REGION");
$country = $enum("COUNTRY");
$brand = current($arResult["DISPLAY_PROPERTIES"]["BRAND"]["LINK_ELEMENT_VALUE"] ?? []) ?: [];
$producer = trim((string)($brand["~NAME"] ?? ""));
$volume = $plain("VOLUME") !== "" ? (string)Loc::getMessage("VINO_PDP_VOLUME_VALUE", ["#VALUE#" => $number($plain("VOLUME"))]) : "";
$alcohol = $plain("ABV") !== "" ? $number($plain("ABV")) . "%" : "";
$aging = $text("AGING");
$serve = $plain("SERVE_TEMP");
$vintage = $plain("VINTAGE");
$detail = LocalizedText::detailText($arResult);
$srcset = function (int $fileId, string $src, int $width): string {
$parts = [];
foreach ([480, 800] as $target) {
if ($width <= $target) {
continue;
}
$resized = CFile::ResizeImageGet($fileId, ["width" => $target, "height" => 9999], BX_RESIZE_IMAGE_PROPORTIONAL, false);
if (!empty($resized["src"])) {
$parts[] = $resized["src"] . " " . $target . "w";
}
}
if (!$parts) {
return "";
}
$parts[] = $src . " " . $width . "w";
return implode(", ", $parts);
};
$thumb = function (int $fileId, string $src): string {
$resized = CFile::ResizeImageGet($fileId, ["width" => 180, "height" => 120], BX_RESIZE_IMAGE_PROPORTIONAL, false);
return (string)($resized["src"] ?? $src);
};
$gallery = [];
$mainPicture = $arResult["DETAIL_PICTURE"] ?: ($arResult["PREVIEW_PICTURE"] ?? null);
if (is_array($mainPicture) && !empty($mainPicture["SRC"])) {
$gallery[] = ["SRC" => $mainPicture["SRC"], "SRCSET" => $srcset((int)($mainPicture["ID"] ?? 0), $mainPicture["SRC"], (int)($mainPicture["WIDTH"] ?? 0)), "THUMB" => $thumb((int)($mainPicture["ID"] ?? 0), $mainPicture["SRC"]), "ALT" => $arResult["~NAME"], "WIDTH" => (int)($mainPicture["WIDTH"] ?? 0), "HEIGHT" => (int)($mainPicture["HEIGHT"] ?? 0)];
}
$photos = (array)($properties["MORE_PHOTO"]["VALUE"] ?? []);
$descriptions = (array)($properties["MORE_PHOTO"]["DESCRIPTION"] ?? []);
foreach (array_filter($photos) as $index => $fileId) {
$file = CFile::GetFileArray((int)$fileId);
$src = (string)($file["SRC"] ?? "");
if ($src === "") {
continue;
}
$description = trim((string)($descriptions[$index] ?? ""));
$gallery[] = [
"SRC" => $src,
"SRCSET" => $srcset((int)$fileId, $src, (int)($file["WIDTH"] ?? 0)),
"THUMB" => $thumb((int)$fileId, $src),
"WIDTH" => (int)($file["WIDTH"] ?? 0),
"HEIGHT" => (int)($file["HEIGHT"] ?? 0),
"ALT" => $description !== "" ? $arResult["~NAME"] . ", " . $description : (string)Loc::getMessage("VINO_PDP_PHOTO_ALT", ["#NAME#" => $arResult["~NAME"]]),
];
}
$price = reset($arResult["ITEM_PRICES"]) ?: [];
$printPrice = (string)($price["PRINT_RATIO_PRICE"] ?? $price["PRINT_PRICE"] ?? "");
$hasDiscount = (float)($price["RATIO_BASE_PRICE"] ?? 0) > (float)($price["RATIO_PRICE"] ?? 0);
$printOldPrice = $hasDiscount ? (string)($price["PRINT_RATIO_BASE_PRICE"] ?? "") : "";
$discountPercent = $hasDiscount ? (int)round((float)($price["PERCENT"] ?? 0)) : 0;
$priceValue = (float)($price["RATIO_PRICE"] ?? $price["PRICE"] ?? 0);
$currency = (string)($price["CURRENCY"] ?? "");
$kind = $colorCode !== "" ? (string)Loc::getMessage("VINO_PDP_KIND_" . strtoupper($colorCode)) : "";
$kicker = trim(($kind !== "" ? $kind : (string)Loc::getMessage("VINO_PDP_KIND")) . ($country !== "" ? " · " . $country : ""), " ·,");
$specs = [[$label("TYPE"), $text("WINE_CATEGORY")], [$label("COUNTRY"), $country], [$label("REGION"), $region], [$label("PRODUCER"), $producer], [$label("GRAPE"), $grape]];
if ($colorCode === "sparkling") {
$specs = array_merge($specs, [
[$label("METHOD"), $text("WINE_METHOD")], [$label("PRESSURE"), $text("PRESSURE")],
[$label("DOSAGE"), $sugar], [$label("RESIDUAL_SUGAR"), $text("RESIDUAL_SUGAR")],
[$label("ABV"), $alcohol], [$label("VOLUME"), $volume], [$label("VINTAGE"), $vintage],
[$label("AGING_LEES"), $aging], [$label("SERVE"), $serve],
]);
} elseif ($colorCode === "dessert") {
$specs = array_merge($specs, [
[$label("SUGAR"), $sugar], [$label("RESIDUAL_SUGAR"), $text("RESIDUAL_SUGAR")],
[$label("ABV"), $alcohol], [$label("VOLUME"), $volume], [$label("VINTAGE"), $vintage],
[$label("AGING"), $aging], [$label("SERVE"), $serve], [$label("AFTER_OPEN"), $text("AFTER_OPEN")],
]);
} else {
$specs = array_merge($specs, [
[$label("COLOR"), $color], [$label("SUGAR"), $sugar],
[$label("ABV"), $alcohol], [$label("VOLUME"), $volume], [$label("VINTAGE"), $vintage],
[$label("AGING"), $aging], [$label("DECANT"), $text("DECANT")], [$label("SERVE"), $serve],
[$label("POTENTIAL"), $text("AGING_POTENTIAL")],
]);
}
$tasting = [[$label("TASTE_COLOR"), $text("TASTE_COLOR")], [$label("AROMA"), $text("AROMA")], [$label("TASTE"), $text("TASTE")], [$label("FOOD"), $text("FOOD_PAIRING")]];
$reviewCount = (int)($properties["REVIEW_COUNT"]["VALUE"] ?? 0);
$reviewRating = (float)($properties["REVIEW_RATING"]["VALUE"] ?? 0);
$plainDetail = trim((string)preg_replace('/\s+/u', " ", strip_tags(str_replace("</p>", " </p>", $detail))));
$url = VINO_HOST . $arResult["DETAIL_PAGE_URL"];
$canBuy = !empty($arResult["CAN_BUY"]);
$seoDescription = \Jinove\Vinoteca\Seo::fitDescription(\Jinove\Vinoteca\Seo::description($plainDetail), [(string)Loc::getMessage("VINO_PDP_META_TAIL_LONG"), (string)Loc::getMessage("VINO_PDP_META_TAIL_MEDIUM"), (string)Loc::getMessage("VINO_PDP_META_TAIL_SHORT")]);
$pathRelative = SITE_DIR !== "/" && str_starts_with($arResult["DETAIL_PAGE_URL"], SITE_DIR) ? "/" . substr($arResult["DETAIL_PAGE_URL"], strlen(SITE_DIR)) : $arResult["DETAIL_PAGE_URL"];
$translations = [];
foreach (\Jinove\Vinoteca\Config::languages() as $language => $settings) {
if ($language !== LANGUAGE_ID) {
$translations[$language] = VINO_HOST . rtrim((string)$settings["dir"], "/") . $pathRelative;
}
}
$dates = \Bitrix\Iblock\ElementTable::getRow(["select" => ["DATE_CREATE", "TIMESTAMP_X"], "filter" => ["=ID" => (int)$arResult["ID"]]]);
$schemaProperties = [];
foreach (array_merge($specs, $tasting) as $row) {
if ($row[1] === "" || in_array($row[0], [$label("COUNTRY"), $label("PRODUCER")], true)) {
continue;
}
$entry = ["name" => $row[0], "value" => $row[1]];
if ($row[0] === $label("ABV") && is_numeric($plain("ABV"))) {
$entry["value"] = (float)$plain("ABV");
$entry["unitCode"] = "P1";
} elseif ($row[0] === $label("VOLUME") && is_numeric($plain("VOLUME"))) {
$entry["value"] = (float)$plain("VOLUME");
$entry["unitCode"] = "LTR";
}
$schemaProperties[] = $entry;
}
$schemaImages = array_map(fn($item) => ["src" => VINO_HOST . $item["SRC"], "width" => $item["WIDTH"], "height" => $item["HEIGHT"], "alt" => $item["ALT"]], $gallery);
$schemaReviews = array_map(fn($item) => $item + ["language" => preg_match("/\p{Cyrillic}/u", $item["text"]) ? "ru" : LANGUAGE_ID], \Jinove\Vinoteca\Catalog\ReviewStats::items((int)$arResult["ID"]));
$schemaRelated = array_map(fn($item) => ["name" => $item["name"], "url" => VINO_HOST . $item["url"]], \Jinove\Vinoteca\Catalog\Related::summaries(\Jinove\Vinoteca\Catalog\Related::ids((int)VINO_CATALOG_IBLOCK, (int)$arResult["ID"])));
$structured = \Jinove\Vinoteca\Catalog\WineSchema::card([
"host" => VINO_HOST,
"language" => LANGUAGE_ID,
"url" => $url,
"name" => $arResult["~NAME"],
"description" => $plainDetail,
"pageDescription" => $seoDescription,
"images" => $schemaImages,
"sku" => $plain("ARTNUMBER"),
"category" => $text("WINE_CATEGORY") !== "" ? $text("WINE_CATEGORY") : $kind,
"country" => $country,
"vintage" => preg_match('/^\d{4}$/', $vintage) ? $vintage : "",
"brand" => ["name" => $producer, "url" => !empty($brand["DETAIL_PAGE_URL"]) ? VINO_HOST . $brand["DETAIL_PAGE_URL"] : ""],
"properties" => $schemaProperties,
"price" => $priceValue,
"currency" => $currency,
"listPrice" => $hasDiscount ? (float)($price["RATIO_BASE_PRICE"] ?? 0) : 0.0,
"canBuy" => $canBuy,
"reviewCount" => $reviewCount,
"reviewRating" => $reviewRating,
"reviews" => $schemaReviews,
"related" => $schemaRelated,
"translations" => $translations,
"created" => $dates ? $dates["DATE_CREATE"]->format("c") : date("c"),
"modified" => $dates ? $dates["TIMESTAMP_X"]->format("c") : date("c"),
]);
$chips = array_values(array_filter([$color, $sugar, $grape, $volume, $alcohol]));
$chipKeys = array_map(fn($chip) => mb_strtolower((string)$chip), $chips);
$detailView = LANGUAGE_ID === "ru" ? (string)preg_replace(['~^\s*<p>[^<]*Регион [^<]*</p>\s*~u', '~^\s*<p>Произведено домом [^<]*</p>\s*~u'], "", $detail, 1) : $detail;
$arResult["VINO"] = [
"CAN_BUY" => $canBuy,
"KICKER" => $kicker,
"BRAND" => $producer,
"ARTICLE" => $plain("ARTNUMBER"),
"OLD_PRICE" => $printOldPrice,
"PERCENT" => $discountPercent,
"CHIPS" => $chips,
"PRICE" => strtr($printPrice, ["&#8381;" => '<span class="vino-pdp__currency">₽</span>', "₽" => '<span class="vino-pdp__currency">₽</span>']),
"GALLERY" => $gallery,
"DETAIL" => $detailView,
"SPECS" => array_values(array_filter($specs, fn($row) => $row[1] !== "" && !in_array(mb_strtolower((string)$row[1]), $chipKeys, true))),
"TASTING" => array_values(array_filter($tasting, fn($row) => $row[1] !== "")),
"REVIEW_COUNT" => $reviewCount,
"REVIEW_RATING" => number_format($reviewRating, 1, LANGUAGE_ID === "en" ? "." : ",", ""),
"STRUCTURED" => $structured,
];
$arResult["VINO_SEO"] = [
"IMAGE" => isset($gallery[0]) ? VINO_HOST . $gallery[0]["SRC"] : "",
"DESCRIPTION" => $seoDescription,
"TITLE" => \Jinove\Vinoteca\Seo::fitTitle([(string)Loc::getMessage("VINO_PDP_META_TITLE", ["#NAME#" => $arResult["~NAME"]]), (string)Loc::getMessage("VINO_PDP_META_TITLE_SHORT", ["#NAME#" => $arResult["~NAME"]])]),
];
$this->__component->SetResultCacheKeys(["VINO_SEO"]);
@@ -0,0 +1,95 @@
(function () {
function initGallery() {
var gallery = document.querySelector('[data-gallery]');
if (!gallery) return;
var main = gallery.querySelector('[data-gallery-main]');
var thumbs = gallery.querySelectorAll('[data-gallery-thumb]');
if (!main || !thumbs.length) return;
thumbs.forEach(function (thumb) {
thumb.addEventListener('click', function () {
main.srcset = thumb.getAttribute('data-gallery-srcset') || '';
main.src = thumb.getAttribute('data-gallery-src');
main.alt = thumb.getAttribute('data-gallery-alt');
thumbs.forEach(function (item) {
var active = item === thumb;
item.classList.toggle('vino-pdp__thumb--active', active);
item.setAttribute('aria-pressed', active ? 'true' : 'false');
});
});
});
}
function initLightbox() {
var gallery = document.querySelector('[data-gallery]');
if (!gallery || !window.PhotoSwipe) return;
var main = gallery.querySelector('[data-gallery-main]');
var opener = gallery.querySelector('[data-gallery-open]');
var thumbs = Array.prototype.slice.call(gallery.querySelectorAll('[data-gallery-thumb]'));
if (!main || !opener) return;
function items() {
if (!thumbs.length) {
return [{ src: main.getAttribute('src'), width: Number(main.getAttribute('width')) || main.naturalWidth, height: Number(main.getAttribute('height')) || main.naturalHeight, alt: main.alt }];
}
return thumbs.map(function (thumb) {
return {
src: thumb.getAttribute('data-gallery-src'),
width: Number(thumb.getAttribute('data-gallery-width')) || 1536,
height: Number(thumb.getAttribute('data-gallery-height')) || 1024,
alt: thumb.getAttribute('data-gallery-alt') || ''
};
});
}
opener.addEventListener('click', function () {
var index = 0;
thumbs.forEach(function (thumb, position) {
if (thumb.classList.contains('vino-pdp__thumb--active')) index = position;
});
var pswp = new window.PhotoSwipe({ dataSource: items(), index: index, bgOpacity: 0.94, wheelToZoom: true });
pswp.on('change', function () {
if (thumbs[pswp.currIndex]) thumbs[pswp.currIndex].click();
});
pswp.init();
});
}
function initStepper() {
var stepper = document.querySelector('[data-stepper]');
if (!stepper) return;
var output = stepper.querySelector('output');
var value = 1;
stepper.querySelectorAll('[data-stepper-step]').forEach(function (button) {
button.addEventListener('click', function () {
value = Math.min(99, Math.max(1, value + Number(button.getAttribute('data-stepper-step'))));
output.textContent = value;
});
});
}
function initRelated() {
var viewport = document.querySelector('[data-related-viewport]');
var nav = document.querySelector('[data-related-nav]');
if (!viewport || !nav) return;
function step() {
var card = viewport.querySelector('.vino-card');
return card ? (card.getBoundingClientRect().width + 22) * 2 : 300;
}
nav.querySelectorAll('[data-dir]').forEach(function (button) {
button.addEventListener('click', function () {
viewport.scrollBy({ left: (Number(button.getAttribute('data-dir')) || 1) * step(), behavior: 'smooth' });
});
});
}
function init() {
initGallery();
initLightbox();
initStepper();
initRelated();
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
@@ -0,0 +1,91 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
$vino = $arResult["VINO"];
$gallery = $vino["GALLERY"];
if ($gallery) {
$this->addExternalCss(SITE_TEMPLATE_PATH . "/assets/vendor/photoswipe/photoswipe.css?v=5.4.4");
$this->addExternalJs(SITE_TEMPLATE_PATH . "/assets/vendor/photoswipe/photoswipe.umd.min.js?v=5.4.4");
}
?>
<script type="application/ld+json"><?= json_encode($vino["STRUCTURED"], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
<section class="vino-pdp">
<div class="vino-wrap">
<div class="vino-pdp__main">
<div class="vino-pdp__gallery" data-gallery>
<div class="vino-pdp__stage vino-pdp__stage--shot">
<?php if (!$gallery): ?><span class="vino-photo-stub"><span class="vino-photo-stub__brand"><?= htmlspecialcharsbx($vino["BRAND"]) ?></span><span class="vino-photo-stub__text"><?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_NOPHOTO")) ?></span></span><?php else: ?><img class="vino-pdp__image" src="<?= htmlspecialcharsbx($gallery[0]["SRC"]) ?>"<?= $gallery[0]["SRCSET"] !== "" ? ' srcset="' . htmlspecialcharsbx($gallery[0]["SRCSET"]) . '" sizes="(max-width: 980px) calc(100vw - 32px), 667px"' : "" ?><?= $gallery[0]["WIDTH"] ? ' width="' . $gallery[0]["WIDTH"] . '" height="' . $gallery[0]["HEIGHT"] . '"' : "" ?> alt="<?= htmlspecialcharsbx($gallery[0]["ALT"]) ?>" fetchpriority="high" decoding="async" data-gallery-main><button type="button" class="vino-pdp__zoom" data-gallery-open aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_ZOOM")) ?>"></button><?php endif; ?>
</div>
<?php if (count($gallery) > 1): ?>
<div class="vino-pdp__thumbs" role="group" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_PHOTOS")) ?>">
<?php foreach ($gallery as $index => $photo): ?>
<button type="button" class="vino-pdp__thumb<?= $index === 0 ? " vino-pdp__thumb--active" : "" ?>" data-gallery-thumb data-gallery-src="<?= htmlspecialcharsbx($photo["SRC"]) ?>" data-gallery-srcset="<?= htmlspecialcharsbx($photo["SRCSET"]) ?>" data-gallery-alt="<?= htmlspecialcharsbx($photo["ALT"]) ?>" data-gallery-width="<?= (int)($photo["WIDTH"] ?? 0) ?>" data-gallery-height="<?= (int)($photo["HEIGHT"] ?? 0) ?>" aria-label="<?= htmlspecialcharsbx($photo["ALT"]) ?>" aria-pressed="<?= $index === 0 ? "true" : "false" ?>">
<img class="vino-pdp__thumb-img" src="<?= htmlspecialcharsbx($photo["THUMB"]) ?>" width="90" height="60" alt="" loading="lazy">
</button>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div class="vino-pdp__info">
<p class="vino-pdp__kicker"><?= htmlspecialcharsbx($vino["KICKER"]) ?></p>
<h1 class="vino-pdp__title"><?= $arResult["NAME"] ?></h1>
<div class="vino-pdp__sub">
<?php if ($vino["REVIEW_COUNT"] > 0): ?><a class="vino-pdp__rating" href="#reviews" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_RATING_LABEL", array("#VALUE#" => $vino["REVIEW_RATING"], "#COUNT#" => $vino["REVIEW_COUNT"]))) ?>"><span class="vino-pdp__rating-star" aria-hidden="true"></span><?= $vino["REVIEW_RATING"] ?> <span class="vino-pdp__rating-count">(<?= $vino["REVIEW_COUNT"] ?>)</span></a><?php endif; ?>
</div>
<?php if ($vino["CHIPS"]): ?>
<ul class="vino-pdp__chips"><?php foreach ($vino["CHIPS"] as $chip): ?><li class="vino-pdp__chip"><?= htmlspecialcharsbx($chip) ?></li><?php endforeach; ?></ul>
<?php endif; ?>
<div class="vino-pdp__buy">
<div class="vino-pdp__price<?= $vino["CAN_BUY"] ? "" : " vino-pdp__price--out" ?>"><b class="vino-pdp__price-now"><?= $vino["PRICE"] ?></b><?php if ($vino["OLD_PRICE"] !== ""): ?><s class="vino-pdp__price-old"><?= $vino["OLD_PRICE"] ?></s><span class="vino-pdp__percent">&minus;<?= (int)$vino["PERCENT"] ?>%</span><?php endif; ?><?php if ($vino["ARTICLE"] !== ""): ?><span class="vino-pdp__art"><?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_ART", array("#VALUE#" => $vino["ARTICLE"]))) ?></span><?php endif; ?></div>
<p class="vino-pdp__stock<?= $vino["CAN_BUY"] ? "" : " vino-pdp__stock--out" ?>"><?= Loc::getMessage($vino["CAN_BUY"] ? "VINO_PDP_STOCK" : "VINO_PDP_STOCK_OUT") ?></p>
<div class="vino-pdp__cart">
<?php if ($vino["CAN_BUY"]): ?>
<div class="vino-pdp__stepper" data-stepper>
<button type="button" class="vino-pdp__step" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_LESS")) ?>" data-stepper-step="-1">−</button>
<output class="vino-pdp__qty" aria-live="polite">1</output>
<button type="button" class="vino-pdp__step" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_MORE")) ?>" data-stepper-step="1">+</button>
</div>
<button type="button" class="vino-pdp__addcart" data-add-cart="<?= (int)$arResult["ID"] ?>"><?= Loc::getMessage("VINO_PDP_ADD_CART") ?></button>
<?php else: ?>
<button type="button" class="vino-pdp__notify" data-sommelier-open data-sommelier-note="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_NOTIFY_NOTE", array("#NAME#" => $arResult["~NAME"]))) ?>"><?= Loc::getMessage("VINO_PDP_NOTIFY") ?></button>
<?php endif; ?>
<button type="button" class="vino-pdp__iconbtn" data-fav-toggle="<?= (int)$arResult["ID"] ?>" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_FAV")) ?>" aria-pressed="false"><svg class="vino-pdp__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.5-1.5 3-3.2 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.8 0-3 .5-4.5 2-1.5-1.5-2.7-2-4.5-2A5.5 5.5 0 0 0 2 8.5C2 10.8 3.5 12.5 5 14l7 7Z"></path></svg></button>
<button type="button" class="vino-pdp__iconbtn vino-pdp__iconbtn--compare" data-compare-toggle="<?= (int)$arResult["ID"] ?>" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_PDP_COMPARE")) ?>" aria-pressed="false"><svg class="vino-pdp__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 20V11M12 20V4M18 20v-6"></path></svg></button>
</div>
<ul class="vino-pdp__assur">
<li class="vino-pdp__assur-item"><svg class="vino-pdp__assur-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9l1.5-5h13L20 9M4 9v10h16V9M4 9h16M9 19v-5h6v5"/></svg><span class="vino-pdp__assur-body"><b class="vino-pdp__assur-title"><?= Loc::getMessage("VINO_PDP_ASSUR_PICKUP") ?></b><span class="vino-pdp__assur-text"><?= Loc::getMessage("VINO_PDP_ASSUR_PICKUP_TEXT") ?></span></span></li>
<li class="vino-pdp__assur-item"><svg class="vino-pdp__assur-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l7 3v5c0 4.5-3 8-7 10-4-2-7-5.5-7-10V6l7-3zM9 12l2 2 4-4"/></svg><span class="vino-pdp__assur-body"><b class="vino-pdp__assur-title"><?= Loc::getMessage("VINO_PDP_ASSUR_ORIGINAL") ?></b><span class="vino-pdp__assur-text"><?= Loc::getMessage("VINO_PDP_ASSUR_ORIGINAL_TEXT") ?></span></span></li>
<li class="vino-pdp__assur-item"><svg class="vino-pdp__assur-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18v12H3zM3 10h18M7 15h4"/></svg><span class="vino-pdp__assur-body"><b class="vino-pdp__assur-title"><?= Loc::getMessage("VINO_PDP_ASSUR_PAY") ?></b><span class="vino-pdp__assur-text"><?= Loc::getMessage("VINO_PDP_ASSUR_PAY_TEXT") ?></span></span></li>
<li class="vino-pdp__assur-item"><svg class="vino-pdp__assur-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 14.5V5a2 2 0 014 0v9.5a4 4 0 11-4 0zM12 8v7"/></svg><span class="vino-pdp__assur-body"><b class="vino-pdp__assur-title"><?= Loc::getMessage("VINO_PDP_ASSUR_STORAGE") ?></b><span class="vino-pdp__assur-text"><?= Loc::getMessage("VINO_PDP_ASSUR_STORAGE_TEXT") ?></span></span></li>
</ul>
</div>
</div>
</div>
<div class="vino-pdp__detail">
<div class="vino-pdp__prose">
<h2 class="vino-pdp__heading"><?= Loc::getMessage("VINO_PDP_DESCRIPTION") ?></h2>
<?= $vino["DETAIL"] ?>
<?php if ($vino["TASTING"]): ?>
<div class="vino-pdp__tasting">
<?php foreach ($vino["TASTING"] as $row): ?><div class="vino-pdp__tasting-row"><div class="vino-pdp__tasting-key"><?= htmlspecialcharsbx($row[0]) ?></div><div class="vino-pdp__tasting-value"><?= htmlspecialcharsbx($row[1]) ?></div></div><?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<aside class="vino-pdp__specs">
<h2 class="vino-pdp__heading vino-pdp__heading--specs"><?= Loc::getMessage("VINO_PDP_SPECS") ?></h2>
<dl class="vino-pdp__list">
<?php foreach ($vino["SPECS"] as $row): ?>
<div class="vino-pdp__row"><dt class="vino-pdp__term"><?= htmlspecialcharsbx($row[0]) ?></dt><dd class="vino-pdp__def"><?= htmlspecialcharsbx($row[1]) ?></dd></div>
<?php endforeach; ?>
</dl>
</aside>
</div>
</div>
</section>
@@ -0,0 +1,24 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
$card = $arResult["CARD"];
$titleTag = ($arResult["TITLE_TAG"] ?? "") === "h2" ? "h2" : "h3";
?>
<article class="vino-card"<?= !empty($arResult["AREA_ID"]) ? ' id="' . $arResult["AREA_ID"] . '"' : "" ?>>
<a class="vino-card__image vino-card__image--shot" href="<?= $card["URL"] ?>" tabindex="-1" aria-hidden="true">
<?php if ($card["IMG"]): ?><img class="vino-card__img" loading="lazy" decoding="async" src="<?= $card["IMG"]["SRC"] ?>"<?= $card["IMG"]["WIDTH"] ? ' width="' . $card["IMG"]["WIDTH"] . '" height="' . $card["IMG"]["HEIGHT"] . '"' : "" ?> alt="<?= htmlspecialcharsbx($card["NAME"]) ?>"><?php else: ?><span class="vino-photo-stub" aria-hidden="true"><span class="vino-photo-stub__brand"><?= htmlspecialcharsbx($card["BRAND"]) ?></span></span><?php endif; ?>
</a>
<div class="vino-card__body">
<<?= $titleTag ?> class="vino-card__title"><a class="vino-card__link" href="<?= $card["URL"] ?>"><?= htmlspecialcharsbx($card["NAME"]) ?></a></<?= $titleTag ?>>
<?php include __DIR__ . "/../parts/rating.php"; ?>
<?php if ($card["PLACE"]): ?><em class="vino-card__place"><?= htmlspecialcharsbx(implode(", ", $card["PLACE"])) ?></em><?php endif; ?>
<?php if ($card["SPEC"]): ?><span class="vino-card__spec"><?= htmlspecialcharsbx(implode(" · ", $card["SPEC"])) ?></span><?php endif; ?>
<?php include __DIR__ . "/../parts/buy.php"; ?>
</div>
<?php include __DIR__ . "/../parts/tools.php"; ?>
</article>
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_CARD_GRAPE"] = "Grape variety:";
$MESS["VINO_CARD_GRAPES"] = "Grape varieties:";
@@ -0,0 +1,5 @@
<?php
$MESS["VINO_CARD_QTY_DOWN"] = "Decrease quantity";
$MESS["VINO_CARD_QTY_UP"] = "Increase quantity";
$MESS["VINO_CARD_TO_CART"] = "Add to cart";
$MESS["VINO_CARD_UNAVAILABLE"] = "Out of stock";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_CARD_RATING"] = "Rated #VALUE# out of 5, reviews: #COUNT#";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_CARD_FAV"] = "Add to favourites";
$MESS["VINO_CARD_COMPARE"] = "Add to comparison";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_ITEM_VOLUME"] = "#VALUE# L";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_CARD_GRAPE"] = "Szczep winogron:";
$MESS["VINO_CARD_GRAPES"] = "Szczepy winogron:";
@@ -0,0 +1,5 @@
<?php
$MESS["VINO_CARD_QTY_DOWN"] = "Zmniejsz ilość";
$MESS["VINO_CARD_QTY_UP"] = "Zwiększ ilość";
$MESS["VINO_CARD_TO_CART"] = "Do koszyka";
$MESS["VINO_CARD_UNAVAILABLE"] = "Brak w magazynie";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_CARD_RATING"] = "Ocena #VALUE# na 5, opinii: #COUNT#";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_CARD_FAV"] = "Dodaj do ulubionych";
$MESS["VINO_CARD_COMPARE"] = "Dodaj do porównania";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_ITEM_VOLUME"] = "#VALUE# l";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_CARD_GRAPE"] = "Сорт винограда:";
$MESS["VINO_CARD_GRAPES"] = "Сорта винограда:";
@@ -0,0 +1,5 @@
<?php
$MESS["VINO_CARD_QTY_DOWN"] = "Уменьшить количество";
$MESS["VINO_CARD_QTY_UP"] = "Увеличить количество";
$MESS["VINO_CARD_TO_CART"] = "В корзину";
$MESS["VINO_CARD_UNAVAILABLE"] = "Нет в наличии";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_CARD_RATING"] = "Оценка #VALUE# из 5, отзывов: #COUNT#";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_CARD_FAV"] = "В избранное";
$MESS["VINO_CARD_COMPARE"] = "Добавить к сравнению";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_ITEM_VOLUME"] = "#VALUE# л";
@@ -0,0 +1,25 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
$card = $arResult["CARD"];
$titleTag = ($arResult["TITLE_TAG"] ?? "") === "h2" ? "h2" : "h3";
?>
<article class="vino-card vino-card--line"<?= !empty($arResult["AREA_ID"]) ? ' id="' . $arResult["AREA_ID"] . '"' : "" ?>>
<a class="vino-card__image vino-card__image--shot" href="<?= $card["URL"] ?>" tabindex="-1" aria-hidden="true">
<?php if ($card["IMG"]): ?><img class="vino-card__img" loading="lazy" decoding="async" src="<?= $card["IMG"]["SRC"] ?>"<?= $card["IMG"]["WIDTH"] ? ' width="' . $card["IMG"]["WIDTH"] . '" height="' . $card["IMG"]["HEIGHT"] . '"' : "" ?> alt="<?= htmlspecialcharsbx($card["NAME"]) ?>"><?php endif; ?>
</a>
<div class="vino-card__body">
<<?= $titleTag ?> class="vino-card__title"><a class="vino-card__link" href="<?= $card["URL"] ?>"><?= htmlspecialcharsbx($card["NAME"]) ?></a></<?= $titleTag ?>>
<?php include __DIR__ . "/../parts/rating.php"; ?>
<?php if ($card["PLACE"]): ?><em class="vino-card__place"><?= htmlspecialcharsbx(implode(", ", $card["PLACE"])) ?></em><?php endif; ?>
<?php if ($card["SPEC"] || $card["DETAILS"]): ?><span class="vino-card__spec"><?= htmlspecialcharsbx(implode(" · ", array_merge($card["SPEC"], $card["DETAILS"]))) ?></span><?php endif; ?>
<?php if ($card["GRAPES"]): ?><span class="vino-card__grapes"><?= Loc::getMessage(count($card["GRAPES"]) > 1 ? "VINO_CARD_GRAPES" : "VINO_CARD_GRAPE") ?> <?= htmlspecialcharsbx(implode(", ", $card["GRAPES"])) ?></span><?php endif; ?>
</div>
<?php include __DIR__ . "/../parts/buy.php"; ?>
<?php include __DIR__ . "/../parts/tools.php"; ?>
</article>
@@ -0,0 +1,22 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
?>
<div class="vino-card__buy">
<strong class="vino-card__price"><?php if ($card["OLD_PRICE"] !== ""): ?><span class="vino-card__old"><s><?= $card["OLD_PRICE"] ?></s> <span class="vino-card__percent">&minus;<?= $card["PERCENT"] ?>%</span></span><?php endif; ?><?= $card["PRICE"] ?></strong>
<?php if ($card["CAN_BUY"]): ?>
<div class="vino-card__qty" data-qty="<?= $card["ID"] ?>">
<button type="button" class="vino-card__step" data-qty-step="-1" aria-label="<?= Loc::getMessage("VINO_CARD_QTY_DOWN") ?>">−</button>
<output class="vino-card__count">1</output>
<button type="button" class="vino-card__step" data-qty-step="1" aria-label="<?= Loc::getMessage("VINO_CARD_QTY_UP") ?>">+</button>
</div>
<button type="button" class="vino-card__cart" data-add-cart="<?= $card["ID"] ?>"><?= Loc::getMessage("VINO_CARD_TO_CART") ?></button>
<?php else: ?>
<span class="vino-card__unavailable"><?= Loc::getMessage("VINO_CARD_UNAVAILABLE") ?></span>
<?php endif; ?>
</div>
@@ -0,0 +1,10 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
?>
<?php if ($card["REVIEWS"] > 0): ?><span class="vino-card__rating" role="img" aria-label="<?= Loc::getMessage("VINO_CARD_RATING", array("#VALUE#" => $card["RATING_TEXT"], "#COUNT#" => $card["REVIEWS"])) ?>"><span class="vino-card__rating-star" aria-hidden="true"></span><?= $card["RATING_TEXT"] ?> <span class="vino-card__rating-count">(<?= $card["REVIEWS"] ?>)</span></span><?php endif; ?>
@@ -0,0 +1,13 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
?>
<div class="vino-card__tools">
<?php if ($card["COMPARE"]): ?><button type="button" class="vino-card__tool vino-card__tool--compare" data-compare-toggle="<?= $card["ID"] ?>" aria-pressed="false" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_CARD_COMPARE")) ?>" title="<?= htmlspecialcharsbx(Loc::getMessage("VINO_CARD_COMPARE")) ?>"><svg class="vino-card__tool-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="<?= $card["COMPARE_REMOVE"] ? "M6 6l12 12M18 6 6 18" : "M6 20V11M12 20V4M18 20v-6" ?>"></path></svg></button><?php endif; ?>
<button type="button" class="vino-card__tool" data-fav-toggle="<?= $card["ID"] ?>" aria-pressed="false" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_CARD_FAV")) ?>"><svg class="vino-card__tool-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.5-1.5 3-3.2 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.8 0-3 .5-4.5 2-1.5-1.5-2.7-2-4.5-2A5.5 5.5 0 0 0 2 8.5C2 10.8 3.5 12.5 5 14l7 7Z"></path></svg></button>
</div>
@@ -0,0 +1,86 @@
<?php
use Bitrix\Main\Localization\Loc;
use Jinove\Vinoteca\Catalog\EnumNames;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
$item = $arResult["ITEM"];
$value = function (string $code) use ($item): string {
$raw = $item["PROPERTIES"][$code]["~VALUE"] ?? $item["PROPERTIES"][$code]["VALUE"] ?? "";
if (is_array($raw)) {
$raw = reset($raw);
}
return trim((string)$raw);
};
$brandName = "";
$brandId = (int)$value("BRAND");
if ($brandId > 0) {
$GLOBALS["VINO_BRAND_NAMES"] = $GLOBALS["VINO_BRAND_NAMES"] ?? array();
if (!isset($GLOBALS["VINO_BRAND_NAMES"][$brandId])) {
$brandRow = \Bitrix\Iblock\ElementTable::getRow(array("select" => array("NAME"), "filter" => array("=ID" => $brandId)));
$GLOBALS["VINO_BRAND_NAMES"][$brandId] = (string)($brandRow["NAME"] ?? "");
}
$brandName = $GLOBALS["VINO_BRAND_NAMES"][$brandId];
}
$image = null;
$pictureId = (int)($item["PREVIEW_PICTURE"]["ID"] ?? 0) ?: (int)($item["DETAIL_PICTURE"]["ID"] ?? 0);
if ($pictureId > 0) {
$resized = CFile::ResizeImageGet($pictureId, array("width" => 420, "height" => 520), BX_RESIZE_IMAGE_PROPORTIONAL, true);
if (!empty($resized["src"])) {
$image = array("SRC" => $resized["src"], "WIDTH" => (int)($resized["width"] ?? 0), "HEIGHT" => (int)($resized["height"] ?? 0));
}
}
$price = "";
$prices = $item["ITEM_PRICES"] ?? array();
$oldPrice = "";
$percent = 0;
if ($prices) {
$selected = $prices[$item["ITEM_PRICE_SELECTED"] ?? 0] ?? reset($prices);
if ((float)($selected["RATIO_PRICE"] ?? 0) > 0) {
$price = (string)$selected["PRINT_RATIO_PRICE"];
}
if ((float)($selected["RATIO_BASE_PRICE"] ?? 0) > (float)($selected["RATIO_PRICE"] ?? 0)) {
$oldPrice = (string)$selected["PRINT_RATIO_BASE_PRICE"];
$percent = (int)round((float)($selected["PERCENT"] ?? 0));
}
}
$volume = $value("VOLUME");
$enum = fn(string $code): string => EnumNames::fromProperty($item["PROPERTIES"][$code] ?? array());
$abv = $value("ABV");
$grapes = array_values(array_filter(array_map("trim", explode(",", $enum("GRAPE")))));
$details = array_values(array_filter(array(
$abv !== "" ? str_replace(".", LANGUAGE_ID === "en" ? "." : ",", (string)(float)$abv) . "%" : "",
$value("VINTAGE"),
)));
$arResult["CARD"] = array(
"ID" => (int)$item["ID"],
"NAME" => $item["~NAME"] ?? $item["NAME"],
"URL" => $item["DETAIL_PAGE_URL"],
"IMG" => $image,
"BRAND" => $brandName,
"PLACE" => array_values(array_filter(array($enum("REGION"), $enum("COUNTRY")))),
"SPEC" => array_values(array_filter(array(
$enum("WINE_COLOR"),
$enum("SUGAR"),
$volume !== "" ? Loc::getMessage("VINO_ITEM_VOLUME", array("#VALUE#" => LANGUAGE_ID === "en" ? $volume : str_replace(".", ",", $volume))) : "",
))),
"PRICE" => $price,
"OLD_PRICE" => $oldPrice,
"PERCENT" => $percent,
"CAN_BUY" => !empty($item["CAN_BUY"]),
"COMPARE" => !empty($item["CAN_BUY"]) || ($arResult["COMPARE_ALWAYS"] ?? "") === "Y",
"COMPARE_REMOVE" => ($arResult["COMPARE_ALWAYS"] ?? "") === "Y",
"DETAILS" => $details,
"GRAPES" => $grapes,
"RATING" => (float)$value("REVIEW_RATING"),
"REVIEWS" => (int)$value("REVIEW_COUNT"),
);
$arResult["CARD"]["RATING_TEXT"] = number_format($arResult["CARD"]["RATING"], 1, LANGUAGE_ID === "en" ? "." : ",", "");
@@ -0,0 +1,10 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$type = mb_strtolower((string)($arResult["TYPE"] ?? "card"));
if (!in_array($type, array("card", "line"), true)) {
$type = "card";
}
include __DIR__ . "/" . $type . "/template.php";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_TILES_COUNT_PLURAL_0"] = "#COUNT# wine";
$MESS["VINO_TILES_COUNT_PLURAL_1"] = "#COUNT# wines";
@@ -0,0 +1,4 @@
<?php
$MESS["VINO_TILES_COUNT_PLURAL_0"] = "#COUNT# wino";
$MESS["VINO_TILES_COUNT_PLURAL_1"] = "#COUNT# wina";
$MESS["VINO_TILES_COUNT_PLURAL_2"] = "#COUNT# win";
@@ -0,0 +1,4 @@
<?php
$MESS["VINO_TILES_COUNT_PLURAL_0"] = "#COUNT# вино";
$MESS["VINO_TILES_COUNT_PLURAL_1"] = "#COUNT# вина";
$MESS["VINO_TILES_COUNT_PLURAL_2"] = "#COUNT# вин";
@@ -0,0 +1,21 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
foreach ($arResult["SECTIONS"] as $index => $section) {
$pictureId = (int)($section["PICTURE"]["ID"] ?? 0);
if ($pictureId <= 0) {
continue;
}
$small = CFile::ResizeImageGet($pictureId, array("width" => 480, "height" => 270), BX_RESIZE_IMAGE_EXACT, true);
$resized = CFile::ResizeImageGet($pictureId, array("width" => 800, "height" => 450), BX_RESIZE_IMAGE_EXACT, true);
if (!empty($resized["src"])) {
$arResult["SECTIONS"][$index]["VINO_IMG"] = array(
"SRC" => $resized["src"],
"SRCSET" => (!empty($small["src"]) ? $small["src"] . " 480w, " : "") . $resized["src"] . " 800w",
"WIDTH" => (int)$resized["width"],
"HEIGHT" => (int)$resized["height"],
);
}
}
@@ -0,0 +1,31 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
if (empty($arResult["SECTIONS"])) return;
$editLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "SECTION_EDIT");
$base = VINO_HOST . SITE_DIR . "catalog/";
$list = array();
?>
<div class="vino-sections">
<?php foreach ($arResult["SECTIONS"] as $i => $section):
$this->AddEditAction($section["ID"], $section["EDIT_LINK"], $editLink);
$count = (int)$section["ELEMENT_CNT"];
$name = \Jinove\Vinoteca\Catalog\Sections::name((string)$section["CODE"], (string)$section["~NAME"]);
$list[] = array("@type" => "ListItem", "position" => $i + 1, "name" => $name, "url" => $base . $section["CODE"] . "/");
?>
<a class="vino-sections__item" id="<?= $this->GetEditAreaId($section["ID"]) ?>" href="<?= SITE_DIR ?>catalog/<?= htmlspecialcharsbx($section["CODE"]) ?>/">
<span class="vino-sections__media"><?php if (!empty($section["VINO_IMG"])): ?><img class="vino-sections__img" loading="lazy" decoding="async" src="<?= $section["VINO_IMG"]["SRC"] ?>" srcset="<?= $section["VINO_IMG"]["SRCSET"] ?>" sizes="(max-width: 760px) calc(100vw - 32px), 50vw" width="<?= $section["VINO_IMG"]["WIDTH"] ?>" height="<?= $section["VINO_IMG"]["HEIGHT"] ?>" alt="<?= htmlspecialcharsbx($name) ?>"><?php endif; ?></span>
<span class="vino-sections__body"><strong class="vino-sections__name"><?= htmlspecialcharsbx($name) ?></strong><span class="vino-sections__meta"><?= Loc::getMessagePlural("VINO_TILES_COUNT", $count, array("#COUNT#" => $count)) ?></span></span>
</a>
<?php endforeach; ?>
</div>
<?php if (($arParams["VINO_SCHEMA"] ?? "Y") !== "N"): ?>
<script type="application/ld+json"><?= json_encode(array(
"@context" => "https://schema.org",
"@type" => "ItemList",
"@id" => $base . "#sections",
"numberOfItems" => count($list),
"itemListElement" => $list,
), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
<?php endif; ?>
@@ -0,0 +1,23 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$vinoSection = \Jinove\Vinoteca\Catalog\Sections::byCode((string)($arParams["SECTION_CODE"] ?? ""));
if ($vinoSection) {
$APPLICATION->SetTitle($vinoSection["PAGE_TITLE"] ?: $vinoSection["NAME"]);
if ($vinoSection["META_TITLE"] !== "") {
$APPLICATION->SetPageProperty("title", $vinoSection["META_TITLE"]);
}
if ($vinoSection["META_DESCRIPTION"] !== "") {
$APPLICATION->SetPageProperty("description", $vinoSection["META_DESCRIPTION"]);
}
}
$requested = $_GET["PAGEN_" . (int)($arResult["VINO_NAV_NUM"] ?? 1)] ?? null;
if ($requested !== null && ($arParams["VINO_AJAX"] ?? "N") !== "Y") {
$requested = (string)$requested;
if (!ctype_digit($requested) || (int)$requested < 1 || (int)$requested > max(1, (int)($arResult["VINO_NAV_PAGES"] ?? 1))) {
\Bitrix\Iblock\Component\Tools::process404("", true, true, true);
}
}
@@ -0,0 +1,17 @@
<?php
$MESS["VINO_SECTION_EMPTY"] = "There are no wines in this section yet.";
$MESS["VINO_SECTION_COUNT_PLURAL_0"] = "#COUNT# wine";
$MESS["VINO_SECTION_COUNT_PLURAL_1"] = "#COUNT# wines";
$MESS["VINO_SECTION_FILTER"] = "Filter";
$MESS["VINO_SECTION_FILTER_OPEN"] = "Open filter";
$MESS["VINO_SECTION_SORT_DEFAULT"] = "Recommended";
$MESS["VINO_SECTION_SORT_LABEL"] = "Sorting";
$MESS["VINO_SECTION_SORT_new"] = "New arrivals";
$MESS["VINO_SECTION_SORT_price_asc"] = "Price: low to high";
$MESS["VINO_SECTION_SORT_price_desc"] = "Price: high to low";
$MESS["VINO_SECTION_SORT_name"] = "By name";
$MESS["VINO_SECTION_VIEW"] = "Catalogue view";
$MESS["VINO_SECTION_VIEW_GRID"] = "Grid";
$MESS["VINO_SECTION_VIEW_LIST"] = "List";
$MESS["VINO_SECTION_PRICE_PRESETS"] = "Price";
$MESS["VINO_SECTION_PRICE_TO"] = "up to #PRICE#";
@@ -0,0 +1,18 @@
<?php
$MESS["VINO_SECTION_EMPTY"] = "W tej kategorii nie ma jeszcze win.";
$MESS["VINO_SECTION_COUNT_PLURAL_0"] = "#COUNT# wino";
$MESS["VINO_SECTION_COUNT_PLURAL_1"] = "#COUNT# wina";
$MESS["VINO_SECTION_COUNT_PLURAL_2"] = "#COUNT# win";
$MESS["VINO_SECTION_FILTER"] = "Filtr";
$MESS["VINO_SECTION_FILTER_OPEN"] = "Otwórz filtr";
$MESS["VINO_SECTION_SORT_DEFAULT"] = "Polecane";
$MESS["VINO_SECTION_SORT_LABEL"] = "Sortowanie";
$MESS["VINO_SECTION_SORT_new"] = "Nowości";
$MESS["VINO_SECTION_SORT_price_asc"] = "Od najtańszych";
$MESS["VINO_SECTION_SORT_price_desc"] = "Od najdroższych";
$MESS["VINO_SECTION_SORT_name"] = "Według nazwy";
$MESS["VINO_SECTION_VIEW"] = "Widok katalogu";
$MESS["VINO_SECTION_VIEW_GRID"] = "Kafelki";
$MESS["VINO_SECTION_VIEW_LIST"] = "Lista";
$MESS["VINO_SECTION_PRICE_PRESETS"] = "Cena";
$MESS["VINO_SECTION_PRICE_TO"] = "do #PRICE#";
@@ -0,0 +1,18 @@
<?php
$MESS["VINO_SECTION_EMPTY"] = "В этом разделе пока нет вин.";
$MESS["VINO_SECTION_COUNT_PLURAL_0"] = "#COUNT# вино";
$MESS["VINO_SECTION_COUNT_PLURAL_1"] = "#COUNT# вина";
$MESS["VINO_SECTION_COUNT_PLURAL_2"] = "#COUNT# вин";
$MESS["VINO_SECTION_FILTER"] = "Фильтр";
$MESS["VINO_SECTION_FILTER_OPEN"] = "Открыть фильтр";
$MESS["VINO_SECTION_SORT_DEFAULT"] = "Рекомендуем";
$MESS["VINO_SECTION_SORT_LABEL"] = "Сортировка";
$MESS["VINO_SECTION_SORT_new"] = "Новинки";
$MESS["VINO_SECTION_SORT_price_asc"] = "Сначала дешёвые";
$MESS["VINO_SECTION_SORT_price_desc"] = "Сначала дорогие";
$MESS["VINO_SECTION_SORT_name"] = "По названию";
$MESS["VINO_SECTION_VIEW"] = "Вид каталога";
$MESS["VINO_SECTION_VIEW_GRID"] = "Плиткой";
$MESS["VINO_SECTION_VIEW_LIST"] = "Списком";
$MESS["VINO_SECTION_PRICE_PRESETS"] = "Цена";
$MESS["VINO_SECTION_PRICE_TO"] = "до #PRICE#";
@@ -0,0 +1,15 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$vinoUrls = \Jinove\Vinoteca\Catalog\Related::summariesById(array_column($arResult["ITEMS"], "ID"));
foreach ($arResult["ITEMS"] as $key => $item) {
if (isset($vinoUrls[(int)$item["ID"]])) {
$arResult["ITEMS"][$key]["DETAIL_PAGE_URL"] = $vinoUrls[(int)$item["ID"]]["url"];
}
}
$nav = $arResult["NAV_RESULT"] ?? null;
$arResult["VINO_NAV_NUM"] = $nav ? (int)$nav->NavNum : 1;
$arResult["VINO_NAV_PAGES"] = $nav ? (int)$nav->NavPageCount : 1;
$this->__component->SetResultCacheKeys(array("VINO_NAV_NUM", "VINO_NAV_PAGES"));
@@ -0,0 +1,91 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$items = $arResult["ITEMS"] ?? array();
$view = ($arParams["VINO_VIEW"] ?? "") === "list" ? "list" : "grid";
if (($arParams["VINO_TOOLBAR"] ?? "") === "Y"):
$count = $arResult["NAV_RESULT"] ? (int)$arResult["NAV_RESULT"]->NavRecordCount : count($items);
$sort = (string)($arParams["VINO_SORT"] ?? "");
$sortUrls = (array)($arParams["VINO_SORT_URLS"] ?? array());
$sortLabel = $sort !== "" ? Loc::getMessage("VINO_SECTION_SORT_" . $sort) : Loc::getMessage("VINO_SECTION_SORT_DEFAULT");
$intro = (string)(\Jinove\Vinoteca\Catalog\Sections::byCode((string)($arParams["SECTION_CODE"] ?? ""))["DESCRIPTION"] ?? "");
if ($intro !== ""):
?><p class="vino-cat-intro"><?= htmlspecialcharsbx($intro) ?></p><?php
endif;
?>
<?php if (!empty($arParams["VINO_PRICE_PRESETS"])): $currency = \Bitrix\Currency\CurrencyManager::getBaseCurrency(); ?>
<nav class="vino-presets" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_SECTION_PRICE_PRESETS")) ?>">
<?php foreach ($arParams["VINO_PRICE_PRESETS"] as $preset): ?>
<a class="vino-presets__link<?= $preset["ACTIVE"] ? " vino-presets__link--active" : "" ?>" href="<?= htmlspecialcharsbx($preset["URL"]) ?>"<?= $preset["ACTIVE"] ? ' aria-current="page"' : "" ?>><?= Loc::getMessage("VINO_SECTION_PRICE_TO", array("#PRICE#" => \CCurrencyLang::CurrencyFormat((float)$preset["LIMIT"], $currency, true))) ?></a>
<?php endforeach; ?>
</nav>
<?php endif; ?>
<div class="vino-cat-toolbar">
<span class="vino-cat-toolbar__count"><?= Loc::getMessagePlural("VINO_SECTION_COUNT", $count, array("#COUNT#" => $count)) ?></span>
<div class="vino-cat-toolbar__right">
<button type="button" class="vino-filter-btn" data-filter-open aria-label="<?= Loc::getMessage("VINO_SECTION_FILTER_OPEN") ?>" aria-controls="vino-filter-panel" aria-expanded="false">
<svg class="vino-filter-btn__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="8" x2="20" y2="8"></line><line x1="4" y1="16" x2="20" y2="16"></line><circle cx="9" cy="8" r="2.4" fill="var(--color-bg)"></circle><circle cx="15" cy="16" r="2.4" fill="var(--color-bg)"></circle></svg>
<span><?= Loc::getMessage("VINO_SECTION_FILTER") ?></span>
</button>
<div class="vino-sort" data-sort>
<button type="button" class="vino-sort__btn" aria-expanded="false" aria-controls="vino-sort-menu">
<span class="vino-sort__label"><?= htmlspecialcharsbx($sortLabel) ?></span>
<svg class="vino-sort__chev" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
</button>
<ul class="vino-sort__menu" id="vino-sort-menu" aria-label="<?= Loc::getMessage("VINO_SECTION_SORT_LABEL") ?>">
<?php foreach ($sortUrls as $code => $url): $code = (string)$code; ?>
<li class="vino-sort__item<?= $sort === $code ? " vino-sort__item--selected" : "" ?>"><a class="vino-sort__link" href="<?= htmlspecialcharsbx($url) ?>"<?= $sort === $code ? ' aria-current="true"' : "" ?>><?= htmlspecialcharsbx(Loc::getMessage($code === "" ? "VINO_SECTION_SORT_DEFAULT" : "VINO_SECTION_SORT_" . $code)) ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="vino-cat-view" role="group" aria-label="<?= Loc::getMessage("VINO_SECTION_VIEW") ?>">
<button type="button" class="vino-cat-view__btn<?= $view === "grid" ? " vino-cat-view__btn--active" : "" ?>" data-catalog-view="grid" aria-pressed="<?= $view === "grid" ? "true" : "false" ?>" aria-label="<?= Loc::getMessage("VINO_SECTION_VIEW_GRID") ?>"><svg class="vino-cat-view__icon" viewBox="0 0 16 16" aria-hidden="true"><rect x="1" y="1" width="6" height="6" rx="1.5"></rect><rect x="9" y="1" width="6" height="6" rx="1.5"></rect><rect x="1" y="9" width="6" height="6" rx="1.5"></rect><rect x="9" y="9" width="6" height="6" rx="1.5"></rect></svg></button>
<button type="button" class="vino-cat-view__btn<?= $view === "list" ? " vino-cat-view__btn--active" : "" ?>" data-catalog-view="list" aria-pressed="<?= $view === "list" ? "true" : "false" ?>" aria-label="<?= Loc::getMessage("VINO_SECTION_VIEW_LIST") ?>"><svg class="vino-cat-view__icon" viewBox="0 0 16 16" aria-hidden="true"><rect x="1" y="2" width="2.5" height="2.5" rx="1"></rect><rect x="5.5" y="2.25" width="9.5" height="2" rx="1"></rect><rect x="1" y="6.75" width="2.5" height="2.5" rx="1"></rect><rect x="5.5" y="7" width="9.5" height="2" rx="1"></rect><rect x="1" y="11.5" width="2.5" height="2.5" rx="1"></rect><rect x="5.5" y="11.75" width="9.5" height="2" rx="1"></rect></svg></button>
</div>
</div>
</div>
<?php endif;
if (empty($items)):
?><p class="vino-cat-empty"><?= Loc::getMessage("VINO_SECTION_EMPTY") ?></p><?php
return;
endif;
?>
<div class="vino-product-grid<?= $view === "list" ? " vino-product-grid--list" : "" ?><?= ($arParams["VINO_GRID_FULL"] ?? "") === "Y" ? " vino-product-grid--full" : "" ?>" id="catalog-grid">
<?php
$editLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT");
foreach ($items as $item):
$this->AddEditAction($item["ID"], $item["EDIT_LINK"], $editLink);
$APPLICATION->IncludeComponent("bitrix:catalog.item", "vinoteca", array(
"RESULT" => array("ITEM" => $item, "AREA_ID" => $this->GetEditAreaId($item["ID"]), "TYPE" => $view === "list" ? "LINE" : "CARD", "TITLE_TAG" => ($arParams["VINO_TITLE_TAG"] ?? "") === "h2" ? "h2" : "h3"),
), $component, array("HIDE_ICONS" => "Y"));
endforeach; ?>
</div>
<?= $arResult["NAV_STRING"] ?? "" ?>
<?php if ((string)($arParams["VINO_LIST_ID"] ?? "") !== ""):
$nav = $arResult["NAV_RESULT"] ?? null;
$offset = $nav ? max(0, ((int)$nav->NavPageNomer - 1) * (int)$nav->NavPageSize) : 0;
$listItems = array();
foreach ($items as $i => $item) {
$listItem = array("@type" => "ListItem", "position" => $offset + $i + 1, "url" => VINO_HOST . $item["DETAIL_PAGE_URL"], "name" => $item["~NAME"]);
$picture = $item["PREVIEW_PICTURE"]["SRC"] ?? $item["DETAIL_PICTURE"]["SRC"] ?? "";
if ($picture !== "") {
$listItem["image"] = VINO_HOST . $picture;
}
$listItems[] = $listItem;
}
?>
<script type="application/ld+json"><?= json_encode(array(
"@context" => "https://schema.org",
"@type" => "ItemList",
"@id" => (string)($arParams["VINO_LIST_ID"] ?? "") !== "" ? $arParams["VINO_LIST_ID"] : VINO_HOST . $arResult["SECTION_PAGE_URL"] . "#items",
"numberOfItems" => $nav ? (int)$nav->NavRecordCount : count($items),
"itemListElement" => $listItems,
), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
<?php endif; ?>
@@ -0,0 +1,18 @@
<?php
$MESS["VINO_FILTER_FROM"] = "from #VALUE#";
$MESS["VINO_FILTER_TO"] = "to #VALUE#";
$MESS["VINO_FILTER_PRICE_MIN"] = "Price from";
$MESS["VINO_FILTER_PRICE_MAX"] = "Price to";
$MESS["VINO_FILTER_MORE"] = "#COUNT# more";
$MESS["VINO_FILTER_LESS"] = "Show less";
$MESS["VINO_FILTER_APPLY"] = "Apply";
$MESS["VINO_FILTER_RESET"] = "Clear filter";
$MESS["VINO_FILTER_PROP_BASE"] = "Retail price";
$MESS["VINO_FILTER_PROP_BRAND"] = "Brand";
$MESS["VINO_FILTER_PROP_COUNTRY"] = "Country";
$MESS["VINO_FILTER_PROP_REGION"] = "Region";
$MESS["VINO_FILTER_PROP_GRAPE"] = "Grape";
$MESS["VINO_FILTER_PROP_VOLUME"] = "Volume, L";
$MESS["VINO_FILTER_PROP_ABV"] = "Alcohol, %";
$MESS["VINO_FILTER_PROP_WINE_COLOR"] = "Colour";
$MESS["VINO_FILTER_PROP_SUGAR"] = "Sweetness";
@@ -0,0 +1,18 @@
<?php
$MESS["VINO_FILTER_FROM"] = "od #VALUE#";
$MESS["VINO_FILTER_TO"] = "do #VALUE#";
$MESS["VINO_FILTER_PRICE_MIN"] = "Cena od";
$MESS["VINO_FILTER_PRICE_MAX"] = "Cena do";
$MESS["VINO_FILTER_MORE"] = "Jeszcze #COUNT#";
$MESS["VINO_FILTER_LESS"] = "Zwiń";
$MESS["VINO_FILTER_APPLY"] = "Zastosuj";
$MESS["VINO_FILTER_RESET"] = "Wyczyść filtr";
$MESS["VINO_FILTER_PROP_BASE"] = "Cena detaliczna";
$MESS["VINO_FILTER_PROP_BRAND"] = "Marka";
$MESS["VINO_FILTER_PROP_COUNTRY"] = "Kraj";
$MESS["VINO_FILTER_PROP_REGION"] = "Region";
$MESS["VINO_FILTER_PROP_GRAPE"] = "Szczep";
$MESS["VINO_FILTER_PROP_VOLUME"] = "Pojemność, l";
$MESS["VINO_FILTER_PROP_ABV"] = "Alkohol, %";
$MESS["VINO_FILTER_PROP_WINE_COLOR"] = "Kolor";
$MESS["VINO_FILTER_PROP_SUGAR"] = "Słodycz";
@@ -0,0 +1,18 @@
<?php
$MESS["VINO_FILTER_FROM"] = "от #VALUE#";
$MESS["VINO_FILTER_TO"] = "до #VALUE#";
$MESS["VINO_FILTER_PRICE_MIN"] = "Цена от";
$MESS["VINO_FILTER_PRICE_MAX"] = "Цена до";
$MESS["VINO_FILTER_MORE"] = "Ещё #COUNT#";
$MESS["VINO_FILTER_LESS"] = "Свернуть";
$MESS["VINO_FILTER_APPLY"] = "Применить";
$MESS["VINO_FILTER_RESET"] = "Очистить фильтр";
$MESS["VINO_FILTER_PROP_BASE"] = "Розничная цена";
$MESS["VINO_FILTER_PROP_BRAND"] = "Бренд";
$MESS["VINO_FILTER_PROP_COUNTRY"] = "Страна";
$MESS["VINO_FILTER_PROP_REGION"] = "Регион";
$MESS["VINO_FILTER_PROP_GRAPE"] = "Сорт винограда";
$MESS["VINO_FILTER_PROP_VOLUME"] = "Объём, л";
$MESS["VINO_FILTER_PROP_ABV"] = "Крепость, %";
$MESS["VINO_FILTER_PROP_WINE_COLOR"] = "Цвет";
$MESS["VINO_FILTER_PROP_SUGAR"] = "Сахар";
@@ -0,0 +1,18 @@
(function () {
document.addEventListener('click', function (event) {
var toggle = event.target.closest('[data-filter-toggle]');
if (toggle) {
var group = toggle.closest('[data-filter-group]');
var collapsed = group.classList.toggle('vino-filter__group--collapsed');
toggle.setAttribute('aria-expanded', collapsed ? 'false' : 'true');
return;
}
var more = event.target.closest('[data-filter-more]');
if (more) {
var box = more.closest('[data-filter-group]');
var expanded = box.classList.toggle('vino-filter__group--expanded');
more.setAttribute('aria-expanded', expanded ? 'true' : 'false');
more.textContent = expanded ? more.dataset.lessText : more.dataset.moreText;
}
});
})();
@@ -0,0 +1,94 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
if (empty($arResult["ITEMS"])) {
return;
}
$items = array_merge(
array_filter($arResult["ITEMS"], function ($item) { return !empty($item["PRICE"]); }),
array_filter($arResult["ITEMS"], function ($item) { return empty($item["PRICE"]); })
);
$visibleLimit = 10;
$decimalComma = LANGUAGE_ID !== "en";
$formatValue = function ($value) use ($decimalComma) {
$value = (string)$value;
return $decimalComma && is_numeric($value) ? str_replace(".", ",", $value) : $value;
};
?>
<form class="vino-filter" name="<?= $arResult["FILTER_NAME"] ?>_form" action="<?= $arResult["FORM_ACTION"] ?>" method="get" data-catalog-filter data-clear-url="<?= htmlspecialcharsbx($arResult["SEF_DEL_FILTER_URL"] ?? $arResult["FORM_ACTION"]) ?>">
<div class="vino-filter__groups">
<?php foreach ($items as $item):
if (!empty($item["PRICE"])):
$min = $item["VALUES"]["MIN"];
$max = $item["VALUES"]["MAX"];
?>
<fieldset class="vino-filter__group" data-filter-group>
<legend class="vino-filter__legend">
<button type="button" class="vino-filter__toggle" aria-expanded="true" data-filter-toggle>
<span class="vino-filter__title"><?= htmlspecialcharsbx(Loc::getMessage("VINO_FILTER_PROP_" . $item["CODE"]) ?: $item["NAME"]) ?></span>
<svg class="vino-filter__chevron" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 15l6-6 6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
</button>
</legend>
<div class="vino-filter__body vino-filter__price">
<input class="vino-filter__input" type="number" inputmode="numeric" name="<?= $min["CONTROL_NAME"] ?>" value="<?= $min["HTML_VALUE"] ?>" placeholder="<?= Loc::getMessage("VINO_FILTER_FROM", array("#VALUE#" => (int)$min["VALUE"])) ?>" aria-label="<?= Loc::getMessage("VINO_FILTER_PRICE_MIN") ?>">
<span class="vino-filter__dash" aria-hidden="true">–</span>
<input class="vino-filter__input" type="number" inputmode="numeric" name="<?= $max["CONTROL_NAME"] ?>" value="<?= $max["HTML_VALUE"] ?>" placeholder="<?= Loc::getMessage("VINO_FILTER_TO", array("#VALUE#" => (int)$max["VALUE"])) ?>" aria-label="<?= Loc::getMessage("VINO_FILTER_PRICE_MAX") ?>">
</div>
</fieldset>
<?php continue;
endif;
$values = $item["VALUES"] ?? array();
if (count($values) < 2) {
continue;
}
$hiddenCount = 0;
$position = 0;
?>
<fieldset class="vino-filter__group" data-filter-group>
<legend class="vino-filter__legend">
<button type="button" class="vino-filter__toggle" aria-expanded="true" data-filter-toggle>
<span class="vino-filter__title"><?= htmlspecialcharsbx(Loc::getMessage("VINO_FILTER_PROP_" . $item["CODE"]) ?: $item["NAME"]) ?></span>
<svg class="vino-filter__chevron" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 15l6-6 6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
</button>
</legend>
<div class="vino-filter__body">
<div class="vino-filter__options">
<?php foreach ($values as $value):
$isHidden = $position >= $visibleLimit && empty($value["CHECKED"]);
if ($isHidden) {
$hiddenCount++;
}
$position++;
$optionClass = "vino-filter__option";
if ($isHidden) {
$optionClass .= " vino-filter__option--extra";
}
if (!empty($value["DISABLED"])) {
$optionClass .= " vino-filter__option--disabled";
}
?>
<label class="<?= $optionClass ?>">
<input class="vino-filter__checkbox" type="checkbox" name="<?= $value["CONTROL_NAME"] ?>" value="<?= $value["HTML_VALUE"] ?>"<?= !empty($value["CHECKED"]) ? " checked" : "" ?><?= !empty($value["DISABLED"]) ? " disabled" : "" ?>>
<span class="vino-filter__name"><?= $formatValue(($item["PROPERTY_TYPE"] ?? "") === "L" ? \Jinove\Vinoteca\Catalog\EnumNames::name((string)$item["CODE"], (string)($value["URL_ID"] ?? ""), (string)$value["VALUE"]) : $value["VALUE"]) ?></span>
</label>
<?php endforeach; ?>
</div>
<?php if ($hiddenCount > 0): ?>
<button type="button" class="vino-filter__more" aria-expanded="false" data-filter-more data-more-text="<?= Loc::getMessage("VINO_FILTER_MORE", array("#COUNT#" => $hiddenCount)) ?>" data-less-text="<?= Loc::getMessage("VINO_FILTER_LESS") ?>"><?= Loc::getMessage("VINO_FILTER_MORE", array("#COUNT#" => $hiddenCount)) ?></button>
<?php endif; ?>
</div>
</fieldset>
<?php endforeach; ?>
</div>
<div class="vino-filter__actions">
<button type="submit" class="vino-btn vino-filter__submit" name="set_filter" value="y"><?= Loc::getMessage("VINO_FILTER_APPLY") ?></button>
<button type="submit" class="vino-filter__reset" name="del_filter" value="y"><?= Loc::getMessage("VINO_FILTER_RESET") ?></button>
</div>
</form>
@@ -0,0 +1,15 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
if (empty($arResult["ITEMS"])) {
return;
}
$editLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT");
foreach ($arResult["ITEMS"] as $item) {
$this->AddEditAction($item["ID"], $item["EDIT_LINK"], $editLink);
$APPLICATION->IncludeComponent("bitrix:catalog.item", "vinoteca", array(
"RESULT" => array("ITEM" => $item, "AREA_ID" => $this->GetEditAreaId($item["ID"]), "TYPE" => "CARD"),
), $component, array("HIDE_ICONS" => "Y"));
}
@@ -0,0 +1,6 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$APPLICATION->IncludeComponent("jinove:catalog.listing", "", array("COUNTRY_CODE" => (string)$arResult["VARIABLES"]["COUNTRY_CODE"]), $component);
@@ -0,0 +1,129 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$countryCode = \Jinove\Vinoteca\Catalog\Listing::countryCodeFromRoute((array)$arResult["VARIABLES"]);
if ($countryCode !== null) {
$arResult["VARIABLES"]["COUNTRY_CODE"] = $countryCode;
include __DIR__ . "/country.php";
return;
}
?>
<section class="vino-razdel-hero">
<div class="vino-wrap">
<?php
$vinoSectionCode = (string)$arResult["VARIABLES"]["SECTION_CODE"];
\Jinove\Vinoteca\Breadcrumbs::show(array(
array(Loc::getMessage("VINO_CATALOG_CRUMB"), "/catalog/"),
array(\Jinove\Vinoteca\Catalog\Sections::name($vinoSectionCode), "/catalog/" . $vinoSectionCode . "/"),
));
?>
</div>
</section>
<?php
$elementId = $APPLICATION->IncludeComponent("bitrix:catalog.element", ".default", array(
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"ELEMENT_CODE" => $arResult["VARIABLES"]["ELEMENT_CODE"],
"SECTION_CODE" => $arResult["VARIABLES"]["SECTION_CODE"],
"SET_TITLE" => "Y",
"SET_BROWSER_TITLE" => "N",
"SET_CANONICAL_URL" => "Y",
"STRICT_SECTION_CHECK" => "Y",
"SET_STATUS_404" => $arParams["SET_STATUS_404"],
"SHOW_404" => $arParams["SHOW_404"],
"FILE_404" => $arParams["FILE_404"],
"MESSAGE_404" => $arParams["MESSAGE_404"],
"ADD_SECTIONS_CHAIN" => "N",
"ADD_ELEMENT_CHAIN" => "Y",
"PRICE_CODE" => $arParams["PRICE_CODE"],
"BASKET_URL" => $arParams["BASKET_URL"],
"ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"],
"PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"],
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"PROPERTY_CODE" => $arParams["DETAIL_PROPERTY_CODE"],
"USE_PRODUCT_QUANTITY" => "Y",
"ADD_TO_BASKET_ACTION" => "ADD",
"SECTION_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["section"],
"DETAIL_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["element"],
), $component);
$relatedIds = $elementId ? \Jinove\Vinoteca\Catalog\Related::ids((int)VINO_CATALOG_IBLOCK, (int)$elementId) : array();
if ($relatedIds) {
$GLOBALS["vinoRelatedFilter"] = array("ID" => $relatedIds);
?>
<section class="vino-pdp-related">
<div class="vino-wrap">
<div class="vino-pdp-related__head">
<h2 class="vino-pdp-related__title"><?= Loc::getMessage("VINO_CATALOG_RELATED") ?></h2>
<div class="vino-slider__nav" data-related-nav>
<button type="button" class="vino-arrow" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_CATALOG_PREV")) ?>" data-dir="-1"><svg class="vino-arrow__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg></button>
<button type="button" class="vino-arrow" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_CATALOG_NEXT")) ?>" data-dir="1"><svg class="vino-arrow__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button>
</div>
</div>
<div class="vino-slider__viewport" data-related-viewport>
<div class="vino-slider__track">
<?php $APPLICATION->IncludeComponent("bitrix:catalog.top", "vinoteca-row", array(
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"ELEMENT_COUNT" => "15",
"ELEMENT_SORT_FIELD" => "ID",
"ELEMENT_SORT_ORDER" => "ASC",
"ELEMENT_SORT_FIELD2" => "NAME",
"ELEMENT_SORT_ORDER2" => "ASC",
"FILTER_NAME" => "vinoRelatedFilter",
"PROPERTY_CODE" => array("WINE_COLOR", "SUGAR", "VOLUME", "REGION", "COUNTRY"),
"PRICE_CODE" => $arParams["PRICE_CODE"],
"PRICE_VAT_INCLUDE" => "Y",
"CONVERT_CURRENCY" => "N",
"HIDE_NOT_AVAILABLE" => "N",
"DETAIL_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["element"],
"SECTION_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["section"],
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => "3600",
"CACHE_GROUPS" => "N",
"CACHE_FILTER" => "Y",
), $component); ?>
</div>
</div>
</div>
</section>
<?php
}
if ($elementId) {
\Bitrix\Main\Page\Asset::getInstance()->addJs(SITE_TEMPLATE_PATH . "/assets/js/vino-review.js");
$GLOBALS["vinoReviewsFilter"] = array("PROPERTY_PRODUCT" => (int)$elementId);
$APPLICATION->IncludeComponent("bitrix:news.list", "vinoteca-reviews", array(
"IBLOCK_TYPE" => "catalog",
"IBLOCK_ID" => "reviews",
"NEWS_COUNT" => "50",
"SORT_BY1" => "ACTIVE_FROM",
"SORT_ORDER1" => "DESC",
"SORT_BY2" => "ID",
"SORT_ORDER2" => "DESC",
"FILTER_NAME" => "vinoReviewsFilter",
"FIELD_CODE" => array("PREVIEW_TEXT", "ACTIVE_FROM", "DATE_CREATE"),
"PROPERTY_CODE" => array("RATING", "AUTHOR"),
"CHECK_DATES" => "Y",
"SET_TITLE" => "N",
"SET_BROWSER_TITLE" => "N",
"SET_META_KEYWORDS" => "N",
"SET_META_DESCRIPTION" => "N",
"SET_LAST_MODIFIED" => "N",
"SET_STATUS_404" => "N",
"INCLUDE_IBLOCK_INTO_CHAIN" => "N",
"ADD_SECTIONS_CHAIN" => "N",
"DISPLAY_TOP_PAGER" => "N",
"DISPLAY_BOTTOM_PAGER" => "N",
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
"CACHE_FILTER" => "Y",
"CACHE_GROUPS" => "N",
"VINO_PRODUCT_ID" => (int)$elementId,
"VINO_PRODUCT_NAME" => $APPLICATION->GetTitle(false),
), $component);
}
@@ -0,0 +1,5 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Catalogue";
$MESS["VINO_CATALOG_RELATED"] = "Frequently bought together";
$MESS["VINO_CATALOG_PREV"] = "Previous";
$MESS["VINO_CATALOG_NEXT"] = "Next";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Catalogue";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Catalogue";
$MESS["VINO_CATALOG_H1"] = "Wine catalogue";
$MESS["VINO_CATALOG_BANNER_EYEBROW"] = "Wine for the occasion";
$MESS["VINO_CATALOG_BANNER_TITLE"] = "Find a bottle for dinner, a gift or a tasting";
$MESS["VINO_CATALOG_BANNER_TEXT"] = "We have grouped the main wine styles into short routes: red with meat, white with fish, sparkling for celebrations and sweet with dessert.";
$MESS["VINO_CATALOG_BANNER_RED"] = "Red wines";
$MESS["VINO_CATALOG_BANNER_SOMMELIER"] = "Ask the sommelier";
@@ -0,0 +1,5 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Katalog";
$MESS["VINO_CATALOG_RELATED"] = "Często kupowane razem";
$MESS["VINO_CATALOG_PREV"] = "Wstecz";
$MESS["VINO_CATALOG_NEXT"] = "Dalej";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Katalog";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Katalog";
$MESS["VINO_CATALOG_H1"] = "Katalog win";
$MESS["VINO_CATALOG_BANNER_EYEBROW"] = "Wino na okazję";
$MESS["VINO_CATALOG_BANNER_TITLE"] = "Znajdź butelkę na kolację, na prezent lub na degustację";
$MESS["VINO_CATALOG_BANNER_TEXT"] = "Zebraliśmy główne style win w krótkie ścieżki: czerwone do mięs, białe do ryb, musujące na świętowanie i słodkie do deseru.";
$MESS["VINO_CATALOG_BANNER_RED"] = "Wina czerwone";
$MESS["VINO_CATALOG_BANNER_SOMMELIER"] = "Zapytaj sommeliera";
@@ -0,0 +1,5 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Каталог";
$MESS["VINO_CATALOG_RELATED"] = "С этим вином берут";
$MESS["VINO_CATALOG_PREV"] = "Назад";
$MESS["VINO_CATALOG_NEXT"] = "Вперёд";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Каталог";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_CATALOG_CRUMB"] = "Каталог";
$MESS["VINO_CATALOG_H1"] = "Каталог вин";
$MESS["VINO_CATALOG_BANNER_EYEBROW"] = "Подбор по случаю";
$MESS["VINO_CATALOG_BANNER_TITLE"] = "Найдите бутылку под ужин, подарок или дегустацию";
$MESS["VINO_CATALOG_BANNER_TEXT"] = "Собрали основные стили вина в короткие маршруты: красные к мясу, белые к рыбе, игристые к празднику и сладкие к десерту.";
$MESS["VINO_CATALOG_BANNER_RED"] = "Красные вина";
$MESS["VINO_CATALOG_BANNER_SOMMELIER"] = "Спросить сомелье";
@@ -0,0 +1,337 @@
(function () {
var loadingClass = 'vino-razdel-content--loading';
var request = 0;
function content() {
return document.querySelector('[data-catalog-content]');
}
function filterForm() {
return document.querySelector('[data-catalog-filter]');
}
function closeSort() {
var sort = document.querySelector('.vino-sort[data-sort]');
if (!sort) return;
sort.classList.remove('vino-sort--open');
var button = sort.querySelector('.vino-sort__btn');
if (button) button.setAttribute('aria-expanded', 'false');
}
function scrollToList() {
var box = content();
if (!box) return;
var top = box.getBoundingClientRect().top;
if (top < 0) {
window.scrollTo({ top: window.scrollY + top - 120, behavior: 'smooth' });
}
}
function action(name, data) {
return BX.ajax.runAction('jinove:vinoteca.catalog.' + name, { method: 'GET', getParameters: data });
}
function canRequest() {
return !!(window.BX && BX.ajax && BX.ajax.runAction);
}
function load(url, options) {
var box = content();
if (!box || !canRequest()) {
window.location.href = url;
return;
}
var target = new URL(url, window.location.href);
var data = { path: target.pathname };
target.searchParams.forEach(function (value, key) {
data[key] = value;
});
var id = ++request;
box.classList.add(loadingClass);
action('listing', data)
.then(function (response) {
if (id !== request) return;
var doc = document.createElement('template');
doc.innerHTML = response.data.html;
var nextBox = doc.content.querySelector('[data-catalog-content]');
if (!nextBox) throw new Error('content');
if (options.push) history.pushState({ vinoCatalog: true }, '', target.href);
box.innerHTML = nextBox.innerHTML;
if (options.syncFilter) {
var form = filterForm();
var nextForm = doc.content.querySelector('[data-catalog-filter]');
if (form && nextForm) form.innerHTML = nextForm.innerHTML;
}
if (response.data.componentResult && response.data.componentResult.title) {
document.title = response.data.componentResult.title;
}
box.classList.remove(loadingClass);
renderChips();
document.dispatchEvent(new CustomEvent('vino:content', { detail: { root: box } }));
if (options.focus) box.focus({ preventScroll: true });
if (options.scroll) scrollToList();
})
.catch(function () {
if (id === request) window.location.href = target.href;
});
}
function chipButton(className, text, label) {
var button = document.createElement('button');
button.type = 'button';
button.className = className;
button.textContent = text;
if (label) button.setAttribute('aria-label', label);
return button;
}
function renderChips() {
var box = content();
var form = filterForm();
if (!box || !form) return;
var old = box.querySelector('[data-filter-chips]');
if (old) old.remove();
var chips = [];
form.querySelectorAll('.vino-filter__checkbox:checked').forEach(function (input) {
var name = input.closest('.vino-filter__option');
name = name ? name.querySelector('.vino-filter__name') : null;
chips.push({ text: name ? name.textContent.trim() : input.value, clear: function () { input.checked = false; } });
});
var price = form.querySelectorAll('.vino-filter__input');
if (price.length === 2 && (price[0].value !== '' || price[1].value !== '')) {
var lang = document.documentElement.lang || 'ru';
var from = price[0].value !== '' ? Number(price[0].value).toLocaleString(lang) : '';
var to = price[1].value !== '' ? Number(price[1].value).toLocaleString(lang) : '';
var text = from && to ? box.dataset.chipsRange.replace('#FROM#', from).replace('#TO#', to)
: from ? box.dataset.chipsFrom.replace('#VALUE#', from) : box.dataset.chipsTo.replace('#VALUE#', to);
chips.push({ text: text, clear: function () { price[0].value = ''; price[1].value = ''; } });
}
if (!chips.length || box.querySelector('.vino-presets__link--active')) return;
var list = document.createElement('div');
list.className = 'vino-chips';
list.setAttribute('data-filter-chips', '');
list.setAttribute('role', 'group');
list.setAttribute('aria-label', box.dataset.chipsLabel);
chips.forEach(function (chip) {
var button = chipButton('vino-chips__chip', chip.text, box.dataset.chipsRemove.replace('#NAME#', chip.text));
button.addEventListener('click', function () {
chip.clear();
applyFilter();
});
list.appendChild(button);
});
var reset = chipButton('vino-chips__reset', box.dataset.chipsReset);
reset.addEventListener('click', function () {
var resetButton = form.querySelector('[name="del_filter"]');
if (form.requestSubmit && resetButton) form.requestSubmit(resetButton);
else resetButton.click();
});
list.appendChild(reset);
var toolbar = box.querySelector('.vino-cat-toolbar');
box.insertBefore(list, toolbar || box.firstChild);
}
function filterHasValues(form) {
return Array.prototype.some.call(form.elements, function (field) {
if (field.type === 'checkbox') return field.checked;
if (field.type === 'number') return field.value !== '';
return false;
});
}
function applyFilter() {
var form = filterForm();
if (!form) return;
if (!filterHasValues(form)) {
load(window.location.pathname.replace(/filter\/.+\/apply\/?$/, ''), { push: true, scroll: false });
return;
}
var box = content();
if (!box || !canRequest()) {
submitForm(form);
return;
}
var data = { section: box.getAttribute('data-catalog-section'), set_filter: 'y' };
new FormData(form).forEach(function (value, key) {
data[key] = value;
});
box.classList.add(loadingClass);
action('filter', data)
.then(function (response) {
var result = response.data;
Object.keys(result.disabled || {}).forEach(function (name) {
var field = form.elements.namedItem(name);
if (!field || field.checked) return;
var option = field.closest('.vino-filter__option');
if (option) option.classList.toggle('vino-filter__option--disabled', result.disabled[name]);
});
load(result.url, { push: true, scroll: false });
})
.catch(function () {
submitForm(form);
});
}
function submitForm(form) {
var flag = document.createElement('input');
flag.type = 'hidden';
flag.name = 'set_filter';
flag.value = 'Y';
form.appendChild(flag);
form.submit();
}
document.addEventListener('change', function (event) {
if (event.target.closest('[data-catalog-filter]')) applyFilter();
});
document.addEventListener('submit', function (event) {
if (!event.target.matches('[data-catalog-filter]')) return;
event.preventDefault();
if (event.submitter && event.submitter.name === 'del_filter') {
Array.prototype.forEach.call(event.target.elements, function (field) {
if (field.type === 'checkbox') field.checked = false;
if (field.type === 'number') field.value = '';
});
event.target.querySelectorAll('.vino-filter__option--disabled').forEach(function (option) {
option.classList.remove('vino-filter__option--disabled');
});
}
applyFilter();
});
document.addEventListener('click', function (event) {
var sortButton = event.target.closest('.vino-sort__btn');
if (sortButton) {
event.stopPropagation();
var sort = sortButton.closest('.vino-sort');
var open = sort.classList.toggle('vino-sort--open');
sortButton.setAttribute('aria-expanded', open ? 'true' : 'false');
return;
}
var viewButton = event.target.closest('[data-catalog-view]');
if (viewButton) {
if (viewButton.getAttribute('aria-pressed') === 'true') return;
document.cookie = 'vino_view=' + viewButton.getAttribute('data-catalog-view') + '; path=/; max-age=31536000; samesite=lax';
closeSort();
load(window.location.href, { push: false, scroll: false });
return;
}
var preset = event.target.closest('[data-catalog-content] .vino-presets__link');
if (preset && !event.ctrlKey && !event.metaKey && !event.shiftKey && event.button === 0) {
event.preventDefault();
closeSort();
load(preset.href, { push: true, syncFilter: true, scroll: false });
return;
}
var link = event.target.closest('[data-catalog-content] .vino-sort__menu a, [data-catalog-content] .vino-pager a');
if (link && !event.ctrlKey && !event.metaKey && !event.shiftKey && event.button === 0) {
event.preventDefault();
closeSort();
var paged = !!link.closest('.vino-pager');
load(link.href, { push: true, scroll: paged, focus: paged });
return;
}
closeSort();
});
window.addEventListener('popstate', function () {
if (!content()) return;
load(window.location.href, { push: false, syncFilter: true, scroll: false });
});
document.addEventListener('keydown', function (event) {
if (event.key !== 'Escape') return;
var sort = document.querySelector('.vino-sort--open');
if (!sort) return;
closeSort();
var button = sort.querySelector('.vino-sort__btn');
if (button) button.focus();
});
function initFilterPanel() {
var panel = document.querySelector('[data-filter-panel]');
var overlay = document.querySelector('[data-filter-overlay]');
var overlayTimer = 0;
if (!panel) return;
var opener = null;
function focusable() {
return Array.prototype.filter.call(
panel.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'),
function (element) { return element.offsetParent !== null; }
);
}
function open(button) {
opener = button;
panel.classList.add('vino-catalog-sidebar--open');
panel.setAttribute('role', 'dialog');
panel.setAttribute('aria-modal', 'true');
panel.setAttribute('aria-label', panel.dataset.filterLabel || '');
if (button) button.setAttribute('aria-expanded', 'true');
var close = panel.querySelector('[data-filter-close]');
if (close) close.focus();
if (overlay) {
clearTimeout(overlayTimer);
overlay.hidden = false;
requestAnimationFrame(function () { overlay.classList.add('vino-filter-overlay--on'); });
}
document.documentElement.style.overflow = 'hidden';
}
function close() {
if (!panel.classList.contains('vino-catalog-sidebar--open')) return;
panel.classList.remove('vino-catalog-sidebar--open');
panel.removeAttribute('role');
panel.removeAttribute('aria-modal');
panel.removeAttribute('aria-label');
var button = opener && document.contains(opener) ? opener : document.querySelector('[data-filter-open]');
if (button) {
button.setAttribute('aria-expanded', 'false');
button.focus();
}
opener = null;
if (overlay) {
overlay.classList.remove('vino-filter-overlay--on');
overlayTimer = setTimeout(function () { overlay.hidden = true; }, 280);
}
document.documentElement.style.overflow = '';
}
document.addEventListener('click', function (event) {
var openButton = event.target.closest('[data-filter-open]');
if (openButton) open(openButton);
if (event.target.closest('[data-filter-close]') || event.target === overlay) close();
});
document.addEventListener('keydown', function (event) {
if (!panel.classList.contains('vino-catalog-sidebar--open')) return;
if (event.key === 'Escape') {
close();
return;
}
if (event.key !== 'Tab') return;
var items = focusable();
if (!items.length) return;
var first = items[0];
var last = items[items.length - 1];
if (event.shiftKey && document.activeElement === first) {
event.preventDefault();
last.focus();
} else if (!event.shiftKey && document.activeElement === last) {
event.preventDefault();
first.focus();
}
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () {
initFilterPanel();
renderChips();
});
} else {
initFilterPanel();
renderChips();
}
})();
@@ -0,0 +1,64 @@
<?php
use Bitrix\Main\Localization\Loc;
use Jinove\Vinoteca\Catalog\Listing;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest();
$sort = (string)$request->getQuery("sort");
if (!in_array($sort, Listing::SORTS, true)) {
$sort = "";
}
$sectionCode = (string)$arResult["VARIABLES"]["SECTION_CODE"];
if ($sectionCode !== strtolower($sectionCode)) {
$query = (string)($_SERVER["QUERY_STRING"] ?? "");
LocalRedirect(VINO_HOST . strtolower($APPLICATION->GetCurPage(false)) . ($query !== "" ? "?" . $query : ""), true, "301 Moved permanently");
}
$filterPath = (string)($arResult["VARIABLES"]["SMART_FILTER_PATH"] ?? "");
if (!Listing::filterPathIsValid($sectionCode, $filterPath)) {
\Bitrix\Iblock\Component\Tools::process404("", true, true, true);
return;
}
$sectionPath = Listing::sectionPath($sectionCode);
$pagePath = Listing::pagePath($sectionCode, $filterPath, $sort, max(1, (int)$request->getQuery("PAGEN_1")));
if ($filterPath !== "" || $sort !== "") {
$APPLICATION->SetPageProperty("robots", "noindex, follow");
}
$APPLICATION->SetPageProperty("vino_canonical", $pagePath);
$APPLICATION->SetPageProperty("og_image", VINO_HOST . SITE_TEMPLATE_PATH . "/assets/media/og-catalog.jpg");
?>
<section class="vino-razdel-hero">
<div class="vino-wrap">
<?php \Jinove\Vinoteca\Breadcrumbs::show(array(array(Loc::getMessage("VINO_CATALOG_CRUMB"), "/catalog/"), array(\Jinove\Vinoteca\Catalog\Sections::name($sectionCode)))); ?>
<h1 class="vino-razdel-hero__title"><?php $APPLICATION->ShowTitle(false); ?></h1>
</div>
</section>
<section class="vino-razdel-sec">
<div class="vino-wrap">
<?php $APPLICATION->IncludeComponent("jinove:catalog.listing", "", array(
"SECTION_CODE" => $sectionCode,
"FILTER_PATH" => $filterPath,
), $component); ?>
</div>
</section>
<?php
$sectionUrl = VINO_HOST . $sectionPath;
$pageUrl = VINO_HOST . $pagePath;
$ld = array(
"@context" => "https://schema.org",
"@type" => "CollectionPage",
"@id" => $pageUrl . "#webpage",
"url" => $pageUrl,
"name" => $APPLICATION->GetTitle(false),
"description" => $APPLICATION->GetPageProperty("description"),
"inLanguage" => LANGUAGE_ID,
"about" => array("@id" => VINO_HOST . "/#store"),
"mainEntity" => array("@id" => $pageUrl . "#items"),
"workTranslation" => \Jinove\Vinoteca\PageSchema::translations($pagePath, "CollectionPage"),
);
?>
<script type="application/ld+json"><?= json_encode($ld, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
@@ -0,0 +1,64 @@
<?php
use Bitrix\Main\Localization\Loc;
use Jinove\Vinoteca\Catalog\Listing;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$legacyCountry = trim((string)\Bitrix\Main\Application::getInstance()->getContext()->getRequest()->getQuery("country"));
if ($legacyCountry !== "") {
LocalRedirect(VINO_HOST . Listing::countryPath($legacyCountry), true, "301 Moved permanently");
}
$site = VINO_HOST . SITE_DIR;
$page = $site . "catalog/";
$ogImage = VINO_HOST . SITE_TEMPLATE_PATH . "/assets/media/og-catalog.jpg";
$APPLICATION->SetPageProperty("og_image", $ogImage);
$ld = array(
"@context" => "https://schema.org",
"@graph" => array(
array(
"@type" => "CollectionPage",
"@id" => $page . "#webpage",
"url" => $page,
"name" => Loc::getMessage("VINO_CATALOG_H1"),
"description" => $APPLICATION->GetPageProperty("description"),
"inLanguage" => LANGUAGE_ID,
"about" => array("@id" => VINO_HOST . "/#store"),
"mainEntity" => array("@id" => $page . "#sections"),
"primaryImageOfPage" => \Jinove\Vinoteca\PageSchema::image($page . "#image", $ogImage, 1200, 630),
"workTranslation" => \Jinove\Vinoteca\PageSchema::translations(SITE_DIR . "catalog/", "CollectionPage"),
),
),
);
?>
<script type="application/ld+json"><?= json_encode($ld, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
<section class="vino-razdel-hero">
<div class="vino-wrap">
<?php \Jinove\Vinoteca\Breadcrumbs::show(array(array(Loc::getMessage("VINO_CATALOG_CRUMB")))); ?>
<h1 class="vino-razdel-hero__title"><?= Loc::getMessage("VINO_CATALOG_H1") ?></h1>
<div class="vino-showcase-banner vino-showcase-banner--catalog">
<picture class="vino-showcase-banner__media">
<source type="image/webp" srcset="<?= SITE_TEMPLATE_PATH ?>/assets/media/catalog-banner-rack-480.webp 480w, <?= SITE_TEMPLATE_PATH ?>/assets/media/catalog-banner-rack-800.webp 800w, <?= SITE_TEMPLATE_PATH ?>/assets/media/catalog-banner-rack-1280.webp 1280w" sizes="(max-width: 760px) 100vw, 60vw">
<img class="vino-showcase-banner__img" src="<?= SITE_TEMPLATE_PATH ?>/assets/media/catalog-banner-rack-1280.jpg" width="1280" height="400" alt="" decoding="async">
</picture>
<div class="vino-showcase-banner__content">
<span class="vino-showcase-banner__eyebrow"><?= Loc::getMessage("VINO_CATALOG_BANNER_EYEBROW") ?></span>
<h2 class="vino-showcase-banner__title"><?= Loc::getMessage("VINO_CATALOG_BANNER_TITLE") ?></h2>
<p class="vino-showcase-banner__text"><?= Loc::getMessage("VINO_CATALOG_BANNER_TEXT") ?></p>
</div>
<div class="vino-showcase-banner__actions">
<a class="vino-btn" href="<?= SITE_DIR ?>catalog/red/"><?= Loc::getMessage("VINO_CATALOG_BANNER_RED") ?></a>
<button type="button" class="vino-btn vino-btn--outline" data-sommelier-open><?= Loc::getMessage("VINO_CATALOG_BANNER_SOMMELIER") ?></button>
</div>
</div>
</div>
</section>
<section class="vino-section vino-brands">
<div class="vino-wrap">
<div class="vino-brands-plain">
<?php $APPLICATION->IncludeComponent("bitrix:catalog.section.list", "vinoteca-tiles", \Jinove\Vinoteca\Catalog\Listing::sectionTilesParams(), $component); ?>
</div>
</div>
</section>
@@ -0,0 +1,11 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
if (empty($arResult)) {
return;
}
?>
<ul class="vino-footer__list">
<?php foreach ($arResult as $item): ?>
<li class="vino-footer__item"><a class="vino-footer__link" href="<?= htmlspecialcharsbx($item["LINK"]) ?>"><?= htmlspecialcharsbx($item["TEXT"]) ?></a></li>
<?php endforeach; ?>
</ul>
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_MEGA_CATALOG"] = "Catalogue";
$MESS["VINO_MEGA_MAIN_MENU"] = "Main menu";
$MESS["VINO_MEGA_FAVORITES"] = "Favourites";
$MESS["VINO_MEGA_COMPARE"] = "Compare";
$MESS["VINO_MEGA_ACCOUNT"] = "My account";
$MESS["VINO_MEGA_ASK"] = "Ask the sommelier";
$MESS["VINO_MEGA_LOGIN"] = "Sign in";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_MEGA_CATALOG"] = "Katalog";
$MESS["VINO_MEGA_MAIN_MENU"] = "Menu główne";
$MESS["VINO_MEGA_FAVORITES"] = "Ulubione";
$MESS["VINO_MEGA_COMPARE"] = "Porównanie";
$MESS["VINO_MEGA_ACCOUNT"] = "Moje konto";
$MESS["VINO_MEGA_ASK"] = "Zapytaj sommeliera";
$MESS["VINO_MEGA_LOGIN"] = "Zaloguj się";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_MEGA_CATALOG"] = "Каталог";
$MESS["VINO_MEGA_MAIN_MENU"] = "Основное меню";
$MESS["VINO_MEGA_FAVORITES"] = "Избранное";
$MESS["VINO_MEGA_COMPARE"] = "Сравнение";
$MESS["VINO_MEGA_ACCOUNT"] = "Личный кабинет";
$MESS["VINO_MEGA_LOGIN"] = "Войти";
$MESS["VINO_MEGA_ASK"] = "Спросить сомелье";
@@ -0,0 +1,25 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
if (empty($arResult)) {
return;
}
?>
<div class="vino-header__main">
<a class="vino-catalog-btn" href="<?= SITE_DIR ?>catalog/" aria-haspopup="true" aria-expanded="false" aria-controls="vino-mega" data-mega-toggle><?= Loc::getMessage("VINO_MEGA_CATALOG") ?></a>
<nav class="vino-nav" id="vino-menu" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_MEGA_MAIN_MENU")) ?>" data-menu>
<?php foreach ($arResult as $item): ?>
<?php $item["SELECTED"] = $item["SELECTED"] && !defined("ERROR_404"); ?>
<?php if ($item["LINK"] === SITE_DIR . "catalog/"): ?>
<a class="vino-nav__link vino-nav__link--catalog<?= $item["SELECTED"] ? " vino-nav__link--active" : "" ?>"<?= $item["SELECTED"] ? ' aria-current="page"' : "" ?> href="<?= htmlspecialcharsbx($item["LINK"]) ?>"><?= htmlspecialcharsbx($item["TEXT"]) ?></a>
<?php else: ?>
<a class="vino-nav__link<?= $item["SELECTED"] ? " vino-nav__link--active" : "" ?>"<?= $item["SELECTED"] ? ' aria-current="page"' : "" ?> href="<?= htmlspecialcharsbx($item["LINK"]) ?>"><?= htmlspecialcharsbx($item["TEXT"]) ?></a>
<?php endif; ?>
<?php endforeach; ?>
<a class="vino-nav__link vino-nav__link--extra" href="<?= SITE_DIR ?>personal/favorites/"><?= Loc::getMessage("VINO_MEGA_FAVORITES") ?></a>
<a class="vino-nav__link vino-nav__link--extra" href="<?= SITE_DIR ?>compare/"><?= Loc::getMessage("VINO_MEGA_COMPARE") ?></a>
<a class="vino-nav__link vino-nav__link--extra" href="<?= htmlspecialcharsbx(\Jinove\Vinoteca\Account::url()) ?>"><?= htmlspecialcharsbx(\Jinove\Vinoteca\Account::label("VINO_MEGA_ACCOUNT", "VINO_MEGA_LOGIN")) ?></a>
<button type="button" class="vino-nav__ask" data-sommelier-open><?= Loc::getMessage("VINO_MEGA_ASK") ?></button>
</nav>
</div>
@@ -0,0 +1,9 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
if (!empty($arResult["VINO_PRELOAD"])) {
$APPLICATION->AddHeadString('<link rel="preload" as="image" href="' . htmlspecialcharsbx($arResult["VINO_PRELOAD"]) . '" media="(max-width: 1023px)">');
}
$APPLICATION->AddHeadString('<link rel="preload" as="image" href="' . SITE_TEMPLATE_PATH . '/assets/media/hero-poster.webp?v=6" media="(min-width: 1024px)">');
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_HERO_PAUSE"] = "Pause video";
$MESS["VINO_HERO_PLAY"] = "Play video";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_HERO_PAUSE"] = "Zatrzymaj wideo";
$MESS["VINO_HERO_PLAY"] = "Odtwórz wideo";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_HERO_PAUSE"] = "Остановить видео";
$MESS["VINO_HERO_PLAY"] = "Включить видео";
@@ -0,0 +1,18 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
foreach ($arResult["ITEMS"] as $index => $item) {
$arResult["ITEMS"][$index] = \Jinove\Vinoteca\Catalog\LocalizedText::localizeItem($item, array("PREVIEW_TEXT"), array("KICKER", "LINK_TEXT"));
}
foreach ($arResult["ITEMS"] as &$item) {
$link = trim((string)($item["PROPERTIES"]["LINK"]["VALUE"] ?? ""));
$item["VINO_LINK"] = str_starts_with($link, "/") && !str_starts_with($link, "//") ? SITE_DIR . ltrim($link, "/") : $link;
}
unset($item);
$first = reset($arResult["ITEMS"]);
$arResult["VINO_PRELOAD"] = $first ? (string)($first["PREVIEW_PICTURE"]["SRC"] ?? "") : "";
$this->__component->SetResultCacheKeys(array("VINO_PRELOAD"));
@@ -0,0 +1,23 @@
(function () {
function init() {
var v = document.querySelector('.vino-hero__video');
if (!v || !window.matchMedia('(min-width:981px)').matches) return;
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
v.muted = true;
function play() { var r = v.play(); if (r && r.catch) r.catch(function () {}); }
function load() {
if (v.dataset.loaded) return;
var src = v.getAttribute('data-src');
if (!src) return;
v.dataset.loaded = '1';
v.setAttribute('preload', 'auto');
v.src = src;
v.load();
play();
}
load();
document.addEventListener('click', function () { load(); play(); }, { once: true });
document.addEventListener('visibilitychange', function () { if (!document.hidden) { load(); play(); } });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); else init();
})();
@@ -0,0 +1,36 @@
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
if (empty($arResult["ITEMS"])) return;
$media = SITE_TEMPLATE_PATH . "/assets/media/";
$editLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT");
$deleteLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_DELETE");
?>
<section class="vino-hero" data-slider="hero">
<video class="vino-hero__video" muted loop playsinline preload="none" poster="<?= $media ?>hero-poster.webp?v=6" data-src="<?= $media ?>wine-pour.mp4?v=2"></video>
<?php foreach ($arResult["ITEMS"] as $arItem):
$this->AddEditAction($arItem["ID"], $arItem["EDIT_LINK"], $editLink);
$this->AddDeleteAction($arItem["ID"], $arItem["DELETE_LINK"], $deleteLink);
$prop = $arItem["PROPERTIES"];
$linkText = trim((string)($prop["LINK_TEXT"]["~VALUE"] ?? ""));
$kicker = trim((string)($prop["KICKER"]["~VALUE"] ?? ""));
?>
<a class="vino-hero__panel" id="<?= $this->GetEditAreaId($arItem["ID"]) ?>" href="<?= htmlspecialcharsbx($arItem["VINO_LINK"]) ?>">
<?php if (!empty($arItem["PREVIEW_PICTURE"]["SRC"])): ?><span class="vino-hero__img" style="--img:url('<?= $arItem["PREVIEW_PICTURE"]["SRC"] ?>')"></span><?php endif; ?>
<span class="vino-hero__veil"></span>
<span class="vino-hero__content">
<?php if ($kicker !== ""): ?><span class="vino-hero__kicker"><?= htmlspecialcharsbx($kicker) ?></span><?php endif; ?>
<span class="vino-hero__title"><?= htmlspecialcharsbx($arItem["~NAME"]) ?></span>
<span class="vino-hero__rule"></span>
<?php if ($arItem["PREVIEW_TEXT"] !== ""): ?><span class="vino-hero__desc"><?= htmlspecialcharsbx($arItem["~PREVIEW_TEXT"]) ?></span><?php endif; ?>
<?php if ($linkText !== ""): ?><span class="vino-hero__cta vino-link"><?= htmlspecialcharsbx($linkText) ?></span><?php endif; ?>
</span>
</a>
<?php endforeach; ?>
<span class="vino-hero__grain" aria-hidden="true"></span>
</section>
<?php if (count($arResult["ITEMS"]) > 1): ?>
<div class="vino-dots vino-dots--overlay" data-slider-dots="hero">
<?php foreach ($arResult["ITEMS"] as $i => $arItem): ?>
<button type="button" class="vino-dots__dot<?= $i ? "" : " vino-dots__dot--active" ?>" aria-label="<?= htmlspecialcharsbx($arItem["~NAME"]) ?>"<?= $i ? "" : ' aria-current="true"' ?>></button>
<?php endforeach; ?>
</div>
<?php endif; ?>
@@ -0,0 +1,4 @@
<?php
$MESS["VINO_BRANDS_KICKER"] = "Collection";
$MESS["VINO_BRANDS_TITLE"] = "Brands in the catalogue";
$MESS["VINO_BRANDS_ALL"] = "All brands";
@@ -0,0 +1,4 @@
<?php
$MESS["VINO_BRANDS_KICKER"] = "Kolekcja";
$MESS["VINO_BRANDS_TITLE"] = "Marki w katalogu";
$MESS["VINO_BRANDS_ALL"] = "Wszystkie marki";
@@ -0,0 +1,4 @@
<?php
$MESS["VINO_BRANDS_KICKER"] = "Коллекция";
$MESS["VINO_BRANDS_TITLE"] = "Бренды в каталоге";
$MESS["VINO_BRANDS_ALL"] = "Все бренды";
@@ -0,0 +1,12 @@
<?php
use Bitrix\Iblock\ElementTable;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
foreach ($arResult["ITEMS"] as $index => $item) {
$arResult["ITEMS"][$index] = \Jinove\Vinoteca\Catalog\LocalizedText::localizeItem($item, array("PREVIEW_TEXT"), array("COUNTRY", "REGION", "GRAPE"));
}
$arResult["VINO_TOTAL"] = ElementTable::getCount(array("=IBLOCK_ID" => (int)$arResult["ID"], "=ACTIVE" => "Y"));
@@ -0,0 +1,49 @@
<?php
use Bitrix\Main\Localization\Loc;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
if (empty($arResult["ITEMS"])) {
return;
}
$pages = array_chunk($arResult["ITEMS"], 4);
$editLink = CIBlock::GetArrayByID($arResult["ID"], "ELEMENT_EDIT");
$deleteLink = CIBlock::GetArrayByID($arResult["ID"], "ELEMENT_DELETE");
?>
<section class="vino-section vino-brands">
<div class="vino-wrap vino-section__inner">
<div class="vino-section__head">
<div class="vino-section__intro">
<p class="vino-kicker"><?= Loc::getMessage("VINO_BRANDS_KICKER") ?></p>
<h2 class="vino-section__title"><?= Loc::getMessage("VINO_BRANDS_TITLE") ?></h2>
</div>
<div class="vino-slider__head-actions vino-section__all">
<a class="vino-section__more" href="<?= htmlspecialcharsbx(preg_replace("#/{2,}#", "/", CComponentEngine::makePathFromTemplate($arResult["~LIST_PAGE_URL"] ?? $arResult["LIST_PAGE_URL"]))) ?>"><?= Loc::getMessage("VINO_BRANDS_ALL") ?> <span class="vino-section__count"><?= (int)$arResult["VINO_TOTAL"] ?></span></a>
</div>
</div>
<div class="vino-brands-plain vino-section__body">
<div class="vino-brands__grid vino-brands__grid--slider" data-slider="brands">
<?php foreach ($pages as $page): ?>
<div class="vino-brands__page">
<?php foreach ($page as $item):
$this->AddEditAction($item["ID"], $item["EDIT_LINK"], $editLink);
$this->AddDeleteAction($item["ID"], $item["DELETE_LINK"], $deleteLink);
$place = implode(" · ", array_filter(array($item["PROPERTIES"]["COUNTRY"]["~VALUE"] ?? "", $item["PROPERTIES"]["REGION"]["~VALUE"] ?? "")));
?>
<a class="vino-brands__item<?= !empty($item["PREVIEW_PICTURE"]["SRC"]) ? " vino-brands__item--logo" : "" ?>" id="<?= $this->GetEditAreaId($item["ID"]) ?>" href="<?= htmlspecialcharsbx($item["DETAIL_PAGE_URL"]) ?>"><?php if (!empty($item["PREVIEW_PICTURE"]["SRC"])): ?><img class="vino-brands__logo" src="<?= $item["PREVIEW_PICTURE"]["SRC"] ?>" width="<?= (int)$item["PREVIEW_PICTURE"]["WIDTH"] ?>" height="<?= (int)$item["PREVIEW_PICTURE"]["HEIGHT"] ?>" alt="" loading="lazy" decoding="async"><?php endif; ?><strong class="vino-brands__name"><?= $item["NAME"] ?></strong><span class="vino-brands__meta"><?= htmlspecialcharsbx($place) ?></span></a>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<?php if (count($pages) > 1): ?>
<div class="vino-dots vino-dots--lines vino-brands__dots" data-slider-dots="brands">
<?php foreach ($pages as $i => $page): ?>
<button type="button" class="vino-dots__dot<?= $i ? "" : " vino-dots__dot--active" ?>" aria-label="<?= htmlspecialcharsbx(implode(", ", array_column($page, "~NAME"))) ?>"<?= $i ? "" : ' aria-current="true"' ?>></button>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
</section>
@@ -0,0 +1,17 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$schemaItems = array();
foreach ($arResult["ITEMS"] as $index => $item) {
$arResult["ITEMS"][$index] = \Jinove\Vinoteca\News::card($item);
$schemaItems[] = array("name" => (string)$arResult["ITEMS"][$index]["~NAME"], "url" => VINO_HOST . $item["DETAIL_PAGE_URL"]);
}
$page = (int)($arResult["NAV_RESULT"] ? $arResult["NAV_RESULT"]->NavPageNomer : 1);
$arResult["VINO_SCHEMA"] = \Jinove\Vinoteca\ArticleSchema::list(
$schemaItems,
\Jinove\Vinoteca\News::folder() . ($page > 1 ? "?PAGEN_1=" . $page : ""),
(string)$GLOBALS["APPLICATION"]->GetPageProperty("title"),
(string)$GLOBALS["APPLICATION"]->GetPageProperty("description")
);
@@ -0,0 +1,66 @@
(function (run) {
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
else run();
})(function () {
var request = 0;
function box() {
return document.querySelector('[data-news-feed]');
}
function canRequest() {
return !!(window.BX && BX.ajax && BX.ajax.runAction);
}
function pageOf(url) {
var page = parseInt(url.searchParams.get('PAGEN_1') || '1', 10);
return page > 0 ? page : 1;
}
function load(url, push) {
var current = box();
if (!current || !canRequest()) {
window.location.href = url.href;
return;
}
var id = ++request;
current.setAttribute('aria-busy', 'true');
BX.ajax.runAction('jinove:vinoteca.news.page', { method: 'GET', getParameters: { PAGEN_1: pageOf(url) } })
.then(function (response) {
if (id !== request) return;
var doc = document.createElement('template');
doc.innerHTML = response.data.html;
var next = doc.content.querySelector('[data-news-feed]');
if (!next) throw new Error('content');
if (push) history.pushState({ vinoNews: true }, '', url.href);
current.innerHTML = next.innerHTML;
current.removeAttribute('aria-busy');
if (response.data.componentResult && response.data.componentResult.title) {
document.title = response.data.componentResult.title;
}
document.dispatchEvent(new CustomEvent('vino:content', { detail: { root: current } }));
var first = current.querySelector('.vino-news__link');
if (first) first.focus({ preventScroll: true });
var top = current.getBoundingClientRect().top;
if (top < 0) window.scrollTo({ top: window.scrollY + top - 120, behavior: 'smooth' });
})
.catch(function () {
if (id === request) window.location.href = url.href;
});
}
document.addEventListener('click', function (event) {
var link = event.target.closest('[data-news-feed] .vino-pager a');
if (!link || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
load(new URL(link.href, window.location.href), true);
});
window.addEventListener('popstate', function (event) {
if (event.state && event.state.vinoNews) load(new URL(window.location.href), false);
});
if (box() && !(history.state && history.state.vinoNews)) {
history.replaceState({ vinoNews: true }, '', window.location.href);
}
});
@@ -0,0 +1,24 @@
.vino-news-feed__content {
transition: opacity var(--duration-fast) var(--ease-base);
}
.vino-news-feed__content[aria-busy="true"] {
opacity: .45;
pointer-events: none;
}
.vino-news-feed .vino-news__grid--feed {
row-gap: var(--space-12);
}
@media (min-width:761px) {
.vino-news-feed .vino-news__grid--feed {
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: var(--space-12);
}
.vino-news__grid--feed .vino-news__title {
font-size: var(--vino-news-feed-title-size);
}
}
@media (max-width:760px) {
.vino-news-feed .vino-news__grid--feed {
row-gap: var(--space-10);
}
}
@@ -0,0 +1,26 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
$editLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT");
$deleteLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_DELETE");
?>
<div class="vino-news-feed__content" data-news-feed aria-live="polite">
<div class="vino-news__grid vino-news__grid--feed">
<?php foreach ($arResult["ITEMS"] as $index => $item):
$this->AddEditAction($item["ID"], $item["EDIT_LINK"], $editLink);
$this->AddDeleteAction($item["ID"], $item["DELETE_LINK"], $deleteLink);
$picture = $item["VINO_PICTURE"];
?>
<article class="vino-news__card" id="<?= $this->GetEditAreaId($item["ID"]) ?>">
<?php if ($picture): ?><a class="vino-news__media" href="<?= $item["DETAIL_PAGE_URL"] ?>" tabindex="-1" aria-hidden="true"><img class="vino-news__img" src="<?= $picture["SRC"] ?>" srcset="<?= $picture["SRCSET"] ?>" sizes="(max-width: 760px) calc(100vw - 32px), 620px" width="<?= $picture["WIDTH"] ?>" height="<?= $picture["HEIGHT"] ?>" alt="<?= htmlspecialcharsbx($picture["ALT"]) ?>"<?= $index > 1 ? ' loading="lazy"' : ($index === 0 ? ' fetchpriority="high"' : "") ?> decoding="async"></a><?php endif; ?>
<?php if ($item["VINO_DATE"]): ?><time class="vino-news__date" datetime="<?= $item["VINO_DATE"]["ISO"] ?>"><?= $item["VINO_DATE"]["TEXT"] ?></time><?php endif; ?>
<h2 class="vino-news__title"><a class="vino-news__link" href="<?= $item["DETAIL_PAGE_URL"] ?>"><?= htmlspecialcharsbx($item["~NAME"]) ?></a></h2>
<?php if ((string)$item["~PREVIEW_TEXT"] !== ""): ?><p class="vino-news__text"><?= htmlspecialcharsbx($item["~PREVIEW_TEXT"]) ?></p><?php endif; ?>
</article>
<?php endforeach; ?>
</div>
<?= $arResult["NAV_STRING"] ?>
</div>
<?php if (($arParams["VINO_AJAX"] ?? "N") !== "Y"): ?><script type="application/ld+json"><?= json_encode($arResult["VINO_SCHEMA"], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP) ?></script><?php endif; ?>
@@ -0,0 +1,8 @@
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
foreach ($arResult["ITEMS"] as $index => $item) {
$arResult["ITEMS"][$index] = \Jinove\Vinoteca\News::card($item);
}
@@ -0,0 +1,19 @@
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
if (empty($arResult["ITEMS"])) return;
$editLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT");
$deleteLink = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_DELETE");
?>
<div class="vino-news__grid">
<?php foreach ($arResult["ITEMS"] as $i => $arItem):
$this->AddEditAction($arItem["ID"], $arItem["EDIT_LINK"], $editLink);
$this->AddDeleteAction($arItem["ID"], $arItem["DELETE_LINK"], $deleteLink);
$pic = $arItem["VINO_PICTURE"];
?>
<article class="vino-news__card<?= $i ? " vino-news__card--compact" : "" ?>" id="<?= $this->GetEditAreaId($arItem["ID"]) ?>">
<?php if ($pic): ?><a class="vino-news__media" href="<?= $arItem["DETAIL_PAGE_URL"] ?>" tabindex="-1" aria-hidden="true"><img class="vino-news__img" loading="lazy" decoding="async" src="<?= $pic["SRC"] ?>" srcset="<?= $pic["SRCSET"] ?>" sizes="(max-width: 760px) <?= $i ? "150px" : "calc(100vw - 32px)" ?>, 400px" width="<?= $pic["WIDTH"] ?>" height="<?= $pic["HEIGHT"] ?>" alt="<?= htmlspecialcharsbx($pic["ALT"]) ?>"></a><?php endif; ?>
<?php if ($arItem["VINO_DATE"]): ?><time class="vino-news__date" datetime="<?= $arItem["VINO_DATE"]["ISO"] ?>"><?= $arItem["VINO_DATE"]["TEXT"] ?></time><?php endif; ?>
<h3 class="vino-news__title"><a class="vino-news__link" href="<?= $arItem["DETAIL_PAGE_URL"] ?>"><?= htmlspecialcharsbx($arItem["~NAME"]) ?></a></h3>
<?php if ((string)$arItem["~PREVIEW_TEXT"] !== ""): ?><p class="vino-news__text"><?= htmlspecialcharsbx($arItem["~PREVIEW_TEXT"]) ?></p><?php endif; ?>
</article>
<?php endforeach; ?>
</div>
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_OFFERS_CODE"] = "Promo code";
@@ -0,0 +1,2 @@
<?php
$MESS["VINO_OFFERS_CODE"] = "Kod rabatowy";
Loaded 100 of 586 files, more files were not shown because too many files have changed in this diff. Show more