Thursday, December 10, 2009

Quick tip: resolving section sort order problem with inheritance


There is a known issue currently with the sort order set on the standard values for the “/sitecore/templates/System/Templates/Template section” template and not being picked correctly and always treated as zero until you set the sort order specifically for the section thus overriding the standard value.

This has impact on section inheritance, producing unexpected behavior in the following case:
1. You have an abstract “base product” template with the following sections:
image

2. You have a derivative template “monitor” with its own domain specific data section:
image

3. You want to have certain sections from the “base product” template show up first, then the “data” section from the “monitor” template itself, then the rest of sections from base:
image 

Since the default inherited sort order for a section is 100 (coming from __Standard values), however you won’t be able to accomplish this by setting the sort order of “descriptors” and “product data” section to 80 and 90 correspondingly.
This is because the value for the section sort order that is coming from the __Standard values will always be considered as zero.

There is an easy and simple way to solve this by simply setting the sort order of “descriptors” and “product data” sections to negative values (-2 and -1) for example.

Enjoy!

2 comments:

Monty said...

Hey there. Thanks for the blog post explaining this. But has this been fixed in 6.3?

I'm seeing similar behavior and was wondering if there is a fix for it. Ordering the inherited templates doesn't set the order.

Whit said...

Can you post more screenshots regarding the steps? I am confused by the last paragraph.

Thanks!