【问题标题】:Shopware rich-snippets add to products problemShopware 丰富的代码片段增加了产品问题
【发布时间】:2019-06-21 21:23:24
【问题描述】:

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

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

priceValidUntilurlimagegtin13

我在 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”rich-sn-ps 添加到我的产品中?

【问题讨论】:

    标签: microdata google-rich-snippets shopware rich-snippets


    【解决方案1】:

    Shopware 没有允许您配置时间控制价格的功能。因此,只有一个模板块提供此功能的插件可以添加其丰富的 sn-ps。因为 sn-p 仅在价格将在一定时间后停止的情况下推荐。

    这是块: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

    评分也是如此。

    【讨论】:

    • 网址、图片和 gtin?我的问题问这个,请更新接受。
    • 根据我上面的回答,您应该已经能够进行这些调整,因为它在每次模板更改时都以相同的方式工作。即使在 stackoverflow 上,其他人也可能无法完全完成所有工作;)我在上面的答案中添加了附加评论。
    猜你喜欢
    • 1970-01-01
    • 2014-09-22
    • 1970-01-01
    • 2017-02-04
    • 2019-04-05
    • 2019-02-10
    • 1970-01-01
    • 1970-01-01
    • 2016-02-15
    相关资源
    最近更新 更多