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 52, 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 <p>LanguageIdTEST:${curLanguage.getLanguageId()}</p>
31 <#assign matchedItemTEST = matchedItemsCache["ics"]!"" />
32 <#assign newValue = matchedItemTEST.value_i18n[curLanguage.getLanguageId()]!matchedItem.value!paramValue />
33 <p>newValue:${newValue}</p>
34
35 <#if !curLanguage.isSelected()>
36
37 <#assign entryHref = buildTranslatedHref(curLanguage.getURL(), curLanguage.getLanguageId(), translatableParams, matchedItemsCache) />
38 <li class="option" role="option"><span class="option-text"> <a href="${entryHref}" class="language-entry-short-text"
39 lang="${curLanguage.getLanguageId()}">${curLanguage.getLongDisplayName()?capitalize}</a> </span></li>
40
41 </#if>
42 </#list>
43 </#if>
44</ul>
45
46
47<#-- ============================================================
48 Traduccion de parametros de la URL al cambiar de idioma
49 ============================================================ -->
50
51<#function findMatchedItem paramName locale>
52 <#local paramValue = request.getParameter(paramName)! />
53 <#if !paramValue?has_content>
54 <#return "" />
55 </#if>
56
57 <#local paramValueTrim = paramValue?trim />
58 <#local paramType = paramName?upper_case />
59 <#local endpointURL = "/c/selectoptions/?languageId=" + locale?string + "&sort=name:asc&filter=optionsType eq '" + paramType + "'" />
60 <#local optionsResponse = restClient.get(endpointURL) />
61
62 <#list optionsResponse.items![] as item>
63 <#local valueI18n = item.value_i18n![] />
64 <#local found = false />
65
66 <#list valueI18n?keys as key>
67 <#if valueI18n[key]! == paramValueTrim>
68 <#local found = true />
69 <#break />
70 </#if>
71 </#list>
72
73 <#if !found && (item.value!"") == paramValueTrim>
74 <#local found = true />
75 </#if>
76
77 <#if found>
78 <#return item />
79 </#if>
80 </#list>
81
82 <#return "" />
83</#function>
84
85<#function buildMatchedItemsCache paramNames locale>
86 <#local cache = {} />
87 <#list paramNames as paramName>
88 <#local cache = cache + {paramName: findMatchedItem(paramName, locale)} />
89 </#list>
90 <#return cache />
91</#function>
92
93<#function translateParamInURL originalURL paramName targetLanguageId matchedItemsCache>
94 <#local paramValue = request.getParameter(paramName)! />
95 <#local matchedItem = matchedItemsCache[paramName]!"" />
96
97 <#if !paramValue?has_content || !matchedItem?has_content>
98 <#return originalURL />
99 </#if>
100
101 <#local rawValueInURL = originalURL?replace(".*[?&]" + paramName + "=([^&]*).*", "$1", "r") />
102
103 <#if rawValueInURL == originalURL>
104 <#return originalURL />
105 </#if>
106
107 <#local urlDecoder = staticUtil["java.net.URLDecoder"] />
108 <#local urlEncoder = staticUtil["java.net.URLEncoder"] />
109 <#local decodedValueInURL = urlDecoder.decode(rawValueInURL, "UTF-8") />
110
111 <#if decodedValueInURL != paramValue?trim>
112 <#return originalURL />
113 </#if>
114
115 <#local newValue = matchedItem.value_i18n[targetLanguageId]!matchedItem.value!paramValue />
116
117 <#--
118 <#if newValue == decodedValueInURL>
119 <#return originalURL />
120 </#if>
121 -->
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 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}










