Search Results Template and default image URL

thumbnail
Jamie Sammons, modified 3 Years ago. Junior Member Posts: 39 Join Date: 3/9/22 Recent Posts

Hello everyone,

I'm creating a Widget Template (Search Results Template). 

I'm working with CPCatalogEntry class and I'm wondering how can I get the url of default image. Unfortunately the method CPCatalogEntry.getDefaultImageFileUrl() doesn't work in my Liferay version (Liferay Community Edition Portal 7.4.3.13 CE GA13)

UPDATE

I was able to get the URL in this way:

<#assign CPDefinitionLocalService = serviceLocator.findService("com.liferay.commerce.product.service.CPDefinitionLocalService")
			CPAttachmentFileEntry = CPDefinitionLocalService.getDefaultImageCPAttachmentFileEntry(curCPCatalogEntry.getCPDefinitionId())
			FileEntry = CPAttachmentFileEntry.fetchFileEntry()
			DLUtil = staticUtil["com.liferay.document.library.kernel.util.DLUtil"]
			imageURl = DLUtil.getPreviewURL(FileEntry, FileEntry.getFileVersion(), themeDisplay, "")
/>

Now I have another problem, how can I get the list of specification of a product?