I'm using a PageTree to render a menu, and the templates use different bullets depending on if they have children or not. This works nicely (I have set EvaluateHasChildren=true in PageTree), but not always as it turns out. The site has been in production several months without anyone noticing, but now we have found a few examples of pages where this does not work.
There are situations where Container.HasChildren is false even though it should be true (there are child pages which the visitor can see). According to editors there may also be situations where it's the other way around (HasChildren is true causing the bullet with an arrow to show, even though there are no child pages).
The currently used version is CMS 5 R2 SP1.
Some more clues...
This seems to happen when the first few child pages (according to sort order as it seems) are not available in the current language. If I browse the Swedish site and the first few children of a menu are available in Swedish only, or Swedish and English, HasChildren will evaluate correctly for the Swedish site. If the first few pages are available in English only HasChildren will evaluate incorrectly for the Swedish site, but correctly for the English site.
It seems that when evaluating HasChildren only the first few children will be inspected, and they may be filtered out because they have the wrong language before counting the pages. So the whole set of children is not used before filtering.
Looking at the PageTemplateContainer.CheckIfHasChildren the prime suspect is the maxRows parameter which is set to 2. I don't know what it does exaclty, but I suspect that it limits the number of results gatherd at a premature state (i.e. before checking the language).
Could this be a bug?
Looks like a bug to me, I'll report it. But I don't understand why CheckIfHasChildren exists at all since EvaluateHasChildren says that the PageTree control should evaluate children as it builds the tree (and it does pass it to PageTreeControl but that control then don't use it).
I'm experiencing the exact same thing. Is there a fix for this yet?
Its fixed and will be part of CMS 6:Bug #29561: HasChildren in PageTree templates sometimes returns the wrong value on globalized sitePossible workarounds is to make sure the first sub page is available on all languages, or use your own HasChildren logic.