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 56, column 5]
----
1<#list .data_model?keys as key>
2 <p>${key}</p>
3</#list>
4
5<#--
6 LANGUAGE HEADER DROPDOWN
7 -->
8<#assign currentURL = themeDisplay.getURLCurrent()>
9<#assign baseURL = themeDisplay.getPortalURL()>
10<#assign relativeURL = currentURL?replace(baseURL, "")>
11
12<#assign translatableParams = ["ics", "ctn"] />
13<#assign matchedItemsCache = buildMatchedItemsCache(translatableParams, locale) />
14
15<#assign desc = themeDisplay.getLanguageId()?split("_")?first >
16<div class="select-btn" id="language-select" role="button" aria-haspopup="listbox" aria-expanded="false" tabindex="0">
17 <#assign siteLanguage = themeDisplay.getLocale().getDisplayLanguage( themeDisplay.getLocale() )?cap_first>
18 <span
19 class="sBtn-text text-uppercase d-flex align-content-center align-items-center">${desc} <span
20 class="fa-solid fa-chevron-down" aria-hidden="true"></span></span>
21</div>
22 <ul class="options hide" role="listbox" aria-labelledby="language-select">
23 <li class="option actives" style="pointer-events:none" role="option" aria-selected="true">
24 <span class="option-text">
25 <svg aria-hidden="true" class="lexicon-icon mr-2 lexicon-icon-${themeDisplay.getLanguageId()?replace('_', '-')?lower_case}">
26 <use href="/o/classic-theme/images/clay/icons.svg#${themeDisplay.getLanguageId()?replace('_', '-')?lower_case}"></use>
27 </svg>
28 ${siteLanguage}
29 </span>
30 </li>
31 <#if entries?has_content>
32 <#list entries as curLanguage>
33
34 <#if !curLanguage.isSelected()>
35
36 <p>url:${curLanguage.getURL()}</p>
37 <p>parameter ics:${request.getParameter("ics")}</p>
38 <p>matchedItem en_us:${matchedItemsCache["ics"].value_i18n["en_US"]}</p>
39
40
41 <#assign entryHref = buildTranslatedHref(curLanguage.getURL(), curLanguage.getLanguageId(), translatableParams, matchedItemsCache) />
42 <li class="option" role="option"><span class="option-text"> <a href="${entryHref}" class="language-entry-short-text"
43 lang="${curLanguage.getLanguageId()}">${curLanguage.getLongDisplayName()?capitalize}</a> </span></li>
44
45 </#if>
46 </#list>
47 </#if>
48</ul>
49
50
51<#-- ============================================================
52 Traduccion de parametros de la URL al cambiar de idioma
53 ============================================================ -->
54
55<#function findMatchedItem paramName locale>
56 <#local paramValue = request.getParameter(paramName)! />
57 <#if !paramValue?has_content>
58 <#return "" />
59 </#if>
60
61 <#local paramValueTrim = paramValue?trim />
62 <#local paramType = paramName?upper_case />
63 <#local endpointURL = "/c/selectoptions/?languageId=" + locale?string + "&sort=name:asc&filter=optionsType eq '" + paramType + "'" />
64 <#local optionsResponse = restClient.get(endpointURL) />
65
66 <#list optionsResponse.items![] as item>
67 <#local valueI18n = item.value_i18n![] />
68 <#local found = false />
69
70 <#list valueI18n?keys as key>
71 <#if valueI18n[key]! == paramValueTrim>
72 <#local found = true />
73 <#break />
74 </#if>
75 </#list>
76
77 <#if !found && (item.value!"") == paramValueTrim>
78 <#local found = true />
79 </#if>
80
81 <#if found>
82 <#return item />
83 </#if>
84 </#list>
85
86 <#return "" />
87</#function>
88
89<#function buildMatchedItemsCache paramNames locale>
90 <#local cache = {} />
91 <#list paramNames as paramName>
92 <#local cache = cache + {paramName: findMatchedItem(paramName, locale)} />
93 </#list>
94 <#return cache />
95</#function>
96
97<#function translateParamInURL originalURL paramName targetLanguageId matchedItemsCache>
98
99 <#local matchedItem = matchedItemsCache[paramName]!"" />
100
101 <#if !matchedItem?has_content>
102 <#return originalURL />
103 </#if>
104
105 <#local newValue = matchedItem.value_i18n[targetLanguageId]!matchedItem.value!"" />
106
107 <#if !newValue?has_content>
108 <#return originalURL />
109 </#if>
110
111 <#local regex = "([?&])" + paramName + "=[^&]*" />
112 <#local replacement = "$1" + paramName + "=" + newValue />
113
114 <#return originalURL?replace(regex, replacement, "r") />
115
116</#function>
117
118<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
119 <#local resultURL = originalURL />
120
121 <#list paramNames as paramName>
122 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
123 </#list>
124
125 <#return resultURL />
126</#function>
127
128
129<#macro printObject obj>
130 <#-- Permite hacer un output de un array de objetos o un objeto que se pasa como parámetro -->
131 <#if obj?is_hash>
132 {
133 <#list obj?keys as k>
134 "${k}":
135 <#assign value = obj[k]>
136 <#if value?is_hash || value?is_sequence>
137 <@printObject obj=value/>
138 <#elseif value?is_boolean>
139 ${value?c}
140 <#elseif value?is_number>
141 ${value}
142 <#elseif value?has_content>
143 "${value?string}"
144 <#else>
145 null
146 </#if>
147 <#if k_has_next>, </#if>
148 </#list>
149 }
150 <#elseif obj?is_sequence>
151 [
152 <#list obj as item>
153 <@printObject obj=item/>
154 <#if item_has_next>, </#if>
155 </#list>
156 ]
157 <#elseif obj?is_boolean>
158 ${obj?c}
159 <#elseif obj?is_number>
160 ${obj}
161 <#elseif obj?has_content>
162 "${obj?string}"
163 <#else>
164 null
165 </#if>
166</#macro>
167
168<#-- ============================================================ -->
169
170<script>
171 $(document).ready(function () {
172 // Toggle el estado del menu de idiomas
173 $('.select-btn').on('click', function () {
174 var expanded = $(this).attr('aria-expanded') === 'true';
175 $(this).attr('aria-expanded', !expanded);
176 $('.options').toggleClass('hide', expanded);
177 });
178
179 // Acciones de teclado para la lupa
180 $('.select-btn').on('keydown', function (e) {
181 if (e.key === 'Enter' || e.key === ' ') {
182 e.preventDefault(); // Evitar desplazamiento al presionar espacio
183 $(this).click(); // Simula el click para abrir/cerrar el menu
184 }
185 });
186
187 // Cerrar el menu al hacer clic en cualquier parte fuera de el
188 $(document).on('click', function (event) {
189 if (!$(event.target).closest('.select-btn, .options').length) {
190 $('.options').addClass('hide');
191 $('.select-btn').attr('aria-expanded', 'false');
192 }
193 });
194
195 // Navegar con las teclas de flecha
196 let options = $('.option');
197 let selectedIndex = 0;
198
199 options.on('keydown', function (e) {
200 if (e.key === 'ArrowDown') {
201 selectedIndex = (selectedIndex + 1) % options.length;
202 options.eq(selectedIndex).focus();
203 }
204 if (e.key === 'ArrowUp') {
205 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
206 options.eq(selectedIndex).focus();
207 }
208 if (e.key === 'Enter') {
209 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
210 }
211 });
212 });
213</script>
El producto se ha añadido a la cesta de la compra
Listado normas citadas
-
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}










