Reading list Switch to dark mode

    Adding Breadcrumb in PrestaShop 1.7 Module Front Controller

    Updated 7 December 2016

    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.

     

    Searching for an experienced
    Prestashop Company ?
    Find out More
    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,

    Breadcrumb in Prestashop V1.7

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    5 comments

  • Deleval Denis
  • Deleval Denis
    • Dheeraj Sharma
  • Zyfraglover
    • Dheeraj Sharma
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home