Magento - overriding Adminhtml block

坚强是说给别人听的谎言 提交于 2019-11-29 15:45:24

Shown below, with a slight modification. It appears that you've misspelt "edit" as "sdit".

<global>
   <blocks>
      <adminhtml>
        <rewrite>
          <system_store_edit_form>Nintera_General_Block_StoreEdit</system_store_edit_form>
        </rewrite>
      </adminhtml>
   </blocks>
</global>

Also keep in mind that if you want to call other blocks using the Mage::getModel("nintera_general/myblock") syntax, you'll need to add your own blocks to that code as well, as shown below.

<global>
   <blocks>
      <adminhtml>
        <rewrite>
          <system_store_edit_form>Nintera_General_Block_StoreEdit</system_store_edit_form>
        </rewrite>
      </adminhtml>
      <nintera_general>
         <class>Nintera_General_Block</class>
      </nintera_general>
   </blocks>
</global>
MudithaE

After Reading several threads I've found the solution for this issue of overriding Mage_Adminhtml_Block_Widget_Grid.

As mentioned in this thread
"You can override (rewrite) in config only the blocks that are instantiated. You cannot inject anything into classes hierarchy as it is not supported by PHP"

I wanted to override the method protected function _addColumnFilterToCollection($column)

for the extended hierarchy of Mage_Adminhtml_Block_Sales_Order_Grid.

Instead of overriding Mage_Adminhtml_Block_Widget_Grid I override the class Mage_Adminhtml_Block_Sales_Order_Grid and place my function there.

And for me this works fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!