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 <#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
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
95 <#local matchedItem = matchedItemsCache[paramName]!"" />
96
97 <#if !matchedItem?has_content>
98 <#return originalURL />
99 </#if>
100
101 <#local newValue = matchedItem.value_i18n[targetLanguageId]!matchedItem.value!"" />
102
103 <#if !newValue?has_content>
104 <#return originalURL />
105 </#if>
106
107 <#local regex = "([?&])" + paramName + "=[^&]*" />
108 <#local replacement = "$1" + paramName + "=" + newValue />
109
110 <#return originalURL?replace(regex, replacement, "r") />
111
112</#function>
113
114<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
115 <#local resultURL = originalURL />
116
117 <#list paramNames as paramName>
118 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
119 </#list>
120
121 <#return resultURL />
122</#function>
123
124
125<#macro printObject obj>
126 <#-- Permite hacer un output de un array de objetos o un objeto que se pasa como parámetro -->
127 <#if obj?is_hash>
128 {
129 <#list obj?keys as k>
130 "${k}":
131 <#assign value = obj[k]>
132 <#if value?is_hash || value?is_sequence>
133 <@printObject obj=value/>
134 <#elseif value?is_boolean>
135 ${value?c}
136 <#elseif value?is_number>
137 ${value}
138 <#elseif value?has_content>
139 "${value?string}"
140 <#else>
141 null
142 </#if>
143 <#if k_has_next>, </#if>
144 </#list>
145 }
146 <#elseif obj?is_sequence>
147 [
148 <#list obj as item>
149 <@printObject obj=item/>
150 <#if item_has_next>, </#if>
151 </#list>
152 ]
153 <#elseif obj?is_boolean>
154 ${obj?c}
155 <#elseif obj?is_number>
156 ${obj}
157 <#elseif obj?has_content>
158 "${obj?string}"
159 <#else>
160 null
161 </#if>
162</#macro>
163
164<#-- ============================================================ -->
165
166<script>
167 $(document).ready(function () {
168 // Toggle el estado del menu de idiomas
169 $('.select-btn').on('click', function () {
170 var expanded = $(this).attr('aria-expanded') === 'true';
171 $(this).attr('aria-expanded', !expanded);
172 $('.options').toggleClass('hide', expanded);
173 });
174
175 // Acciones de teclado para la lupa
176 $('.select-btn').on('keydown', function (e) {
177 if (e.key === 'Enter' || e.key === ' ') {
178 e.preventDefault(); // Evitar desplazamiento al presionar espacio
179 $(this).click(); // Simula el click para abrir/cerrar el menu
180 }
181 });
182
183 // Cerrar el menu al hacer clic en cualquier parte fuera de el
184 $(document).on('click', function (event) {
185 if (!$(event.target).closest('.select-btn, .options').length) {
186 $('.options').addClass('hide');
187 $('.select-btn').attr('aria-expanded', 'false');
188 }
189 });
190
191 // Navegar con las teclas de flecha
192 let options = $('.option');
193 let selectedIndex = 0;
194
195 options.on('keydown', function (e) {
196 if (e.key === 'ArrowDown') {
197 selectedIndex = (selectedIndex + 1) % options.length;
198 options.eq(selectedIndex).focus();
199 }
200 if (e.key === 'ArrowUp') {
201 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
202 options.eq(selectedIndex).focus();
203 }
204 if (e.key === 'Enter') {
205 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
206 }
207 });
208 });
209</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}










