Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Issues rewriting Function in Class Mage_Shipping_Model_Mysql4_Carrier_Tablerate
 
Zettt
Jr. Member
 
Total Posts:  9
Joined:  2012-06-10
 

Hi, I want to rewrite the function getRate(Mage_Shipping_Model_Rate_Request $request), wich is found in class Mage_Shipping_Model_Resource_Carrier_Tablerate. This class is extended by class Mage_Shipping_Model_Mysql4_Carrier_Tablerate, wich is extended by my class. The extension is set active in the backend, but my rewritten function isn’t called. Magento uses the corefunction instead.

This is the config.xml

<?xml version="1.0"?>
<config>
    <
modules>
        <
COMPANY_ZShipping>
            <
version>0.1.0</version>
        </
COMPANY_ZShipping>
         </
modules>

    <global>
        <
models>
            <
shipping_mysql4>
                <
rewrite>
                    <
carrier_tablerate>COMPANY_ZShipping_Model_Mysql4_Carrier_Tablerate</carrier_tablerate>
                </
rewrite>
            </
shipping_mysql4>
        </
models>
    </global>
</
config>

This is my COMPANY_ZShipping.xml

<?xml version="1.0"?>
<config>
    <
modules>
        <
COMPANY_ZShipping>
            <
active>true</active>
            <
codePool>local</codePool>
        </
COMPANY_ZShipping>
    </
modules>
</
config>

And this is the beginning of my classfile

<?php
class COMPANY_ZShipping_Model_Mysql4_Carrier_Tablerate extends Mage_Shipping_Model_Mysql4_Carrier_Tablerate{
        
    
public function getRate(Mage_Shipping_Model_Rate_Request $request){
....}

I asked google, searched through the magento homepage, magento answers, wiki, forum, etc and tried countless possible solutions, but nothing worked. Please help me, i don’t know what to try anymore.

Greetings, Zettt

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lister Tech
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2012-02-15
 

Change your module name form ZShipping to Zshipping may work

 
Magento Community Magento Community
Magento Community
Magento Community
 
Zettt
Jr. Member
 
Total Posts:  9
Joined:  2012-06-10
 

What the…

Thanks for the advice, it seems to work now. Think i won’t ever make THAT stupid mistake again…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Zettt
Jr. Member
 
Total Posts:  9
Joined:  2012-06-10
 

.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top