1

I am trying to get breadcrumb path in my controller by using this helper

public function __construct(\Magento\Catalog\Helper\Data $catalogData, ) {
$this->catalogData = $catalogData;
}
$path = $this->catalogData->getBreadcrumbPath();

When I print $path it's giving me an empty array. But when I get this helper function in any product phtml file like this

$helper = $this->helper('\Magento\Catalog\Helper\Data');
$values = $helper->getBreadcrumbPath();

it's giving me the full path in phtml. How can I access this function in my controller as well?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.