RE: Commerce Categories Navigation Template and Friendly 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 (Commerce Categories Navigation). 

I'm working with AssetCategory class (https://learn.liferay.com/reference/latest/en/dxp/javadocs/portal-kernel/com/liferay/asset/kernel/model/AssetCategory.html) and I'm wondering how can I get the friendly url.

Liferay Community Edition Portal 7.4.3.13 CE GA13

thumbnail
Jamie Sammons, modified 3 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts

Hi ,

You can try below code for fetching friendly url 

<#if entries?has_content>
	<#list entries as curAssetCategory>
				<#assign
				categoryHref = cpAssetCategoriesNavigationDisplayContext
				.getFriendlyURL(curAssetCategory.getCategoryId(), themeDisplay)
			/>
		${categoryHref}
	</#list>
</#if>

 

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

Thank you very much, I tried and it works!