Magento local block will not overlap
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 xml config overrode is just fine. Any ideas on what my problem is?
I also used Modules Conflict Detector and made sure we don't have conflicts in our magento instance.
The module I'm trying to override
Application / 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 / amng / 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 / amng / OneStepCheckout / block / Checkout.php
class KNG_OneStepCheckout_Block_Checkout extends Idev_OneStepCheckout_Block_Checkout {
public function getBillingFieldsOrder($fields = array()) {
....
}
}
source to share
I found out that their module already had another class overriding the class that I was trying to override. Not sure why this didn't seem like a conflict when I checked for conflicts.
Their class which has already been overridden
App / Code / Local / Idev / OneStepCheckout / Block / Fields.php
class Idev_OneStepCheckout_Block_Fields extends Idev_OneStepCheckout_Block_Checkout
{
....
}
To get my overriding work done, I just overridden the field class instead of the validation 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 / amng / 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 / amng / OneStepCheckout / block / Fields.php
class KNG_OneStepCheckout_Block_Fields extends Idev_OneStepCheckout_Block_Fields {
public function getBillingFieldsOrder($fields = array()) {
....
}
}
source to share