Recherchez l’ensemble du site et utilisez des filtres pour affiner votre recherche
Une erreur s'est produite lors du traitement du modèle.
The following has evaluated to null or missing: ==> documentObject.uuid [in template "1757375#1757416#17553084" at line 318, column 103] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign documentUrl = "/c/document_li... [in template "1757375#1757416#17553084" at line 318, column 41] ----
1<#--
2Questo template FreeMarker gestisce la visualizzazione dei risultati di ricerca per Liferay Commerce 7.4,
3includendo articoli, prodotti e documenti scaricabili.
4
5Funzionalità principali:
61. Visualizzazione del numero totale di risultati di ricerca.
72. Gestione multilingua per etichette e contenuti.
83. Visualizzazione di articoli, prodotti e documenti scaricabili.
94. Gestione di immagini e link per ogni tipo di contenuto.
105. Implementazione di un selettore di lingua per i documenti scaricabili.
116. Gestione dell'accesso ai documenti basata sullo stato di login dell'utente.
127. Visualizzazione di badge di stato per i prodotti.
13
14Entità principali:
151. JournalArticle: Rappresenta articoli di contenuto generico e documenti scaricabili.
162. CPDefinition e CPInstance: Rappresentano prodotti nel catalogo di Liferay Commerce.
173. DDMStructure e DDMFormValues: Gestiscono la struttura e i valori dei campi dinamici.
18
19Servizi utilizzati:
20- DDMFieldLocalService: Per accedere ai campi di strutture dinamiche.
21- JournalArticleLocalService: Per recuperare articoli di contenuto.
22- CPDefinitionLocalService: Per accedere alle definizioni dei prodotti.
23- CPDefinitionSpecificationOptionValueLocalService e CPSpecificationOptionLocalService:
24 Per gestire le specifiche dei prodotti.
25- RestClient: Per effettuare chiamate API RESTful.
26
27Processo:
281. Definizione delle etichette multilingua.
292. Determinazione del percorso base del sito.
303. Iterazione sui risultati della ricerca (entries).
314. Per ogni entry:
32 a. Determinazione del tipo di contenuto (articolo, prodotto, documento).
33 b. Estrazione di titolo, descrizione, immagine e link.
34 c. Per i documenti, gestione delle versioni in diverse lingue e controllo dell accesso.
35 d. Per i prodotti, recupero e visualizzazione delle specifiche e dello stato del prodotto.
365. Visualizzazione dei risultati formattati in base al tipo di contenuto.
37
38Note per gli sviluppatori:
39- Assicurarsi che tutti i servizi necessari siano disponibili nel contesto FreeMarker.
40- Le etichette multilingua sono gestite tramite language keys di Liferay.
41- La struttura dei campi per articoli e documenti è basata su strutture DDM personalizzate.
42- L accesso ai documenti è controllato tramite la variabile loginRequiredForDownload.
43- Il selettore di lingua per i documenti utilizza JavaScript per l interattività.
44- La gestione delle immagini e dei link varia a seconda del tipo di contenuto.
45- Lo stato del prodotto è recuperato tramite una chiamata API REST.
46
47Personalizzazione:
48- Per aggiungere nuove lingue, seguire le istruzioni nel commento --COME AGGIUNGERE UNA NUOVA LINGUA-- .
49- Per modificare la visualizzazione, adattare le sezioni HTML/CSS corrispondenti.
50- Per aggiungere nuovi tipi di contenuto, creare nuove condizioni nell iterazione principale.
51
52Debugging:
53- Utilizzare i console.log sparsi nel codice per il debugging.
54- Controllare la console del browser per eventuali errori o output di debug.
55
56Riferimenti:
57- Liferay Commerce Developer Guide: https://learn.liferay.com/commerce/latest/en/developer-guide.html
58- FreeMarker in Liferay: https://learn.liferay.com/dxp/latest/en/developing-applications/developing-a-java-web-application/using-jsps/freemarker-templates.html
59- Liferay 7.4 API Documentation: https://docs.liferay.com/dxp/portal/7.4-latest/javadocs/
60-->
61
62<#--
63COME AGGIUNGERE UNA NUOVA LINGUA
64PROCEDURA:
65
661) Aggiungere nuovo campo all interno della struttura dei documenti
672) Aggiungere un nuovo language overidde per la gestione dell etichetta nel multi-lingua
683) Assegnare il valore della language overidde ad una variabile freemarker - segui il pattern qui sotto
694) Aggiungere le nuove lingue alla variabile freemarker "languages". Aggiungi seguendo questo pattern: {"ref": "chiaveStrutturaCampoLingua", "code": variabilelabel}
70
71Ricordati di eseguire l'operazione anche all'interno del web content template : "Documents"
72-->
73
74<div class="search-total-label">
75 <#if searchContainer.getTotal() == 1>
76 ${languageUtil.format(locale, "x-result-for-x", [searchContainer.getTotal(), "<strong>" + htmlUtil.escape(searchResultsPortletDisplayContext.getKeywords()) + "</strong>"], false)}
77 <#else>
78 ${languageUtil.format(locale, "x-results-for-x", [searchContainer.getTotal(), "<strong>" + htmlUtil.escape(searchResultsPortletDisplayContext.getKeywords()) + "</strong>"], false)}
79 </#if>
80</div>
81
82<#assign englishLabel>
83 <@liferay.language key='scame-label-english' />
84</#assign>
85
86<#assign frenchLabel>
87 <@liferay.language key='scame-label-french' />
88</#assign>
89
90<#assign germanLabel>
91 <@liferay.language key='scame-label-german' />
92</#assign>
93
94<#assign italianLabel>
95 <@liferay.language key='scame-label-italian' />
96</#assign>
97
98<#assign latvianLabel>
99 <@liferay.language key='scame-label-latvian' />
100</#assign>
101
102<#assign lithuanianLabel>
103 <@liferay.language key='scame-label-lithuanian' />
104</#assign>
105
106<#assign portugueseLabel>
107 <@liferay.language key='scame-label-portuguese' />
108</#assign>
109
110<#assign romanianLabel>
111 <@liferay.language key='scame-label-romanian' />
112</#assign>
113
114<#assign spanishLabel>
115 <@liferay.language key='scame-label-spanish' />
116</#assign>
117
118<#assign swedishLabel>
119 <@liferay.language key='scame-label-swedish' />
120</#assign>
121
122<#assign arabicLabel>
123 <@liferay.language key='scame-label-arabic' />
124</#assign>
125
126<#assign slovakLabel>
127 <@liferay.language key='scame-label-slovak' />
128</#assign>
129
130<#assign turkishLabel>
131 <@liferay.language key='scame-label-turkish' />
132</#assign>
133
134<#assign generalCatalog>
135 <@liferay.language key='scame-general-catalog' />
136</#assign>
137
138<#assign seriesCatalog>
139 <@liferay.language key='scame-series-catalog' />
140</#assign>
141
142<#assign labelLanguage>
143<@liferay.language key="scame-label-language" />
144</#assign>
145
146<#assign labelRestrictedAccess>
147 <@liferay.language key='scame-label-restricted-access' />
148</#assign>
149
150<#assign labelFreeAccess>
151 <@liferay.language key='scame-label-free-access' />
152</#assign>
153
154<#assign ctaDownloadForDocument>
155 <@liferay.language key='scame-cta-download-for-document' />
156</#assign>
157
158<#assign ctaLoginPage>
159 <@liferay.language key='scame-cta-login-page' />
160</#assign>
161
162<#assign textSelectLanguage>
163 <@liferay.language key='selectLanguage' />
164</#assign>
165
166<div class="display-list">
167 <#assign defaultTitle = "Default Title"/>
168 <#assign defaultDescription = "Default Description"/>
169 <#assign defaultImage = themeDisplay.getScopeGroup().getExpandoBridge().getAttribute("path-default-image")/>
170 <#assign defaultImageProduct = themeDisplay.getScopeGroup().getExpandoBridge().getAttribute("path-default-image-product") />
171 <#assign defaultLink = "/web/scame-global/"/>
172
173 <#assign ddmFieldLocalService = serviceLocator.findService("com.liferay.dynamic.data.mapping.service.DDMFieldLocalService")/>
174 <#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")/>
175 <#assign commerceProductLocalService = serviceLocator.findService("com.liferay.commerce.product.service.CPDefinitionLocalService")/>
176 <#assign cpDefinitionSpecificationOptionValueLocalService = serviceLocator.findService("com.liferay.commerce.product.service.CPDefinitionSpecificationOptionValueLocalService") />
177 <#assign cpSpecificationOptionLocalService = serviceLocator.findService("com.liferay.commerce.product.service.CPSpecificationOptionLocalService")/>
178 <#--
179 <#assign baseGroupUrl = themeDisplay.getSiteGroup().getDisplayURL(themeDisplay, false) />
180 <script>console.log("url base: ${baseGroupUrl?js_string}")</script>
181 -->
182
183 <#assign isSignedIn = themeDisplay.isSignedIn() />
184
185 <#assign languages = [
186 {"ref": "engDocument", "code": englishLabel },
187 {"ref": "itaDocument", "code": italianLabel},
188 {"ref": "spDocument", "code": spanishLabel},
189 {"ref": "ptDocument", "code": portugueseLabel},
190 {"ref": "frDocument", "code": frenchLabel},
191 {"ref": "deDocument", "code": germanLabel},
192 {"ref": "svDocument", "code": swedishLabel},
193 {"ref": "roDocument", "code": romanianLabel},
194 {"ref": "ltDocument", "code": latvianLabel},
195 {"ref": "lvDocument", "code": lithuanianLabel},
196 {"ref": "arDocument", "code": arabicLabel},
197 {"ref": "skDocument", "code": slovakLabel},
198 {"ref": "trDocument", "code": turkishLabel}
199 ]/>
200
201 <#assign current_url = currentURL>
202
203 <#assign lang_prefixes = ["/it/", "/es/", "/en/", "/fr/", "/de/"]/>
204 <#assign has_lang = false/>
205 <#assign lang_path = ""/>
206 <#list lang_prefixes as prefix>
207 <#if current_url?contains(prefix)>
208 <#assign has_lang = true/>
209 <#assign lang_path = prefix/>
210 <#break>
211 </#if>
212 </#list>
213
214 <#assign segments = current_url?split("/")/>
215
216 <#if has_lang>
217 <#assign default_path = "/${segments[3]}/${segments[4]}/${segments[5]}/"/>
218 <#else>
219 <#assign default_path = "/${segments[3]}/${segments[4]}/"/>
220 </#if>
221
222 <assign entryType = ""/>
223
224 <#if entries?has_content>
225 <#list entries as entry>
226 <#assign title = defaultTitle/>
227 <#assign imageUrl = defaultImage/>
228 <#assign description = defaultDescription/>
229 <#assign finalLink = entry.getViewURL() />
230 <#assign loginRequiredForDownload = "false" />
231
232 <#assign displayImage = true/>
233 <#assign documentUrls = {}>
234
235 <#if entry.getClassName() == "com.liferay.journal.model.JournalArticle">
236 <#assign entryType = "article"/>
237
238 <#assign classPK = entry.getClassPK()/>
239 <#assign journalArticle = journalArticleLocalService.fetchLatestArticle(classPK)/>
240 <#if journalArticle??>
241 <#assign document = saxReaderUtil.read(journalArticle.getContent())/>
242 <#assign rootElement = document.getRootElement()>
243 <#assign ddmStructure = journalArticle.getDDMStructure()/>
244 <#assign ddmForm = ddmStructure.getDDMForm()/>
245 <#assign ddmFormValues = ddmFieldLocalService.getDDMFormValues(ddmForm, journalArticle.getId()) />
246 <#assign ddmFormFieldValues = ddmFormValues.getDDMFormFieldValues() />
247
248 <#list ddmFormFieldValues as fieldName>
249 <#if fieldName.getFieldReference() == 'description'|| fieldName.getFieldReference()== 'image'>
250 <#assign entryType = "download"/>
251 </#if>
252 </#list>
253
254 <#list ddmFormFieldValues as fieldName>
255 <#if entryType == "article">
256 <#if fieldName.getFieldReference() == 'title'>
257 <#assign title = fieldName.getValue().getString(locale) />
258 <#elseif fieldName.getFieldReference() == 'smallDescription' >
259 <#assign description = fieldName.getValue().getString(locale) />
260 <#elseif fieldName.getFieldReference() == 'previewImage'>
261 <#assign imageObjectString = fieldName.getValue().getString(locale) />
262 <#if imageObjectString?is_string && imageObjectString != "" && imageObjectString != "{}">
263 <#assign imageObject = jsonFactoryUtil.createJSONObject(imageObjectString)>
264 <#if imageObject.has("url")>
265 <#assign imageUrl = imageObject.getString("url") />
266 <#-- <script>console.log('imageUrl: ${imageUrl?js_string}')</script> -->
267 </#if>
268 </#if>
269 <#elseif fieldName.getFieldReference() == 'linkToDetailPage'>
270 <#assign linkObjectString = fieldName.getValue().getString(locale) />
271 <#if linkObjectString?is_string && linkObjectString != "" && linkObjectString != "{}">
272 <#assign linkObject = jsonFactoryUtil.createJSONObject(linkObjectString) />
273 <#if linkObject.has("name")>
274 <#assign fullLink = linkObject.getString("name") />
275 <#assign lastPartOfLinkRaw = fullLink?split(" > ")?last />
276 <#assign lastPartOfLink = convertToURLFriendlyString(lastPartOfLinkRaw) />
277 <#assign finalLink = default_path + lastPartOfLink />
278 </#if>
279 </#if>
280 </#if>
281 <#elseif entryType = "download">
282 <#if fieldName.getFieldReference() == 'title'>
283 <#assign title = fieldName.getValue().getString(locale) />
284 <#elseif fieldName.getFieldReference() == 'image'>
285 <#assign imageObjectString = fieldName.getValue().getString(locale)>
286 <#if imageObjectString?is_string && imageObjectString != "" && imageObjectString != "{}">
287 <#assign imageObject = jsonFactoryUtil.createJSONObject(imageObjectString)>
288 <#if imageObject.has("url")>
289 <#assign imageUrl = imageObject.getString("url")>
290 </#if>
291 </#if>
292 <#elseif fieldName.getFieldReference() == 'description'>
293 <#assign description = fieldName.getValue().getString(locale) />
294 <#elseif fieldName.getFieldReference() == 'typeOfCatalog'>
295 <#assign typeOfCatalog = fieldName.getValue().getString(locale)>
296 <#if (typeOfCatalog != "Option75196029")>
297 <#if (typeOfCatalog == 'Option42672553')>
298 <#assign typeOfCatalog = generalCatalog />
299 <#elseif (typeOfCatalog == 'Option47412803')>
300 <#assign typeOfCatalog = seriesCatalog />
301 </#if>
302 </#if>
303
304 <#elseif fieldName.getFieldReference() == 'visabilityDocument'>
305 <#assign downloadableByLoggedInUser = fieldName.getValue().getString(locale)>
306 <#if (downloadableByLoggedInUser == "opzione50448385")>
307 <#assign loginRequiredForDownload = "true" />
308 </#if>
309
310 <#elseif fieldName.getFieldReference() == 'idCatalog'>
311 <#assign idCatalog = fieldName.getValue().getString(locale) />
312 <#else>
313 <#list languages as lang>
314 <#if fieldName.getFieldReference() == lang.ref>
315 <#assign stringObject = fieldName.getValue().getString(locale)>
316 <#if stringObject?is_string && stringObject != "" && stringObject != "{}">
317 <#assign documentObject = jsonFactoryUtil.createJSONObject(stringObject)>
318 <#assign documentUrl = "/c/document_library/get_file?uuid=" + documentObject.uuid + "&groupId=" + documentObject.groupId>
319 <#-- <script>console.log("TEST: ${documentUrl?js_string}")</script> -->
320 <#assign documentUrls = documentUrls + {lang.code: documentUrl}/>
321 <#if lang.code == englishLabel>
322 <#assign default_url = documentUrl/>
323 </#if>
324 </#if>
325 </#if>
326 </#list>
327 </#if>
328 </#if>
329 </#list>
330 </#if>
331 <#elseif entry.getClassName() == "com.liferay.commerce.product.model.CPDefinition">
332 <#--
333 Documentazione:
334 REST API:
335 https://learn.liferay.com/w/dxp/site-building/creating-pages/page-fragments-and-widgets/using-widgets/styling-widgets/creating-a-widget-template#calling-headless-apis-in-the-template-editor
336 https://help.liferay.com/hc/en-us/articles/360031163631-Filter-Sort-and-Search
337 -----------------------------------------------------------------
338 Processo per la gestione dei prodotti:
339 1. Verifica se l entry è una CPDefinition.
340 2. Recupera il CPDefinition del prodotto.
341 3. Ottiene il nome, la descrizione e il codice ERC del prodotto.
342 4. Recupera l ID del CPDefinition e del CProduct.
343 5. Effettua una chiamata API REST per ottenere lo stto del prodotto.
344 6. Determina la classe del badge e il testo dell etichetta in base allo stato del prodotto.
345 7. Ottiene tutte le specifiche del prodotto (CPDefinitionSpecificationOptionValues).
346 8. Gestisce l immagine del prodotto, utilizzando un immagine predefinita se necessario.
347 9. Crea il link alla pagina di dettaglio del prodotto.
348 10. Visualizza le informazioni del prodotto, incluso il badge di stato.
349 -----------------------------------------------------------------
350 -->
351 <#assign entryType = "product"/>
352 <#assign product = commerceProductLocalService.getCPDefinition(entry.getClassPK()) />
353 <#if product??>
354 <#assign title = ""/>
355 <#assign
356 badgeClass = ""
357 labelText = ""
358 />
359
360 <#assign codProduct = product.getName(locale)! />
361 <#assign description = product.getShortDescription(locale)! />
362 <#assign ercCode = product.getCProduct().getExternalReferenceCode()! />
363
364 <#assign CPDefinitionId = product.getCPDefinitionId() />
365 <#assign CProductId = product.getCProductId() />
366
367 <#assign
368 scopeGroupId = themeDisplay.getScopeGroupId()
369 CProductId = CProductId!""
370 url = "/c/productextensions/scopes/${scopeGroupId}?filter=r_product_CPDefinitionId%20eq%20%27${CProductId}%27"
371 productExtensions = restClient.get(url).items
372 />
373
374 <#if productExtensions?has_content>
375 <#list productExtensions as item>
376 <#if item.productStatus??>
377 <#if item.productStatus.key == "low">
378 <#assign badgeClass= "badge-warning" />
379 <#elseif item.productStatus.key == "newProduct">
380 <#assign badgeClass= "badge-success" />
381 <#elseif item.productStatus.key == "outOfProduction">
382 <#assign badgeClass= "badge-danger" />
383 <#else>
384 <#assign badgeClass= "no-badge" />
385 </#if>
386 <#assign labelText = item.productStatus.name />
387 </#if>
388 </#list>
389 <#else>
390 <script>console.log('No product extensions found.')</script>
391 </#if>
392
393 <#assign commercialSeries = "">
394 <#assign specificationValues = product.getCPDefinitionSpecificationOptionValues() />
395
396 <#if specificationValues?? && specificationValues?has_content>
397 <ul>
398 <#list specificationValues as spec>
399 <#assign cpSpecificationOption = cpSpecificationOptionLocalService.getCPSpecificationOption(spec.getCPSpecificationOptionId())>
400 <#assign label = cpSpecificationOption.getKey()!''>
401 <#-- <script>console.log("label: ${label?js_string}, value: ${spec.getValue(locale)}")</script> -->
402 <#if label == "descrizione-sintetica">
403 <#assign title = spec.getValue(locale) />
404 </#if>
405 <#if label == "material-series">
406 <#assign commercialSeries = spec.getValue(locale)>
407 </#if>
408 </#list>
409 </ul>
410 </#if>
411
412 <#if CPDefinitionId??>
413 <#assign imageFileEntry = commerceProductLocalService.getDefaultImageCPAttachmentFileEntry(CPDefinitionId)!"">
414 <#if imageFileEntry??>
415 <#assign imageString = imageFileEntry?string />
416 <#assign imageObject = jsonFactoryUtil.createJSONObject(imageString) />
417 <#assign CPAttachmentfileEntryId = imageObject.getLong("CPAttachmentFileEntryId") />
418 </#if>
419 <#else>
420 <#assign CPAttachmentfileEntryId = null />
421 <script>console.log('CPAttachmentfileEntryId non recuperato')</script>
422 </#if>
423
424 <#if CPAttachmentfileEntryId?? && CPAttachmentfileEntryId != 0>
425 <#assign imagePath = "/o/commerce-media/accounts/0/images/" + CPAttachmentfileEntryId />
426 <#assign imageUrl = imagePath />
427 <#else>
428 <#assign imageUrl = defaultImageProduct />
429 </#if>
430
431 <#if codProduct??>
432 <#-- default_path = path di default del portale -->
433 <#assign pathDetailProductPage = default_path + "p/" + codProduct />
434 <#assign finalLink = pathDetailProductPage />
435 <#else>
436 <script>console.log('path non funzionante')</script>
437 </#if>
438 <#else>
439 <script>console.log('prodotto inesistente')</script>
440 </#if>
441 </#if>
442
443 <#if entryType = "download">
444 <div class="document-container">
445 <div class="row">
446 <div class="details-container col-md-8 d-flex">
447 <#if (imageUrl??)>
448 <img
449 class="image"
450 src="${imageUrl}"
451 />
452 </#if>
453 <div class="details ml-3">
454 <h2 class="title typo18">
455 <#if (title??)>
456 ${title}
457 </#if>
458 </h2>
459 <div class="description typo16">
460 <#if (description??)>
461 ${description}
462 </#if>
463 </div>
464
465 <div class="download-info">
466 <#if isSignedIn>
467 <div class="free-access">
468 <span class="icon" aria-hidden="true">🔓</span> <!-- icona di lucchetto aperto -->
469 <span class="text">Disponibile per il download</span>
470 </div>
471 <#elseif (loginRequiredForDownload == 'true')>
472 <div class="restricted-access">
473 <span class="icon" aria-hidden="true">🔒</span> <!-- icona di lucchetto chiuso -->
474 <span class="text">${labelRestrictedAccess}</span>
475 </div>
476 <#else>
477 <div class="free-access">
478 <span class="icon" aria-hidden="true">🔓</span> <!-- icona di lucchetto aperto -->
479 <span class="text">${labelFreeAccess}</span>
480 </div>
481 </#if>
482 </div>
483
484 <#if (ttypeOfCatalog??)>
485 <#if (typeOfCatalog != "Option75196029")>
486 <div class="catalog d-flex align-items-center">
487 <div class="typeOfCatalog typo14 mr-3">
488 ${typeOfCatalog}
489 </div>
490 <div class="idCatalog typo16">
491 <#if (idCatalog??)>
492 ${idCatalog}
493 </#if>
494 </div>
495 </div>
496 </#if>
497 </#if>
498 </div>
499 </div>
500 <div class="selection-and-download-container col-md-4">
501 <div class="d-flex align-items-center">
502 <div class="selection d-flex flex-column">
503 <label for="documentSelector">
504 ${labelLanguage}
505 </label>
506 <div class="inner-select-download d-flex align-items-center">
507 <select id="documentSelector" class="documentSelector" name="documentSelector">
508 <option value="" disabled selected hidden>${textSelectLanguage?cap_first}</option>
509 <#list documentUrls?keys as langCode>
510 <option value="${documentUrls[langCode]}">${langCode}</option>
511 </#list>
512 </select>
513 <#if isSignedIn>
514 <@downloadButton/>
515 <#elseif (loginRequiredForDownload == 'true')>
516 <#assign fullUrlSite = themeDisplay.getSiteGroup().getDisplayURL(themeDisplay, false) />
517 <#assign pathPortal = fullUrlSite?replace("^[^/]+//[^/]+", "", "r") />
518 <#assign loginUrl = pathPortal + "/myscame" />
519
520 <a href="${loginUrl}" class="cta diagonal-arrow-link" target="_blank">
521 ${ctaLoginPage}
522 </a>
523 <#else>
524 <@downloadButton/>
525 </#if>
526 </div>
527 </div>
528 </div>
529 </div>
530 </div>
531 </div>
532 <#else>
533 <a href="${finalLink}">
534 <div class="scame-card-result ${entryType} <#if entryType == 'product'> badge-enabled ${badgeClass} </#if>">
535 <div class="image-container ${entryType}">
536 <img class="${entryType}" src="${imageUrl}">
537 </div>
538 <div class="details ${entryType}">
539 <div class="title typo25">
540 ${title}
541 </div>
542 <#if entryType = "product">
543 <#if commercialSeries != "">
544 <div class="commercial-series typo18">
545 ${commercialSeries}
546 </div>
547 </#if>
548 </#if>
549 <div class="description typo16">
550 ${description}
551 </div>
552 <#if entryType = "product">
553 <#if codProduct != "">
554 <div class="cod-product typo14">
555 Cod. ${codProduct}
556 </div>
557 </#if>
558 </#if>
559 <#if entryType = "product">
560 <span class="badge badge-pill ${badgeClass} aspect-ratio-item-top-left">
561 <span class="label-text">${labelText}</span>
562 </span>
563 </#if>
564 </div>
565 </div>
566 </a>
567 </#if>
568 <hr>
569 </#list>
570 </#if>
571</div>
572
573<#macro downloadButton>
574 <a href="#" class="download-document cta diagonal-arrow-link disabled-link" download="">
575 ${ctaDownloadForDocument}
576 </a>
577</#macro>
578
579<#function convertToURLFriendlyString(input)>
580 <#assign output = input?replace(" ", "-")>
581 <#assign output = output?replace(",", "-")>
582 <#assign output = output?replace("--", "-")>
583 <#return output?lower_case>
584</#function>
585
586<script>
587 $(document).ready(function() {
588 $('.documentSelector').change(function() {
589 var selectedLink = $(this).val();
590 var downloadLink = $(this).closest('.inner-select-download').find('.download-document');
591
592 if (selectedLink) {
593 // Rimuove la classe 'disabled-link', abilita il link e aggiorna l'href
594 downloadLink.removeClass('disabled-link');
595 downloadLink.attr('href', selectedLink);
596 } else {
597 // Aggiunge la classe 'disabled-link' per disabilitare il link e rimuove l'href
598 downloadLink.addClass('disabled-link');
599 downloadLink.attr('href', '#');
600 }
601 });
602 });
603</script>