So I have a methodology that works fine but I have a distinct feeling there is a totally different way, more Magentoriffic way to do this.

I have an admin module with a tabbed form. In one of the tabs, I want a small form to reside just above a grid. I have done it by doing a simple append on the blocks with a period as shown below.

Works great, no errors, no exceptions, but I have not seen this methodology anywhere else in Magento.

So, I am on a quest to determine the Magento way of doing this. Here is my code:

$this->addTab('directory_content', array(
    'label'     => Mage::helper('businessdirectory')->__('Listings'),
    'title'     => Mage::helper('businessdirectory')->__('Listings'),
    'content'   => $this->getLayout()->createBlock('businessdirectory/adminhtml_directories_edit_tab_listing')->toHtml().
  • How we can do like above in magento 2? Jul 5 '17 at 6:55

What you could do is use url instead of content. This will fill the content with a call to a specific url, in this way you can then use a controller rendering layout via xml so that the whole thing becomes more expendable.

'url'       => $this->getUrl('*/*/categories', array('_current' => true)),

A perfect example of this is the catalog and how you can add categories and other products such as upselling and cross selling to products. Check out app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php and see how it is done there.

Though I am not saying that either is more "Magentoriffic"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.