Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How to create multiple horizontal and vertical tab like category page at admin side and save data in DB?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
166 views
Welcome To Ask or Share your Answers For Others

1 Answer

I have idea about adding vertical tab in form, just put below code in your tabs.php file of your module in _beforeToHtml() function

 $this->addTab('tabid', array(
            'label'     => Mage::helper('modulename')->__('Name of tab'),
            'class'     => 'ajax',
            'url'       => $this->getUrl('*/*/action controller name', array('_current' => true)),
        ));

just give tabid whatever you want and in url give action name add this function also in your tabs.php file for handle tab update and call $this->_updateActiveTab(); in _beforeToHtml() function

protected function _updateActiveTab()
{
    $tabId = $this->getRequest()->getParam('tab');
    if ($tabId) {
        $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
        if ($tabId) {
            $this->setActiveTab($tabId);
        }
    }
    else {
       $this->setActiveTab('form_section'); 
    }
}

add action in controller something like this

public function yourAction() 
{
    $id = (int) $this->getRequest()->getParam('id');
    $model = Mage::getModel('modulename/modulename');

    if ($id) {
        $model->load($id);
    }

    Mage::register('modulename_data', $model);

    $this->getResponse()->setBody($this->getLayout()
      ->createBlock('modulename/adminhtml_modulename_edit_tab_tabid')->toHtml());
}  

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...