Add Breadcrumb in PrestaShop 1.7 Module Front Controller By a function :
PrestaShop 1.7 has been released early and there are many changes from code end like Symfony introduced and the default theme is updated to a new classic theme.
If you are developing Module for PrestaShop 1.7. This version introduced a new way of managing the Breadcrumbs on every page. In V1.6, we were managing breadcrumbs on tpl page but now we can manage this by a php function.
You are just needed to add this PHP function in your module front controller, You can see then the breadcrumbs in your front page.
public function getBreadcrumbLinks() { $breadcrumb = parent::getBreadcrumbLinks(); $breadcrumb['links'][] = [ 'title' => $this->getTranslator()->trans('Women', [], 'Breadcrumb'), 'url' => $this->context->link->getModuleLink('module_name', 'controller_name') ]; $breadcrumb['links'][] = [ 'title' => $this->getTranslator()->trans('T-shirts', [], 'Breadcrumb'), 'url' => '' ]; return $breadcrumb; }
Initial Prestashop versions is not translating the string written in trans() function for non-native modules. You can use
$this->module->l(‘Women’, ‘controller_name’)
instead of this.
Finally, Breadcrumb will look like this,
Thanks for your help !
Denis