Desde 1964 acompañándote
- ';
cat.items.forEach(function(nombre) {
html += '
- ' + nombre + ' '; }); html += '
';
html += '';
html += '
';
html += '';
html += '
';
html += '';
html += '';
html += '';
html += '
';
html += '';
html += '';
html += '';
html += '
';
html += '';
html += '
';
});
grid.innerHTML = html;
})();
/* ======= FUNCIONES ======= */
function ovlToggleCat(btn) {
var sub = btn.nextElementSibling;
var icon = btn.querySelector('.ovl-cat-icon');
var isOpen = sub.classList.contains('ovl-open');
document.querySelectorAll('.ovl-cat-sub.ovl-open').forEach(function(openSub) {
openSub.classList.remove('ovl-open');
});
document.querySelectorAll('.ovl-consulta-panel.ovl-open').forEach(function(panel) {
panel.classList.remove('ovl-open');
});
document.querySelectorAll('.ovl-wa-menu.ovl-open').forEach(function(menu) {
menu.classList.remove('ovl-open');
});
document.querySelectorAll('.ovl-cat-icon').forEach(function(i) {
i.textContent = '+';
});
if (!isOpen) {
sub.classList.add('ovl-open');
icon.textContent = '−';
}
}
function ovlToggleWa(menuId) {
var menu = document.getElementById(menuId);
if (!menu) return;
var isOpen = menu.classList.contains('ovl-open');
document.querySelectorAll('.ovl-wa-menu.ovl-open').forEach(function(m) {
m.classList.remove('ovl-open');
});
if (!isOpen) menu.classList.add('ovl-open');
}
function ovlConsultar(li, catId) {
var nombre = li.textContent.trim();
var panel = document.getElementById('panel-' + catId);
var label = document.getElementById('nombre-' + catId);
var wa1 = document.getElementById('wa1-' + catId);
var wa2 = document.getElementById('wa2-' + catId);
if (!panel || !label || !wa1 || !wa2) return;
if (panel.classList.contains('ovl-open') && label.textContent === 'Consultar por ' + nombre) {
panel.classList.remove('ovl-open');
return;
}
label.textContent = 'Consultar por ' + nombre;
var msg = encodeURIComponent('Hola, quiero consultar por ' + nombre);
wa1.href = 'https://wa.me/' + OVL_WA1 + '?text=' + msg;
wa2.href = 'https://wa.me/' + OVL_WA2 + '?text=' + msg;
panel.classList.add('ovl-open');
setTimeout(function() {
panel.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}, 80);
}
function ovlOpenModal(id) {
var p = window.ovlDestacados.filter(function(x) {
return x.id === id;
})[0];
if (!p) return;
document.getElementById('ovl-modal-title').textContent = p.nombre;
document.getElementById('ovl-modal-avail').textContent = 'Disponible: ' + p.disponible;
document.getElementById('ovl-modal-img').innerHTML =
ovlProductImage(p, 'width:100px;height:100px;font-size:2.4rem;');
var specsHtml = '';
p.specs.forEach(function(s) {
specsHtml += '' + ovlProductImage(p, '') + '
';
html += '' + p.nombre + '
'; html += ''; html += '