0

I want add a function to the core class. To do this I have added a file to extend the class core but when I call the function it's returning nothing.

0

for this you need to rewrite that class in your custom module config.xml and then your class will load first and for core functions it will take core classes

Here is below sample code you can rewrite block classes, The same way you can rewrite helpers and Model classes

If I want to rewrite this block class `Mage_Adminhtml_Block_Sales_Order_Create then I code in my module config.xml Like Below.

<global>
    <blocks>
        <adminhtml>
            <rewrite>
               <sales_order_create>Trimantra_Smallchanges_Block_Adminhtml_Sales_Order_Create</sales_order_create>
            </rewrite>
        </adminhtml>
    </blocks>
</global>

And In my class Trimantra_Smallchanges_Block_Adminhtml_Sales_Order_Create

I code Like Below

class Trimantra_Smallchanges_Block_Adminhtml_Sales_Order_Create extends Mage_Adminhtml_Block_Sales_Order_Create {
       //My Function Or funcions That I want to Rewrite..
}

In blow url I have written a blog you can also check that for more reference

http://blog.trimantra.com/magento-difference-override-rewrite/

Or you can check blow answer for more detail

How do I override/rewrite a block class in Magento 1?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.