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










