Jump to content

Remove link in breadcrumb


Recommended Posts

Hello there,

In the current breadcrumb, the page where we at is also a link which is weird.

For example : Home (link1) / Category 1 (link2) / Product1 (link3)

So we are on the page of the "Product 1" and it is a link that can be clicked.

I would like to remove the link of the page where we at, in the breadcrumb.tpl file we can only remove all the links which is not a solution.

Link to comment
Share on other sites

  • 3 weeks later...

Hi @Nishikidori

This depends on the theme you have. In the default prestashop "classic" theme there is no link on the last breadcrumb item, the breadcrumb.tpl looks like this:
 

{**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 *}
<nav data-depth="{$breadcrumb.count}" class="breadcrumb hidden-sm-down">
  <ol itemscope itemtype="http://schema.org/BreadcrumbList">
    {block name='breadcrumb'}
      {foreach from=$breadcrumb.links item=path name=breadcrumb}
        {block name='breadcrumb_item'}
          <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
            {if not $smarty.foreach.breadcrumb.last}
              <a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
            {else}
              <span itemprop="name">{$path.title}</span>
            {/if}
            <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}">
          </li>
        {/block}
      {/foreach}
    {/block}
  </ol>
</nav>

There is an if statement that does not include the link for the last breadcrumb element:

{if not $smarty.foreach.breadcrumb.last}
	<a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
{else}
	<span itemprop="name">{$path.title}</span>
{/if}

Try adding this if - else statement to your breadcrumb based on the code above.tpl and should function as expected.


Cheers,
Leo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...