Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sortorder of Inherited Templates

Using Sitecore 6.6 we are constructing some templates that inherit many base templates. This is great for reuse and standardizing our code, as all the fields are stored in a constants file for easy reference. However, we seem to be unable to define the order that these inherited templates are displayed.

The templates seem to be sticking to the original order they were added in no matter what. We've tried using the sortorder on the actual base templates themselves, but that doesnt appear to work. Likewise with just reordering the templates in the __Base template field picker.

Any ideas?

like image 919
sottenad Avatar asked Jun 07 '13 06:06

sottenad


4 Answers

I have found that sorting template sections and fields often works best when using negative numbers. Strange but true.

like image 97
Zooking Avatar answered Nov 01 '22 13:11

Zooking


That is a great approach for templating. To reorder the fields/fieldsets set the sortorder of the Template Fields and Template Sections themselves inside of the inherited templates.

like image 41
Patrick Jones Avatar answered Nov 01 '22 13:11

Patrick Jones


I have the same problem with sorting in template inheritance. I have been using a combination of negative and positive numbers, fixed this. Retro fitting does seem a pain and quite a lot of work though. Definitely something to think about upfront.

like image 2
Charlie Afford Avatar answered Nov 01 '22 14:11

Charlie Afford


My experience is that fields are added based on the Sort Order of the section, and if two sections have the same value, then the fields are added from the child template first.

Suppose you have a template My New Template that inherits from the Sample Item, with a field in the Data section called My New Field. Even if My New Field has a sort order of 300, and Title and Text are 100 and 200, My New Field will come first if both Data sections are set to 100. To make it come after Title and Text, set the section Sort Order to a higher value, like 150.

like image 1
Dan Solovay Avatar answered Nov 01 '22 14:11

Dan Solovay