Prestashop在Google搜索中缺少字段“价格”

我在Google Search Console中遇到一些错误:

Error screenshot

这是product-list.tpl的代码段:

{if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
    {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
        <span itemprop="price" class="price product-price{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} product-price-new{/if}">
            {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
        </span>
        <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
        {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
            {hook h="displayProductPriceBlock" product=$product type="old_price"}
            <span class="old-price product-price">
                {displayWtPrice p=$product.price_without_reduction}
            </span>
            {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
            {if $product.specific_prices.reduction_type == 'percentage'}
                <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
            {/if}
        {/if}
        {hook h="displayProductPriceBlock" product=$product type="price"}
        {hook h="displayProductPriceBlock" product=$product type="unit_price"}
    {/if}
</div>
{/if}

如何解决此错误?

更新,我没有注意到此代码似乎与错误有关:

{if $page_name != 'index'}
    {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}                                   
        {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
            <span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability">
                {if ($product.allow_oosp || $product.quantity > 0)}
                    <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}">
                        <link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
                    </span>
                {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                    <span class="available-dif">
                        <link itemprop="availability" href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}
                    </span>
                {else}
                    <span class="out-of-stock">
                        <link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'}
                    </span>
                {/if}
            </span>
        {/if}
    {/if}
{/if}
bingojqliu5 回答:Prestashop在Google搜索中缺少字段“价格”

sreenshot代码与屏幕截图不同。请注意,在屏幕截图中,项offers是类span的{​​{1}},而代码中的项目是类availability的{​​{1}}。

您需要检查此代码的来源。

然后检查div模式https://developers.google.com/search/docs/data-types/product

您需要添加一个content_price项,例如本示例https://search.google.com/structured-data/testing-tool?utm_campaign=devsite&utm_medium=microdata&utm_source=product

更新 添加价格代码:

Offer
本文链接:https://www.f2er.com/3083811.html

大家都在问