Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page meta title fix in case breadcrumb section is removed via XML #9324

Merged
merged 2 commits into from
Apr 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app/code/Magento/Catalog/Block/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function getTitleSeparator($store = null)
*/
protected function _prepareLayout()
{
$title = [];
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
$breadcrumbsBlock->addCrumb(
'home',
Expand All @@ -64,7 +65,6 @@ protected function _prepareLayout()
]
);

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

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

$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));

return parent::_prepareLayout();
}

$path = $this->_catalogData->getBreadcrumbPath();

foreach ($path as $name => $breadcrumb) {
$title[] = $breadcrumb['label'];
}

$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));

return parent::_prepareLayout();
}
}