Select to view content in your preferred language

Adding additional fields & info in the item card

1559
4
03-10-2021 05:25 AM
by Anonymous User
Not applicable

I am trying to add additional fields in the card here

NovicaJ_0-1615382533248.png

I am using a custom profile at the moment with a few extra fields /values and I am trying to add them in the card item, for example.

NovicaJ_1-1615382777952.png

Can this be done?

0 Kudos
4 Replies
Marten
by
Regular Contributor

hi, yes, this is possible. For this you should start by looking at ItemCard.js and the corresponding template found in ...\geoportal\app\search. You will find a number of renderer functions here (for title, thumbnail, etc). Each one has a corresponding section in the ItemCard.html template. The key is to include a data-dojo-attach-point attribute in the div element. You would then add something like a 'renderEcommrce()' function and call it in the render() function. You will pass in the item (as you will see in the existing renderers). That item will give access to the information in your item.

Related note, for this to work, you will need to extract the ecommerce values out of the xml and include them in the index itself. For this you will need to update the metadata evaluators found in .../geoportal/WEB-INF/classes/js. These functions show how to extract metadata from specific elements/attributes and store them in a field in the index. Don't worry if your index doesn't have the field yet. It will automatically be created when you submit a document and Geoportal extracts the element for those fields.

0 Kudos
by Anonymous User
Not applicable

Hey Marten, thanks for the input.

May I kindly ask for more pointers about extracting the values from the xml and including them in the index? Where in /WEB-INF/classes can I get examples on how to extract the values?

0 Kudos
Marten
by
Regular Contributor

hi, I recommend taking a look at this folder: geoportal\WEB-INF\classes\metadata\js. This is where the so-called evaluators are found. When publishing metadata to the catalog (through editor, upload, or harvester), the metadata will pass through these evaluators. The purpose is exactly to pull out pieces of information from the XML and put that in a desired field in elastic.

I think in your case that EvaluatorFor_ISO.js is worth a look specifically.

0 Kudos
by Anonymous User
Not applicable

Marten,

I tried adding something like this in the EvaluatorFor_ISO.js 

NovicaJ_0-1616378047421.png

but this doesn't work. Any pointers on what I am doing wrong?

0 Kudos