首页 > 解决方案 > Shopware 丰富的代码片段增加了产品问题

问题描述

我在我的商店使用 Shopware 5.5.10。我尝试为谷歌搜索控制台的每个产品设置“priceValidUntil”,因为它有警告。

在此处输入图像描述

5.5.8 版更新中告知的商店软件

priceValidUntil为、url和增加了丰富的image片段 gtin13

我在 details/index.tpl 中有以下部分

{block name='frontend_detail_index_buy_container_inner'}
                        <div itemprop="offers" itemscope itemtype="{if $sArticle.sBlockPrices}http://schema.org/AggregateOffer{else}http://schema.org/Offer{/if}" class="buybox--inner">
                            {* Product name *}
                            {block name='frontend_detail_index_name'}
                                <h1 class="product--title" itemprop="name" style="margin: 0px 0px 20px 0px; margin: 0rem 0rem 1.25rem 0rem;">
                                    {$sArticle.articleName}
                                </h1>
                            {/block}

如何将“priceValidUntil”丰富片段添加到我的产品中?

标签: microdatagoogle-rich-snippetsshopwarerich-snippets

解决方案


Shopware 没有允许您配置时间控制价格的功能。因此,只有一个模板块,提供此功能的插件可以在其中添加丰富的片段。由于仅在价格将在一定时间后停止的情况下才推荐使用该代码段。

这是块:https ://github.com/shopware/shopware/blob/8b4a754307c24cb26630ee72559b15b337e7ceff/themes/Frontend/Bare/frontend/detail/content/buy_container.tpl#L84

您可以像这样添加自己的数据:

{extends file="parent:frontend/detail/content/buy_container.tpl"}

{block name="frontend_detail_index_data_price_valid_until"}
    {$smarty.block.parent}
    <meta itemprop="priceValidUntil" content="your-time" />
{/block} 

这些是商店用品模板教程中描述的简单模板调整。不建议按正常价格使用,因为它们不会在特定时间结束。

//编辑:

https://github.com/shopware/shopware/blob/fe95215f7bb9da24f4b78a86300579b340f4a1c2/themes/Frontend/Bare/frontend/detail/content/header.tpl#L14

在产品详细信息页面上,shopware 将自动使用产品的第一张图片。不需要调整 - 如果您想更改此行为,您可以使用之前的语法并更改您想要覆盖的块。

https://github.com/shopware/shopware/blob/fe95215f7bb9da24f4b78a86300579b340f4a1c2/themes/Frontend/Bare/frontend/detail/content/header.tpl#L20

与 ean 相同。Shopware 将使用 Ean 字段作为 gtin 并检查输入的长度。您可以使用简单的模板调整来覆盖此逻辑。

https://github.com/shopware/shopware/blob/96161effd05153d4b95f4a9324998c047988724c/themes/Frontend/Bare/frontend/_includes/rating.tpl#L77

评级也是如此。


推荐阅读