0
votes

I'm trying to override: - Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract - Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options wich extends the first one

in config.xml i have:

<config>
    <global>
       <blocks>
          ....
          <eav>
          <rewrite>        
                  <adminthml_attribute_edit_options_abstract>         
                       Mymodule_Block_Adminhtml_Attribute_Edit_Options_Abstract
                  </adminthml_attribute_edit_options_abstract>
           </rewrite>               
      </eav>
      <adminhtml>
           <rewrite>
               <catalog_product_attribute_edit_tab>
                       Mymodule_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options
               </catalog_product_attribute_edit_tab>
           </rewrite>
      </adminhtml>
       </blocks>
       ....
    </global>
</config>

And Then in: code/local/Mymodule/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php:

class Mymodule_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options 
       extends Mymodule_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
{
}

And in: code/local/Mymodule/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php:

abstract class Mymodule_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract 
       extends Mage_Adminhtml_Block_Widget
{
....(code)...
}

But this two don't seem to be loaded. Any chance someone can help?

1

1 Answers

1
votes

You can only rewrite concrete classes that get instantiated. Rewriting actually maps the class alias used in createBlock() (or getModel(), helper() etc.) to a class name. The abstract class will never be addressed like this.

If you really need to make changes there, you have two options:

  1. copy the class to app/local/Mage and modify it. This way the autoloader prefers yours over the core class. It has to be a complete copy with the same class name. Note that this is considered bad practice and reduces maintainability but in cases like yours it might be unavoidable
  2. rewrite all concrete classes that extend from this one