I want to rewrite core/adminthtml/block/widget/tabs.php class which is a super class for core/adminhtml/block/sales/order/view/tabs.php class.
Here is config code for both scenarios:
<blocks>
<adminhtml>
<rewrite>
<sales_order_view_tabs>Jimmy_SalesAffil_Block_Widget_Tabs</sales_order_view_tabs>
<widget_tabs>Jimmy_SalesAffil_Block_Widget_Tabs</widget_tabs>
.....
</rewrite>
</adminhtml>
</blocks>
While I am able to rewrite ...view/tabs.php, I am not able to rewrite the super class. Why? Is it possible? How?
You can rewrite the parent class, but that will only apply to calls for that class itself. So this call will retrieve the correctly overridden class:
This is because the real classname is loaded by Magento using the XML / overrides system. However, if you don’t override the child class, this call will not work as you expect:
That’s because the parent class is not specified using Magento’s system, but using regular PHP:
If you want to override the parent class, the XML-based override system cannot help you. You can, however, copy the
Widget_Tabsclass into the local space and Magento will load it there. Make a directory pathapp/code/local/Mage/Adminhtml/Block/Widget/and copyTabs.phpinto it, and you can make modifications as necessary.Hope that helps.
Thanks,
Joe