gpt4 book ai didi

php - Magento 2 - 如何覆盖 block 模板

转载 作者:可可西里 更新时间:2023-10-31 22:52:32 25 4
gpt4 key购买 nike

我尝试覆盖

vendor\magento\module-multishipping\view\frontend\templates\checkout\addresses.phtml

我创建布局

app\code\My\CustomModule\view\frontend\layout\multishipping_checkout_addresses.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Multishipping\Block\Checkout\Addresses" name="checkout_addresses" template="My_CustomModule::checkout/addresses.phtml" cacheable="false">
</block>
</referenceContainer>
</body>
</page>

和模板

app\code\My\CustomModule\view\frontend\templates\checkout\addresses.phtml

<h1>It works </h1>

它不起作用...请帮助我!谢谢。

最佳答案

<referenceBlock name='copyright'>
<action method='setTemplate'>
<argument name='template' xsi:type='string'>Dfr_Backend::page/copyright.phtml</argument>
</action>
</referenceBlock>

关于php - Magento 2 - 如何覆盖 block 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35271324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com