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










