VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Digi-web on August 29, 2018, 12:50:47 PM

Title: breadcrumb ListItem does not show the product URL - link
Post by: Digi-web on August 29, 2018, 12:50:47 PM
Hello,

i think i figured an issue from Google https://search.google.com/structured-data/testing-tool
The last item (product) is missing the item value ( URL ) when we are on a virtuemart product page.

Google reports:
itemListElement   
@type   
ListItem
name   
ItemName
position   
5
litem   
A value for the item field is required

i performed a var_dump($item); in 

modules\mod_breadcrumbs\tmpl\default.php:67:
object(stdClass)[1299]
  public 'name' => string 'XXX name' (length=54)
  public 'link' => string '' (length=0)


A relative posts is this one (other issue thought):
https://forum.virtuemart.net/index.php?topic=139906.msg491659#msg491659

Is there an option for that i am missing perhaps?

info:
Use full category tree for product links enabled
Virtuemart - joomla latest.
Tested on both localhost and live servers.

BR,
Alexander
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: StefanSTS on September 10, 2018, 07:25:00 AM
Hello Alexander,

the structured data is given by the sublayout snippet.php. Maybe you like to add the the property "url" there?

Regards
Stefan
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: jjk on September 10, 2018, 10:12:52 AM
I can reproduce that. But Google's Structured Data Testing Tool throws an error only if the Joomla breadcrumbs are enabled. (I don't use it on my live site). Without the breadcrumbs module enabled, the test tool shows no error.

If I understand it correctly, Google expects the URL to the webpage that represents the breadcrumb as the value of 'item'.

Update:
Just tested a replacement for the Joomla breadcrumbs module. In my test case, the Google 'Structured Data Test Tool' shows no error after I replaced the original Joomla breadcrumbs module with this one:
https://extensions.joomla.org/extension/microdata-google-breadcrumbs/ (https://extensions.joomla.org/extension/microdata-google-breadcrumbs/)
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: Digi-web on September 10, 2018, 14:12:47 PM
Yes jjk, this is the case only with the module you fan see this error.
Hmm sinxe the error does not appear with the ither breadcumb  perhaps it is not a vm issue ... but perhaps the devs there have made a custom query os such .. cannot be sure .

I will further test when i have time . Surelley it must be addressed by either vm or joomla devs.

Br
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: Digi-web on September 20, 2019, 13:59:42 PM
Hello again, long time no see.
I guess you have noticed the google update informing about this issue (Missing field 'item' eg: https://support.google.com/webmasters/thread/14845432?hl=en).

I can confirm the module does not have this error, at least it is a temporary workaround...

I am not sure if it is a virtuemart or Joomla issue after all.
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: StefanSTS on October 01, 2019, 16:52:04 PM
https://github.com/joomla/joomla-cms/pull/26268#issuecomment-533903915
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: Studio 42 on October 02, 2019, 00:06:48 AM
Here my answer in github https://github.com/joomla/joomla-cms/pull/26268#issuecomment-533791148
I implemented this and no more breadcrumb error report.
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: StefanSTS on October 02, 2019, 07:17:04 AM
Studio, your snippet does not give a consistent structure, see the first screenshot.

I posted two default.php files for mod_breadcrumbs' default.php in the Joomla forum, that produce the same structure for all list items like in the second screenshot.
https://forum.joomla.org/viewtopic.php?f=712&t=974526&p=3581290#p3581290

The second default.php has the option to show the last current item as a link, which is not wanted mostly, but some might want that.

Regards
Stefan
Title: Re: breadcrumb ListItem does not show the product URL - link
Post by: Studio 42 on October 02, 2019, 16:27:53 PM
Google validated the snippet. But you are right, the item need to be inside the listItem
This code is right and dont need a link:
        $uri = JFactory::getURI();
         $absolute_url = $uri->toString();
         // Render last item if reqd. ?>
         <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="active">
            <span itemprop="item" content="<?php echo $absolute_url?>">
               <span itemprop="name">
                  <?php echo $item->name?>
               </span>
            </span>
            <meta itemprop="position" content="<?php echo $key 1?>">
         </li>