Field Ordering When Inheriting Sitecore Templates

I have come across this many times before. I will have a base #Sitecore template that is inherited by another template. The fields from both templates are combined in one section. The content editor though wants the order of the fields changed. That is easy to do if the fields are from the same template, but it is not so easy to do it when the fields are from two different #Sitecore templates. I will show you an easy workaround though to get the correct order.

In my example I have a ProductBase template that has a Description field. The Product template inherits from this template so it will have the Description field.

This is what the current product item looks like. As you can see it is currently in the default alphabetical order. What if though the content editor wants the Description under the Name?

In order to have the fields reordered you will need to go to your main template. Select the field you want to reorder and navigate to the Appearance section and then the Sortorder field. Sitecore usually numbers their fields starting at 100, 200, 300 and so on. So in this case we want Name on the top. Giving it a -100 value in the Sortorder field will make it automatically be the top field since it will then be displayed before 100.

As you can see the order has now changed and the content editor will be able to edit in their preferred order.

This was a simple example. For more multiple field reorders changing the Sortorder fields with different values will take a little more of playing with the value, but the concept will be the same. I suggest never changing the Sortorder on a base template. The reason being is that for other templates they may want a different order and it would be the same for all templates that inherit the base template and/or will make it difficult to reorder your main template. Let me know if you have any questions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s