Magento-覆盖表率资源模型 [英] Magento - Override the tablerate resource model

查看:56
本文介绍了Magento-覆盖表率资源模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了这里的各种线程,但是仍然无法解决以下问题.我试图使用下面的方法覆盖资源模型,但是我一点都没有运气.

I have read through the various threads on here however i can still not get the following problem resolved. I am attempting to override a resource Model using the method below, however i am having no luck at all.

Magento版本:1.7

Magento Version: 1.7

我想重写位于以下位置的 Mage_Shipping_Model_Resource_Carrier_Tablerate 类:

I would like to rewrite the the Mage_Shipping_Model_Resource_Carrier_Tablerate class found at:

app/code/core/Mage/Shipping/Model/Resource/Carrier/Tablerate

我也复制了文件:

app/code/local/me/Shipping/Model/Resource/Carrier/Tablerate.php

,并将文件中的类重命名为:

and renamed the class within the file to:

me_Shipping_Model_Resource_Carrier_Tablerate

我已经在app/etc/modules/me_Shipping.xml中创建了一个文件,其中包含:

I have created a file in app/etc/modules/me_Shipping.xml that contains:

<?xml version="1.0"?>
<config>
    <modules>
        <me_Shipping>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Shipping />
            </depends>
        </me_Shipping>
    </modules>
</config>

最后,我在以下位置创建了config.xml: app/code/local/me/Shipping/etc/config.xml

Finally i have create a config.xml in: app/code/local/me/Shipping/etc/config.xml

我在此文件中尝试了许多变体,我的最新版本是:

I have tried many variations in this file, my latest is:

<?xml version="1.0"?>
<config>
    <modules>
        <me_Shipping>
            <version>1.0</version>
        </me_Shipping>
    </modules>

    <global>
        <models>
            <shipping>
                <rewrite>
                    <resource_carrier_tablerate>me_Shipping_Model_Resource_Carrier_Tablerate</resource_carrier_tablerate>
                </rewrite>
            </shipping>
        </models>
    </global>
</config> 

预先感谢

推荐答案

    <shipping_resource>
        <rewrite>
            <carrier_tablerate>me_Shipping_Model_Resource_Carrier_Tablerate</carrier_tablerate>
        </rewrite>
    </shipping_resource>

这解决了问题

这篇关于Magento-覆盖表率资源模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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