문제

I have an admin custom module in which there are three tabs present. First tab is use to collect basic informations of the module and second one is used for avanced information collection.

I want some of the content portions render with a template file and rest of the content render with the tab file itself in my second tab. Here is my second tab file

<?php
class Electronicsstore_News_Block_Adminhtml_News_Edit_Tab_Advance extends Mage_Adminhtml_Block_Widget_Form
{
    public function __construct()
  {                  

        $this->setTemplate('news/calendar/calendar.phtml');//use to render calander field   
        parent::__construct();                    
  }

  protected function _prepareForm()
  {
    $news = new Varien_Data_Form();
    $this->setForm($news);
    $fieldset = $news->addFieldset('news_advance',  array('legend'=>Mage::helper('news')->__('Advanced Settings')));


   //use to add date; need to add start and final days in this module
    $fieldset->addField('news_stime', 'time', array(
          'label'     => Mage::helper('news')->__('Start Date'),
          'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'title',
          'onclick' => "",
          'onchange' => "",
          'value'  => '12,04,15',
          'disabled' => false,
          'readonly' => false,
          'after_element_html' => '<small>Comments</small>',
          'tabindex' => 1
    ));
    $fieldset->addField('news_ltime', 'time', array(
          'label'     => Mage::helper('news')->__('End Date'),
          'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'title',
          'onclick' => "",
          'onchange' => "",
          'value'  => '12,04,15',
          'disabled' => false,
          'readonly' => false,
          'after_element_html' => '<small>Comments</small>',
          'tabindex' => 1
    ));
}
}

so I want render the calendar template first and then it should followed by those time fields which I have set through the method _prepareform() in my second tab's content section. Currently it is not working together. I didn't get the template file output in my tab. Is it possible in magento? Please enlighten me with good ideas. Thanks in advance

도움이 되었습니까?

해결책

Change this method:

public function __construct()
{                   

    $this->setTemplate('news/calendar/calendar.phtml');//use to render calander field   
    parent::__construct();                    
 }

to

protected function _construct() //only one underscore in front
{                  
    parent::_construct(); //only one underscore
    $this->setTemplate('news/calendar/calendar.phtml');//use to render calander field   

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top