Vinoteca: wine shop on 1C-Bitrix (module, template, components, pages)
This commit is contained in:
commit
0590195880
593 files changed
+27942
No files matched your search
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
|
||||
|
||||
$arTemplate = array(
|
||||
"NAME" => "Vinoteca (jinove_wine)",
|
||||
"DESCRIPTION" => "Тёмная винная тема Vinoteca: бордо + золото, Cormorant Garamond + Manrope.",
|
||||
"SORT" => 1,
|
||||
);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -0,0 +1,13 @@
|
||||
<svg width="512" height="512" viewBox="170 110 560 560" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M386.325 392.156C420.742 425.079 471.612 425.657 504.923 390.832C509.853 385.699 514.222 380.058 517.961 374.005C524.909 362.802 530.222 350.779 535.267 338.457C546.983 309.865 559.402 277.589 559.314 246.306C559.27 229.488 553.728 212.039 541.244 200.541C530.618 190.753 516.946 186.65 502.835 185.115C500.634 184.876 495.356 184.907 494.521 183.26L495.101 182.272C499.39 181.585 510.517 181.826 515.36 181.829L552.107 181.861C591.086 181.902 630.11 181.909 669.094 181.801C671.142 181.796 672.935 181.876 674.851 182.63L675.185 183.171L674.811 184.269C672.078 184.881 668.786 185.17 665.952 185.562C638.569 189.352 613.78 205.976 599.853 229.952C580.535 263.214 567.519 300.655 552.393 335.995C562.447 325.854 572.168 319.686 585.822 314.596C605.325 307.325 630.009 308.294 641.558 287.602C643.975 283.269 645.521 277.788 645.477 272.84C645.482 266.275 642.766 260.002 637.972 255.515C633.85 251.618 628.308 249.581 622.639 249.879C613.063 250.334 604.314 258.104 605.039 267.991C605.312 271.768 607.148 275.26 610.106 277.625C614.887 281.381 621.435 281.021 624.718 275.727C629.077 268.707 624.248 268.144 620.367 265.549C625.553 261.961 634.891 275.647 622.068 282.441C618.904 284.117 615.204 284.47 611.78 283.424C602.262 280.44 598.43 269.343 601.484 260.363C603.51 254.536 607.86 249.808 613.499 247.303C619.787 244.44 626.687 244.051 633.204 246.496C639.984 249.021 645.464 254.174 648.395 260.79C657.4 281.03 643.166 303.112 623.874 310.213C599.643 319.132 579.797 318.783 560.355 338.479C577.301 330.719 598.293 331.318 610.418 347.642C611.657 349.31 613.679 351.991 615.256 353.304C618.662 351.61 618.06 344.52 619.33 341.477C621.852 335.429 628.545 330.7 633.507 326.661C633.445 330.316 633.458 333.513 633.595 337.163C636.592 334.583 641.544 331.521 645.442 330.933L646.299 331.192L646.181 333.309C648.712 333.844 661.966 332.804 664.774 332.35C660.858 336.907 658.121 341.127 654.469 345.723L654.697 346.212L656.415 346.822C655.642 350.858 645.029 354.265 641.373 355.491C658.604 354.116 656.161 356.84 668.909 366.942C664.55 367.932 659.707 369.606 655.563 370.237C659.896 373.752 661.425 376.472 663.403 381.623C662.484 381.908 661.895 382.046 660.955 382.244C659.804 385.835 662.994 396.889 664.422 400.745C661.074 398.79 657.554 396.629 653.95 394.975C651.023 393.632 645.161 392.74 642.713 390.921C641.395 389.944 634.482 379.834 633.116 380.004L633.423 380.184C632.333 383.473 638.477 388.714 639.98 391.266C641.408 393.69 644.331 401.678 642.968 404.091C641.509 404.056 641.448 403.784 640.068 403.019L639.365 403.21C638.156 406.391 639.382 409.095 638.279 412.309C637.466 412.527 636.486 412.586 636.267 413.114C634.689 416.946 633.208 423.137 632.474 427.079C631.622 425.722 628.884 421.313 627.97 420.411C621.734 414.276 621.809 416.482 617.08 408.552L614.338 412.273C612.479 407.57 612.286 406.627 611.701 401.74C611.222 397.72 613.261 389.405 612.031 387.042C610.106 391.194 610.378 397.979 608.348 401.039C604.336 407.071 601.273 407.394 597.533 414.772C596.874 412.134 594.822 402.955 592.629 401.447C589.241 401.149 590.08 395.704 590.054 392.851C588.001 394.033 586.705 394.79 584.771 396.229C585.435 388.749 586.226 387.523 590.476 381.332C579.094 387.819 578.114 382.186 566.692 385.217C568.872 382.914 575.635 372.903 575.754 370.22L575.301 369.912C574.585 369.417 574.853 369.606 574.08 368.984C576.057 366.333 581.788 362.975 584.894 361.926L577.204 356.462C584.235 354.811 589.412 351.526 596.733 352.4C600.965 352.905 606.27 358.462 609.434 355.664C609.636 354.471 609.144 353.61 608.467 352.655C595.644 334.536 570.907 336.48 554.708 348.683C551.892 350.805 544.447 357.226 542.979 360.345C529.638 388.638 518.541 418.984 506.307 447.697C524.483 431.329 551.149 429.401 568.244 448.427C574.871 455.933 578.294 465.732 577.784 475.734C577.138 486.479 572.831 495.541 564.838 502.827C553.394 513.259 532.894 514.797 522.193 502.211C518.902 498.335 517.302 493.299 517.755 488.237C518.177 483.921 519.565 481.32 522.901 478.129C529.541 471.788 543.894 475.989 542.461 486.123C541.819 490.68 537.675 493.594 532.806 492.403C531.404 491.221 531.809 491.919 531.259 490.421C532.468 490.329 533.07 492.174 534.814 491.761C541.055 490.276 541.63 483.227 536.401 479.984C534.182 478.622 531.501 478.23 528.983 478.894C526.153 479.637 524.004 481.966 522.69 484.479C518.484 492.517 525.023 500.876 532.415 503.969C547.932 510.46 563.897 500.858 569.689 486.048C572.849 478.072 572.695 469.165 569.268 461.303C565.62 452.953 558.721 446.458 550.165 443.32C531.057 436.149 510.737 447.038 500.59 463.302C497.975 467.486 496.217 472.276 494.336 476.824L486.215 496.477L457.479 565.014L457.396 538.629C457.378 535.078 457.106 523.648 457.928 520.923C459.334 516.256 463.148 508.105 465.24 503.293L478.094 473.08L501.627 417.306C505.362 408.455 510.174 395.914 514.38 387.693C504.497 400.202 492.319 410.844 477.633 417.169C464.937 422.638 452.188 427.632 450.018 443.285C447.851 458.947 448.563 476.266 448.879 492.253L449.407 534.757L449.763 569.188C449.982 583.752Line truncated
|
||||
<path d="M630.646 348.972L631.477 349.686C627.051 352.407 622.318 355.351 617.796 357.894C628.132 361.792 634.737 364.696 642.683 372.496L641.817 372.907C637.291 368.525 631.696 365.381 625.882 363.03C623.527 362.077 616.381 359.898 616.047 357.511C619.115 355.029 626.924 350.952 630.646 348.972Z" fill="#080807"/>
|
||||
<path d="M597.212 365.291C601.884 363.292 610.277 360.081 614.268 357.705C611.042 368.262 605.342 376.103 601.822 386.538C602.169 380.508 608.638 366.936 611.372 361.185C607.333 362.581 600.93 364.678 597.226 366.482L597.212 365.291Z" fill="#080807"/>
|
||||
<path d="M614.509 359.434C620.503 368.173 620.842 377.669 624.234 387.281L623.061 386.467C620.741 378.262 616.206 366.86 614.509 359.434Z" fill="#080807"/>
|
||||
<path d="M597.212 365.291L597.226 366.482C593.815 368.262 591.196 369.594 587.663 371.067C590.691 368.898 593.886 366.967 597.212 365.291Z" fill="#51472B"/>
|
||||
<path d="M630.646 348.972C633.45 347.264 634.979 346.616 638.024 345.334L638.275 345.459C635.919 347.06 633.938 348.252 631.477 349.686L630.646 348.972Z" fill="#51472B"/>
|
||||
<path d="M623.061 386.467L624.234 387.281C624.731 389.515 625.144 390.926 625.157 393.235C624.102 391.361 623.597 388.621 623.061 386.467Z" fill="#51472B"/>
|
||||
<path d="M642.683 372.496C644.506 374.125 645.592 375.701 647.068 377.632C645.135 376.028 643.632 374.629 641.817 372.907L642.683 372.496Z" fill="#7A6230"/>
|
||||
<path d="M217.48 181.96C230.962 181.511 246.658 181.836 260.339 181.844L338.597 181.866L375.921 181.832C380.652 181.825 394.398 181.492 398.477 182.486L398.656 183.087C396.836 185.332 385.112 186.084 381.635 186.866C378.416 187.588 375.161 188.674 372.111 189.922C358.764 195.383 349.287 205.045 343.828 218.367C321.851 271.992 373.69 383.754 395.78 435.716L430.979 519.315C432.428 523.033 430.701 570.028 430.989 578.689L347.168 384.699L309.735 298.724L292.715 260.029C274.402 218.397 264.329 188.902 218.093 184.166C217.697 184.125 217.556 182.404 217.48 181.96Z" fill="#B49B59"/>
|
||||
<path d="M381.491 265.718C381.98 267.41 378.723 282.571 378.372 285.605C374.745 316.981 381.125 349.628 404.06 372.716C411 379.702 418.543 385.378 427.365 389.715C429.493 390.762 433.12 391.703 434.818 392.999C434.002 393.626 433.155 393.429 431.889 393.5C423.679 393.43 418.144 393.094 410.435 389.822C395.46 383.466 385.378 370.63 379.553 355.74C370.378 332.288 371.587 306.035 376.954 281.831C377.994 277.142 379.657 269.969 381.491 265.718Z" fill="#F7F0D4"/>
|
||||
<path d="M377.724 382.52C380.831 385.439 383.683 388.808 386.325 392.156L385.864 393.389C382.488 389.686 380.054 386.951 377.724 382.52Z" fill="#7A6230"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,46 @@
|
||||
(function () {
|
||||
function config() {
|
||||
try {
|
||||
return JSON.parse(document.getElementById('vino-config').textContent) || {};
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function arm(guard) {
|
||||
var cfg = config();
|
||||
if (!guard || !cfg.altcha) return;
|
||||
if (!document.querySelector('script[data-altcha]')) {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'module';
|
||||
script.src = cfg.altcha;
|
||||
script.setAttribute('data-altcha', '');
|
||||
document.head.appendChild(script);
|
||||
return;
|
||||
}
|
||||
if (typeof guard.getState === 'function' && ['verified', 'verifying'].indexOf(guard.getState()) < 0) guard.verify();
|
||||
}
|
||||
|
||||
function armed(guard) {
|
||||
return new Promise(function (resolve) {
|
||||
var tick = 0;
|
||||
(function poll() {
|
||||
var state = guard && typeof guard.getState === 'function' ? guard.getState() : '';
|
||||
if (state === 'verified') return resolve(true);
|
||||
var failed = state === 'error' || state === 'expired';
|
||||
var idle = state === 'unverified' && tick >= 30;
|
||||
if ((failed || idle) && tick % 30 === 0) guard.verify();
|
||||
if (++tick > 150) return resolve(false);
|
||||
setTimeout(poll, 100);
|
||||
})();
|
||||
});
|
||||
}
|
||||
|
||||
function reset(guard) {
|
||||
if (!guard) return;
|
||||
if (typeof guard.reset === 'function') guard.reset();
|
||||
if (typeof guard.verify === 'function') guard.verify();
|
||||
}
|
||||
|
||||
window.VinoAltcha = { arm: arm, armed: armed, reset: reset };
|
||||
})();
|
||||
@@ -0,0 +1,34 @@
|
||||
(function () {
|
||||
var layer = null;
|
||||
var label = null;
|
||||
|
||||
function build() {
|
||||
layer = document.createElement('div');
|
||||
layer.className = 'vino-busy';
|
||||
layer.hidden = true;
|
||||
layer.setAttribute('role', 'status');
|
||||
layer.setAttribute('aria-live', 'polite');
|
||||
var spinner = document.createElement('span');
|
||||
spinner.className = 'vino-busy__spinner';
|
||||
label = document.createElement('p');
|
||||
label.className = 'vino-busy__text';
|
||||
layer.appendChild(spinner);
|
||||
layer.appendChild(label);
|
||||
document.body.appendChild(layer);
|
||||
}
|
||||
|
||||
window.addEventListener('pageshow', function (e) {
|
||||
if (e.persisted && layer) layer.hidden = true;
|
||||
});
|
||||
|
||||
window.VinoBusy = {
|
||||
show: function (text) {
|
||||
if (!layer) build();
|
||||
label.textContent = text || '';
|
||||
layer.hidden = false;
|
||||
},
|
||||
hide: function () {
|
||||
if (layer) layer.hidden = true;
|
||||
}
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,97 @@
|
||||
(function () {
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var items = {};
|
||||
var timers = {};
|
||||
var version = 0;
|
||||
var cfg = {};
|
||||
try { cfg = JSON.parse(document.getElementById('vino-config').textContent); } catch (e) {}
|
||||
var max = cfg.cartMax;
|
||||
|
||||
function total() {
|
||||
return Object.keys(items).reduce(function (sum, id) { return sum + items[id]; }, 0);
|
||||
}
|
||||
|
||||
function counters(count) {
|
||||
document.querySelectorAll('[data-cart-count]').forEach(function (c) {
|
||||
c.textContent = count > 99 ? '99+' : count;
|
||||
c.hidden = !count;
|
||||
});
|
||||
}
|
||||
|
||||
function render() {
|
||||
document.querySelectorAll('[data-qty]').forEach(function (box) {
|
||||
var qty = items[box.getAttribute('data-qty')] || 0;
|
||||
box.classList.toggle('vino-card__qty--active', qty > 0);
|
||||
var out = box.querySelector('.vino-card__count');
|
||||
if (out) out.textContent = qty || 1;
|
||||
});
|
||||
counters(total());
|
||||
}
|
||||
|
||||
function apply(data, sent) {
|
||||
if (!data || !data.items || sent !== version) return;
|
||||
items = {};
|
||||
Object.keys(data.items).forEach(function (id) { items[id] = data.items[id]; });
|
||||
render();
|
||||
}
|
||||
|
||||
function load() {
|
||||
var sent = version;
|
||||
BX.ajax.runAction('jinove:vinoteca.basket.state', { method: 'GET' })
|
||||
.then(function (res) { apply(res.data, sent); }, function () {});
|
||||
}
|
||||
|
||||
function send(id) {
|
||||
var sent = version;
|
||||
BX.ajax.runAction('jinove:vinoteca.basket.set', { data: { id: id, qty: items[id] || 0 } })
|
||||
.then(function (res) { apply(res.data, sent); }, function () { if (sent === version) load(); });
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
var step = e.target.closest('[data-qty-step]');
|
||||
if (!step) return;
|
||||
var box = step.closest('[data-qty]');
|
||||
if (!box) return;
|
||||
e.preventDefault();
|
||||
var id = box.getAttribute('data-qty');
|
||||
var qty = Math.max(0, Math.min(max, (items[id] || 0) + parseInt(step.getAttribute('data-qty-step'), 10)));
|
||||
if (qty) items[id] = qty; else delete items[id];
|
||||
version++;
|
||||
render();
|
||||
clearTimeout(timers[id]);
|
||||
timers[id] = setTimeout(function () { send(id); }, 350);
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
var b = e.target.closest('[data-add-cart]');
|
||||
if (!b) return;
|
||||
e.preventDefault();
|
||||
var id = b.getAttribute('data-add-cart');
|
||||
if (!id || b.disabled) return;
|
||||
var qty = 1;
|
||||
var box = b.closest('.vino-pdp__buy') || b.closest('.vino-pdp__cart') || document;
|
||||
var out = box.querySelector('[data-stepper] output');
|
||||
if (out) {
|
||||
var q = parseInt(out.textContent, 10);
|
||||
if (q > 0) qty = q;
|
||||
}
|
||||
items[id] = Math.min(max, (items[id] || 0) + qty);
|
||||
version++;
|
||||
render();
|
||||
clearTimeout(timers[id]);
|
||||
timers[id] = setTimeout(function () { send(id); }, 350);
|
||||
});
|
||||
|
||||
function boot() {
|
||||
if (!window.VinoState) return load();
|
||||
var sent = version;
|
||||
VinoState.first('basket').then(function (res) { apply(res.data, sent); }, load);
|
||||
}
|
||||
|
||||
boot();
|
||||
document.addEventListener('vino:content', render);
|
||||
document.addEventListener('vino:basket', function (e) {
|
||||
version++;
|
||||
apply(e.detail, version);
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,103 @@
|
||||
(function () {
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var cfg = {};
|
||||
try { cfg = JSON.parse(document.getElementById('vino-config').textContent); } catch (e) {}
|
||||
var text = cfg.text || {};
|
||||
var MAX = cfg.compareLimit;
|
||||
var items = [];
|
||||
var timers = {};
|
||||
var version = 0;
|
||||
var toast = null;
|
||||
|
||||
function render() {
|
||||
document.querySelectorAll('[data-compare-count]').forEach(function (counter) {
|
||||
counter.textContent = items.length;
|
||||
counter.hidden = !items.length;
|
||||
});
|
||||
document.querySelectorAll('[data-compare-toggle]').forEach(function (button) {
|
||||
var on = items.indexOf(Number(button.getAttribute('data-compare-toggle'))) >= 0;
|
||||
var label = on ? text.compareRemove : text.compareAdd;
|
||||
button.classList.toggle(button.classList[0] + '--active', on);
|
||||
button.setAttribute('aria-pressed', on ? 'true' : 'false');
|
||||
button.setAttribute('aria-label', label || '');
|
||||
button.title = label || '';
|
||||
});
|
||||
}
|
||||
|
||||
function say(message, link) {
|
||||
if (!toast) {
|
||||
toast = document.createElement('div');
|
||||
toast.className = 'vino-toast';
|
||||
toast.setAttribute('role', 'status');
|
||||
document.body.appendChild(toast);
|
||||
}
|
||||
toast.textContent = message;
|
||||
var anchor = document.createElement('a');
|
||||
anchor.className = 'vino-toast__link';
|
||||
anchor.href = link.href;
|
||||
anchor.textContent = link.label;
|
||||
toast.appendChild(anchor);
|
||||
toast.classList.add('vino-toast--on');
|
||||
clearTimeout(toast.timer);
|
||||
toast.timer = setTimeout(function () { toast.classList.remove('vino-toast--on'); }, 3500);
|
||||
}
|
||||
|
||||
function warnFull() {
|
||||
say((text.compareMax || '').replace('#N#', MAX), { href: (cfg.siteDir || '/') + 'compare/', label: text.compareOpen || '' });
|
||||
}
|
||||
|
||||
function apply(response, sent) {
|
||||
if (sent !== version) return;
|
||||
var data = response.data || {};
|
||||
items = data.items || [];
|
||||
render();
|
||||
if (data.full) warnFull();
|
||||
}
|
||||
|
||||
function load() {
|
||||
var sent = version;
|
||||
BX.ajax.runAction('jinove:vinoteca.compare.state', { method: 'GET' }).then(function (response) { apply(response, sent); }, function () {});
|
||||
}
|
||||
|
||||
function send(id) {
|
||||
var sent = ++version;
|
||||
var on = items.indexOf(id) >= 0;
|
||||
BX.ajax.runAction('jinove:vinoteca.compare.set', { data: { id: id, on: on ? 'Y' : 'N' } })
|
||||
.then(function (response) { apply(response, sent); }, function () { if (sent === version) load(); });
|
||||
}
|
||||
|
||||
function boot() {
|
||||
if (!window.VinoState) return load();
|
||||
var sent = version;
|
||||
VinoState.first('compare').then(function (response) { apply(response, sent); }, load);
|
||||
}
|
||||
|
||||
boot();
|
||||
document.addEventListener('vino:content', render);
|
||||
document.addEventListener('vino:compare', function (event) {
|
||||
version++;
|
||||
items = (event.detail && event.detail.items) || [];
|
||||
render();
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
var button = event.target.closest('[data-compare-toggle]');
|
||||
if (!button) return;
|
||||
event.preventDefault();
|
||||
var id = Number(button.getAttribute('data-compare-toggle'));
|
||||
var index = items.indexOf(id);
|
||||
if (index >= 0) {
|
||||
items.splice(index, 1);
|
||||
} else {
|
||||
if (items.length >= MAX) {
|
||||
warnFull();
|
||||
return;
|
||||
}
|
||||
items.push(id);
|
||||
}
|
||||
version++;
|
||||
render();
|
||||
clearTimeout(timers[id]);
|
||||
timers[id] = setTimeout(function () { send(id); }, 350);
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,63 @@
|
||||
(function () {
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var items = [];
|
||||
var timers = {};
|
||||
var version = 0;
|
||||
|
||||
function render() {
|
||||
document.querySelectorAll('[data-fav-count]').forEach(function (counter) {
|
||||
counter.textContent = items.length > 99 ? '99+' : items.length;
|
||||
counter.hidden = !items.length;
|
||||
});
|
||||
document.querySelectorAll('[data-fav-toggle]').forEach(function (button) {
|
||||
var on = items.indexOf(Number(button.getAttribute('data-fav-toggle'))) >= 0;
|
||||
button.classList.toggle(button.classList[0] + '--active', on);
|
||||
button.setAttribute('aria-pressed', on ? 'true' : 'false');
|
||||
});
|
||||
}
|
||||
|
||||
function apply(response, sent) {
|
||||
if (sent !== version) return;
|
||||
items = (response.data && response.data.items) || [];
|
||||
render();
|
||||
}
|
||||
|
||||
function load() {
|
||||
var sent = version;
|
||||
BX.ajax.runAction('jinove:vinoteca.favorite.state', { method: 'GET' }).then(function (response) { apply(response, sent); }, function () {});
|
||||
}
|
||||
|
||||
function send(id) {
|
||||
var sent = ++version;
|
||||
var on = items.indexOf(id) >= 0;
|
||||
BX.ajax.runAction('jinove:vinoteca.favorite.set', { data: { id: id, on: on ? 'Y' : 'N' } })
|
||||
.then(function (response) { apply(response, sent); }, function () { if (sent === version) load(); });
|
||||
}
|
||||
|
||||
function boot() {
|
||||
if (!window.VinoState) return load();
|
||||
var sent = version;
|
||||
VinoState.first('favorite').then(function (response) { apply(response, sent); }, load);
|
||||
}
|
||||
|
||||
boot();
|
||||
document.addEventListener('vino:content', render);
|
||||
document.addEventListener('vino:favorite', function (event) {
|
||||
version++;
|
||||
items = (event.detail && event.detail.items) || [];
|
||||
render();
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
var button = event.target.closest('[data-fav-toggle]');
|
||||
if (!button) return;
|
||||
event.preventDefault();
|
||||
var id = Number(button.getAttribute('data-fav-toggle'));
|
||||
var index = items.indexOf(id);
|
||||
if (index >= 0) items.splice(index, 1); else items.push(id);
|
||||
version++;
|
||||
render();
|
||||
clearTimeout(timers[id]);
|
||||
timers[id] = setTimeout(function () { send(id); }, 350);
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,33 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
var root = document.querySelector('[data-favorites]');
|
||||
if (!root || !window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var status = root.querySelector('[data-favorites-status]');
|
||||
document.addEventListener('click', function (event) {
|
||||
var button = event.target.closest('[data-favorites] [data-fav-toggle]');
|
||||
if (!button) return;
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
var card = button.closest('.vino-card');
|
||||
if (!card) return;
|
||||
var parent = card.parentNode;
|
||||
var next = card.nextSibling;
|
||||
var neighbour = card.nextElementSibling || card.previousElementSibling;
|
||||
card.remove();
|
||||
if (status) status.textContent = root.getAttribute('data-favorites-removed') || '';
|
||||
var focus = (neighbour && neighbour.querySelector('.vino-card__link')) || document.querySelector('h1');
|
||||
if (focus) {
|
||||
if (focus.tagName === 'H1') focus.setAttribute('tabindex', '-1');
|
||||
focus.focus();
|
||||
}
|
||||
BX.ajax.runAction('jinove:vinoteca.favorite.set', { data: { id: button.getAttribute('data-fav-toggle'), on: 'N' } }).then(function (response) {
|
||||
document.dispatchEvent(new CustomEvent('vino:favorite', { detail: response.data }));
|
||||
if (!root.querySelector('.vino-card')) window.location.href = window.location.pathname;
|
||||
}, function () {
|
||||
parent.insertBefore(card, next);
|
||||
if (status) status.textContent = '';
|
||||
});
|
||||
}, true);
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
var AGE_KEY = 'vino-age-ok';
|
||||
var BAR_KEY = 'vino-cookie-ok';
|
||||
var bar = document.querySelector('[data-cookie-bar]');
|
||||
var gate = document.querySelector('[data-age-gate]');
|
||||
|
||||
function stored(key) {
|
||||
try { return localStorage.getItem(key) === '1'; } catch (e) { return false; }
|
||||
}
|
||||
function store(key) {
|
||||
try { localStorage.setItem(key, '1'); } catch (e) {}
|
||||
}
|
||||
function choice() {
|
||||
try { return localStorage.getItem(BAR_KEY) || ''; } catch (e) { return ''; }
|
||||
}
|
||||
function choose(value) {
|
||||
try { localStorage.setItem(BAR_KEY, value); } catch (e) {}
|
||||
}
|
||||
|
||||
function notify() {
|
||||
document.dispatchEvent(new CustomEvent('vino:consent'));
|
||||
}
|
||||
|
||||
window.VinoConsent = {
|
||||
allowed: function () {
|
||||
var value = choice();
|
||||
return value === 'accept' || value === '1';
|
||||
},
|
||||
accept: function () {
|
||||
if (bar) answer('accept');
|
||||
else {
|
||||
choose('accept');
|
||||
notify();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function showBar() {
|
||||
if (!bar || choice()) return;
|
||||
bar.hidden = false;
|
||||
void bar.offsetWidth;
|
||||
bar.classList.add('vino-cookie--on');
|
||||
}
|
||||
|
||||
function answer(value) {
|
||||
choose(value);
|
||||
notify();
|
||||
bar.classList.remove('vino-cookie--on');
|
||||
setTimeout(function () { bar.hidden = true; }, 300);
|
||||
}
|
||||
|
||||
if (bar) {
|
||||
var ok = bar.querySelector('[data-cookie-ok]');
|
||||
var decline = bar.querySelector('[data-cookie-decline]');
|
||||
if (ok) ok.addEventListener('click', function () { answer('accept'); });
|
||||
if (decline) decline.addEventListener('click', function () { answer('decline'); });
|
||||
document.addEventListener('click', function (e) {
|
||||
if (!e.target.closest('[data-cookie-settings]')) return;
|
||||
try { localStorage.removeItem(BAR_KEY); } catch (err) {}
|
||||
showBar();
|
||||
});
|
||||
}
|
||||
|
||||
if (!gate || stored(AGE_KEY)) {
|
||||
if (gate) gate.remove();
|
||||
showBar();
|
||||
return;
|
||||
}
|
||||
|
||||
gate.hidden = false;
|
||||
document.documentElement.style.overflow = 'hidden';
|
||||
var yes = gate.querySelector('[data-age-yes]');
|
||||
var no = gate.querySelector('[data-age-no]');
|
||||
var card = gate.querySelector('.vino-age__card');
|
||||
if (card) card.focus();
|
||||
function trap(event) {
|
||||
if (event.key !== 'Tab' || !yes || !no) return;
|
||||
var active = document.activeElement;
|
||||
if (event.shiftKey && (active === yes || active === card)) {
|
||||
event.preventDefault();
|
||||
no.focus();
|
||||
} else if (!event.shiftKey && (active === no || !gate.contains(active))) {
|
||||
event.preventDefault();
|
||||
yes.focus();
|
||||
}
|
||||
}
|
||||
document.addEventListener('keydown', trap);
|
||||
if (yes) yes.addEventListener('click', function () {
|
||||
store(AGE_KEY);
|
||||
document.removeEventListener('keydown', trap);
|
||||
document.documentElement.style.overflow = '';
|
||||
gate.classList.add('vino-age--leaving');
|
||||
setTimeout(function () { gate.remove(); }, 400);
|
||||
setTimeout(showBar, 500);
|
||||
});
|
||||
if (no) no.addEventListener('click', function () {
|
||||
window.location.href = gate.getAttribute('data-exit') || '/';
|
||||
});
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1,107 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
var header = document.querySelector('[data-header]');
|
||||
if (header) {
|
||||
var onScroll = function () { header.classList.toggle('vino-header--scrolled', window.scrollY > 20); };
|
||||
onScroll();
|
||||
window.addEventListener('scroll', onScroll, { passive: true });
|
||||
}
|
||||
var toggle = document.querySelector('[data-menu-toggle]');
|
||||
var menu = document.querySelector('[data-menu]');
|
||||
if (toggle && menu) {
|
||||
var setMenu = function (open) {
|
||||
menu.classList.toggle('vino-nav--open', open);
|
||||
toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
};
|
||||
toggle.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
setMenu(!menu.classList.contains('vino-nav--open'));
|
||||
});
|
||||
menu.addEventListener('click', function (e) { if (e.target.closest('a, button')) setMenu(false); });
|
||||
document.addEventListener('click', function (e) { if (!menu.contains(e.target)) setMenu(false); });
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key !== 'Escape' || !menu.classList.contains('vino-nav--open')) return;
|
||||
setMenu(false);
|
||||
toggle.focus();
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
(function () {
|
||||
var box = document.querySelector('[data-lang]');
|
||||
if (!box) return;
|
||||
var btn = box.querySelector('[data-lang-toggle]');
|
||||
function set(open) {
|
||||
box.setAttribute('data-open', open ? 'true' : 'false');
|
||||
btn.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
}
|
||||
btn.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
set(box.getAttribute('data-open') !== 'true');
|
||||
});
|
||||
document.addEventListener('click', function (e) { if (!box.contains(e.target)) set(false); });
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key !== 'Escape' || box.getAttribute('data-open') !== 'true') return;
|
||||
set(false);
|
||||
btn.focus();
|
||||
});
|
||||
})();
|
||||
|
||||
(function () {
|
||||
var root = document.querySelector('[data-search]');
|
||||
if (!root) return;
|
||||
var input = root.querySelector('[data-search-input]');
|
||||
var hideTimer = 0;
|
||||
var opener = null;
|
||||
var openers = document.querySelectorAll('[data-search-open]');
|
||||
function focusable() {
|
||||
return Array.prototype.filter.call(root.querySelectorAll('a[href], button:not([disabled]), input:not([disabled])'), function (el) { return el.offsetParent !== null; });
|
||||
}
|
||||
function open(e) {
|
||||
if (e) e.preventDefault();
|
||||
opener = e && e.currentTarget ? e.currentTarget : document.activeElement;
|
||||
openers.forEach(function (o) { o.setAttribute('aria-expanded', 'true'); });
|
||||
clearTimeout(hideTimer);
|
||||
root.hidden = false;
|
||||
void root.offsetWidth;
|
||||
root.classList.add('vino-search--open');
|
||||
if (input) input.focus();
|
||||
document.documentElement.style.overflow = 'hidden';
|
||||
}
|
||||
function close() {
|
||||
root.classList.remove('vino-search--open');
|
||||
if (input) input.value = '';
|
||||
document.dispatchEvent(new CustomEvent('vino:search-close'));
|
||||
hideTimer = setTimeout(function () { root.hidden = true; }, 280);
|
||||
document.documentElement.style.overflow = '';
|
||||
openers.forEach(function (o) { o.setAttribute('aria-expanded', 'false'); });
|
||||
if (opener && opener.focus) opener.focus();
|
||||
}
|
||||
document.querySelectorAll('[data-search-open]').forEach(function (o) { o.addEventListener('click', open); });
|
||||
root.querySelectorAll('[data-search-close]').forEach(function (b) { b.addEventListener('click', close); });
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (root.hidden) return;
|
||||
if (e.key === 'Escape') {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if (e.key !== 'Tab') return;
|
||||
var items = focusable();
|
||||
if (!items.length) return;
|
||||
var first = items[0], last = items[items.length - 1];
|
||||
if (e.shiftKey && document.activeElement === first) {
|
||||
e.preventDefault();
|
||||
last.focus();
|
||||
} else if (!e.shiftKey && document.activeElement === last) {
|
||||
e.preventDefault();
|
||||
first.focus();
|
||||
} else if (!root.contains(document.activeElement)) {
|
||||
e.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
});
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
(function () {
|
||||
function init() {
|
||||
document.querySelectorAll('[data-password-toggle]').forEach(function (toggle) {
|
||||
var input = document.getElementById(toggle.getAttribute('aria-controls'));
|
||||
var form = toggle.closest('form');
|
||||
if (!input || !form) return;
|
||||
|
||||
function sync() {
|
||||
var empty = input.value === '';
|
||||
toggle.hidden = empty;
|
||||
if (empty && input.type === 'text') {
|
||||
input.type = 'password';
|
||||
toggle.textContent = form.dataset.labelShow;
|
||||
toggle.setAttribute('aria-pressed', 'false');
|
||||
}
|
||||
}
|
||||
|
||||
toggle.addEventListener('click', function () {
|
||||
var show = input.type === 'password';
|
||||
input.type = show ? 'text' : 'password';
|
||||
toggle.textContent = show ? form.dataset.labelHide : form.dataset.labelShow;
|
||||
toggle.setAttribute('aria-pressed', show ? 'true' : 'false');
|
||||
input.focus();
|
||||
});
|
||||
['input', 'change', 'focus'].forEach(function (name) {
|
||||
input.addEventListener(name, sync);
|
||||
});
|
||||
sync();
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,165 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
function setup(input) {
|
||||
var code = input.getAttribute('data-phone-code');
|
||||
var length = Number(input.getAttribute('data-phone-digits'));
|
||||
var prefix = '+' + code + ' ';
|
||||
var error = input.getAttribute('data-phone-error');
|
||||
var groups = (input.getAttribute('data-phone-groups') || '').split(',').map(Number).filter(Boolean);
|
||||
var bounds = [0];
|
||||
while (bounds[bounds.length - 1] < length) {
|
||||
var size = groups[bounds.length - 1] || groups[groups.length - 1] || 3;
|
||||
bounds.push(Math.min(length, bounds[bounds.length - 1] + size));
|
||||
}
|
||||
|
||||
function digitsOf(value) {
|
||||
return value.slice(prefix.length).replace(/\D/g, '');
|
||||
}
|
||||
|
||||
function validate() {
|
||||
if (!error) return;
|
||||
var count = digitsOf(input.value).length;
|
||||
input.setCustomValidity(count !== length && (count || input.required) ? error : '');
|
||||
}
|
||||
|
||||
function format(digits) {
|
||||
var parts = [];
|
||||
for (var i = 1; i < bounds.length && bounds[i - 1] < digits.length; i++) {
|
||||
parts.push(digits.slice(bounds[i - 1], bounds[i]));
|
||||
}
|
||||
return prefix + parts.join(' ');
|
||||
}
|
||||
|
||||
function before(index) {
|
||||
return bounds.filter(function (b) { return b > 0 && b < index; }).length;
|
||||
}
|
||||
|
||||
function positionOf(index) {
|
||||
return index <= 0 ? prefix.length : prefix.length + index + before(index);
|
||||
}
|
||||
|
||||
function indexOf(position) {
|
||||
return input.value.slice(prefix.length, Math.max(position, prefix.length)).replace(/\D/g, '').length;
|
||||
}
|
||||
|
||||
function render(digits, caret) {
|
||||
if (caret === undefined) caret = digits.length;
|
||||
input.value = format(digits);
|
||||
var position = positionOf(caret);
|
||||
input.setSelectionRange(position, position);
|
||||
validate();
|
||||
}
|
||||
|
||||
function normalize(raw) {
|
||||
var digits = raw.replace(/\D/g, '');
|
||||
if (digits.length > length) {
|
||||
if (digits.indexOf('00' + code) === 0) digits = digits.slice(code.length + 2);
|
||||
else if (digits.indexOf(code) === 0) digits = digits.slice(code.length);
|
||||
else if (code === '7' && digits.length === length + 1 && digits.charAt(0) === '8') digits = digits.slice(1);
|
||||
}
|
||||
return digits;
|
||||
}
|
||||
|
||||
function replace(text, isPaste) {
|
||||
var current = digitsOf(input.value);
|
||||
var start = indexOf(input.selectionStart);
|
||||
var end = indexOf(input.selectionEnd);
|
||||
var whole = start === 0 && end === current.length;
|
||||
var room = length - current.length + (end - start);
|
||||
var clean = isPaste && whole ? normalize(text) : text.replace(/\D/g, '');
|
||||
if (!isPaste && clean.length > room) {
|
||||
var fixed = normalize(current.slice(0, start) + clean + current.slice(end));
|
||||
if (fixed.length <= length) {
|
||||
render(fixed);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isPaste && clean.length > room) return;
|
||||
var inserted = clean.slice(0, room);
|
||||
if (!inserted) return;
|
||||
render(current.slice(0, start) + inserted + current.slice(end), start + inserted.length);
|
||||
}
|
||||
|
||||
function lower(index) {
|
||||
return bounds.filter(function (b) { return b < index; }).pop() || 0;
|
||||
}
|
||||
|
||||
function upper(index, max) {
|
||||
var next = bounds.filter(function (b) { return b > index; })[0];
|
||||
return Math.min(max, next === undefined ? max : next);
|
||||
}
|
||||
|
||||
function remove(type) {
|
||||
var current = digitsOf(input.value);
|
||||
var start = indexOf(input.selectionStart);
|
||||
var end = indexOf(input.selectionEnd);
|
||||
if (start === end) {
|
||||
if (type.indexOf('Backward') >= 0) {
|
||||
if (type.indexOf('Line') >= 0) start = 0;
|
||||
else if (type.indexOf('Word') >= 0) start = lower(start);
|
||||
else start = Math.max(0, start - 1);
|
||||
} else if (type.indexOf('Line') >= 0) {
|
||||
end = current.length;
|
||||
} else if (type.indexOf('Word') >= 0) {
|
||||
end = upper(end, current.length);
|
||||
} else {
|
||||
end = Math.min(current.length, end + 1);
|
||||
}
|
||||
}
|
||||
render(current.slice(0, start) + current.slice(end), start);
|
||||
}
|
||||
|
||||
function keepCaret() {
|
||||
setTimeout(function () {
|
||||
if (document.activeElement !== input) return;
|
||||
if (input.value.indexOf(prefix) !== 0) {
|
||||
render(normalize(input.value).slice(0, length));
|
||||
return;
|
||||
}
|
||||
if (input.selectionStart === input.selectionEnd && input.selectionStart < prefix.length) {
|
||||
input.setSelectionRange(prefix.length, prefix.length);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
input.addEventListener('beforeinput', function (e) {
|
||||
e.preventDefault();
|
||||
if (e.inputType.indexOf('delete') === 0) remove(e.inputType);
|
||||
else if (e.inputType === 'insertFromPaste' || e.inputType === 'insertFromDrop') replace(e.dataTransfer ? e.dataTransfer.getData('text/plain') : (e.data || ''), true);
|
||||
else if (e.inputType.indexOf('insert') === 0 && e.data) replace(e.data, e.inputType === 'insertReplacementText');
|
||||
});
|
||||
|
||||
input.addEventListener('input', function () {
|
||||
render(normalize(input.value.indexOf(prefix) === 0 ? digitsOf(input.value) : input.value).slice(0, length));
|
||||
});
|
||||
|
||||
input.addEventListener('focus', function () {
|
||||
if (!input.value) render('');
|
||||
keepCaret();
|
||||
});
|
||||
|
||||
input.addEventListener('blur', function () {
|
||||
if (!digitsOf(input.value)) input.value = '';
|
||||
validate();
|
||||
});
|
||||
|
||||
['click', 'keyup', 'select'].forEach(function (type) { input.addEventListener(type, keepCaret); });
|
||||
|
||||
validate();
|
||||
|
||||
input.vinoPhone = {
|
||||
value: function () {
|
||||
var digits = digitsOf(input.value);
|
||||
return digits ? '+' + code + digits : '';
|
||||
},
|
||||
filled: function () { return digitsOf(input.value).length > 0; },
|
||||
complete: function () { return digitsOf(input.value).length === length; }
|
||||
};
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-phone-code]').forEach(setup);
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
if ('IntersectionObserver' in window && !window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||
document.documentElement.classList.add('vino-reveal');
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
var root = document.documentElement;
|
||||
if (!root.classList.contains('vino-reveal')) return;
|
||||
var els = document.querySelectorAll('.vino-section, .vino-story, .vino-sales, .vino-footer, .vino-pdp, .vino-reviews, .vino-pdp-related, .vino-auth:not(.vino-auth--embed), .vino-cab, .vino-cart, .vino-order, .vino-done, .vino-about__panel, .vino-brand-detail, .vino-article, .vino-news-feed, .vino-offers, .vino-offer, .vino-offers-wines, .vino-showcase, .vino-showcase-shots');
|
||||
els.forEach(function (el) {
|
||||
el.classList.add('vino-reveal__item');
|
||||
if (el.classList.contains('vino-section') || el.classList.contains('vino-news-feed') || el.classList.contains('vino-offers-wines')) el.classList.add('vino-reveal__item--deep');
|
||||
});
|
||||
var seen = false;
|
||||
var io = new IntersectionObserver(function (list) {
|
||||
seen = true;
|
||||
list.forEach(function (e) {
|
||||
if (e.isIntersecting) {
|
||||
e.target.classList.add('vino-reveal__item--visible');
|
||||
io.unobserve(e.target);
|
||||
}
|
||||
});
|
||||
}, { rootMargin: '0px 0px -12% 0px' });
|
||||
els.forEach(function (el) { io.observe(el); });
|
||||
setTimeout(function () {
|
||||
if (!seen) els.forEach(function (el) { el.classList.add('vino-reveal__item--visible'); });
|
||||
}, 3000);
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1,139 @@
|
||||
(function () {
|
||||
var modal = document.querySelector('[data-review-modal]');
|
||||
if (!modal || !window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var body = modal.querySelector('[data-review-body]');
|
||||
var form = modal.querySelector('[data-review-form]');
|
||||
var done = modal.querySelector('[data-review-done]');
|
||||
var err = modal.querySelector('[data-review-err]');
|
||||
var submit = form.querySelector('[type="submit"]');
|
||||
var guard = form.querySelector('altcha-widget');
|
||||
var started = 0;
|
||||
var codes = { rating: 'rating', author: 'author', text: 'text', consent: 'consent', too_often: 'tooOften', altcha: 'altcha' };
|
||||
|
||||
function visible(el) {
|
||||
return !!el && el.offsetParent !== null;
|
||||
}
|
||||
|
||||
function focusable() {
|
||||
return Array.prototype.filter.call(modal.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled])'), function (el) {
|
||||
return el.tabIndex >= 0 && visible(el);
|
||||
});
|
||||
}
|
||||
|
||||
function say(message) {
|
||||
err.textContent = message || '';
|
||||
err.hidden = !message;
|
||||
}
|
||||
|
||||
function mark(field, bad) {
|
||||
if (!field) return;
|
||||
field.classList.toggle('vino-inp--invalid', bad);
|
||||
if (bad) field.setAttribute('aria-invalid', 'true');
|
||||
else field.removeAttribute('aria-invalid');
|
||||
}
|
||||
|
||||
function open() {
|
||||
body.hidden = false;
|
||||
done.hidden = true;
|
||||
say('');
|
||||
started = Date.now();
|
||||
VinoAltcha.arm(guard);
|
||||
modal.showModal();
|
||||
var heading = visible(modal.querySelector('.vino-review-user')) ? modal.querySelector('#vino-review-title') : modal.querySelector('.vino-auth__title');
|
||||
if (heading) {
|
||||
if (!heading.id) heading.id = 'vino-auth-title';
|
||||
modal.setAttribute('aria-labelledby', heading.id);
|
||||
}
|
||||
setTimeout(function () {
|
||||
var list = focusable();
|
||||
var first = form.querySelector('.vino-rate__input:checked');
|
||||
if (!first || !visible(first)) first = list[0];
|
||||
if (first) first.focus();
|
||||
}, 30);
|
||||
}
|
||||
|
||||
function close() {
|
||||
modal.close();
|
||||
}
|
||||
|
||||
function check() {
|
||||
var f = form.elements;
|
||||
var problems = [];
|
||||
var rated = !!form.querySelector('.vino-rate__input:checked');
|
||||
form.querySelector('.vino-rate').classList.toggle('vino-rate--invalid', !rated);
|
||||
if (!rated) problems.push('rating');
|
||||
var text = f.text.value.trim();
|
||||
mark(f.text, text.length < 10);
|
||||
if (text.length < 10) problems.push('text');
|
||||
mark(f.consent, !f.consent.checked);
|
||||
if (!f.consent.checked) problems.push('consent');
|
||||
return problems;
|
||||
}
|
||||
|
||||
function message(code) {
|
||||
var key = codes[code] || 'error';
|
||||
return form.dataset['msg' + key.charAt(0).toUpperCase() + key.slice(1)] || form.dataset.msgError;
|
||||
}
|
||||
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
var problems = check();
|
||||
if (problems.length) {
|
||||
say(message(problems[0]));
|
||||
return;
|
||||
}
|
||||
say('');
|
||||
submit.disabled = true;
|
||||
var f = form.elements;
|
||||
var data = {
|
||||
productId: form.dataset.product,
|
||||
rating: form.querySelector('.vino-rate__input:checked').value,
|
||||
text: f.text.value.trim(),
|
||||
consent: f.consent.checked ? '1' : '',
|
||||
website: f.website.value,
|
||||
started: String(started),
|
||||
lang: document.documentElement.lang || 'en',
|
||||
page: window.location.href
|
||||
};
|
||||
VinoAltcha.armed(guard)
|
||||
.then(function (ok) {
|
||||
if (!ok) return Promise.reject({ errors: [{ code: 'altcha' }] });
|
||||
data.altcha = f.altcha ? f.altcha.value : '';
|
||||
return BX.ajax.runAction('jinove:vinoteca.review.add', { data: data });
|
||||
})
|
||||
.then(function () {
|
||||
submit.disabled = false;
|
||||
form.reset();
|
||||
if (guard && typeof guard.reset === 'function') guard.reset();
|
||||
body.hidden = true;
|
||||
done.hidden = false;
|
||||
done.focus();
|
||||
}, function (res) {
|
||||
submit.disabled = false;
|
||||
VinoAltcha.reset(guard);
|
||||
var code = res && res.errors && res.errors[0] ? res.errors[0].code : '';
|
||||
say(message(code));
|
||||
});
|
||||
});
|
||||
|
||||
form.addEventListener('input', function (event) {
|
||||
if (event.target.classList.contains('vino-inp--invalid')) mark(event.target, false);
|
||||
if (event.target.classList.contains('vino-rate__input')) form.querySelector('.vino-rate').classList.remove('vino-rate--invalid');
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
if (event.target.closest('[data-review-open]')) {
|
||||
event.preventDefault();
|
||||
open();
|
||||
return;
|
||||
}
|
||||
if (modal.open && (event.target === modal || event.target.closest('[data-review-close]'))) close();
|
||||
});
|
||||
|
||||
try {
|
||||
if (sessionStorage.getItem('vinoOpenReview') === '1') {
|
||||
sessionStorage.removeItem('vinoOpenReview');
|
||||
open();
|
||||
}
|
||||
} catch (e) {}
|
||||
})();
|
||||
@@ -0,0 +1,36 @@
|
||||
(function () {
|
||||
function init() {
|
||||
var list = document.querySelector('[data-shots]');
|
||||
if (!list || !window.PhotoSwipe) return;
|
||||
var texts = {};
|
||||
try { texts = JSON.parse(list.getAttribute('data-viewer') || '{}'); } catch (e) {}
|
||||
var links = Array.prototype.slice.call(list.querySelectorAll('[data-shots-item]'));
|
||||
var items = links.map(function (link) {
|
||||
var img = link.querySelector('img');
|
||||
return {
|
||||
src: link.getAttribute('href'),
|
||||
width: Number(link.getAttribute('data-width')),
|
||||
height: Number(link.getAttribute('data-height')),
|
||||
alt: img ? img.alt : ''
|
||||
};
|
||||
});
|
||||
links.forEach(function (link, index) {
|
||||
link.addEventListener('click', function (event) {
|
||||
if (event.ctrlKey || event.metaKey || event.shiftKey || event.button !== 0) return;
|
||||
event.preventDefault();
|
||||
new window.PhotoSwipe(Object.assign({
|
||||
dataSource: items,
|
||||
index: index,
|
||||
bgOpacity: 0.94,
|
||||
wheelToZoom: true,
|
||||
paddingFn: function (viewport) {
|
||||
var side = viewport.x < 760 ? 0 : 88;
|
||||
return { top: 64, bottom: viewport.x < 760 ? 16 : 40, left: side, right: side };
|
||||
}
|
||||
}, texts)).init();
|
||||
});
|
||||
});
|
||||
}
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
|
||||
else init();
|
||||
})();
|
||||
@@ -0,0 +1,86 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
function dots(track, box) {
|
||||
var items = box.querySelectorAll('.vino-dots__dot'), cur = 0;
|
||||
if (!items.length) return null;
|
||||
items.forEach(function (dot, i) {
|
||||
dot.addEventListener('click', function () {
|
||||
track.scrollTo({ left: i * track.clientWidth, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
return function () {
|
||||
var w = track.clientWidth;
|
||||
if (!w) return;
|
||||
var i = Math.max(0, Math.min(items.length - 1, Math.round(track.scrollLeft / w)));
|
||||
if (i === cur) return;
|
||||
items[cur].classList.remove('vino-dots__dot--active');
|
||||
items[cur].removeAttribute('aria-current');
|
||||
items[i].classList.add('vino-dots__dot--active');
|
||||
items[i].setAttribute('aria-current', 'true');
|
||||
cur = i;
|
||||
};
|
||||
}
|
||||
function progress(track, box) {
|
||||
var bar = box.querySelector('.vino-progress__bar');
|
||||
if (!bar) return null;
|
||||
return function () {
|
||||
var total = track.scrollWidth, view = track.clientWidth;
|
||||
if (!total || !view) return;
|
||||
var size = Math.min(1, view / total), max = total - view;
|
||||
bar.style.setProperty('--vino-progress-width', (size * 100) + '%');
|
||||
bar.style.setProperty('--vino-progress-shift', (max > 0 ? (track.scrollLeft / max) * (1 / size - 1) * 100 : 0) + '%');
|
||||
};
|
||||
}
|
||||
function init(track) {
|
||||
var name = track.getAttribute('data-slider'), handlers = [];
|
||||
var dotsBox = document.querySelector('[data-slider-dots="' + name + '"]');
|
||||
var barBox = document.querySelector('[data-slider-progress="' + name + '"]');
|
||||
if (dotsBox) handlers.push(dots(track, dotsBox));
|
||||
if (barBox) handlers.push(progress(track, barBox));
|
||||
handlers = handlers.filter(Boolean);
|
||||
if (!handlers.length) return;
|
||||
function update() { handlers.forEach(function (fn) { fn(); }); }
|
||||
track.addEventListener('scroll', update, { passive: true });
|
||||
window.addEventListener('resize', update);
|
||||
update();
|
||||
}
|
||||
function arrows(viewport, prev, next) {
|
||||
if (!viewport) return;
|
||||
function step() {
|
||||
var card = viewport.querySelector('.vino-card');
|
||||
if (!card) return 300;
|
||||
var gap = parseFloat(getComputedStyle(card.parentElement).columnGap) || 0;
|
||||
return (card.getBoundingClientRect().width + gap) * 2;
|
||||
}
|
||||
function update() {
|
||||
var max = viewport.scrollWidth - viewport.clientWidth - 2;
|
||||
var fits = max <= 0;
|
||||
if (prev) {
|
||||
prev.hidden = fits;
|
||||
prev.disabled = viewport.scrollLeft <= 2;
|
||||
}
|
||||
if (next) {
|
||||
next.hidden = fits;
|
||||
next.disabled = viewport.scrollLeft >= max;
|
||||
}
|
||||
}
|
||||
if (prev) prev.addEventListener('click', function () { viewport.scrollBy({ left: -step(), behavior: 'smooth' }); });
|
||||
if (next) next.addEventListener('click', function () { viewport.scrollBy({ left: step(), behavior: 'smooth' }); });
|
||||
viewport.addEventListener('scroll', update, { passive: true });
|
||||
window.addEventListener('resize', update);
|
||||
update();
|
||||
}
|
||||
document.querySelectorAll('[data-slider]').forEach(init);
|
||||
document.querySelectorAll('[data-slider]').forEach(function (viewport) {
|
||||
var name = viewport.getAttribute('data-slider');
|
||||
var prev = document.querySelector('[data-slider-prev="' + name + '"]');
|
||||
var next = document.querySelector('[data-slider-next="' + name + '"]');
|
||||
if (prev || next) arrows(viewport, prev, next);
|
||||
});
|
||||
arrows(document.querySelector('.vino-bestsellers .vino-slider__viewport'), document.querySelector('.vino-bestsellers [data-slide-prev]'), document.querySelector('.vino-bestsellers [data-slide-next]'));
|
||||
arrows(document.querySelector('.vino-new-arrivals .vino-slider__viewport'), document.querySelector('.vino-new-arrivals [data-arrivals-prev]'), document.querySelector('.vino-new-arrivals [data-arrivals-next]'));
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1,118 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
var m = document.querySelector('[data-sommelier]');
|
||||
if (!m) return;
|
||||
var cfg = {};
|
||||
try { cfg = JSON.parse(document.getElementById('vino-config').textContent); } catch (e) {}
|
||||
var text = cfg.text || {};
|
||||
var body = m.querySelector('[data-sommelier-body]');
|
||||
var form = m.querySelector('[data-sommelier-form]');
|
||||
var done = m.querySelector('[data-sommelier-done]');
|
||||
var err = m.querySelector('[data-sommelier-err]');
|
||||
var guard = form.querySelector('altcha-widget');
|
||||
|
||||
function clear(el) {
|
||||
el.classList.remove('vino-inp--invalid');
|
||||
el.removeAttribute('aria-invalid');
|
||||
}
|
||||
|
||||
function open() {
|
||||
body.hidden = false;
|
||||
done.hidden = true;
|
||||
err.hidden = true;
|
||||
VinoAltcha.arm(guard);
|
||||
var nav = document.querySelector('[data-menu]');
|
||||
if (nav) nav.classList.remove('vino-nav--open');
|
||||
var menuToggle = document.querySelector('[data-menu-toggle]');
|
||||
if (menuToggle) menuToggle.setAttribute('aria-expanded', 'false');
|
||||
form.querySelectorAll('.vino-inp--invalid').forEach(clear);
|
||||
m.showModal();
|
||||
setTimeout(function () {
|
||||
var f = form.querySelector('[name="name"]');
|
||||
if (f) f.focus();
|
||||
}, 30);
|
||||
}
|
||||
|
||||
function close() {
|
||||
m.close();
|
||||
}
|
||||
|
||||
function say(msg) {
|
||||
err.textContent = msg;
|
||||
err.hidden = !msg;
|
||||
}
|
||||
|
||||
function check() {
|
||||
var f = form.elements, first = '', focus = null, mask = 0;
|
||||
function bad(el, msg) {
|
||||
el.classList.add('vino-inp--invalid');
|
||||
el.setAttribute('aria-invalid', 'true');
|
||||
if (!focus) focus = el;
|
||||
if (msg && !first) first = msg;
|
||||
}
|
||||
[f.name, f.phone, f.message, f.consent].forEach(clear);
|
||||
var phone = f.phone.vinoPhone;
|
||||
if (!f.name.value.trim()) { bad(f.name, ''); mask += 1; }
|
||||
if (!phone.filled()) { bad(f.phone, ''); mask += 2; }
|
||||
if (!f.message.value.trim()) { bad(f.message, ''); mask += 4; }
|
||||
if (mask) first = (text.empty || [])[mask] || '';
|
||||
if (phone.filled() && !phone.complete()) bad(f.phone, text.phone);
|
||||
if (!f.consent.checked) bad(f.consent, text.consent);
|
||||
say(first);
|
||||
if (focus) focus.focus();
|
||||
return !focus;
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
var opener = e.target.closest('[data-sommelier-open]');
|
||||
if (opener) {
|
||||
e.preventDefault();
|
||||
open();
|
||||
var note = opener.getAttribute('data-sommelier-note');
|
||||
if (note && !form.elements.message.value.trim()) form.elements.message.value = note;
|
||||
return;
|
||||
}
|
||||
if (m.open && (e.target === m || e.target.closest('[data-sommelier-close]'))) close();
|
||||
});
|
||||
form.addEventListener('input', function (e) { clear(e.target); });
|
||||
form.addEventListener('change', function (e) { clear(e.target); });
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
if (!check()) return;
|
||||
var b = form.querySelector('[type="submit"]');
|
||||
b.disabled = true;
|
||||
VinoAltcha.armed(guard)
|
||||
.then(function (ok) {
|
||||
if (!ok) throw new Error('guard');
|
||||
var f = form.elements;
|
||||
return BX.ajax.runAction('jinove:vinoteca.lead.question', {
|
||||
data: {
|
||||
name: f.name.value,
|
||||
phone: f.phone.vinoPhone.value(),
|
||||
message: f.message.value,
|
||||
consent: f.consent.checked ? 'Y' : '',
|
||||
website: f.website.value,
|
||||
altcha: f.altcha ? f.altcha.value : '',
|
||||
page: window.location.pathname
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function (res) {
|
||||
if (res && res.data && res.data.ok) {
|
||||
done.querySelector('[data-sommelier-phone]').textContent = form.elements.phone.value.trim();
|
||||
form.reset();
|
||||
body.hidden = true;
|
||||
done.hidden = false;
|
||||
done.focus();
|
||||
} else {
|
||||
say(text.fail);
|
||||
}
|
||||
})
|
||||
.catch(function () { VinoAltcha.reset(guard); say(text.fail); })
|
||||
.then(function () { b.disabled = false; });
|
||||
});
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
(function () {
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var pending = null;
|
||||
window.VinoState = {
|
||||
first: function (name) {
|
||||
if (!pending) {
|
||||
pending = new Promise(function (resolve) {
|
||||
BX.ajax.runAction('jinove:vinoteca.state.all', { method: 'GET' }).then(
|
||||
function (response) { resolve((response && response.data) || {}); },
|
||||
function () { resolve({}); }
|
||||
);
|
||||
});
|
||||
}
|
||||
return pending.then(function (all) {
|
||||
if (!all[name]) throw new Error('state');
|
||||
return { data: all[name] };
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,86 @@
|
||||
(function (run) {
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
||||
else run();
|
||||
})(function () {
|
||||
(function () {
|
||||
var form = document.querySelector('[data-subscribe]');
|
||||
if (!form || !window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var cfg = {};
|
||||
try { cfg = JSON.parse(document.getElementById('vino-config').textContent); } catch (e) {}
|
||||
var text = cfg.text || {};
|
||||
var done = form.parentNode.querySelector('[data-subscribe-msg]');
|
||||
var err = form.querySelector('[data-subscribe-err]');
|
||||
var guard = form.querySelector('altcha-widget');
|
||||
|
||||
function clear(el) {
|
||||
el.classList.remove('vino-inp--invalid');
|
||||
el.removeAttribute('aria-invalid');
|
||||
}
|
||||
|
||||
function mark(el) {
|
||||
el.classList.add('vino-inp--invalid');
|
||||
el.setAttribute('aria-invalid', 'true');
|
||||
}
|
||||
|
||||
function say(msg) {
|
||||
err.textContent = msg;
|
||||
err.hidden = !msg;
|
||||
}
|
||||
|
||||
form.addEventListener('focusin', function () { VinoAltcha.arm(guard); }, { once: true });
|
||||
form.addEventListener('input', function (e) { clear(e.target); say(''); });
|
||||
form.addEventListener('change', function (e) { clear(e.target); say(''); });
|
||||
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
var f = form.elements, focus = null, msg = '';
|
||||
[f.email, f.consent].forEach(clear);
|
||||
if (!f.email.value.trim() || !f.email.checkValidity()) {
|
||||
mark(f.email);
|
||||
focus = f.email;
|
||||
msg = form.getAttribute('data-error');
|
||||
}
|
||||
if (!f.consent.checked) {
|
||||
mark(f.consent);
|
||||
if (!focus) focus = f.consent;
|
||||
if (!msg) msg = text.consent;
|
||||
}
|
||||
say(msg);
|
||||
if (focus) {
|
||||
focus.focus();
|
||||
return;
|
||||
}
|
||||
var button = form.querySelector('[type="submit"]');
|
||||
button.disabled = true;
|
||||
VinoAltcha.arm(guard);
|
||||
VinoAltcha.armed(guard)
|
||||
.then(function (verified) {
|
||||
if (!verified) throw new Error('guard');
|
||||
return BX.ajax.runAction('jinove:vinoteca.lead.subscribe', {
|
||||
data: {
|
||||
email: f.email.value,
|
||||
consent: 'Y',
|
||||
website: f.website.value,
|
||||
altcha: f.altcha ? f.altcha.value : '',
|
||||
page: window.location.pathname
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function (res) {
|
||||
if (res && res.data && res.data.ok) {
|
||||
form.hidden = true;
|
||||
done.textContent = form.getAttribute('data-ok');
|
||||
done.hidden = false;
|
||||
} else {
|
||||
say(text.fail);
|
||||
}
|
||||
})
|
||||
.catch(function (res) {
|
||||
VinoAltcha.reset(guard);
|
||||
var code = res && res.errors && res.errors[0] ? res.errors[0].code : '';
|
||||
say(code === 'email' ? form.getAttribute('data-error') : code === 'consent' ? text.consent : text.fail);
|
||||
})
|
||||
.then(function () { button.disabled = false; });
|
||||
});
|
||||
})();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":8,"sources":{"openmaptiles":{"type":"vector","url":"https://tiles.openfreemap.org/planet"}},"sprite":"https://tiles.openfreemap.org/sprites/ofm_f384/ofm","glyphs":"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"#2a0b17"}},{"id":"water","type":"fill","source":"openmaptiles","source-layer":"water","filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["!=",["get","brunnel"],"tunnel"]],"paint":{"fill-antialias":false,"fill-color":"#16060d"}},{"id":"landcover_ice_shelf","type":"fill","source":"openmaptiles","source-layer":"landcover","maxzoom":8,"filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["==",["get","subclass"],"ice_shelf"]],"paint":{"fill-color":"#2a0b17","fill-opacity":0.7}},{"id":"landcover_glacier","type":"fill","source":"openmaptiles","source-layer":"landcover","maxzoom":8,"filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["==",["get","subclass"],"glacier"]],"paint":{"fill-color":"#2a0b17","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,0.5]}},{"id":"landuse_residential","type":"fill","source":"openmaptiles","source-layer":"landuse","maxzoom":9,"filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["==",["get","class"],"residential"]],"paint":{"fill-color":"#2f0f1c","fill-opacity":0.4}},{"id":"landcover_wood","type":"fill","source":"openmaptiles","source-layer":"landcover","minzoom":10,"filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["==",["get","class"],"wood"]],"paint":{"fill-color":"#361322","fill-opacity":["interpolate",["exponential",0.3],["zoom"],8,0,10,0.8,13,0.4],"fill-pattern":"wood-pattern","fill-translate":[0,0]}},{"id":"landuse_park","type":"fill","source":"openmaptiles","source-layer":"landuse","filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["==",["get","class"],"park"]],"paint":{"fill-color":"#361322"}},{"id":"waterway","type":"line","source":"openmaptiles","source-layer":"waterway","filter":["match",["geometry-type"],["LineString","MultiLineString"],true,false],"paint":{"line-color":"#16060d"}},{"id":"water_name","type":"symbol","source":"openmaptiles","source-layer":"water_name","filter":["match",["geometry-type"],["LineString","MultiLineString"],true,false],"layout":{"symbol-placement":"line","symbol-spacing":500,"text-field":["case",["has","name:nonlatin"],["concat",["get","name:latin"],"\n",["get","name:nonlatin"]],["coalesce",["get","name_en"],["get","name"]]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":12},"paint":{"text-color":"#dcc3b4","text-halo-color":"#2a0b17","text-halo-width":1.2}},{"id":"building","type":"fill","source":"openmaptiles","source-layer":"building","minzoom":12,"filter":["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],"paint":{"fill-antialias":true,"fill-color":"#401829","fill-outline-color":"rgb(27 ,27 ,29)"}},{"id":"road_area_pier","type":"fill","source":"openmaptiles","source-layer":"transportation","filter":["all",["match",["geometry-type"],["MultiPolygon","Polygon"],true,false],["==",["get","class"],"pier"]],"paint":{"fill-antialias":true,"fill-color":"#2a0b17"}},{"id":"road_pier","type":"line","source":"openmaptiles","source-layer":"transportation","filter":["all",["match",["geometry-type"],["LineString","MultiLineString"],true,false],["match",["get","class"],["pier"],true,false]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4],"line-color":"#2a0b17"}},{"id":"highway_path","type":"line","source":"openmaptiles","source-layer":"transportation","filter":["all",["match",["geometry-type"],["LineString","MultiLineString"],true,false],["==",["get","class"],"path"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-dasharray":[1.5,1.5],"line-opacity":0.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10],"line-color":"#4d2133"}},{"id":"highway_minor","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":8,"filter":["all",["match",["geometry-type"],["LineString","MultiLineString"],true,false],["match",["get","class"],["minor","service","track"],true,false]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-opacity":0.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"#4d2133"}},{"id":"highway_major_casing","type":"line","source":"openmaptiles","source-layer":"transportation","minzoom":11,"filter":["all",["match",["geometry-type"],["LineString","MultiLineString"],true,false],["match",["get","class"],["primary","secondary","tertiary","trunk"],true,false]],"layout":{"line-cap":"butt","line-join":"miter"},"paint":{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(10,3,6,0.Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 260"><path fill-rule="evenodd" d="M41 4h18v10h-2v32c0 10 15 22 15 54v152c0 4-3 8-8 8H36c-5 0-8-4-8-8V100c0-32 15-44 15-54V14h-2zM36 150h28v62H36z"/></svg>
|
||||
|
After Width: | Height: | Size: 212 B |
File diff suppressed because it is too large.
Load diff
@@ -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;
|
||||
+6
@@ -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.";
|
||||
+6
@@ -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ą.";
|
||||
+6
@@ -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"] = "Различий в характеристиках нет.";
|
||||
+6
@@ -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()));
|
||||
+68
@@ -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);
|
||||
});
|
||||
+203
@@ -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;
|
||||
}
|
||||
}
|
||||
+50
@@ -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) : "–" ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
+12
@@ -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>
|
||||
+15
@@ -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"]);
|
||||
}
|
||||
+63
@@ -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.";
|
||||
+63
@@ -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.";
|
||||
+63
@@ -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.";
|
||||
+208
@@ -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, ["₽" => '<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">−<?= (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>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_GRAPE"] = "Grape variety:";
|
||||
$MESS["VINO_CARD_GRAPES"] = "Grape varieties:";
|
||||
+5
@@ -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";
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_RATING"] = "Rated #VALUE# out of 5, reviews: #COUNT#";
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_FAV"] = "Add to favourites";
|
||||
$MESS["VINO_CARD_COMPARE"] = "Add to comparison";
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$MESS["VINO_ITEM_VOLUME"] = "#VALUE# L";
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_GRAPE"] = "Szczep winogron:";
|
||||
$MESS["VINO_CARD_GRAPES"] = "Szczepy winogron:";
|
||||
+5
@@ -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";
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_RATING"] = "Ocena #VALUE# na 5, opinii: #COUNT#";
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_FAV"] = "Dodaj do ulubionych";
|
||||
$MESS["VINO_CARD_COMPARE"] = "Dodaj do porównania";
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$MESS["VINO_ITEM_VOLUME"] = "#VALUE# l";
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_GRAPE"] = "Сорт винограда:";
|
||||
$MESS["VINO_CARD_GRAPES"] = "Сорта винограда:";
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_QTY_DOWN"] = "Уменьшить количество";
|
||||
$MESS["VINO_CARD_QTY_UP"] = "Увеличить количество";
|
||||
$MESS["VINO_CARD_TO_CART"] = "В корзину";
|
||||
$MESS["VINO_CARD_UNAVAILABLE"] = "Нет в наличии";
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_RATING"] = "Оценка #VALUE# из 5, отзывов: #COUNT#";
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_CARD_FAV"] = "В избранное";
|
||||
$MESS["VINO_CARD_COMPARE"] = "Добавить к сравнению";
|
||||
+2
@@ -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">−<?= $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>
|
||||
+86
@@ -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";
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$MESS["VINO_TILES_COUNT_PLURAL_0"] = "#COUNT# wine";
|
||||
$MESS["VINO_TILES_COUNT_PLURAL_1"] = "#COUNT# wines";
|
||||
+4
@@ -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";
|
||||
+4
@@ -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# вин";
|
||||
+21
@@ -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"],
|
||||
);
|
||||
}
|
||||
}
|
||||
+31
@@ -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; ?>
|
||||
+23
@@ -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);
|
||||
}
|
||||
}
|
||||
+17
@@ -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#";
|
||||
+18
@@ -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#";
|
||||
+18
@@ -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#";
|
||||
+15
@@ -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; ?>
|
||||
+18
@@ -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";
|
||||
+18
@@ -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";
|
||||
+18
@@ -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;
|
||||
}
|
||||
});
|
||||
})();
|
||||
+94
@@ -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);
|
||||
}
|
||||
Loaded 100 of 593 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user