Magento-如何覆盖管理销售总额块(Mage_Adminhtml_Block_Sales_Totals) [英] Magento - How override admin Sales Totals block (Mage_Adminhtml_Block_Sales_Totals)

查看:109
本文介绍了Magento-如何覆盖管理销售总额块(Mage_Adminhtml_Block_Sales_Totals)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试覆盖"/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php"下的admin Sales Totals块(Mage_Adminhtml_Block_Sales_Totals)

I am trying to override the admin Sales Totals block (Mage_Adminhtml_Block_Sales_Totals) situated under "/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php"

我这样声明我的模块:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <CompanyName_Adminhtml>
            <version>0.1.0</version>
        </CompanyName_Adminhtml>
    </modules>

    <global>
        <blocks>

            <companyname_adminhtml>
                <class>CompanyName_Adminhtml_Block_Adminhtml_Sales_Totals</class>
            </companyname_adminhtml>

            <adminhtml>
                <rewrite>
                    <sales_totals>CompanyName_Adminhtml_Block_Adminhtml_Sales_Totals</sales_totals>
                </rewrite>
            </adminhtml>

        </blocks>
    </global>
</config>

我的模块类路径是这样的: local/CompanyName_Adminhtml/Block/Adminhtml/Sales/Totals.php

My module class path is like this: local/CompanyName_Adminhtml/Block/Adminhtml/Sales/Totals.php

我的班级代码开始是这样的:

and My class code start like this:

class CompanyName_Adminhtml_Block_Adminhtml_Sales_Totals extends Mage_Adminhtml_Block_Sales_Totals   {
        // block methods goes here..
    }           

不幸的是,该类重写无效,并且在日志文件中没有任何错误. 我正在使用Magento 1.7.0.2版

Unfortunately the class override don't works and I don't get any errors in the log files. I am using Magento Version 1.7.0.2

在magento后台,我可以看到我的模块已启用.

In the magento backoffice I can see my module as enabled.

有帮助吗?

推荐答案

尝试覆盖单个的Totals.php块,该块位于Mage/AdminHtml/Block/Sales/Order/文件的位置,而不是位于菜单下的主要Totals.php. Mage/AdminHtml/Block/Sales/文件夹.

Try Overriding the individual Totals.php block which is at the location Mage/AdminHtml/Block/Sales/Order/ file rather than the main Totals.php under the Mage/AdminHtml/Block/Sales/ folder.

对我有用.因为我想在order-totals块中再显示一行.

It worked for me. As i wanted to show one more row in the order-totals block.

这篇关于Magento-如何覆盖管理销售总额块(Mage_Adminhtml_Block_Sales_Totals)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