覆盖Magento子总计并在管理员发票电子邮件中添加新行

时间:2013-01-21 08:04:56

标签: magento

我想在Magento Invoice Email中添加Sub total之后的新行。任何人都可以指出我的Invoice Email重写的右核心文件吗?

我试图在Magento核心文件中找到文件,以便在Sub Total之后添加Invoice Email新行,但我不知道Magento核心文件夹中的正确路径和文件名。

2 个答案:

答案 0 :(得分:3)

您正在寻找Totals-block。请查看本文底部的链接,其中给出了如何扩展和添加自己的选项的示例

基本上你必须向magento表明,在某些类型如报价,发票,......你想要添加一个“总计”项目,你可以给出如例子中的位置:

<global>
        <sales>
            <quote>
                <totals>
                    <yourcompany_yourmodule>
                        <class>company_module/path_to_class</class>
                        <after>subtotal</after>
                        <before>tax</before>
                    </yourcompany_yourmodule>
                </totals>
            </quote>
            <order_invoice>
                <totals>
                    <yourcompany_yourmodule>
                        <class>company_module/path_to_class</class>
                        <after>subtotal</after>
                        <before>tax</before>
                    </yourcompany_yourmodule>
                </totals>
            </order_invoice>
            <order_creditmemo>
                <totals>
                    <yourcompany_yourmodule>
                        <class>company_module/path_to_class</class>
                        <after>subtotal</after>
                        <before>tax</before>
                    </yourcompany_yourmodule>
                </totals>
            </order_creditmemo>
        </sales>
    </global>

您必须创建正确的类并从所需的类扩展。

更多信息和步骤:http://turnkeye.com/blog/magento-development-add-total-row-checkout/

答案 1 :(得分:0)

我已使用以下重写规则重新编写了发票电子邮件子总计并在子总计之后添加了ned行

    <blocks>
            <sales>
            <rewrite>
                <order_invoice_totals>Companyname_Modulename_Block_Sales_Order_Invoice_Totals</order_invoice_totals>
            </rewrite>
            </sales>
</blocks>

并在下面的路径中重写子总数

<?php 
class Companyname_Modulename_Block_Sales_Order_Invoice_Totals extends Mage_Sales_Block_Order_Invoice_Totals
{
    protected function _initTotals()
    {
            parent::_initTotals();

            //Your Code Logic Here

            return $this;
    }
}