Magento - Override the tablerate resource model

半城伤御伤魂 提交于 2019-12-12 04:13:07

问题


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 Version: 1.7

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

I have copied the file too:

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

and renamed the class within the file to:

me_Shipping_Model_Resource_Carrier_Tablerate

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>

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> 

Thanks in advance


回答1:


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

This resolves the issue



来源:https://stackoverflow.com/questions/12673185/magento-override-the-tablerate-resource-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!