我目前正在使用Shopware 6插件。我有一个MyCustomProductDetailRoute.php
。我插件目录中的自定义文件将变量$expectedShippingCosts
变量设置为扩展名,如下所示:
$productDetailResponse->getResult()->addExtension(
'expectedShippingCosts', $expectedShippingCosts);
但是当我无法从twig模板中的page.extensions.expectedShippingCosts
访问expectedShippingCosts
属性时。我的dump(page)
显示:
Shopware\Storefront\Page\Product\ProductPage {#8164 ▼
#extensions: []
#header: Shopware\Storefront\Pagelet\Header\HeaderPagelet {#7759 ▶}
#footer: Shopware\Storefront\Pagelet\Footer\FooterPagelet {#7739 ▶}
#salesChannelShippingMethods: Shopware\Core\Checkout\Shipping\ShippingMethodCollection {#8083 ▶}
#salesChannelPaymentMethods: Shopware\Core\Checkout\Payment\PaymentMethodCollection {#8233 ▶}
#metaInformation: Shopware\Storefront\Page\MetaInformation {#7953 ▶}
#product: Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity {#6490 ▶}
#cmsPage: null
#navigationId: "01898d65262070718a76e2a12169ea79"
#configuratorSettings: Shopware\Core\Content\Property\PropertyGroupCollection {#5563 ▶}
#reviewLoaderResult: Shopware\Storefront\Page\Product\Review\ReviewLoaderResult {#7964 ▶}
#selectedOptions: Shopware\Core\Content\Property\Aggregate\PropertyGroupOption\PropertyGroupOptionCollection {#8324 ▶}
#crossSellings: Shopware\Core\Content\Product\SalesChannel\CrossSelling\CrossSellingElementCollection {#8357 ▶}
}
如何访问twig模板中的扩展名?
问候,Lodhi
1条答案
按热度按时间gfttwv5a1#
将其更改为