Skip to content

Commit 25fb4f5

Browse files
author
Oleksii Korshenko
authored
MAGETWO-67614: Page meta title fix in case breadcrumb section is removed via XML #9324
2 parents 9bae15f + 015ea80 commit 25fb4f5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/code/Magento/Catalog/Block/Breadcrumbs.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function getTitleSeparator($store = null)
5454
*/
5555
protected function _prepareLayout()
5656
{
57+
$title = [];
5758
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
5859
$breadcrumbsBlock->addCrumb(
5960
'home',
@@ -64,7 +65,6 @@ protected function _prepareLayout()
6465
]
6566
);
6667

67-
$title = [];
6868
$path = $this->_catalogData->getBreadcrumbPath();
6969

7070
foreach ($path as $name => $breadcrumb) {
@@ -73,7 +73,18 @@ protected function _prepareLayout()
7373
}
7474

7575
$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
76+
77+
return parent::_prepareLayout();
78+
}
79+
80+
$path = $this->_catalogData->getBreadcrumbPath();
81+
82+
foreach ($path as $name => $breadcrumb) {
83+
$title[] = $breadcrumb['label'];
7684
}
85+
86+
$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
87+
7788
return parent::_prepareLayout();
7889
}
7990
}

0 commit comments

Comments
 (0)