I'm trying to override the Helper_Data of a thirdparty module. But for some reason it wont work.
app/etc/modules/My_CustomModule.xml
<?xml version="1.0"?> <config> <modules> <My_CustomModule> <active>true</active> <codePool>local</codePool> <depends> <Idev_OneStepCheckout/> </depends> </My_CustomModule> </modules> </config>
.
app/code/local/My/CustomModule/etc/config.xml
<?xml version="1.0"?> <config> <modules> <My_CustomModule> <version>0.1.1</version> </My_CustomModule> </modules> <global> <helpers> <onestepcheckout> <rewrite> <data>My_CustomModule_Helper_Data</data> </rewrite> </onestepcheckout> </helpers> </global> </config>
.
app/code/local/My/CustomModule/Helper/Data.php
<?php class My_CustomModule_Helper_Data extends Idev_OneStepCheckout_Helper_Data { public function setCustomerComment($observer) { Mage::log(get_class($this), null, 'test.log'); // REST OF PARENT FUNCTION I WANT TO OVERRIDE } }
I already added a Mage::log
to the function I'm trying to override but this keeps returning the classname of the original function.
UPDATE:
I did some digging in the code and found out that the function setCustomerComment is called by the observer event. I have no idea what this exactly does and or this just simply overrules the override?
app/code/local/Idev/OneStepCheckout/etc/config.xml
<?php <events> <checkout_type_onepage_save_order> <observers> <onestepcheckout_save_customercomment> <type>model</type> <class>Idev_OneStepCheckout_Helper_Data</class> <method>setCustomerComment</method> </onestepcheckout_save_customercomment> </observers> </checkout_type_onepage_save_order> ... </events>
I also created a file "test.php" in the root of magento with the code:
test.php
<?php include "app/Mage.php"; Mage::app(); $customerHelper = Mage::helper('onestepcheckout/data'); var_dump(get_class($customerHelper));
This returns the module I have created, so it should override the initial class and functions right?
Any help would be appreciated.