Construction worktools
An error occurred while processing the template.
Java method "com.sun.proxy.$Proxy1079.getObjectDefinition(long)" threw an exception when invoked on com.sun.proxy.$Proxy1079 object "com.liferay.object.service.impl.ObjectDefinitionServiceImpl@29b77dab"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign className = objectDefinitionS... [in template "14306307#14306335#12373263" at line 14, column 1] ----
1<#include "${templatesPath}/10241186">
2<#assign objectDefinitionId = 9471223>
3<#assign objectDefinitionService = serviceLocator.findService("com.liferay.object.service.ObjectDefinitionService")>
4<#assign objectEntryLocalService = serviceLocator.findService("com.liferay.object.service.ObjectEntryLocalService")>
5<#assign objectRelationshipService = serviceLocator.findService("com.liferay.object.service.ObjectRelationshipService")>
6<#assign classNameLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.ClassNameLocalService")>
7<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")>
8<#assign dlFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")>
9<#assign cpAttachmentFileEntryService = serviceLocator.findService("com.liferay.commerce.product.service.CPAttachmentFileEntryService")>
10<#assign assetCategoryPropertyService = serviceLocator.findService("com.liferay.asset.category.property.service.AssetCategoryPropertyService")>
11<#assign dlAppServiceUtil = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppService")/>
12<#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")>
13<#assign friendlyURLEntryLocalService = serviceLocator.findService("com.liferay.friendly.url.service.FriendlyURLEntryLocalService")>
14<#assign className = objectDefinitionService.getObjectDefinition(objectDefinitionId).getClassName() />
15<#assign classNameId = classNameLocalService.getClassNameId(className) />
16<#assign groupId = themeDisplay.getScopeGroupId()>
17<#assign portalURL = themeDisplay.getPortalURL()>
18<#assign assetCategoryClassName = "com.liferay.asset.kernel.model.AssetCategory" />
19<#assign assetCategoryClassNameId = classNameLocalService.getClassNameId(assetCategoryClassName) />
20<section class="grid-productos pt-40 pb-40 m-pt-20 m-pb-20">
21 <div class="cc">
22
23 <div class="toggle-sys mb-30 tar df aic jce p-20 bg-white" id="metric-imperial-button">
24 <label class="font-12 mr-10"><@liferay_ui["message"] key="finanzauto.products.unidades.medida" /> : </label>
25 <div class="dfc mt-0 mb-0">
26 <p onclick="toggleElements('metric')" id="metric"
27 class="cp mt-0 btn-master bg-primary h-40 "><@liferay_ui["message"] key="finanzauto.products.metrico" /></p>
28 <p onclick="toggleElements('imperial')" id="imperial"
29 class="cp mt-0 btn-master ml-10 h-40"><@liferay_ui["message"] key="finanzauto.products.imperial" /></p>
30 </div>
31 <#-- <button onclick="toggleElements()" id="toggleButton" class="btn-master bg-primary h-40 c-white">Imperial</button> -->
32 </div>
33<#assign articleId = .vars['reserved-article-id'].data />
34<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
35<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
36<#assign article = journalArticleLocalService.getArticle(getterUtil.getLong(scopeGroupId), articleId) />
37<#assign asset = assetEntryLocalService.getEntry('com.liferay.journal.model.JournalArticle', article.resourcePrimKey) />
38<#assign categories =asset.getCategories() />
39
40 <#if categories?has_content>
41 <#list categories as curAssetCategory>
42 <#assign categoryId = curAssetCategory.getCategoryId() />
43 <#assign categoryProperties = assetCategoryPropertyService.getCategoryProperties(categoryId)/>
44 ${curAssetCategory.setName("99")}
45 <#list categoryProperties as categoryProperty>
46 <#assign key=categoryProperty["key"]/>
47 <#if (key == "SORT") >
48 ${curAssetCategory.setName(categoryProperty["value"])}
49 </#if>
50 </#list>
51 </#list>
52
53 <#assign categories = categories?sort_by("name")>
54 <#list categories as curAssetCategory>
55 <#assign categoryHreflist = friendlyURLEntryLocalService.getFriendlyURLEntries(groupId,assetCategoryClassNameId, curAssetCategory.categoryId)/>
56 <#list categoryHreflist as categoryHref>
57 <#assign categoryHrefLocale = friendlyURLEntryLocalService.getFriendlyURLEntryLocalization(categoryHref.getFriendlyURLEntryId(),locale)/>
58 </#list>
59 <#-- ------------- Saber si mostramos el "Ver todos" ------------- -->
60 <#assign showChilds = true />
61 <#assign categoryProperties = assetCategoryPropertyService.getCategoryProperties(categoryId)/>
62 <#list categoryProperties as categoryProperty>
63 <#assign key=categoryProperty["key"]/>
64 <#if (key == "DONT_SHOW_CHILDS") >
65 <#assign showChilds = true />
66 </#if>
67 </#list>
68 <#assign categoryHref = "/${categoryHrefLocale.getUrlTitle()?replace('/g/','/')}"/>
69 <#assign categoryName = curAssetCategory.getTitle(locale) />
70 <#assign categoryId = curAssetCategory.getCategoryId() />
71 <#assign allObjectsValues =[] />
72
73 <#-- ------------- Productos de la categoria ------------- -->
74 <#assign hits = assetEntryLocalService.search(companyId,[groupId],0,className,"","","",categoryId+"","",0,true,0,99).getDocs()>
75 <#-- ------------- Si no hay productos, mostramos los de sus hijos ------------- -->
76 <#if (hits?size==0) >
77 <#assign childCategories = assetCategoryLocalService.getSubcategoryIds(categoryId)/>
78 <#if (childCategories?size>0)>
79 <#assign hits = assetEntryLocalService.search(companyId,[groupId],0,className,"","","",childCategories?join(","),"",0,true,0,99).getDocs()>
80 </#if>
81 </#if>
82 <#if (hits?size>0) >
83 <div class="carousel-section mb-60 m-mb-40">
84 <div class="subcategory mb-20">
85 <#assign urlCategory =categoryHref?replace('/g/','/') />
86 <#if showChilds>
87 <h2 class="font-20 c-neutral900 dfc"><a class="dfc ml-5 underline m-mc"
88 href="${urlCategory}">${categoryName}
89 </a>
90 <p class="font-16 ml-5">(${hits?size})</p>
91 </h2>
92 <a href="${urlCategory}"><span
93 class="underline bold"><@liferay_ui["message"] key="finanzauto.products.ver.todos" /></span>
94 <i class="bi bi-arrow-right bold"></i></a>
95 <#else>
96 <h2 class="font-20 c-neutral900 dfc">${categoryName} <p class="font-16 ml-5">
97 (${hits?size})</p>
98 </h2>
99 </#if>
100 </div>
101 <ul class="df product-carousel product-carousel${curAssetCategory?index}">
102 <#assign hideLoadCarousel = "" />
103 <#list hits as hit>
104 <#assign objectId = hit.entryClassPK?number />
105 <#-- ------------- Valores del producto ------------- -->
106 <#assign values = objectEntryLocalService.getValues(objectId) />
107 <#assign values = values + {"objectId": objectId}>
108 <#assign allObjectsValues = allObjectsValues + [values] />
109 </#list>
110 <#assign allObjectsValues = allObjectsValues?sort_by("names")>
111 <#list allObjectsValues as values>
112 <#assign imageList = [] />
113 <#-- ------------- Imagen del producto ------------- -->
114 <#assign attachmentFiles = cpAttachmentFileEntryService.getCPAttachmentFileEntries(classNameId, values.objectId, 0, 0, -1, -1) />
115 <#list attachmentFiles as attachmentFile>
116 <#attempt>
117 <#assign image = dlFileEntryLocalService.getFileEntry(attachmentFile.getFileEntryId())/>
118 <#if (image.extension=="jpg"|| image.extension=="jpeg"||image.extension=="png")
119 && !image.fileName?contains("features") && !image.fileName?contains("no2dimage2davailable")
120 && !image.fileName?contains("no-image-available")>
121 <#assign imageList = imageList + [image] />
122 </#if>
123 <#recover>
124 </#attempt>
125 </#list>
126
127 <#assign image = -1>
128 <#assign imageList = imageList?sort_by("fileName")>
129 <#if (imageList?size>0)>
130 <#assign image = imageList[0]>
131 <#else><#-- Fotos personalizadas -->
132 <#assign imagesRelationshipId = objectRelationshipService.getObjectRelationship(objectDefinitionId, "images").getObjectRelationshipId() >
133 <#assign images=objectEntryLocalService.getOneToManyObjectEntries(groupId, imagesRelationshipId, values.objectId, true, -1, -1)>
134 <#list images as image>
135 <#assign fileId = image.getValues()["image"]>
136 <#attempt>
137 <#assign file = dlFileEntryLocalService.getFileEntry(fileId)>
138 <#assign imageList = imageList + [file]>
139 <#recover>
140 </#attempt>
141 </#list>
142
143 <#assign imageList = imageList?sort_by("fileName")>
144 <#if (imageList?size>0)>
145 <#assign image = imageList[0]>
146 </#if>
147 </#if>
148 <#-- ------------- Valores del producto ------------- -->
149 <li class="${hideLoadCarousel}">
150
151 <#if locale=="es_ES" && values.productUrlEs!="" >
152 <a href="/productos/${values.productUrlEs}" class="w-card w-100 product h-100">
153 <#elseif values.productUrlEn!="">
154 <a href="/en/products/${values.productUrlEn}"
155 class="w-card w-100 product h-100">
156 <#else>
157 <a href="/productos/${values.productUrlEs}" class="w-card w-100 product h-100">
158 </#if>
159
160 <span class="image p-15">
161 <#if (image?? && (!image?is_number)) >
162 <img class="ofc" loading="lazy"
163 src="${portalURL}/o/adaptive-media/image/${image.getFileEntryId()}/Thumbnail-300x300/${image.fileName}"/>
164 <#else>
165 <img class="ofc" src="/o/finanzauto-theme/images/no-photo.jpg"/>
166 </#if>
167 </span>
168 <span class="container">
169 <span class="c-title bb-gray2 pt-10 pb-20 mb-10 dfc sb">
170 <p class="underline bold font-15">
171 ${getLanguage(values.names)}
172 </p>
173 <span class="card-chevron dfcc w-28 h-28 border-white br-50 circle-white"><i
174 class="bi bi-chevron-right bold"></i></span>
175 </span>
176
177 <span>
178 ${getLanguageSection(values.featuredSpecifications)}
179 </span>
180 </span>
181
182 <p style="display:none;" class="product-category">${categoryName}</p>
183 <p style="display:none;" class="product-brand">${values.brand}</p>
184 <p style="display:none;" class="product-id">${values.objectId}</p>
185 </a>
186 </a>
187 </li>
188
189 <#if values?index == 3 >
190 <#assign hideLoadCarousel>display:none</#assign>
191 </#if>
192 </#list>
193 </ul>
194 </div>
195 </#if>
196
197 </#list>
198 </#if>
199
200 </div>
201</section>
202
203
204<style>
205 .toggle-sys:not(:first-of-type) {
206 display: none;
207 }
208
209 .caterpillar #metric, .caterpillar #imperial {
210 border: 1px solid #fc0;
211 }
212
213 #metric, #imperial {
214 margin-left: 0px;
215 max-height: 30px;
216 border: 1px solid #e4032e;
217 }
218
219 #metric:not(.bg-primary) {
220 font-weight: normal !important;
221 }
222
223 #imperial:not(.bg-primary) {
224 font-weight: normal !important;
225 }
226
227 div.subcategory {
228 display: flex;
229 justify-content: space-between;
230 }
231
232 div.featuredspecifications div {
233 display: flex;
234 justify-content: space-between;
235 }
236
237 div.featuredspecifications div p.name {
238 color: #333D48;
239 font-size: 0.88rem;
240 line-height: 1.13rem;
241 }
242
243 div.featuredspecifications div p.value {
244 font-weight: bold;
245 margin-top: 0px;
246 font-size: 1rem;
247 line-height: 1.5rem;
248 letter-spacing: 0.5px;
249 text-align: right;
250 }
251
252 ul.product-carousel:not(.tns-carousel) {
253 display: grid;
254 grid-template-columns: 1fr 1fr 1fr 1fr;
255 gap: 15px;
256 }
257
258 .product-carousel.tns-carousel > li {
259 display: inline-block !important;
260 }
261
262 .image-selector .tns-nav button {
263 width: 10px;
264 height: 10px;
265 padding: 0px;
266 margin: 0px;
267 }
268
269
270 .tns-outer {
271 display: grid;
272 grid-template:
273 "a a"
274 "b c";
275 }
276
277 .tns-controls {
278 grid-area: c;
279 display: flex;
280 justify-content: flex-end;
281 padding-right: 10px;
282 }
283
284 .tns-nav {
285 grid-area: b;
286 }
287
288 .tns-ovh {
289 grid-area: a;
290 }
291
292 .tns-controls button {
293 width: 32px;
294 height: 32px;
295 border-radius: 50%;
296 border: 0px;
297 background-color: #030712;
298 color: #fff;
299 overflow: hidden;
300 white-space: nowrap;
301 text-indent: 100px;
302 position: relative;
303 }
304
305 .tns-controls button + button {
306 margin-left: 10px;
307 }
308
309 .tns-controls button + button::after {
310 content: "\F285";
311 font-size: 14px;
312 color: #fff;
313 text-indent: 0px;
314 left: 10px;
315 top: 9px;
316 position: absolute;
317 z-index: 1;
318 font-family: 'bootstrap-icons';
319 font-weight: bold;
320 }
321
322 .tns-controls button:first-child::after {
323 content: "\F284";
324 font-size: 14px;
325 color: #fff;
326 text-indent: 0px;
327 left: 9px;
328 top: 9px;
329 position: absolute;
330 z-index: 1;
331 font-family: 'bootstrap-icons';
332 font-weight: bold;
333 }
334
335 .tns-controls button[disabled] {
336 background-color: #d4d6d8;
337 color: #404953;
338 }
339
340 .tns-controls button[disabled]::after {
341 color: #404953;
342 }
343
344 .tns-nav button {
345 width: 50px;
346 margin-right: 20px;
347 border-radius: 6px;
348 border: 0px;
349 background-color: #bfc2c6;
350 height: 4px;
351 }
352
353 .tns-nav button.tns-nav-active {
354 background-color: #030712;
355 }
356
357 .tns-item {
358 opacity: 0;
359 transition: all 0.25s linear;
360 }
361
362 .tns-item.tns-slide-active {
363 opacity: 1;
364 }
365
366 .tns-controls {
367 margin-top: 20px;
368 }
369
370 .tns-nav {
371 margin-top: 20px;
372 }
373
374 ul.product-carousel:not(.tns-carousel) li {
375 max-width: 300.75px;
376 }
377
378 .w-card span.image {
379 height: auto !important;
380 max-height: 230px;
381 }
382
383 span.c-info > .grid-2 {
384 grid-template-columns: 60% 1fr;
385 }
386
387 @media (max-width: 769px) {
388 .tns-nav {
389 display: none;
390 }
391
392 .w-card span.image {
393 max-height: inherit;
394 }
395
396 .m-mc {
397
398 width: min-content;
399 }
400 }
401
402
403</style>
404<script>
405
406 $(document).ready(function () {
407
408
409 <#if categories?has_content>
410 <#list categories as curAssetCategory>
411 var slider = tns({
412 container: '.product-carousel${curAssetCategory?index}',
413 items: 4,
414 gutter: 15,
415 slideBy: 'page',
416 autoplay: false,
417 loop: false,
418 responsive: {
419 1150: {
420 items: 4
421 },
422 769: {
423 items: 3
424 },
425 550: {
426 items: 2
427 },
428 0: {
429 items: 1
430 }
431 }
432 });
433 </#list>
434 </#if>
435
436 });
437</script>