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










