Combination of two field values to be rendered in content tree

Naresh Ede asked on November 21, 2018 18:21

Hello guys,

I have product page type with Pagename and Skunumber fileds.

I was entering product name and product skunumber in two different fields.

By default kentico rendering the pagename/documentname of products in content tree.

But i want to render the product names in content tree as {skunumber}-{documentname} (combination of two fields).

Is that possible to do that ? Or i need to save both skunumber and page name in one field ?

Please help me out to achieve this.


Naresh Ede.

Recent Answers

Juraj Ondrus answered on November 22, 2018 07:58

The content tree names are based on the page name - and in the page type settings only one field can be set as the source (sample screenshot). So, in this case you will need to add a separate field which will combine the two fields - e.g. a custom form control which will do the logic in the code and this field will be then set as the page name source field. Also, this field can be hidden on the editing form, so the editors will not be confused.
Another option would be using global event handler and in the before inster/update events you will read the values from the two fields and set them as the document name.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.