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










