Se ha producido un error al procesar la plantilla.
Denied access to method or field getParameter of class org.apache.catalina.core.ApplicationHttpRequest
----
FTL stack trace ("~" means nesting-related):
- Failed at: #local paramValue = request.getParame... [in template "34352066712900#33336#65816767" in function "findMatchedItem" at line 50, column 5]
----
1<#--
2 LANGUAGE HEADER DROPDOWN
3 -->
4<#assign currentURL = themeDisplay.getURLCurrent()>
5<#assign baseURL = themeDisplay.getPortalURL()>
6<#assign relativeURL = currentURL?replace(baseURL, "")>
7
8<#assign translatableParams = ["ics", "ctn"] />
9<#assign matchedItemsCache = buildMatchedItemsCache(translatableParams, locale) />
10
11<#assign desc = themeDisplay.getLanguageId()?split("_")?first >
12<div class="select-btn" id="language-select" role="button" aria-haspopup="listbox" aria-expanded="false" tabindex="0">
13 <#assign siteLanguage = themeDisplay.getLocale().getDisplayLanguage( themeDisplay.getLocale() )?cap_first>
14 <span
15 class="sBtn-text text-uppercase d-flex align-content-center align-items-center">${desc} <span
16 class="fa-solid fa-chevron-down" aria-hidden="true"></span></span>
17</div>
18 <ul class="options hide" role="listbox" aria-labelledby="language-select">
19 <li class="option actives" style="pointer-events:none" role="option" aria-selected="true">
20 <span class="option-text">
21 <svg aria-hidden="true" class="lexicon-icon mr-2 lexicon-icon-${themeDisplay.getLanguageId()?replace('_', '-')?lower_case}">
22 <use href="/o/classic-theme/images/clay/icons.svg#${themeDisplay.getLanguageId()?replace('_', '-')?lower_case}"></use>
23 </svg>
24 ${siteLanguage}
25 </span>
26 </li>
27 <#if entries?has_content>
28 <#list entries as curLanguage>
29
30 <#if !curLanguage.isSelected()>
31
32
33
34
35 <#assign entryHref = buildTranslatedHref(curLanguage.getURL(), curLanguage.getLanguageId(), translatableParams, matchedItemsCache) />
36 <li class="option" role="option"><span class="option-text"> <a href="${entryHref}" class="language-entry-short-text"
37 lang="${curLanguage.getLanguageId()}">${curLanguage.getLongDisplayName()?capitalize}</a> </span></li>
38
39 </#if>
40 </#list>
41 </#if>
42</ul>
43
44
45<#-- ============================================================
46 Traduccion de parametros de la URL al cambiar de idioma
47 ============================================================ -->
48
49<#function findMatchedItem paramName locale>
50 <#local paramValue = request.getParameter(paramName)! />
51 <#if !paramValue?has_content>
52 <#return "" />
53 </#if>
54
55 <#local paramValueTrim = paramValue?trim />
56 <#local paramType = paramName?upper_case />
57 <#local endpointURL = "/c/selectoptions/?languageId=" + locale?string + "&sort=name:asc&filter=optionsType eq '" + paramType + "'" />
58 <#local optionsResponse = restClient.get(endpointURL) />
59
60 <#list optionsResponse.items![] as item>
61 <#local valueI18n = item.value_i18n![] />
62 <#local found = false />
63
64 <#list valueI18n?keys as key>
65 <#if valueI18n[key]! == paramValueTrim>
66 <#local found = true />
67 <#break />
68 </#if>
69 </#list>
70
71 <#if !found && (item.value!"") == paramValueTrim>
72 <#local found = true />
73 </#if>
74
75 <#if found>
76 <#return item />
77 </#if>
78 </#list>
79
80 <#return "" />
81</#function>
82
83<#function buildMatchedItemsCache paramNames locale>
84 <#local cache = {} />
85 <#list paramNames as paramName>
86 <#local cache = cache + {paramName: findMatchedItem(paramName, locale)} />
87 </#list>
88 <#return cache />
89</#function>
90
91<#function translateParamInURL originalURL paramName targetLanguageId matchedItemsCache>
92
93 <#local matchedItem = matchedItemsCache[paramName]!"" />
94
95 <#if !matchedItem?has_content>
96 <#return originalURL />
97 </#if>
98
99 <#local translatedValue =
100 matchedItem.value_i18n[targetLanguageId]!matchedItem.value!""
101 />
102
103 <#if !translatedValue?has_content>
104 <#return originalURL />
105 </#if>
106
107 <#-- Caso update_language con redirect -->
108 <#if originalURL?contains("redirect=")>
109
110 <#local redirectEncoded = originalURL?replace(
111 ".*redirect=([^&]+).*",
112 "$1",
113 "r"
114 ) />
115
116 <#local redirectDecoded = urlCodec.decodeURL(redirectEncoded) />
117
118 <#if !redirectDecoded?contains(paramName + "=")>
119 <#return originalURL />
120 </#if>
121
122 <#local translatedRedirect = redirectDecoded?replace(
123 "([?&])" + paramName + "=[^&]*",
124 "$1" + paramName + "=" + translatedValue,
125 "r"
126 ) />
127
128 <#local translatedRedirectEncoded =
129 urlCodec.encodeURL(translatedRedirect)
130 />
131
132 <#return originalURL?replace(
133 redirectEncoded,
134 translatedRedirectEncoded
135 ) />
136
137 </#if>
138
139 <#-- URL normal -->
140 <#if originalURL?contains(paramName + "=")>
141
142 <#return originalURL?replace(
143 "([?&])" + paramName + "=[^&]*",
144 "$1" + paramName + "=" + translatedValue,
145 "r"
146 ) />
147
148 </#if>
149
150 <#return originalURL />
151
152</#function>
153
154<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
155 <#local resultURL = originalURL />
156
157 <#list paramNames as paramName>
158 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
159 </#list>
160
161 <#return resultURL />
162</#function>
163
164<#-- ============================================================ -->
165
166<script>
167 $(document).ready(function () {
168 // Toggle el estado del menu de idiomas
169 $('.select-btn').on('click', function () {
170 var expanded = $(this).attr('aria-expanded') === 'true';
171 $(this).attr('aria-expanded', !expanded);
172 $('.options').toggleClass('hide', expanded);
173 });
174
175 // Acciones de teclado para la lupa
176 $('.select-btn').on('keydown', function (e) {
177 if (e.key === 'Enter' || e.key === ' ') {
178 e.preventDefault(); // Evitar desplazamiento al presionar espacio
179 $(this).click(); // Simula el click para abrir/cerrar el menu
180 }
181 });
182
183 // Cerrar el menu al hacer clic en cualquier parte fuera de el
184 $(document).on('click', function (event) {
185 if (!$(event.target).closest('.select-btn, .options').length) {
186 $('.options').addClass('hide');
187 $('.select-btn').attr('aria-expanded', 'false');
188 }
189 });
190
191 // Navegar con las teclas de flecha
192 let options = $('.option');
193 let selectedIndex = 0;
194
195 options.on('keydown', function (e) {
196 if (e.key === 'ArrowDown') {
197 selectedIndex = (selectedIndex + 1) % options.length;
198 options.eq(selectedIndex).focus();
199 }
200 if (e.key === 'ArrowUp') {
201 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
202 options.eq(selectedIndex).focus();
203 }
204 if (e.key === 'Enter') {
205 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
206 }
207 });
208 });
209</script>
El producto se ha añadido a la cesta de la compra
Listado libros relacionados
-
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}










