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 54, 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 <p>LanguageIdTEST:${curLanguage.getLanguageId()}</p>
30
31 <p>matchedItemsCacheTEST:<@printObject matchedItemsCache /></p>
32
33
34 <#if !curLanguage.isSelected()>
35
36
37
38 <#assign entryHref = buildTranslatedHref(curLanguage.getURL(), curLanguage.getLanguageId(), translatableParams, matchedItemsCache) />
39 <li class="option" role="option"><span class="option-text"> <a href="${entryHref}" class="language-entry-short-text"
40 lang="${curLanguage.getLanguageId()}">${curLanguage.getLongDisplayName()?capitalize}</a> </span></li>
41
42
43 </#if>
44 </#list>
45 </#if>
46</ul>
47
48
49<#-- ============================================================
50 Traduccion de parametros de la URL al cambiar de idioma
51 ============================================================ -->
52
53<#function findMatchedItem paramName locale>
54 <#local paramValue = request.getParameter(paramName)! />
55 <#if !paramValue?has_content>
56 <#return "" />
57 </#if>
58
59 <#local paramValueTrim = paramValue?trim />
60 <#local paramType = paramName?upper_case />
61 <#local endpointURL = "/c/selectoptions/?languageId=" + locale?string + "&sort=name:asc&filter=optionsType eq '" + paramType + "'" />
62 <#local optionsResponse = restClient.get(endpointURL) />
63
64 <#list optionsResponse.items![] as item>
65 <#local valueI18n = item.value_i18n![] />
66 <#local found = false />
67
68 <#list valueI18n?keys as key>
69 <#if valueI18n[key]! == paramValueTrim>
70 <#local found = true />
71 <#break />
72 </#if>
73 </#list>
74
75 <#if !found && (item.value!"") == paramValueTrim>
76 <#local found = true />
77 </#if>
78
79 <#if found>
80 <#return item />
81 </#if>
82 </#list>
83
84 <#return "" />
85</#function>
86
87<#function buildMatchedItemsCache paramNames locale>
88 <#local cache = {} />
89 <#list paramNames as paramName>
90 <#local cache = cache + {paramName: findMatchedItem(paramName, locale)} />
91 </#list>
92 <#return cache />
93</#function>
94
95<#function translateParamInURL originalURL paramName targetLanguageId matchedItemsCache>
96 <#local paramValue = request.getParameter(paramName)! />
97 <#local matchedItem = matchedItemsCache[paramName]!"" />
98
99 <#if !paramValue?has_content || !matchedItem?has_content>
100 <#return originalURL />
101 </#if>
102
103 <#local rawValueInURL = originalURL?replace(".*[?&]" + paramName + "=([^&]*).*", "$1", "r") />
104
105 <#if rawValueInURL == originalURL>
106 <#return originalURL />
107 </#if>
108
109 <#local urlDecoder = staticUtil["java.net.URLDecoder"] />
110 <#local urlEncoder = staticUtil["java.net.URLEncoder"] />
111 <#local decodedValueInURL = urlDecoder.decode(rawValueInURL, "UTF-8") />
112
113 <#if decodedValueInURL != paramValue?trim>
114 <#return originalURL />
115 </#if>
116
117 <#local newValue = matchedItem.value_i18n[targetLanguageId]!matchedItem.value!paramValue />
118
119 <#if newValue == decodedValueInURL>
120 <#return originalURL />
121 </#if>
122
123 <#local newEncoded = urlEncoder.encode(newValue, "UTF-8") />
124
125 <#return originalURL?replace(paramName + "=" + rawValueInURL, paramName + "=" + newEncoded) />
126</#function>
127
128<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
129 <#local resultURL = originalURL />
130
131 <#list paramNames as paramName>
132 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
133 </#list>
134
135 <#return resultURL />
136</#function>
137
138
139<#macro printObject obj>
140 <#-- Permite hacer un output de un array de objetos o un objeto que se pasa como parámetro -->
141 <#if obj?is_hash>
142 {
143 <#list obj?keys as k>
144 "${k}":
145 <#assign value = obj[k]>
146 <#if value?is_hash || value?is_sequence>
147 <@printObject obj=value/>
148 <#elseif value?is_boolean>
149 ${value?c}
150 <#elseif value?is_number>
151 ${value}
152 <#elseif value?has_content>
153 "${value?string}"
154 <#else>
155 null
156 </#if>
157 <#if k_has_next>, </#if>
158 </#list>
159 }
160 <#elseif obj?is_sequence>
161 [
162 <#list obj as item>
163 <@printObject obj=item/>
164 <#if item_has_next>, </#if>
165 </#list>
166 ]
167 <#elseif obj?is_boolean>
168 ${obj?c}
169 <#elseif obj?is_number>
170 ${obj}
171 <#elseif obj?has_content>
172 "${obj?string}"
173 <#else>
174 null
175 </#if>
176</#macro>
177
178<#-- ============================================================ -->
179
180<script>
181 $(document).ready(function () {
182 // Toggle el estado del menu de idiomas
183 $('.select-btn').on('click', function () {
184 var expanded = $(this).attr('aria-expanded') === 'true';
185 $(this).attr('aria-expanded', !expanded);
186 $('.options').toggleClass('hide', expanded);
187 });
188
189 // Acciones de teclado para la lupa
190 $('.select-btn').on('keydown', function (e) {
191 if (e.key === 'Enter' || e.key === ' ') {
192 e.preventDefault(); // Evitar desplazamiento al presionar espacio
193 $(this).click(); // Simula el click para abrir/cerrar el menu
194 }
195 });
196
197 // Cerrar el menu al hacer clic en cualquier parte fuera de el
198 $(document).on('click', function (event) {
199 if (!$(event.target).closest('.select-btn, .options').length) {
200 $('.options').addClass('hide');
201 $('.select-btn').attr('aria-expanded', 'false');
202 }
203 });
204
205 // Navegar con las teclas de flecha
206 let options = $('.option');
207 let selectedIndex = 0;
208
209 options.on('keydown', function (e) {
210 if (e.key === 'ArrowDown') {
211 selectedIndex = (selectedIndex + 1) % options.length;
212 options.eq(selectedIndex).focus();
213 }
214 if (e.key === 'ArrowUp') {
215 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
216 options.eq(selectedIndex).focus();
217 }
218 if (e.key === 'Enter') {
219 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
220 }
221 });
222 });
223</script>
El producto se ha añadido a la cesta de la compra
Listado colecciones temáticas 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}










