如何将Block添加到另一个--Magento 2

问题描述 投票:0回答:2

这是怎么回事!

我需要一些帮助。我正在尝试使用以下代码创建一些块:

    <referenceContainer name="content">
    <block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit" name="quotes_quotes_edit" template="Gysa_Quotes::quote/create/form.phtml">
        <block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit\Products" template="Gysa_Quotes::quote/create/products.phtml" name="quotes_quotes_edit_products" />
    </block>
</referenceContainer>

但块“quotes_quotes_edit_products”并没有显示出来。我看了一些关于“Magento Sales”的例子,我可以看到这是可能的。那么我做错了什么。

任何人都可以帮忙。

干杯。

magento frontend block magento2
2个回答
0
投票

这可能听起来很傻,但是你清除了缓存吗?如果启用模板提示,还可以查看是否已加载块


0
投票

只是改变它: -

  <referenceContainer name="content">
    <block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit" name="quotes_quotes_edit" template="Gysa_Quotes::quote/create/form.phtml">
    name="quotes_quotes_edit_products" />
    </block>
<refernceBlock name="quotes_quotes_edit">
    <block class="Gysa\Quotes\Block\Adminhtml\Quotes\Edit\Products" template="Gysa_Quotes::quote/create/products.phtml" 
</refernceBlock>
</referenceContainer>
© www.soinside.com 2019 - 2024. All rights reserved.