#ecom-norma-detail-normas-referenced .standards-section {
position: relative;
}
#ecom-norma-detail-normas-referenced .standards-section .container {
display: block;
width: 100%;
max-width: 1110px;
margin: 0 auto !important;
padding: 0 15px !important;
box-sizing: border-box;
}
#ecom-norma-detail-normas-referenced .standards-section .container.m-1.p-1 {
margin: 0 !important;
padding: 0 15px !important;
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container {
display: flex;
flex-wrap: nowrap;
gap: 20px 0;
width: 100%;
max-width: 100%;
flex: 0 0 100%;
box-sizing: border-box;
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
column-gap: 3.5%;
row-gap: 20px;
width: 100%;
flex-wrap: unset;
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid .item-standard {
width: 100%;
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid .item-standard {
height: 100%;
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid .item-standard .info-standard {
display: flex;
flex-direction: column;
height: 100%;
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid .price-container {
margin-top: auto;
}
@media (max-width: 1200px) {
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: 4%;
}
}
@media (max-width: 576px) {
#ecom-norma-detail-normas-referenced .standards-section .standards-container.standards-grid {
grid-template-columns: 1fr;
column-gap: 0;
}
}
#ecom-norma-detail-normas-referenced .standards-section .standards-container:not(.owl-drag) .owl-stage {
cursor: auto;
}
#ecom-norma-detail-normas-referenced .standards-section .item-standard {
position: relative;
border: 1px solid #e0e0e0;
padding: 20px 14px 16px;
border-radius: 4px;
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
justify-content: space-between;
}
#ecom-norma-detail-normas-referenced .standards-section .title-standard {
font-family: SohoGothicPro-Regular;
font-size: 16px;
font-weight: bold;
color: #1a4b94;
margin-top: 10px;
margin-bottom: 10px;
}
#ecom-norma-detail-normas-referenced .standards-section .description-text {
margin-top: 10px;
margin-bottom: 12px;
font-family: SohoGothicPro-Regular;
font-size: 13px;
text-align: left;
color: #333;
}
#ecom-norma-detail-normas-referenced .standards-section .price-container {
display: flex;
flex-direction: column;
text-align: left;
letter-spacing: -0.02em;
}
#ecom-norma-detail-normas-referenced .standards-section .price-container .price-text {
font-family: SohoGothicPro-Regular;
font-size: 12px;
font-weight: 400;
line-height: 13.2px;
color: #000;
}
#ecom-norma-detail-normas-referenced .standards-section .price-container .price {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
color: #1a4b94;
}
#ecom-norma-detail-normas-referenced .standards-section .info-container {
display: flex;
}
@media (min-width: 500px) and (max-width: 767px) {
#ecom-norma-detail-normas-referenced .standards-section .info-container {
flex-direction: column;
justify-content: end;
align-items: start;
}
}
#ecom-norma-detail-normas-referenced .standards-section .info-container .standard-mode img,
#ecom-norma-detail-normas-referenced .standards-section .info-container .standard-date img,
#ecom-norma-detail-normas-referenced .standards-section .info-container .standard-mode picture,
#ecom-norma-detail-normas-referenced .standards-section .info-container .standard-date picture {
width: 16px;
}
#ecom-norma-detail-normas-referenced .standards-section .info-container .standard-mode {
margin-right: 16px;
}
#ecom-norma-detail-normas-referenced .standards-section .standard-button {
border: 0;
outline: 0;
padding: 17px;
width: 100%;
text-align: center;
display: block;
background-color: var(--brand-color-1, #1f57a3);
color: #fff;
text-transform: uppercase;
font-family: SohoStd-Medium;
font-size: 14px;
font-weight: 500;
line-height: 14px;
text-align: center;
cursor: pointer;
}
#ecom-norma-detail-normas-referenced .standards-section .standard-button.disabled,
#ecom-norma-detail-normas-referenced .standards-section .standard-button:disabled,
#ecom-norma-detail-normas-referenced .standards-section .standard-button[disabled],
#ecom-norma-detail-normas-referenced .standards-section .standard-button.ecom-btn-loading {
opacity: .6;
pointer-events: none;
filter: brightness(0.85);
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next {
width: 50px;
border: 1px solid #c3c3c3;
border-radius: 0;
height: 50px;
font-size: 30px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next:focus {
outline: 0;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev {
width: 50px;
border: 1px solid #c3c3c3;
border-radius: 0;
height: 50px;
font-size: 30px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-dots {
display: flex;
justify-content: center;
margin-top: 30px;
}
#ecom-norma-detail-normas-referenced .standards-section button.owl-dot {
width: 15px;
height: 15px;
background: transparent;
margin: 10px;
border: 1px solid var(--brand-color-2, #6a9bd3);
background-color: var(--brand-color-2, #6a9bd3);
}
#ecom-norma-detail-normas-referenced .standards-section button.owl-dot:focus-visible {
outline: solid;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-dot button {
color: white;
}
#ecom-norma-detail-normas-referenced .standards-section .pagi-btn {
font-family: "SohoGothicPro-Regular";
font-size: 16px;
font-weight: 400;
line-height: 24px;
position: relative;
width: 100%;
background: transparent !important;
border: none !important;
cursor: pointer;
padding: 32px 10px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-dot.active {
background: var(--brand-color-3, #29337f);
border: 1px solid var(--brand-color-3, #29337f);
}
#ecom-norma-detail-normas-referenced .standards-section .owl-dot.active .pagi-btn {
color: white;
font-family: "SohoStd-Medium";
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-dot.active .pagi-btn::before {
border-bottom: 28px solid var(--brand-color-2, #6a9bd3);
border-left: 15px solid transparent;
border-right: 15px solid transparent;
width: 0;
height: 0;
content: "";
position: absolute;
bottom: 84px;
left: 45%;
}
@media (min-width: 992px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-navigation-mobile {
display: none;
}
}
#ecom-norma-detail-normas-referenced .standards-section .owl-navigation-mobile .owl-navigation-mobile-box {
background: linear-gradient(0deg, var(--brand-color-2, #6a9bd3) 4.9%, var(--brand-color-1, #1f57a3) 110.78%);
padding: 28px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-navigation-mobile .owl-navigation-mobile-box p {
color: white;
font-family: "SohoStd-Medium";
font-size: 14px;
font-weight: 500;
line-height: 18px;
margin-bottom: 0;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-navigation-mobile .owl-navigation-mobile-box::before {
border-bottom: 28px solid var(--brand-color-1, #1f57a3);
border-left: 15px solid transparent;
border-right: 15px solid transparent;
width: 0;
height: 0;
content: "";
position: absolute;
bottom: 72px;
z-index: 1;
margin-left: -14px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav {
position: absolute;
top: 50%;
left: 0;
right: 0;
transform: translateY(-50%);
pointer-events: none;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev,
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next {
position: absolute;
background: none;
border: 2px solid #fff;
z-index: 100;
pointer-events: auto;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev.disabled,
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next.disabled {
opacity: 0.5;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev {
background: var(--brand-color-3, #29337f);
padding: 16px !important;
left: -55px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev i {
color: white;
position: absolute;
top: 17px;
left: 19px;
font-size: 13px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next {
background: var(--brand-color-3, #29337f);
padding: 16px !important;
right: -55px;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next i {
color: white;
position: absolute;
top: 17px;
left: 19px;
font-size: 13px;
}
@media (max-width: 991px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: -55px; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: -55px; }
}
@media (max-width: 868px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: -25px; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: -25px; }
}
@media (max-width: 767px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: -60px; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: -60px; }
}
@media (max-width: 668px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav { top: 103%; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: 40%; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: 40%; }
}
@media (max-width: 575px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: 35%; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: 35%; }
}
@media (max-width: 400px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: 32%; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: 32%; }
}
@media (min-width: 300px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-stage-outer {
overflow: visible;
}
}
@media (min-width: 1100px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: -55px; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: -55px; }
}
@media (min-width: 1200px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: -25px; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: -25px; }
}
@media (min-width: 1330px) {
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-prev { left: -75px; }
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-nav .owl-next { right: -75px; }
}
#ecom-norma-detail-normas-referenced .standards-section .owl-item {
display: flex;
flex-direction: column;
justify-content: stretch;
}
.status-standard {
margin-right: 10px;
color: white;
font-size: 10px;
padding: 2px 6px;
border-radius: 3px;
font-weight: bold;
}
.date-standard {
font-size: 12px;
color: #666;
}
#ecom-norma-detail-normas-referenced .standards-section .tag-standard {
position: absolute;
background-color: #6a9bd3;
top: -10px;
left: 16px;
padding: 4px 10px;
border-radius: 4px;
color: #fff;
font-weight: bold;
font-size: 12px;
z-index: 5;
}
#ecom-norma-detail-normas-referenced .standards-section .status-box {
text-transform: uppercase;
align-items: center;
display: flex;
flex-wrap: wrap;
margin: 0 0 10px;
gap: 4px 0;
}
#ecom-norma-detail-normas-referenced .standards-section .status-box .status-standard.red-tag {
background-color: var(--ae-450, #D44436);
border: 1px solid var(--ae-450, #D44436);
color: #fff;
}
#ecom-norma-detail-normas-referenced .standards-section .status-box .status-standard.green-tag {
background-color: #138636;
border: 1px solid #138636;
color: #fff;
}
#ecom-norma-detail-normas-referenced .standards-section .status-box .status-standard.blue-tag {
background-color: #0078c0;
border: 1px solid #0078c0;
color: #fff;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-stage-outer {
overflow-x: hidden;
overflow-y: visible;
}
#ecom-norma-detail-normas-referenced .standards-section .owl-carousel .owl-stage-outer .owl-stage {
overflow: hidden;
display: flex;
align-items: stretch;
padding-left: 0 !important;
padding-right: 0 !important;
padding-top: 30px;
}
/* select */
select .form-control {
padding: 15.5px 16px;
font-family: "SohoGothicPro-Regular";
font-size: 14px;
font-weight: 400;
line-height: 18px;
letter-spacing: 0.5px;
text-align: left;
border: 1px solid #c2c2c2;
height: 50px;
width: 100%;
color: #66757f;
border-radius: 4px;
}
select.form-control option {
font-family: "SohoGothicPro-Regular";
font-size: 14px;
font-weight: 400;
line-height: 18px;
letter-spacing: 0.5px;
text-align: left;
}
select.form-control,
select.form-control:focus,
select.form-control:focus-visible {
background-image: url(/documents/d/global/ico-chevron-down);
position: relative;
background-size: 18px 10px;
background-position-x: 95%;
}
#ecom-norma-detail-normas-referenced .standards-section .options-standard {
display: flex;
gap: 10px;
margin-bottom: 16px;
border: none;
}
#ecom-norma-detail-normas-referenced .standards-section .options-standard .select-language {
background-color: #f5f5f5;
flex: 2;
font-size: 13px;
}
#ecom-norma-detail-normas-referenced .standards-section .options-standard .select-format {
background-color: #f5f5f5;
flex: 1;
font-size: 13px;
}
//TODO: repasar y quitar lo relacionado con selectores y precio.
/*TODO:
-Se llama a la [async function init()] dentro de aqui [ecomNormaReferencedScript]
desde fragment [dxp-ecom-portal/misc/fragments/Collection Tienda/ECOM-Global_functions/index.js] de la siguiente manera:
if (typeof window.ecomNormaReferencedScript?.init === "function") {
await window.ecomNormaReferencedScript.init();
}
*/
window.ecomNormaReferencedScript = (function ($) {
/* === CONFIG === */
let DEBUG = false;
let ROOT_SELECTOR = null;
function log(...args) {
if (DEBUG) console.log("[ecomNorma]", ...args);
}
/* === FUNCIONES PRIVADAS === */
function _euros(v) {
const n = Number(v) || 0;
return n.toLocaleString("es-ES", { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + " €";
}
function _uniq(a) {
return Array.from(new Set(a));
}
function _fill($sel, values, textFn) {
const keep = $sel.val();
$sel.empty();
values.forEach(v => {
$sel.append($("<option>", { value: v, text: textFn ? textFn(v) : v }));
});
if (keep && values.includes(keep)) $sel.val(keep);
else if (values.length) $sel.val(values[0]);
}
function _relabel($sel, textFn) {
$sel.find("option").each(function () {
const v = $(this).attr("value");
$(this).text(textFn ? textFn(v) : v);
});
}
/* === initCarousel — PÚBLICA === */
function initCarousel(force = false) {
const $owl = $(ROOT_SELECTOR + " .standards-container");
// no inicializar si no existe, está oculto o no tiene items
if (!$owl.length || !$owl.hasClass("owl-carousel") || !$owl.is(':visible') || $owl.children().length === 0) {
log("initCarousel abortado: no visible o sin items", $owl);
return;
}
if (force && $owl.hasClass("owl-loaded") && $owl.data("owl.carousel")) {
log("initCarousel Destruyendo Owl Carousel existent:", $owl);
$owl.trigger('destroy.owl.carousel');
// limpiar también owl-hidden para permitir reinicialización
$owl.removeClass('owl-loaded owl-hidden');
// limpiar markup de Owl
$owl.find('.owl-stage-outer').children().unwrap();
}
if ($owl.length && !$owl.hasClass("owl-loaded") && !$owl.data("owl.carousel")) {
$owl.owlCarousel({
nav: true,
navText: [
'<i class="fa-solid fa-chevron-left"></i>',
'<i class="fa-solid fa-chevron-right"></i>'
],
loop: false,
dots: false,
pagination: false,
margin: 25,
autoHeight: false,
responsive: {
0: { items: 1 }, 500: { items: 1 }, 767: { items: 2 }, 1000: { items: 3 }, 1200: { items: 4 }
}
});
$owl.off("initialized.owl.carousel refreshed.owl.carousel resized.owl.carousel translated.owl.carousel")
.on("initialized.owl.carousel refreshed.owl.carousel resized.owl.carousel translated.owl.carousel", adjustHeights);
log("initCarousel executed");
}
}
/* === initCard — PÚBLICA === */
function initCard($card) {
const dataNode = $card.find("script.normas-data")[0];
let data = [];
if (dataNode) {
try { data = JSON.parse(dataNode.textContent); } catch {}
}
const hasData = Array.isArray(data) && data.length > 0;
let langMap = {};
const mapNode = $card.find("script.lang-map")[0];
try { if (mapNode) langMap = JSON.parse(mapNode.textContent); } catch {}
const $lang = $card.find(".select-language");
const $fmt = $card.find(".select-format");
const $price = $card.find(".price-ae");
const toUC = s => (s || "").toString().toUpperCase();
const labelOf = lang => langMap[toUC(lang)] || lang;
const formatsFor = lang => _uniq(data.filter(d => d.language === lang).map(d => d.format));
const languagesFor = fmt => _uniq(data.filter(d => d.format === fmt).map(d => d.language));
const priceOf = (lang, fmt) => {
const m = data.find(d => d.language === lang && d.format === fmt);
return m ? Number(m.price) || 0 : 0;
};
const parsePriceText = (text) => {
if (!text) return 0;
const clean = String(text).replace(/[^\d,.-]/g, "").trim();
if (!clean) return 0;
if (clean.includes(",") && clean.includes(".")) {
const normalized = clean.replace(/\./g, "").replace(",", ".");
return Number(normalized) || 0;
}
const normalized = clean.replace(",", ".");
return Number(normalized) || 0;
};
if (hasData) {
function onLanguageChange() {
const lang = $lang.val();
const fmts = formatsFor(lang);
_fill($fmt, fmts);
$price.text(_euros(priceOf(lang, $fmt.val())));
}
function onFormatChange() {
const fmt = $fmt.val();
const langs = languagesFor(fmt);
_fill($lang, langs, labelOf);
$price.text(_euros(priceOf($lang.val(), fmt)));
}
const l0 = $lang.val();
const f0 = $fmt.val();
if (!data.find(d => d.language === l0 && d.format === f0)) onLanguageChange();
else $price.text(_euros(priceOf(l0, f0)));
_relabel($lang, labelOf);
$lang.off("change.ae").on("change.ae", onLanguageChange);
$fmt.off("change.ae").on("change.ae", onFormatChange);
}
async function onAdd(e) {
e.preventDefault();
var entryType = ($card.data('entrytype') || 'Norma');
var code = ($card.data('code') || '').toString();
var codIdioma = ($card.find('.select-language').val() || '').toString();
var codFormato = ($card.find('.select-format').val() || '').toString();
if (!code) code = ($card.find('.title-standard').text() || '').trim();
await window.ecomGlobalScripts.functions.addToCart({
entryType: entryType,
code: code,
codIdioma: codIdioma,
codFormato: codFormato,
price: Number(priceOf(codIdioma, codFormato)) || 0,
name: ($card.data('title') || '').toString(),
amount: 1
});
}
$card.find(".standard-button").off("click.ae").on("click.ae", function(e){
const btn = this;
const run = () => onAdd(e);
const helper = window.ecomGlobalScripts?.functions?.withButtonSpinner;
if (typeof helper === "function") {
return helper(btn, run, { spinnerClass: "spinner-border spinner-border-sm text-light", mode: "replace" });
}
return run();
});
// Evita que Owl Carousel interprete el click como drag horizontal
$card.find(".standard-button")
.off("pointerdown.owl mousedown.owl touchstart.owl")
.on("pointerdown.owl mousedown.owl touchstart.owl", function(e){
e.stopPropagation();
});
}
/* === adjustHeights — PÚBLICA === */
function adjustHeights() {
if ($(window).width() > 766.98) {
let hT = 0, hD = 0;
$(ROOT_SELECTOR + " .title-standard").css("height","auto").each(function(){ hT=Math.max(hT,$(this).outerHeight()); });
$(ROOT_SELECTOR + " .description-text").css("height","auto").each(function(){ hD=Math.max(hD,$(this).outerHeight()); });
$(ROOT_SELECTOR + " .title-standard").height(hT);
$(ROOT_SELECTOR + " .description-text").height(hD);
} else {
$(ROOT_SELECTOR + " .title-standard, .description-text").css("height","auto");
}
log("adjustHeights executed");
}
/* === init — PÚBLICA === */
async function init() {
// debug externo
DEBUG = window.ecomNormaScripts?.properties?.isDebug === true;
// prefijo para todos los selectores
ROOT_SELECTOR =
window.ecomGlobalScripts?.properties?.querySelectors?.rootSelector ||
window.ecomNormaScripts?.properties?.querySelectors?.rootSelector ||
"#ecom-norma-detail-normas-referenced .standards-section";
log("window.ecomNormaReferencedScript init");
$(ROOT_SELECTOR + " .item-standard").each(function(){ initCard($(this)); });
initCarousel(true);
adjustHeights();
$(window).off("resize.standards").on("resize.standards", adjustHeights);
log("init executed");
}
/* === API pública === */
return { init, initCard, adjustHeights, initCarousel };
})(jQuery);
-
URL del producto:
https://aenorportalesweb-uat.lxc.liferay.com/web/tienda/e/{friendlyURL_display-page-template}/{ClassNameId-CPDefinition}/{CPDefinition ID (Field: product.id)}
por ejemplo: https://aenorportalesweb-uat.lxc.liferay.com/web/tienda/e/producto-tienda/30025/${cpDefinitionId}










