3
votes

I am trying to override a plugin in the local code pool with another plugin in the local code pool, but the block I need to override is not overriding. The helper in my config xml overrode just fine. Any, ideas on what my issue might be?

I also used Modules Conflict Detector and made sure we do not have any conflicts in our magento instance.

Module I am trying to override

app/code/local/Idev/OneStepCheckout/etc/config.xml

<blocks>
    <onestepcheckout>
        <class>Idev_OneStepCheckout_Block</class>
    </onestepcheckout>
</blocks>

app/code/local/Idev/OneStepCheckout/Block/Checkout.php

class Idev_OneStepCheckout_Block_Checkout extends Mage_Checkout_Block_Onepage_Abstract  {
    public function getBillingFieldsOrder($fields = array()){
    ....
    }
}

My Module

app/etc/modules/KNG_OneStepCheckout.xml

<config>
    <modules>
        <KNG_OneStepCheckout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Idev_OneStepCheckout />
            </depends>
        </KNG_OneStepCheckout>
    </modules>
</config>

app/code/local/KNG/OneStepCheckout/etc/config.xml

<global>
    <blocks>
        <onestepcheckout>
            <rewrite>
                <checkout>KNG_OneStepCheckout_Block_Checkout</checkout>
            </rewrite>
        </onestepcheckout>
    </blocks>
    <helpers>
        <onestepcheckout>
            <rewrite>
                <checkout>KNG_OneStepCheckout_Helper_Checkout</checkout>
            </rewrite>
        </onestepcheckout>
    </helpers>
</global>

app/code/local/KNG/OneStepCheckout/Block/Checkout.php

class KNG_OneStepCheckout_Block_Checkout extends Idev_OneStepCheckout_Block_Checkout {
    public function getBillingFieldsOrder($fields = array()) {
    ....
    }
}
1

1 Answers

2
votes

I found out that their module already had another class overriding the class I was trying to override. Not sure why it didn't show up as a conflict when I checked for conflicts though.

Their Class that was overriding already

app/code/local/Idev/OneStepCheckout/Block/Fields.php

class Idev_OneStepCheckout_Block_Fields extends Idev_OneStepCheckout_Block_Checkout
{
....
}

To make my override work I just overrode the fields class instead of the checkout class and it worked like a charm.

Working Code

app/etc/modules/KNG_OneStepCheckout.xml

<config>
    <modules>
        <KNG_OneStepCheckout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Idev_OneStepCheckout />
            </depends>
        </KNG_OneStepCheckout>
    </modules>
</config>

app/code/local/KNG/OneStepCheckout/etc/config.xml

<global>
    <blocks>
        <onestepcheckout>
            <rewrite>
                <fields>KNG_OneStepCheckout_Block_Fields</fields>
            </rewrite>
        </onestepcheckout>
    </blocks>
    <helpers>
        <onestepcheckout>
            <rewrite>
                <checkout>KNG_OneStepCheckout_Helper_Checkout</checkout>
            </rewrite>
        </onestepcheckout>
    </helpers>
</global>

app/code/local/KNG/OneStepCheckout/Block/Fields.php

class KNG_OneStepCheckout_Block_Fields extends Idev_OneStepCheckout_Block_Fields {
    public function getBillingFieldsOrder($fields = array()) {
    ....
    }
}