Cannot reproduce Breadcrumbs are incorrect with nested categories

DragonByte Tech

Well-known member
Affected version
2.0.2
Consider the following structure:
j6vag8r.png


Expected result:
I would expect to see "Home -> Forums -> DragonByte Technologies Product Support -> Modifications" when viewing the "Test" node.

Actual result:
I see "Home -> Forums -> Modifications" when viewing the "Test" node.


Fillip
 
Interesting. I can replicate it on my local computer, but not on the test imported installation.

I edited \XF\Entity\Node:
PHP:
        if ($this->breadcrumb_data)
        {
            \XF::dump($this->breadcrumb_data);
            foreach ($this->breadcrumb_data AS $crumb)

This is the output when browsing the Test forum:
array:1 [▼
11 => array:6 [▼
"node_id" => 11
"title" => "Modifications"
"depth" => 1
"lft" => 12
"node_name" => null
"node_type_id" => "Category"
]
]

This is the full data row set for the 4 nodes I added:
Code:
INSERT INTO `xf_node` (`node_id`, `title`, `description`, `node_name`, `node_type_id`, `parent_node_id`, `display_order`, `display_in_list`, `lft`, `rgt`, `depth`, `style_id`, `effective_style_id`, `breadcrumb_data`, `navigation_id`, `effective_navigation_id`)
VALUES
    (10, 'DragonByte Technologies Product Support', 'Information and support for our various products.', NULL, X'43617465676F7279', 0, 100, 1, 11, 18, 0, 0, 0, X'613A303A7B7D', X'666F72756D73', X'666F72756D73'),
    (11, 'Modifications', 'Information and support for our modifications.', NULL, X'43617465676F7279', 10, 10, 1, 12, 15, 1, 0, 0, X'613A303A7B7D', X'', X'666F72756D73'),
    (12, 'Skins', 'Information and support for our skins.', NULL, X'43617465676F7279', 10, 20, 1, 16, 17, 1, 0, 0, X'613A303A7B7D', X'', X'666F72756D73'),
    (13, 'Test', 'Test', NULL, X'466F72756D', 11, 1, 1, 13, 14, 2, 0, 0, X'613A313A7B693A31313B613A363A7B733A373A226E6F64655F6964223B693A31313B733A353A227469746C65223B733A31333A224D6F64696669636174696F6E73223B733A353A226465707468223B693A313B733A333A226C6674223B693A31323B733A393A226E6F64655F6E616D65223B4E3B733A31323A226E6F64655F747970655F6964223B733A383A2243617465676F7279223B7D7D', X'', X'666F72756D73');

Does that help figure out what happened, or is there any other form of debug data I can add somewhere else that might help track down why this might have happened?


Fillip
 
It sounds like the RebuildNestedSet service didn't run, but I'm not sure why it wouldn't. The breadcrumb_data is wrong for node_id 11 and 12, it seems.

The breadcrumb data for those nodes should be:
Code:
a:1:{i:10;a:6:{s:7:"node_id";i:10;s:5:"title";s:39:"DragonByte Technologies Product Support";s:5:"depth";i:0;s:3:"lft";i:1;s:9:"node_name";N;s:12:"node_type_id";s:8:"Category";}}
Of course any sort of manual manipulation of the node table won't rebuild that so that should be avoided but other than that I'm not sure what would have happened.
 
I've tried moving the "Test" forum up the tree and back down again, and tried to move the "DragonByte Technologies Product Support" underneath the default Main Category and back again, yet the breadcrumb data stays the same. (All via the UI, of course.) Nothing in the server error log either.

I edited \XF\Service\RebuildNestedSet:
PHP:
        if ($entity)
        {
            $counter++;
        }
        $right = $counter;
        
        \XF::dumpSimple($id);
        \XF::dumpSimple($selfData);

        if ($entity)
        {
            $updateData = $selfData + [
                'lft' => $left,
                'rgt' => $right,
                'depth' => $depth
            ];

            $entity->fastUpdate($updateData);
        }

That produces the following output:
Code:
int(2)
array(3) {
  ["breadcrumb_data"] => array(1) {
    [1] => array(6) {
      ["node_id"] => int(1)
      ["title"] => string(13) "Main category"
      ["depth"] => int(0)
      ["lft"] => int(1)
      ["node_name"] => NULL
      ["node_type_id"] => string(8) "Category"
    }
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(0) "
}

int(8)
array(3) {
  ["breadcrumb_data"] => array(2) {
    [1] => array(6) {
      ["node_id"] => int(1)
      ["title"] => string(13) "Main category"
      ["depth"] => int(0)
      ["lft"] => int(1)
      ["node_name"] => NULL
      ["node_type_id"] => string(8) "Category"
    }
    [3] => array(6) {
      ["node_id"] => int(3)
      ["title"] => string(10) "Test Forum"
      ["depth"] => int(1)
      ["lft"] => int(4)
      ["node_name"] => NULL
      ["node_type_id"] => string(5) "Forum"
    }
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(0) "
}

int(3)
array(3) {
  ["breadcrumb_data"] => array(1) {
    [1] => array(6) {
      ["node_id"] => int(1)
      ["title"] => string(13) "Main category"
      ["depth"] => int(0)
      ["lft"] => int(1)
      ["node_name"] => NULL
      ["node_type_id"] => string(8) "Category"
    }
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(0) "
}

int(1)
array(3) {
  ["breadcrumb_data"] => array(0) {
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(0) "
}

int(9)
array(3) {
  ["breadcrumb_data"] => array(0) {
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(15) "dbtechEcommerce"
}

int(13)
array(3) {
  ["breadcrumb_data"] => array(1) {
    [11] => array(6) {
      ["node_id"] => int(11)
      ["title"] => string(13) "Modifications"
      ["depth"] => int(1)
      ["lft"] => int(12)
      ["node_name"] => NULL
      ["node_type_id"] => string(8) "Category"
    }
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(6) "forums"
}

int(11)
array(3) {
  ["breadcrumb_data"] => array(0) {
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(6) "forums"
}

int(12)
array(3) {
  ["breadcrumb_data"] => array(0) {
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(6) "forums"
}

int(10)
array(3) {
  ["breadcrumb_data"] => array(0) {
  }
  ["effective_style_id"] => int(0)
  ["effective_navigation_id"] => string(6) "forums"
}

int(0)
array(0) {
}{

If I'm reading this correctly, it's failing to build the breadcrumb data for ID 11 and 12, but the service is definitely running.


Fillip
 
Top Bottom