Skip to content

Commit

Permalink
BUGFIX: Fix site tree filter not showing parents of results more than…
Browse files Browse the repository at this point in the history
… a level deep in the hierachy
  • Loading branch information
andrewandante committed Sep 5, 2012
1 parent 4ad2b25 commit f843dd5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/controllers/CMSSiteTreeFilter.php
Expand Up @@ -71,13 +71,15 @@ protected function populateIDs() {
$parents[$pageArr['ParentID']] = true;
$this->_cache_ids[$pageArr['ID']] = true;
}
if(!empty($parents)) {

while(!empty($parents)) {
$q = new SQLQuery();
$q->setSelect(array('"ID"','"ParentID"'))
->setFrom('"SiteTree"')
->setWhere('"ID" in ('.implode(',',array_keys($parents)).')');

$parents = array();

foreach($q->execute() as $row) {
if ($row['ParentID']) $parents[$row['ParentID']] = true;
$this->_cache_ids[$row['ID']] = true;
Expand Down

0 comments on commit f843dd5

Please sign in to comment.