简体   繁体   English

在Schema.org中显示折扣

[英]Show discount in Schema.org

I have a product which has reduced price. 我有一个降价的产品。 I want to show both prices - original and discounted. 我想要显示两种价格 - 原价和折扣价。 Is there a way to mark this in Schema.org? 有没有办法在Schema.org中标记这个?

For now I have something similar: 现在我有类似的东西:

<ul class="productPriceList" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
     <li class="productPriceList">
         <div class="price red"><span class="" itemprop="price">4302</span>&nbsp;<span itemprop="priceCurrency" content="USD">$</span></div>
         <span class="price crossOut" itemprop="price">26890</span>&nbsp;<span itemprop="priceCurrency" content="USD">$</span>&nbsp;<span class="product-promo">84</span>%&nbsp;off
     </li>                  
</ul>

This shows as: 这显示为:

offers  
     @type: Offer
     price: 4302
     priceCurrency: USD 
     price: 26890
     priceCurrency: USD 

Your current markup doesn't convey which price is the old/new one. 您当前的加价不会传达哪个价格是新旧价格。 You shouldn't use that. 你不应该使用它。

You could use two PriceSpecification items instead (as value for the priceSpecification property). 您可以使用两个PriceSpecification项目(作为priceSpecification属性的值)。 With validFrom and validThrough you can specify the dates when the old price was valid and since when the new price is valid. 使用validFromvalidThrough您可以指定旧价格有效的日期以及新价格有效时的日期。

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

  <div itemprop="priceSpecification" itemscope itemtype="PriceSpecification">
    <s>$ <span itemprop="price">26890</span></s>
    <meta itemprop="priceCurrency" content="USD" />
    <meta itemprop="validThrough" content="…" />
  </div>

  <div itemprop="priceSpecification" itemscope itemtype="PriceSpecification">
    $ <span itemprop="price">4302</span>
    <meta itemprop="priceCurrency" content="USD" />
    <meta itemprop="validFrom" content="…" />
  </div>

</div>

(Note that the span element can't have a content attribute in Microdata. I replaced it with a meta element.) (注意, span元素在Microdata中不能有content属性。我用meta元素替换它。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM