Jump to content

Breadcrumbs : Either "name" or "item.name" should be specified


Olena123

Recommended Posts

Ok, here's the code from the github link...

<a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
              <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}">
            </li>
          {else}
          {elseif isset($path.title)}
            <li>
              <span>{$path.title}</span>
            </li>

They suggest adding from the "else" down.  But is there an "if" statement that the "else" is supposed to go with?  I'm not seeing "if" anywhere.

Link to comment
Share on other sites

thisi is my final code:

<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'}
          {if not $smarty.foreach.breadcrumb.last}
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
              <a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
              <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}">
            </li>
                   {elseif isset($path.title)}
            <li>
              <span>{$path.title}</span>
            </li>
          {/if}
        {/block}
      {/foreach}
    {/block}
  </ol>
</nav>

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...
On 10/1/2019 at 12:02 PM, OlenaMokra said:

thisi is my final code:


<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'}
          {if not $smarty.foreach.breadcrumb.last}
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
              <a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
              <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}">
            </li>
                   {elseif isset($path.title)}
            <li>
              <span>{$path.title}</span>
            </li>
          {/if}
        {/block}
      {/foreach}
    {/block}
  </ol>
</nav>

 

OlenaMokra, your code worked fine for me.  Validation passed.

Link to comment
Share on other sites

  • 1 month later...

I am having the same issue. The fix above seems to be for the default theme. I am using another theme and the breadcrumb.tpl file in my theme looks very different. I am assuming that prestashop will use the breadcrumb.tpl file (as described above) from the active theme? Can anyone shine some light on this please. Thanks

Link to comment
Share on other sites

You should contact your theme developer and ask them to fix it - if you post your code here we can help to fix it but there is the risk it gets overwritten with further theme updates (unless you are using a child theme)

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...
  • 3 months later...
On 12/29/2019 at 8:18 PM, barati_a said:

Hi ;

I changed my file like this but now I have this error

Missing field "itemListElement"

How can I solve this problem? where do I change this Item?

tnx;

Same problem here one 1.7.6.4, anyone got a solution? Got standard theme btw...

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Hello,  My site has been running for several months and no issues as such.  I have recently received the Google Search Console error as referred to here.  I have changed the code as in several suggestions but none of it works for me.  I am using a theme called Angar on 1.7.6.1.  Has a fix or mod that definitely works been published anywhere?

Many thanks

Link to comment
Share on other sites

  • 1 month later...
On 12/29/2019 at 8:18 PM, barati_a said:

Missing field "itemListElement"

How can I solve this problem? where do I change this Item?

It looks like this problem occurs only at pages with (useless) single breadcrumb. Because, there is no (navigation) itemListElement item. Like for example: home page, new products, prices drop ... If you do not need this (useless) single breadcrumb on these pages you can do something like this in your theme file \templates\_partials\breadcrumb.tpl 

{if $breadcrumb.count > 1}

<nav data-depth="{$breadcrumb.count}" class="breadcrumb hidden-sm-down">
  <ol itemscope itemtype="http://schema.org/BreadcrumbList">
	...
  </ol>
</nav>

{/if}

 

 

Edited by Peter Liska (see edit history)
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Nice it works!

3 hours ago, Peter Liska said:

It looks like this problem occurs only at pages with (useless) single breadcrumb. Because, there is no (navigation) itemListElement item. Like for example: home page, new products, prices drop ... If you do not need this (useless) single breadcrumb on these pages you can do something like this in your theme file \templates\_partials\breadcrumb.tpl 


{if $breadcrumb.count > 1}

<nav data-depth="{$breadcrumb.count}" class="breadcrumb hidden-sm-down">
  <ol itemscope itemtype="http://schema.org/BreadcrumbList">
	...
  </ol>
</nav>

{/if}

 

 

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 11/14/2020 at 6:45 PM, RaymondSt said:

Nice it works!

 

Works for me too. I have been trying to fix this for ages. My code now looks like this:

