Search code examples
sap-commerce-cloud

How to find specific url of newly created category in Hybris PCM


Hi whenever i try to create the new product category in hybris product cockpit i create the identifier, name and the correct catalog version which is Online

but when i try to edit the navigation of the website im currently lost where do i find the url of that specific category so when the user click on that navigation it will filter on which category of the product is tagged


Solution

    • If your navigation menu is composed of CMSLinkComponents you are lucky, because CMSLinkComponent was already made to handle this, you have just to :

      1. create a new CMSLinkComponent.
      2. Attach the new create Category to the CMSLinkComponent.
      3. Then add this CMSLinkComponent to your navigation menu. (that's all what you need to do).

    enter image description here

    • However if you don't use CMSLinkComponent, you can use the defaultCategoryModelUrlResolver.resolve(newCategory) to generate the URL of the category and then send it back to the Front to be printed.

    • Or just print it like this in your jsp file :

      <c:url var="categoryUrl" value="/c/${newCategory.code}" /> <a href="${categoryUrl}">${newCategory.name}</a>