为什么 Magento 没有获取我的交易电子邮件订单的主题模板文件?

发布于 2024-12-14 19:14:34 字数 2135 浏览 4 评论 0原文

我对 Magento 后端的新订单交易电子邮件模板进行了一些模板更改。电子邮件顶部的文本更改(在“感谢您的订单...”部分)效果很好。但是,当我更改订单详细信息的模板时,它们没有出现在我的电子邮件中。

我在模板中创建了两个文件,我认为它们会覆盖电子邮件:

  1. app/design/frontend/default/mythemehere/template/email/order/items.phtml
  2. app/design/frontend /default/mythemehere/template/email/order/items/order/default.phtml

这些在 app/design/frontend/default/mythemehere/layout 中的 sales.xml 文件中引用

<sales_email_order_items>
    <block type="sales/order_email_items" name="items" template="email/order/items.phtml">
        <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
        <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
            <action method="setLabelProperties"><value>colspan="2" align="right" style="padding:3px 9px"</value></action>
            <action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
            <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
                <action method="setIsPlaneMode"><value>1</value></action>
            </block>
        </block>
    </block>
    <block type="core/text_list" name="additional.product.info" />
</sales_email_order_items>

但是,当我下订单时,我会在电子邮件中收到基本模板。

如果我在 Magento 中犯下了重写基本模板文件(app/design/frontend/base/default/template/email/order ...)的大罪,你瞧,我看到了我的更改!看来 Magento 非常热衷于使用它的基本模板。

我已经覆盖了销售部分中的其他模板(例如:sales/order/view.phtml、sales/order/print.phtml),Magento 论坛上的各种帖子表明从概念上讲,我正在做正确的事情。但唉!这对我来说不起作用。

I made some template changes to Magento's New Order transactional email template in the backend. The textual changes at the top of the email (in the "thanks for your order..." section) worked fine. But when I change the templates for the order details, they are not appearing in my email.

I have created two files within my template which I thought would override the email:

  1. app/design/frontend/default/mythemehere/template/email/order/items.phtml
  2. app/design/frontend/default/mythemehere/template/email/order/items/order/default.phtml

These are referenced in my sales.xml file in app/design/frontend/default/mythemehere/layout

<sales_email_order_items>
    <block type="sales/order_email_items" name="items" template="email/order/items.phtml">
        <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
        <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
            <action method="setLabelProperties"><value>colspan="2" align="right" style="padding:3px 9px"</value></action>
            <action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
            <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
                <action method="setIsPlaneMode"><value>1</value></action>
            </block>
        </block>
    </block>
    <block type="core/text_list" name="additional.product.info" />
</sales_email_order_items>

However, when I place my order, I get the base template in the email.

If I commit the Cardinal Sin in Magento of overriding base template files (app/design/frontend/base/default/template/email/order ...), lo and behold, I see my changes! Seems Magento is very keen to use its base template.

I have overridden other templates in the sales section (eg: sales/order/view.phtml, sales/order/print.phtml), and various posts on Magento's forums indicate I'm doing the right thing in concept. But alas! It's just not working for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

秋千易 2024-12-21 19:14:34

要将您的自定义主题文件用于订单电子邮件“app/design/frontend/default/mythemehere/template/email/order/items.phtml”,请

在管理中转到“系统”->“配置”->“设计”,

从顶部选择您的网站左边
现在,在主题模板中取消选中复选框并添加主题名称。

To use your custom theme file for order email "app/design/frontend/default/mythemehere/template/email/order/items.phtml"

In the admin go to System->configuration->design

Select your website from the top left
Now in the themes template uncheck the checkbok and add the theme name.

一直在等你来 2024-12-21 19:14:34

我也有同样的问题。我发现电子邮件将在“基本”模板之前使用 /app/design/frontend/default/default 模板。因此,如果您将基本模板复制到 default/default 文件夹中,您的文件在更新时不会被覆盖。

然而,它仍然不理想,因为它仍然在主题文件夹之外,但它比使用“基本”文件更好。我还没有找到真正的解决方案。

I had the same problem. I discovered that the emails will use the /app/design/frontend/default/default templates before the 'base' templates. So if you copy the base templates into the default/default folder your files will not be overwritten on update.

However it is still not ideal as this is still outside your theme folder, however it is better than using 'base' files. I still haven't found a true solution.

最丧也最甜 2024-12-21 19:14:34

发生这种情况是因为如果我们在System>Configuration>General ->> 下提到了错误的值。设计部分

Magento 默认设置

我们可以有以下两种情况。

1) 自定义设计的默认包

默认 package_custom 主题

default package_custom theme_directory

2) 自定义包

自定义包

自定义包目录

如果我们没有在当前包名称字段中填写正确的值,则会出现问题中提到的问题。

当我使用自定义包时,它发生在我身上,但给出的值是
当前包名称字段下的默认

我们应该正确配置主题,以便 Magento 可以正确遵循主题回退。

This kind of situation happens because if we mention wrong values under System>Configuration>General -> Design section

Magento default settings

We can have following two scenarios.

1) Default package with custom design

default package_custom theme

default package_custom theme_directory

2) Custom package

custom package

custom package directory

If we do not fill correct values under Current Package Name field then issue mentioned in the question will occur.

It happened with me when I was using a custom package but had given value as
default under Current Package Name field.

We should configure the theme properly so that Magento can follow theme fallback properly.

征棹 2024-12-21 19:14:34

覆盖 base/defaultdefault/default 中的模板 强烈建议不要,因为更新 Magento 将覆盖这些目录。

对我有用的(对于电子邮件)是将修改后的文件放在 app/design/frontend/your_design_package/default/templates/ 下。

Overwriting templates in base/default and default/default is strongly discouraged, because updating Magento will overwrite those directories.

What worked for me (with emails) is to put the modified files under app/design/frontend/your_design_package/default/templates/.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文