{if $breadcrumb.count > 1}
<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'}
          {if not $smarty.foreach.breadcrumb.last}
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
              <a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
              <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}">
            </li>
          {elseif isset($path.title)}
            <li>
              <span>{$path.title}</span>
            </li>
          {/if}
        {/block}
      {/foreach}
    {/block}
  </ol>
</nav>
{/if}

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Bonsoir, je retire ce que j'ai écrit plus tôt. Mon site était hs après vérification. Je mets le debugger message.

(1/1) SmartyCompilerException

Syntax error in template "file:/home/lessolei/les3soleils.com/themes/classic/templates/_partials/breadcrumb.tpl" on line 48 "{/if}" unexpected closing tag

in smarty_internal_templatecompilerbase.php line 48

at Smarty_Internal_TemplateCompilerBase->trigger_template_error('unexpected closing tag', 48, true)in smarty_internal_compilebase.php line 200

at Smarty_Internal_CompileBase->closeTag(object(Smarty_Internal_SmartyTemplateCompiler), array('if', 'else', 'elseif'))in smarty_internal_compile_if.php line 200

at Smarty_Internal_Compile_Ifclose->compile(array(), object(Smarty_Internal_SmartyTemplateCompiler), array(), null, null)in smarty_internal_templatecompilerbase.php line 764

at Smarty_Internal_TemplateCompilerBase->callTagCompiler('ifclose', array(), array())in smarty_internal_templatecompilerbase.php line 1493

at Smarty_Internal_TemplateCompilerBase->compileTag2('ifclose', array(), array())in smarty_internal_templatecompilerbase.php line 565

at Smarty_Internal_TemplateCompilerBase->compileTag('ifclose', array())in smarty_internal_templateparser.php line 2468

at Smarty_Internal_Templateparser->yy_r45()in smarty_internal_templateparser.php line 3383

at Smarty_Internal_Templateparser->yy_reduce(45)in smarty_internal_templateparser.php line 3479

at Smarty_Internal_Templateparser->doParse(5, '')in smarty_internal_smartytemplatecompiler.php line 128

at Smarty_Internal_SmartyTemplateCompiler->doCompile('{** * 2007-2019 PrestaShop and Contributors * * 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.txt. * 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://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2019 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaShop SA *}if $breadcrumb.count > 1}<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\'} {if not $smarty.foreach.breadcrumb.last} <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a> <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}"> </li> {elseif isset($path.title)} <li> <span>{$path.title}</span> </li> {/if} {/block} {/foreach} {/block} </ol></nav>{/if}', true)in smarty_internal_templatecompilerbase.php line 481

at Smarty_Internal_TemplateCompilerBase->compileTemplateSource(object(SmartyDevTemplate), false, null)in smarty_internal_templatecompilerbase.php line 404

at Smarty_Internal_TemplateCompilerBase->compileTemplate(object(SmartyDevTemplate))in smarty_template_compiled.php line 184

at Smarty_Template_Compiled->compileTemplateSource(object(SmartyDevTemplate))in smarty_template_compiled.php line 141

at Smarty_Template_Compiled->process(object(SmartyDevTemplate))in smarty_template_compiled.php line 105

at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender('file:_partials/breadcrumb.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 0, false)in f87cacf2af109f8d1eb7a32c483b03d704f7dc32_2.file.layout-both-columns.tpl.php line 224

at Block_19837038716034269fd9fb15_15189800->callBlock(object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 248

at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_19837038716034269fd9fb15_15189800), object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 184

at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_19837038716034269fd9fb15_15189800))in smarty_internal_runtime_inheritance.php line 156

at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_19837038716034269fd9fb15_15189800', 'breadcrumb')in f87cacf2af109f8d1eb7a32c483b03d704f7dc32_2.file.layout-both-columns.tpl.php line 77

