Display Taxonomy on page

On product page I am trying to display product categories. (Using Taxonomy to add category for product). In my scenario I have added 2 taxonomy (categories) for product and using following code in productpage.ftl file to display categories in which that product falls. But output of following is just iterating the keys and showing ‘|’ two times. Any Idea how can I iterate on taxonomy?

<#list document.keys as item>
<hst:html hippohtml="${item}" /> |
</#list>

Hi,
A key is not a rich text field so you can’t use <hst:html> to render it.

There’s an example here on how to go from the key string to a localized name, using <taxonomy:categories> tag:

Also you could do it from the HST component, retrieving the names from Spring instantiated TaxonomyManager

HTH
Jeroen

1 Like

Thanks for the quick reply. Actually I was trying to set jsp for my template and getting issue with that (Not able to set jsp in property hst:renderpath for template) so wanted to try with .ftl.

Hi, I am using the code below as per this document:

TaxonomyManager taxonomyManager = HstServices.getComponentManager().getComponent(TaxonomyManager.class.getName());

but I just get null…??

Taxonomy is configured correctly as I can add it to the page, but I need the list of items so that the user can filter content …

Bloomreach version 14.5

Any help would be appreciated

Thanks
J

Hi,
I see that in SpringComponentManager-taxonomymanager.xml within hippo-plugin-taxonomy-hstclient.jar, the TaxonomyManager bean is defined as:

  <bean id="TaxonomyManager" class="org.onehippo.taxonomy.impl.TaxonomyManagerImpl">
   ....
  </bean>

Retrieving it by ‘TaxonomyManager.class.getName()’ doesn’t seem to match… can you try to retrieve it by the id or classname above?

Jeroen

Maybe just use TaxonomyManager.class.getSimpleName() instead of getName()?

quote=“jeroen.hoffman, post:5, topic:936”]
taxonomy
[/quote]

Hi niether methods seem to work I am afraid… :frowning:

J

Hmm that is odd, the SpringComponentManager-taxonomymanager.xml doesn’t seem to be Spring-loaded on startup then… maybe you can debug that, Spring logging?

And/or, as a workaround, add that file (see [1]) to your project, below
site/component/src/main/resources/META-INF/hst-assembly/overrides

HTH
Jeroen

[1] brxm/SpringComponentManager-taxonomymanager.xml at brxm-14.7.11 · bloomreach/brxm · GitHub

Success…

whoever had configured this originally did not have that file!

Appreciate your help.

Thanks
John

Good to see you have it covered!

Looks like something broke along the way… I created https://issues.onehippo.com/browse/CMS-15366 to figure it out. No promises on time line :slight_smile: