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 <#-- URL tipo update_language -->
108 <#if originalURL?contains("redirect=")>
109
110 <#local encodedValue = urlCodec.encodeURL(translatedValue) />
111
112 <#-- Liferay suele esperar %2B en lugar de + -->
113 <#local encodedValue = encodedValue?replace("+", "%2B") />
114
115 <#return originalURL?replace(
116 paramName + "%3D[^&]*",
117 paramName + "%3D" + encodedValue,
118 "r"
119 ) />
120
121 </#if>
122
123 <#-- URL normal -->
124 <#return originalURL?replace(
125 "([?&])" + paramName + "=[^&]*",
126 "$1" + paramName + "=" + translatedValue,
127 "r"
128 ) />
129
130</#function>
131
132<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
133 <#local resultURL = originalURL />
134
135 <#list paramNames as paramName>
136 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
137 </#list>
138
139 <#return resultURL />
140</#function>
141
142<#-- ============================================================ -->
143
144<script>
145 $(document).ready(function () {
146 // Toggle el estado del menu de idiomas
147 $('.select-btn').on('click', function () {
148 var expanded = $(this).attr('aria-expanded') === 'true';
149 $(this).attr('aria-expanded', !expanded);
150 $('.options').toggleClass('hide', expanded);
151 });
152
153 // Acciones de teclado para la lupa
154 $('.select-btn').on('keydown', function (e) {
155 if (e.key === 'Enter' || e.key === ' ') {
156 e.preventDefault(); // Evitar desplazamiento al presionar espacio
157 $(this).click(); // Simula el click para abrir/cerrar el menu
158 }
159 });
160
161 // Cerrar el menu al hacer clic en cualquier parte fuera de el
162 $(document).on('click', function (event) {
163 if (!$(event.target).closest('.select-btn, .options').length) {
164 $('.options').addClass('hide');
165 $('.select-btn').attr('aria-expanded', 'false');
166 }
167 });
168
169 // Navegar con las teclas de flecha
170 let options = $('.option');
171 let selectedIndex = 0;
172
173 options.on('keydown', function (e) {
174 if (e.key === 'ArrowDown') {
175 selectedIndex = (selectedIndex + 1) % options.length;
176 options.eq(selectedIndex).focus();
177 }
178 if (e.key === 'ArrowUp') {
179 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
180 options.eq(selectedIndex).focus();
181 }
182 if (e.key === 'Enter') {
183 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
184 }
185 });
186 });
187</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}










