【问题标题】:Magento 2 override default.phtml and items.phtml in new order emailMagento 2 在新订单电子邮件中覆盖 default.phtml 和 items.phtml
【发布时间】:2017-06-06 17:41:14
【问题描述】:

我制作了一个覆盖 default.phtml 的模块,并将产品图像放在那里,它工作正常!

我制作了这个 sales_email_orders_renderers.xml 来覆盖 default.phtml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="sales.email.order.renderers">
        <block class="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder" as="default" template="EmizenTech_SalesEmail::email/items/order/default.phtml"/>
    </referenceBlock>
</body>
</page>

原件在vendor/magento/module-sales/view/frontend/templates/email/items/order/

但是如何也覆盖其他文件夹中的 items.phtml 呢?

/vendor/magento/module-sales/view/frontend/templates/email/

我需要制作另一个xml还是可以在现有的xml中添加一些标签?

【问题讨论】:

    标签: magento magento2


    【解决方案1】:

    请转到您的主题并创建文件夹 Magento_Sales/templates/email/items/order

    那么 下载default.phtml文件

    来自 /vendor/magento/module-sales/view/frontend/templates/email/items/order

    然后粘贴到这里 Magento_Sales/templates/email/items/order your theme.

    【讨论】:

    • 无论如何在模块中而不是在主题中这样做?因为模块化开发在现代技术中更加强大。
    • @GhulamAkbar,你有没有为模块找到任何解决方案
    猜你喜欢
    • 2016-01-23
    • 1970-01-01
    • 1970-01-01
    • 2019-03-13
    • 1970-01-01
    • 2013-11-21
    • 2011-09-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多