at content_6034269fdaa946_01780921(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender('layouts/layout-both-columns.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 125

at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-both-columns.tpl')in 7b1bf3961dee73d43039bcedf28896f8429c3255_2.file.layout-left-column.tpl.php line 38

at content_6034269fd7bad0_83635272(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender('layouts/layout-left-column.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 125

at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-left-column.tpl')in a3759c5cd2be4ac2e8d10a70f3d6dbae226183d4_2.file.page.tpl.php line 33

at content_6034269fd58de5_24237178(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender('page.tpl', null, 'layouts/layout-left-column.tpl', 0, 3600, array(), 2, false, null, null)in smarty_internal_runtime_inheritance.php line 125

at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'page.tpl')in 96125b007d1a618aeb0b8d2b1b1065bcf124ca17_2.file.index.tpl.php line 33

at content_6034269fd35fa9_39574344(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216

at Smarty_Internal_Template->render(false, 0)in smarty_internal_templatebase.php line 232

at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, 'layouts/layout-left-column.tpl', null, 0)in smarty_internal_templatebase.php line 116

at Smarty_Internal_TemplateBase->fetch('index.tpl', null, 'layouts/layout-left-column.tpl', null, false, true, false)in SmartyDev.php line 40

at SmartyDev->fetch('index.tpl', null, 'layouts/layout-left-column.tpl')in FrontController.php line 683

at FrontControllerCore->smartyOutputContent('index.tpl')in FrontController.php line 667

at FrontControllerCore->display()in Controller.php line 312

at ControllerCore->run()in Dispatcher.php line 515

at DispatcherCore->dispatch()in index.php line 28

si quelqu'un peut m'aider., je remercie d'avance . mon prestashop est 1.7.

Philippe

 

Link to comment
Share on other sites

On 2/22/2021 at 11:06 PM, Molina111 said:

Bonsoir, je retire ce que j'ai écrit plus tôt. Mon site était hs après vérification. Je mets le debugger message.

It would be nice to show us original vs. actual content of the file that you have changed.

 

And this is International community (English) !!!

Edited by Peter Liska (see edit history)
Link to comment
Share on other sites

  • 1 month later...
On 11/14/2020 at 4:18 PM, Peter Liska said:

It looks like this problem occurs only at pages with (useless) single breadcrumb. Because, there is no (navigation) itemListElement item. Like for example: home page, new products, prices drop ... If you do not need this (useless) single breadcrumb on these pages you can do something like this in your theme file \templates\_partials\breadcrumb.tpl 


{if $breadcrumb.count > 1}

<nav data-depth="{$breadcrumb.count}" class="breadcrumb hidden-sm-down">
  <ol itemscope itemtype="http://schema.org/BreadcrumbList">
	...
  </ol>
</nav>

{/if}

 

 

Hello,

even if your solution works for the purpose of this thread it "breaks" mu cart and checkout page because in those pages the breadcrumbs tag is needed in order to sho the layout correctly.

 

It is possible to add another condition in order to avoi the if in order and checkout page?

 

Regards,

 

Vincenzo.

Link to comment
Share on other sites

  • 10 months later...
On 10/1/2019 at 12:02 PM, OlenaMokra said:

thisi is my final code:

<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'}
          {if not $smarty.foreach.breadcrumb.last}
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
              <a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a>
              <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}">
            </li>
                   {elseif isset($path.title)}
            <li>
              <span>{$path.title}</span>
            </li>
          {/if}
        {/block}
      {/foreach}
    {/block}
  </ol>
</nav>

 

Fantastic! Work fine for my shop (Presta 1.7.8.3). Tks so much!

Edited by mirkodescalchi (see edit history)
Link to comment
Share on other sites

  • 5 months later...
  • 2 months later...

Here is short code

<a itemprop="item" href="{$path.url}"><span itemprop="name">{$path.title}</span></a> <meta itemprop="position" content="{$smarty.foreach.breadcrumb.iteration}"> </li> {else} {elseif isset($path.title)} <li> <span>{$path.title}</span> </li>

If you need still help, Contact me, i will fix live

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...