1
我们有一个称为产品的内容类型,它有一个自定义的“输入”按钮,允许您“添加到购物车”。所以我有这样的:如何将微数据添加到价格字段?
<input type="submit" value="Buy Now $'.$content['field_price'][0]['#markup'].'" alt="Buy Now $'.$content['field_price'][0]['#markup'].'" />
的问题是价格字段输入字段内,因此没有显示出来,所以我就不得不表明价格一些其他的方式,包括它的产品页面中。
我有示例显示了页面上的价格,但我不想显示价格,因为它已显示在我的输入字段中。所以这是行不通的:
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Kenmore White 17" Microwave</span>
<img src="kenmore-microwave-17in.jpg" alt='Kenmore 17" Microwave' />
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">$55.00</span>
<link itemprop="availability" href="http://schema.org/InStock" />In stock
</div>
</div>
我看到这个工作的唯一方法是我做的这样偷偷摸摸的事:
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price" style="displaY: none;">$55.00</span>
</div>
那会被允许或者是不会解决我的问题?
UPDATE
这工作:
<div itemscope itemtype="http://schema.org/Product">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="price" style="displaY: none;">$55.00</span>
</div>
</div>
这不:
<div itemscope itemtype="http://schema.org/Product">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" itemprop="55.00" />
<meta itemprop="priceCurrency" itemprop="USD" />
</div>
</div>
不工作。我试着在这里添加它:https://developers.google.com/structured-data/testing-tool/ ...我会用更多的信息更新我的问题。 – coderama
@coderama:对不起,我在我的例子中有一个错字:第二个属性应该是'content',而不是重复的'itemprop'。我纠正了它。 – unor