How to add custom tab in left sidebar to my custom page in admin section in magento module?

▼魔方 西西 提交于 2019-12-03 16:48:38

It seem like you are tying to create a 'left' and 'main' block within your admin controller.

$this->loadLayout();
$this->_addContent($this->getLayout()->createBlock('form/adminhtml_form_edit'))
            ->_addLeft($this->getLayout()->createBlock('form/adminhtml_form_edit_tabs'));
$this->renderLayout();


class Excellence_Form_Block_Adminhtml_Form_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{

  public function __construct()
  {
      parent::__construct();
      $this->setId('form_tabs');
      $this->setDestElementId('edit_form'); // this should be same as the form id define above
      $this->setTitle(Mage::helper('form')->__('Product Information'));
  }

  protected function _beforeToHtml()
  {
      $this->addTab('form_section', array(
          'label'     => Mage::helper('form')->__('Item Information'),
          'title'     => Mage::helper('form')->__('Item Information'),
          'content'   => $this->getLayout()->createBlock('form/adminhtml_form_edit_tab_form')->toHtml(),
      ));

      return parent::_beforeToHtml();
  }
}

See http://www.excellencemagentoblog.com/module-development-series-magento-admin-module-part3

$this->_addLeft($this->getLayout()
    ->createBlock('core/text')
    ->setText('<h1>Left Block</h1>'));

$block = $this->getLayout()
    ->createBlock('core/text')
    ->setText('<h1>Main Block</h1>');           
    $this->_addContent($block);

Read more @ http://alanstorm.com/magento_admin_controllers

I read your question to fast in my previous answer, so I'll add this new one with the correct information. You will need to make a folder structure, in which the tabs are all separated in different files.

The following link explains how to add a tab to an existing module, you might want to search for a better article yourself, as there is enough information on this to be found: http://terrani.wordpress.com/2011/01/03/magento-add-a-new-tab-on-customer-edit-page/

Another article about it: http://www.atwix.com/magento/new-tab-product-edit-page/

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