Magento 2.2.5:“指定了itemprop属性,但该元素不是任何项目的属性”

时间:2018-11-14 09:35:48

标签: html schema.org microdata

有人知道我需要添加什么来解决以下代码的问题吗?

<div class="product-info-main">
    <div class="product attribute overview">
        <div class="value" itemprop="description">
            KISS KISS BANG BANG
        </div>
    </div>
    <div class="product-info-price">
        <div class="page-title-wrapper product">
            <h1 class="page-title"><span class="base" data-ui-id="page-title-wrapper" itemprop="name">FAUX FUR TEDDY COAT</span></h1>
        </div>
        <div class="price-box price-final_price" data-price-box="product-id-9586" data-product-id="9586" data-role="priceBox">
            <span class="normal-price"><span class="price-container price-final_price tax weee" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><span class="price-wrapper" data-price-amount="350" data-price-type="finalPrice" id="product-price-9586"><span class="price">€350.00</span></span></span></span>
            <meta content="350" itemprop="price">
            <meta content="EUR" itemprop="priceCurrency">
        </div>
    </div>
</div>

错误与以下代码段有关:

<div class="value" itemprop="description">KISS K...

<span class="base" data-ui-id="page-title-wrapper" itemprop="name">...

<span class="price-container price-final_price tax weee" itemprop="offers" itemscope itemtype="http://schema.org/Offer">...

<meta itemprop="price" content="350" />...    

<meta itemprop="priceCurrency" content="EUR" />...

2 个答案:

答案 0 :(得分:0)

您的价格和priceCurrency不在要约范围内。工作代码可能是:

<div class="product-info-main">
    <div class="product attribute overview">
        <div class="value" itemprop="description">
            KISS KISS BANG BANG
        </div>
    </div>
    <div class="product-info-price">
        <div class="page-title-wrapper product">
            <h1 class="page-title"><span class="base" data-ui-id="page-title-wrapper" itemprop="name">FAUX FUR TEDDY COAT</span></h1>
        </div>
        <div class="price-box price-final_price" data-price-box="product-id-9586" data-product-id="9586" data-role="priceBox">
            <span class="normal-price"><span class="price-container price-final_price tax weee" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><span class="price-wrapper" data-price-amount="350" data-price-type="finalPrice" id="product-price-9586"><span class="price">€350.00</span>
                        <meta content="350" itemprop="price">
            <meta content="EUR" itemprop="priceCurrency">
            </span></span></span>
        </div>
    </div>
</div>

enter image description here

答案 1 :(得分:0)

删除与微数据无关的所有内容,您可以:

<div itemprop="description">KISS KISS BANG BANG</div>

<span itemprop="name">FAUX FUR TEDDY COAT</span>

<span itemprop="offers" itemscope itemtype="http://schema.org/Offer"></span>

<meta content="350" itemprop="price">
<meta content="EUR" itemprop="priceCurrency">

除非您的摘要中未显示父微数据项(带有itemscope,并且可能有itemtype),否则您的itemprop属性都不会与该项相关联,这是无效的。

我假设您的数据是关于Product的,因此应该是这样的:

<article itemscope itemtype="http://schema.org/Product">

  <p itemprop="description">KISS KISS BANG BANG</p>

  <h2 itemprop="name">FAUX FUR TEDDY COAT</h2>

  <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <meta content="350" itemprop="price">
    <meta content="EUR" itemprop="priceCurrency">
  </div>

</article>