Merge branch 'main' of http://91.189.216.43:3000/jacek.pyziak/drmaterac.pl
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1308,7 +1308,7 @@ article.product-miniature:hover {
|
||||
margin-bottom: 80px !important;
|
||||
}
|
||||
|
||||
.box-ekomi-widget {
|
||||
.box-ekomi {
|
||||
margin-top: 50px;
|
||||
margin-bottom: 70px !important;
|
||||
}
|
||||
@@ -4531,7 +4531,7 @@ body#cms.cms-id-23 {
|
||||
margin-top: 10px;
|
||||
|
||||
button {
|
||||
background: #FFF !important;
|
||||
background: #fff !important;
|
||||
color: #34d6ad !important;
|
||||
border: 1px solid #34d6ad !important;
|
||||
}
|
||||
@@ -5794,6 +5794,96 @@ main#page {
|
||||
}
|
||||
}
|
||||
|
||||
body:not(#index) {
|
||||
.footer-center {
|
||||
>.container {
|
||||
>.inner {
|
||||
.ApRow:first-child {
|
||||
>.col-xl-8 {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.box-ekomi-widget {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
max-height: 215px;
|
||||
overflow: hidden;
|
||||
|
||||
.title_block {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ekomi-widget-sf1479766890a0175aa13 {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
.ekomi-widget-sf14797668b168fac5bd0 {
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
flex-direction: column;
|
||||
max-height: 550px;
|
||||
|
||||
.ekomi-widget-sf1479766890a0175aa13 {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ekomi-widget-sf14797668b168fac5bd0 {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.ekomi-widget-sf14797668b168fac5bd0 {
|
||||
#widget8 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
>div {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.preloader {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
z-index: 9999;
|
||||
|
||||
.spinner {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.preloader-text {
|
||||
color: #000;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
body:not(#index) {
|
||||
.footer-center {
|
||||
>.container {
|
||||
|
||||
@@ -1099,3 +1099,84 @@ prestashop.on('updateCart', function (event) {
|
||||
// $a.replaceWith($span)
|
||||
// })
|
||||
// })
|
||||
|
||||
$(document).ready(function () {
|
||||
var $widget = $('.box-ekomi-widget')
|
||||
|
||||
$widget.css('position', 'relative').prepend(`
|
||||
<div class="preloader">
|
||||
<div class="spinner owl-carousel owl-loading"></div>
|
||||
<div class="preloader-text">Ładowanie recenzji, prosimy o chwilę cierpliwości…</div>
|
||||
</div>
|
||||
`)
|
||||
|
||||
function watchSlickTrack() {
|
||||
var $slickTrack = $widget.find('.slick-track')
|
||||
|
||||
if ($slickTrack.length) {
|
||||
var observer = new MutationObserver(function (mutationsList) {
|
||||
mutationsList.forEach(function (mutation) {
|
||||
if (
|
||||
mutation.type === 'attributes' &&
|
||||
mutation.attributeName === 'style'
|
||||
) {
|
||||
var transform = $slickTrack.css('transform')
|
||||
if (transform && transform !== 'none') {
|
||||
setTimeout(function () {
|
||||
$widget.find('.preloader').fadeOut(500)
|
||||
observer.disconnect()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
observer.observe($slickTrack[0], {
|
||||
attributes: true,
|
||||
attributeFilter: ['style'],
|
||||
})
|
||||
} else {
|
||||
setTimeout(watchSlickTrack, 200)
|
||||
}
|
||||
}
|
||||
|
||||
watchSlickTrack()
|
||||
|
||||
setTimeout(function () {
|
||||
$widget.find('.preloader').fadeOut(500)
|
||||
}, 10000)
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').on(
|
||||
'click',
|
||||
'#box-product-accessories .buy-protector-btn',
|
||||
|
||||
function (e) {
|
||||
let selectedSize = $(
|
||||
'#add-to-cart-or-refresh .product-variants .product-variants-item select#group_3 option:selected'
|
||||
)
|
||||
.text()
|
||||
.trim()
|
||||
|
||||
localStorage.removeItem('selectedSize')
|
||||
localStorage.setItem('selectedSize', JSON.stringify(selectedSize))
|
||||
}
|
||||
)
|
||||
|
||||
if (localStorage.getItem('selectedSize')) {
|
||||
let savedSize = JSON.parse(localStorage.getItem('selectedSize'))
|
||||
|
||||
let $select = $(
|
||||
'#add-to-cart-or-refresh .product-variants .product-variants-item select#group_3'
|
||||
)
|
||||
$select.find('option').each(function () {
|
||||
if ($(this).text().trim() === savedSize) {
|
||||
$(this).prop('selected', true).trigger('change')
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
localStorage.removeItem('selectedSize')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -499,12 +499,19 @@
|
||||
{* {/if} *}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="widget-stars" onclick="const target = document.querySelector('#tabs > .tabs-nav > li[data-tab="tabs-4"]'); if (target) { target.click(); setTimeout(() => { const rect = target.getBoundingClientRect(); const offsetTop = window.pageYOffset + rect.top - 100; window.scrollTo({ top: offsetTop, behavior: 'smooth' }); }, 300); }">
|
||||
<span>Ocena:</span>
|
||||
<div id="widget-container" class="data-ekomi-emp ekomi-widget-container ekomi-widget-sf14797663a5a947df4ad"></div>
|
||||
<div id="ekomi-product-widget-identifier" class="prod-data-emp" style="visibility: hidden">{$product.id}</div>
|
||||
<a href="https://www.ekomi-pl.com/opinie-drmaterac.html" target="_blank"><img alt="drmaterac.pl Reviews with ekomi-pl.com" src="https://smart-widget-assets.ekomiapps.de/resources/ekomi_logo.png" style="display: none;"/></a>
|
||||
</div>
|
||||
<script>
|
||||
document.querySelector('a[href="#opinions-sections"]').addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
</script>
|
||||
<a href="#opinions-sections" style="display:flex; gap:10px;">
|
||||
<div class="widget-stars" onclick="const target = document.querySelector('#tabs > .tabs-nav > li[data-tab="tabs-4"]'); if (target) { target.click(); setTimeout(() => { const rect = target.getBoundingClientRect(); const offsetTop = window.pageYOffset + rect.top - 100; window.scrollTo({ top: offsetTop, behavior: 'smooth' }); }, 300); }">
|
||||
<span>Ocena:</span>
|
||||
<div id="widget-container" class="data-ekomi-emp ekomi-widget-container ekomi-widget-sf14797663a5a947df4ad"></div>
|
||||
<div id="ekomi-product-widget-identifier" class="prod-data-emp" style="visibility: hidden">{$product.id}</div>
|
||||
<a href="https://www.ekomi-pl.com/opinie-drmaterac.html" target="_blank"><img alt="drmaterac.pl Reviews with ekomi-pl.com" src="https://smart-widget-assets.ekomiapps.de/resources/ekomi_logo.png" style="display: none;"/></a>
|
||||
</div>
|
||||
</a>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -52,98 +52,191 @@
|
||||
</div>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
|
||||
products_list_functions.push(
|
||||
function(){
|
||||
if($('#category-products').parents('.tab-pane').length)
|
||||
{
|
||||
if(!$('#category-products').parents('.tab-pane').hasClass('active'))
|
||||
{
|
||||
var width_owl_active_tab = $('#category-products').parents('.tab-pane').siblings('.active').find('.owl-carousel').width();
|
||||
$('#category-products').width(width_owl_active_tab);
|
||||
}
|
||||
function() {
|
||||
if ($('#category-products').parents('.tab-pane').length) {
|
||||
if (!$('#category-products').parents('.tab-pane').hasClass('active')) {
|
||||
var width_owl_active_tab = $('#category-products').parents('.tab-pane').siblings('.active').find(
|
||||
'.owl-carousel').width();
|
||||
$('#category-products').width(width_owl_active_tab);
|
||||
}
|
||||
}
|
||||
$('#category-products').owlCarousel({
|
||||
{if isset($IS_RTL) && $IS_RTL}
|
||||
direction:'rtl',
|
||||
direction: 'rtl',
|
||||
{else}
|
||||
direction:'ltr',
|
||||
direction: 'ltr',
|
||||
{/if}
|
||||
items : 4,
|
||||
itemsCustom : false,
|
||||
itemsDesktop : [1200, 4],
|
||||
itemsDesktopSmall : [992, 3],
|
||||
itemsTablet : [768, 2],
|
||||
itemsTabletSmall : false,
|
||||
itemsMobile : [480, 1],
|
||||
singleItem : false, // true : show only 1 item
|
||||
itemsScaleUp : false,
|
||||
slideSpeed : 200, // change speed when drag and drop a item
|
||||
paginationSpeed :800, // change speed when go next page
|
||||
items: 4,
|
||||
itemsCustom: false,
|
||||
itemsDesktop: [1200, 4],
|
||||
itemsDesktopSmall: [992, 3],
|
||||
itemsTablet: [768, 2],
|
||||
itemsTabletSmall: false,
|
||||
itemsMobile: [480, 1],
|
||||
singleItem: false, // true : show only 1 item
|
||||
itemsScaleUp: false,
|
||||
slideSpeed: 200, // change speed when drag and drop a item
|
||||
paginationSpeed: 800, // change speed when go next page
|
||||
|
||||
autoPlay : false, // time to show each item
|
||||
stopOnHover : false,
|
||||
navigation : true,
|
||||
navigationText : ["‹", "›"],
|
||||
autoPlay: false, // time to show each item
|
||||
stopOnHover: false,
|
||||
navigation: true,
|
||||
navigationText: ["‹", "›"],
|
||||
|
||||
scrollPerPage :true,
|
||||
responsive :true,
|
||||
scrollPerPage: true,
|
||||
responsive: true,
|
||||
|
||||
pagination : false,
|
||||
paginationNumbers : false,
|
||||
pagination: false,
|
||||
paginationNumbers: false,
|
||||
|
||||
addClassActive : true,
|
||||
addClassActive: true,
|
||||
|
||||
mouseDrag : true,
|
||||
touchDrag : true,
|
||||
mouseDrag: true,
|
||||
touchDrag: true,
|
||||
|
||||
addClassActive : true,
|
||||
addClassActive: true,
|
||||
afterInit: OwlLoaded,
|
||||
afterAction : SetOwlCarouselFirstLast,
|
||||
afterAction: SetOwlCarouselFirstLast,
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
function OwlLoaded(el){
|
||||
|
||||
function OwlLoaded(el) {
|
||||
el.removeClass('owl-loading').addClass('owl-loaded').parents('.owl-row').addClass('hide-loading');
|
||||
if ($(el).parents('.tab-pane').length && !$(el).parents('.tab-pane').hasClass('active'))
|
||||
el.width('100%');
|
||||
el.width('100%');
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="row ApRow has-bg bg-boxed" data-bg=" no-repeat" style="background: no-repeat;">
|
||||
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 col-sp-12 ApColumn ">
|
||||
<div class="block ApRawHtml">
|
||||
<h4 class="title_block">Opinie naszych Klientów</h4>
|
||||
<div id="widget-container" class="ekomi-widget-container ekomi-widget-sf1479766153086b9ea4f"></div>
|
||||
<a href="https://www.ekomi-pl.com/opinie-drmaterac.html" target="_blank"><img alt="drmaterac.pl Reviews with ekomi-pl.com" src="https://smart-widget-assets.ekomiapps.de/resources/ekomi_logo.png" style="display: none;"/></a>
|
||||
<div class="block box-ekomi ApRawHtml">
|
||||
<section class="box-ekomi-widget">
|
||||
<div id="widget-container" class="ekomi-widget-container ekomi-widget-sf1479766890a0175aa13"></div>
|
||||
<a href="https://www.ekomi-pl.com/opinie-drmaterac.html" target="_blank">
|
||||
<img alt="drmaterac.pl Reviews with ekomi-pl.com"
|
||||
src="https://smart-widget-assets.ekomiapps.de/resources/ekomi_logo.png" style="display: none;" />
|
||||
</a>
|
||||
|
||||
<script type="text/javascript">
|
||||
function registerWidget (w, token) {
|
||||
w['_ekomiWidgetsServerUrl'] = 'https://widgets.ekomi.com';
|
||||
w['_customerId'] = 147976;
|
||||
w['_language'] = new Array();w['_language'][token] = 'auto';
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
function registerWidget(w, token) {
|
||||
w['_ekomiWidgetsServerUrl'] = 'https://widgets.ekomi.com';
|
||||
w['_customerId'] = 147976;
|
||||
w['_theme'] = 'light';
|
||||
if (w['_language'] == undefined) {
|
||||
w['_language'] = new Array();
|
||||
}
|
||||
w['_language'][token] = 'auto';
|
||||
|
||||
if(typeof(w['_ekomiWidgetTokens']) !== 'undefined'){
|
||||
w['_ekomiWidgetTokens'][w['_ekomiWidgetTokens'].length] = token;
|
||||
} else {
|
||||
w['_ekomiWidgetTokens'] = new Array(token);
|
||||
}
|
||||
if(typeof(ekomiWidgetJs) == 'undefined') {
|
||||
ekomiWidgetJs = true;
|
||||
var scr = document.createElement('script');scr.src = 'https://sw-assets.ekomiapps.de/static_resources/widget.js';
|
||||
var head = document.getElementsByTagName('head')[0];head.appendChild(scr);
|
||||
if (typeof(w['_ekomiWidgetTokens']) !== 'undefined') {
|
||||
w['_ekomiWidgetTokens'][w['_ekomiWidgetTokens'].length] = token;
|
||||
} else {
|
||||
w['_ekomiWidgetTokens'] = new Array(token);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
if (typeof(ekomiWidgetJs) == 'undefined') {
|
||||
ekomiWidgetJs = true;
|
||||
var scr = document.createElement('script');
|
||||
scr.src = 'https://sw-assets.ekomiapps.de/static_resources/widget.js';
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
head.appendChild(scr);
|
||||
} else {
|
||||
if (typeof ekomiWidgetMain != 'undefined') {ekomiWidgetMain('ajax', token);}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
(function (w) {
|
||||
var token = 'sf1479766153086b9ea4f';
|
||||
var k = document.getElementsByClassName("ekomi-widget-" + token);
|
||||
for(var x=0;x<k.length;x++){ registerWidget(w,token); }
|
||||
(function(w) {
|
||||
var token = 'sf1479766890a0175aa13';
|
||||
var k = document.getElementsByClassName("ekomi-widget-" + token);
|
||||
for (var x = 0; x < k.length; x++) { registerWidget(w, token); }
|
||||
})(window);
|
||||
</script>
|
||||
</div>
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
<div id="widget-container" class="ekomi-widget-container ekomi-widget-sf14797668b168fac5bd0"></div>
|
||||
<a href="https://www.ekomi-pl.com/opinie-drmaterac.html" target="_blank"><img
|
||||
alt="drmaterac.pl Reviews with ekomi-pl.com"
|
||||
src="https://smart-widget-assets.ekomiapps.de/resources/ekomi_logo.png" style="display: none;" /></a>
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
function registerWidget(w, token) {
|
||||
w['_ekomiWidgetsServerUrl'] = 'https://widgets.ekomi.com';
|
||||
w['_customerId'] = 147976;
|
||||
|
||||
if (w['_language'] == undefined) {
|
||||
w['_language'] = new Array();
|
||||
}
|
||||
w['_language'][token] = 'auto';
|
||||
|
||||
if (typeof(w['_ekomiWidgetTokens']) !== 'undefined') {
|
||||
w['_ekomiWidgetTokens'][w['_ekomiWidgetTokens'].length] = token;
|
||||
} else {
|
||||
w['_ekomiWidgetTokens'] = new Array(token);
|
||||
}
|
||||
if (typeof(ekomiWidgetJs) == 'undefined') {
|
||||
ekomiWidgetJs = true;
|
||||
var scr = document.createElement('script');
|
||||
scr.src = 'https://sw-assets.ekomiapps.de/static_resources/widget.js';
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
head.appendChild(scr);
|
||||
} else {
|
||||
if (typeof ekomiWidgetMain != 'undefined') {
|
||||
ekomiWidgetMain('ajax', token);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
(function(w) {
|
||||
var token = 'sf14797668b168fac5bd0';
|
||||
var k = document.getElementsByClassName("ekomi-widget-" + token);
|
||||
for (var x = 0; x < k.length; x++) {
|
||||
registerWidget(w, token);
|
||||
}
|
||||
})(window);
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
</section>
|
||||
{* <h4 class="title_block">Opinie naszych Klientów</h4>
|
||||
<div id="widget-container" class="ekomi-widget-container ekomi-widget-sf1479766153086b9ea4f"></div>
|
||||
<a href="https://www.ekomi-pl.com/opinie-drmaterac.html" target="_blank"><img
|
||||
alt="drmaterac.pl Reviews with ekomi-pl.com"
|
||||
src="https://smart-widget-assets.ekomiapps.de/resources/ekomi_logo.png" style="display: none;" /></a>
|
||||
|
||||
<script type="text/javascript">
|
||||
function registerWidget(w, token) {
|
||||
w['_ekomiWidgetsServerUrl'] = 'https://widgets.ekomi.com';
|
||||
w['_customerId'] = 147976;
|
||||
w['_language'] = new Array();
|
||||
w['_language'][token] = 'auto';
|
||||
|
||||
if (typeof(w['_ekomiWidgetTokens']) !== 'undefined') {
|
||||
w['_ekomiWidgetTokens'][w['_ekomiWidgetTokens'].length] = token;
|
||||
} else {
|
||||
w['_ekomiWidgetTokens'] = new Array(token);
|
||||
}
|
||||
if (typeof(ekomiWidgetJs) == 'undefined') {
|
||||
ekomiWidgetJs = true;
|
||||
var scr = document.createElement('script');
|
||||
scr.src = 'https://sw-assets.ekomiapps.de/static_resources/widget.js';
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
head.appendChild(scr);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
(function(w) {
|
||||
var token = 'sf1479766153086b9ea4f';
|
||||
var k = document.getElementsByClassName("ekomi-widget-" + token);
|
||||
for (var x = 0; x < k.length; x++) { registerWidget(w, token); }
|
||||
})(window);
|
||||
</script> *}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,7 +74,6 @@
|
||||
<div id="category-description" class="text-muted">{$category.description nofilter}</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{else}
|
||||
|
||||
{include file='errors/not-found.tpl'}
|
||||
@@ -83,6 +82,143 @@
|
||||
</section>
|
||||
|
||||
</section>
|
||||
{literal}
|
||||
<script>
|
||||
(function () {
|
||||
// ============ KONFIG ============
|
||||
var ENDPOINT = '/category-description.php'; // PHP, który zwróci HTML opisu
|
||||
var SHOW_ONLY_FIRST_PAGE = false; // jeśli opis tylko na 1. stronie -> true
|
||||
var DEBOUNCE_MS = 200;
|
||||
|
||||
// ============ NARZĘDZIA ============
|
||||
var lastUrl = null;
|
||||
var debounceTimer = null;
|
||||
var inflightController = null;
|
||||
|
||||
function onReady(fn) {
|
||||
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||
setTimeout(fn, 0);
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', fn);
|
||||
}
|
||||
}
|
||||
|
||||
// Wywołuj "locationchange" przy każdej zmianie historii
|
||||
function hookHistoryEvents() {
|
||||
var wrap = function (type) {
|
||||
var orig = history[type];
|
||||
return function () {
|
||||
var ret = orig.apply(this, arguments);
|
||||
window.dispatchEvent(new Event('locationchange'));
|
||||
window.dispatchEvent(new Event(type));
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
history.pushState = wrap('pushState');
|
||||
history.replaceState = wrap('replaceState');
|
||||
window.addEventListener('popstate', function () {
|
||||
window.dispatchEvent(new Event('locationchange'));
|
||||
});
|
||||
}
|
||||
|
||||
function isFirstPage(urlStr) {
|
||||
if (!SHOW_ONLY_FIRST_PAGE) return true;
|
||||
try {
|
||||
var u = new URL(urlStr, window.location.origin);
|
||||
var p = u.searchParams.get('page') || u.searchParams.get('p');
|
||||
return !p || p === '1';
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function ensureContainer() {
|
||||
var el = document.getElementById('category-description');
|
||||
if (el) return el;
|
||||
|
||||
var anchor = document.querySelector('#js-product-list-top') || document.querySelector('#js-product-list');
|
||||
el = document.createElement('div');
|
||||
el.id = 'category-description';
|
||||
el.className = 'text-muted';
|
||||
if (anchor && anchor.parentNode) {
|
||||
anchor.parentNode.insertBefore(el, anchor.nextSibling);
|
||||
} else {
|
||||
document.body.appendChild(el);
|
||||
}
|
||||
return el;
|
||||
}
|
||||
|
||||
function replaceDescriptionIfHasContent(html) {
|
||||
if (typeof html !== 'string') return;
|
||||
var clean = html.trim();
|
||||
if (!clean) return; // <-- KLUCZOWA ZMIANA: tylko jeśli coś przyszło
|
||||
|
||||
var box = ensureContainer();
|
||||
box.innerHTML = clean;
|
||||
box.style.display = '';
|
||||
}
|
||||
|
||||
function fetchDescriptionFor(urlStr) {
|
||||
if (inflightController) {
|
||||
inflightController.abort();
|
||||
inflightController = null;
|
||||
}
|
||||
inflightController = new AbortController();
|
||||
|
||||
var endpointUrl = ENDPOINT + '?url=' + encodeURIComponent(urlStr);
|
||||
|
||||
return fetch(endpointUrl, {
|
||||
method: 'GET',
|
||||
credentials: 'same-origin',
|
||||
signal: inflightController.signal,
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
})
|
||||
.then(function (res) {
|
||||
if (!res.ok) throw new Error('HTTP ' + res.status);
|
||||
return res.text();
|
||||
})
|
||||
.then(function (html) {
|
||||
replaceDescriptionIfHasContent(html); // <-- tylko podmiana, gdy niepuste
|
||||
})
|
||||
.catch(function () { /* cicho ignorujemy błąd */ })
|
||||
.finally(function () {
|
||||
inflightController = null;
|
||||
});
|
||||
}
|
||||
|
||||
function updateDescriptionDebounced() {
|
||||
clearTimeout(debounceTimer);
|
||||
debounceTimer = setTimeout(function () {
|
||||
var currentUrl = window.location.href;
|
||||
if (currentUrl === lastUrl) return;
|
||||
lastUrl = currentUrl;
|
||||
|
||||
// Jeśli chcesz pokazywać opis tylko na 1. stronie — nie ruszamy treści,
|
||||
// po prostu nie robimy requestu na stronach > 1.
|
||||
if (!isFirstPage(currentUrl)) return;
|
||||
|
||||
fetchDescriptionFor(currentUrl);
|
||||
}, DEBOUNCE_MS);
|
||||
}
|
||||
|
||||
function wirePrestashopEvents() {
|
||||
if (window.prestashop && typeof window.prestashop.on === 'function') {
|
||||
window.prestashop.on('updateProductList', updateDescriptionDebounced);
|
||||
window.prestashop.on('updatedProductList', updateDescriptionDebounced);
|
||||
window.prestashop.on('facets:changed', updateDescriptionDebounced);
|
||||
}
|
||||
document.addEventListener('updateProductList', updateDescriptionDebounced, true);
|
||||
document.addEventListener('updatedProductList', updateDescriptionDebounced, true);
|
||||
}
|
||||
|
||||
onReady(function () {
|
||||
hookHistoryEvents();
|
||||
wirePrestashopEvents();
|
||||
window.addEventListener('locationchange', updateDescriptionDebounced);
|
||||
updateDescriptionDebounced(); // start
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{/literal}
|
||||
{hook h='displayApSC' sc_key=sc2450863744}
|
||||
{/block}
|
||||
@@ -40,8 +40,8 @@
|
||||
<meta property="product:price:amount" content="{$product.price_amount}">
|
||||
<meta property="product:price:currency" content="{$currency.iso_code}">
|
||||
{if isset($product.weight) && ($product.weight != 0)}
|
||||
<meta property="product:weight:value" content="{$product.weight}">
|
||||
<meta property="product:weight:units" content="{$product.weight_unit}">
|
||||
<meta property="product:weight:value" content="{$product.weight}">
|
||||
<meta property="product:weight:units" content="{$product.weight_unit}">
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
@@ -85,7 +85,8 @@
|
||||
|
||||
<div class="product-information">
|
||||
{block name='product_description_short'}
|
||||
<div id="product-description-short-{$product.id}" itemprop="description">{$product.description_short nofilter}</div>
|
||||
<div id="product-description-short-{$product.id}" itemprop="description">{$product.description_short nofilter}
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{if $product.is_customizable && count($product.customizations.fields)}
|
||||
@@ -99,7 +100,8 @@
|
||||
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
|
||||
<input type="hidden" name="token" value="{$static_token}">
|
||||
<input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id">
|
||||
<input type="hidden" name="id_customization" value="{$product.id_customization}" id="product_customization_id">
|
||||
<input type="hidden" name="id_customization" value="{$product.id_customization}"
|
||||
id="product_customization_id">
|
||||
|
||||
{block name='product_variants'}
|
||||
{include file='catalog/_partials/product-variants.tpl'}
|
||||
@@ -164,10 +166,10 @@
|
||||
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-6 col-sp-12 ajax_block_product">
|
||||
{block name='product_miniature'}
|
||||
{if isset($productProfileDefault) && $productProfileDefault}
|
||||
{* exits THEME_NAME/profiles/profile_name.tpl -> load template*}
|
||||
{hook h='displayLeoProfileProduct' product=$product_accessory profile=$productProfileDefault}
|
||||
{* exits THEME_NAME/profiles/profile_name.tpl -> load template*}
|
||||
{hook h='displayLeoProfileProduct' product=$product_accessory profile=$productProfileDefault}
|
||||
{else}
|
||||
{include file='catalog/_partials/miniatures/product.tpl' product=$product_accessory}
|
||||
{include file='catalog/_partials/miniatures/product.tpl' product=$product_accessory}
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
@@ -196,4 +198,4 @@
|
||||
|
||||
</section>
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
Reference in New Issue
Block a user