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 1: URL de cambio de idioma 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?matches(".*[?&]" + paramName + "=.*")>
119
120 <#local newRedirectDecoded = redirectDecoded?replace(
121 "([?&])" + paramName + "=[^&]*",
122 "$1" + paramName + "=" + translatedValue,
123 "r"
124 ) />
125
126 <#local newRedirectEncoded =
127 urlCodec.encodeURL(newRedirectDecoded)
128 />
129
130 <#return originalURL?replace(
131 redirectEncoded,
132 newRedirectEncoded
133 ) />
134
135 </#if>
136
137 <#return originalURL />
138
139 </#if>
140
141 <#-- Caso 2: URL normal -->
142 <#if originalURL?matches(".*[?&]" + paramName + "=.*")>
143
144 <#return originalURL?replace(
145 "([?&])" + paramName + "=[^&]*",
146 "$1" + paramName + "=" + translatedValue,
147 "r"
148 ) />
149
150 </#if>
151
152 <#return originalURL />
153
154</#function>
155
156<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
157 <#local resultURL = originalURL />
158
159 <#list paramNames as paramName>
160 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
161 </#list>
162
163 <#return resultURL />
164</#function>
165
166<#-- ============================================================ -->
167
168<script>
169 $(document).ready(function () {
170 // Toggle el estado del menu de idiomas
171 $('.select-btn').on('click', function () {
172 var expanded = $(this).attr('aria-expanded') === 'true';
173 $(this).attr('aria-expanded', !expanded);
174 $('.options').toggleClass('hide', expanded);
175 });
176
177 // Acciones de teclado para la lupa
178 $('.select-btn').on('keydown', function (e) {
179 if (e.key === 'Enter' || e.key === ' ') {
180 e.preventDefault(); // Evitar desplazamiento al presionar espacio
181 $(this).click(); // Simula el click para abrir/cerrar el menu
182 }
183 });
184
185 // Cerrar el menu al hacer clic en cualquier parte fuera de el
186 $(document).on('click', function (event) {
187 if (!$(event.target).closest('.select-btn, .options').length) {
188 $('.options').addClass('hide');
189 $('.select-btn').attr('aria-expanded', 'false');
190 }
191 });
192
193 // Navegar con las teclas de flecha
194 let options = $('.option');
195 let selectedIndex = 0;
196
197 options.on('keydown', function (e) {
198 if (e.key === 'ArrowDown') {
199 selectedIndex = (selectedIndex + 1) % options.length;
200 options.eq(selectedIndex).focus();
201 }
202 if (e.key === 'ArrowUp') {
203 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
204 options.eq(selectedIndex).focus();
205 }
206 if (e.key === 'Enter') {
207 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
208 }
209 });
210 });
211</script>
El producto se ha añadido a la cesta de la compra
Listado normas relacionadas
-
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}










