Magento - overriding Adminhtml block

后端 未结 2 450
失恋的感觉
失恋的感觉 2020-12-21 06:13

I\'ve spent hours trying to override the Magento block for the \"Add store\" and \"Edit store\" pages in an extension, to add another text box to it. After Going through boo

相关标签:
2条回答
  • 2020-12-21 06:19

    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>
    
    0 讨论(0)
  • 2020-12-21 06:23

    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.

    0 讨论(0)
提交回复
热议问题