0

我有一个在线商店(它是 Shopware 6 [Symfony,twig])。在产品详细信息页面 i 显示变化。当它们缺货时,我将它们设为灰色:

在此处输入图像描述

但问题出在产品列表页面中,我无法在快速视图中将缺货产品变灰,因为我的变量不会加载:

在此处输入图像描述

我想知道我是否可以以某种方式包含以下变量:

    {% sw_include '@Storefront/storefront/page/product-detail/configurator.html.twig' with {notinhere : page.unavailable} %}

更新: 此代码在我的 Configurator.html.twig 中:

    {% set notinhere = page.unavailable %}
    <div class="product-detail-configurator-option {% if option.id in page.unavailable %}grau-labels{% endif %}">
        {% block page_product_detail_configurator_option_radio %}
            <input type="radio" name="{{ group.id }}" value="{{ option.id }}" class="product-detail-configurator-option-input{% if isCombinableCls %} {{ isCombinableCls }}{% endif %}" title="{{ optionIdentifier }}" id="{{ optionIdentifier }}" {% if isActive %} checked="checked" {% endif %}>
        </div>
    {% endblock %}

然后这个文件包含在我的 buy-widget.html.twig 中

{% if page.product.parentId and page.configuratorSettings|length > 0 %}
    <div class="product-detail-configurator-container">
        {% sw_include '@Storefront/storefront/page/product-detail/configurator.html.twig' %}
    </div>
{% endif %}

和使用这个(buy-widget.html.twig)的产品详细信息页面,它在产品详细信息页面中工作得很好。

我的快速浏览树枝包括:

    {% sw_include '@Storefront/storefront/page/product-detail/buy-widget.html.twig' %}

所以,我尝试notinhere : page.unavailable在两个 sw_include 上添加,但它仍然无法正常工作。这里有什么问题?!

4

0 回答 0