Magento - overriding Adminhtml block


Question

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 books and Googling, I've found several solutions which people say are working, however not for me.

One recommendation was this one.

I've copied the supposedly correct solution from Lee Saferite which works for the original poster but not for me. Of course, I changed the values to the class I'm overriding and the new modified class.

My config.xml (the relevant part):

<global>
    <blocks>
      <adminhtml>
        <rewrite>
          <system_store_sdit_form>Nintera_General_Block_StoreEdit</system_store_sdit_form>
        </rewrite>
      </adminhtml>
    </blocks>
    <resources></resources>
    <helpers>
      <Nintera_General>
        <class>Nintera_General_Helper</class>
      </Nintera_General>
    </helpers>
  </global>

And the block class located at Nintera/General/Block/StoreEdit.php:

class Nintera_General_Block_StoreEdit extends Mage_Adminhtml_Block_System_Store_Edit_Form
{
    /**
     * Prepare form data
     *
     * return Mage_Adminhtml_Block_Widget_Form
     */
    protected function _prepareForm()
    { ... }
}

This class contains new input fields. The fields show up perfectly if I modify the original core file at:

app/core/Mage/Adminhtml/Block/System/Store/Edit.php

But I really want my extension to override it. If necessary I can post my entire config.xml but it's mostly creating a top level admin menu and specifies extension info, not much else.

Any ideas on what goes wrong? A solution would be HIGHLY appreciated!

1
3
6/1/2012 8:41:35 AM

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>
10
12/10/2009 3:12:46 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon