Jump to content

Calling a function in helperList


beginner1

Recommended Posts

Hi everyone, I have created a helperList and added an edit action to it. The problem is that the function renderForm linked to the edit action doesn't get called. I have pasted the code of my controller. Any idea what I am doing wrong?

 

class AdminQuotationQuotationsController extends AdminController
{ 
 public $module;

public function __construct()
{
    $this->module = Module::getInstanceByName('quotation');
    $this->bootstrap = true;
    parent::__construct();
}

private function createList()
{
    $fields_list = array(
        'quotation_name' => array(
            'title' => $this->l('quotation_name'),
            'width' => 140,
            'type' => 'text',
        ),
        'input_1' => array(
            'title' => $this->l('input_1'),
            'width' => 140,
            'type' => 'text',
        ),
    );
    $helper = new HelperList();

    $helper->shopLinkType = '';

    $helper->simple_header = false;

    // Actions to be displayed in the "Actions" column
    $helper->actions = array(
        'edit',
    );

    $helper->identifier = 'id_category';
    $helper->show_toolbar = true;
    $helper->title = 'HelperList';
    $helper->table = $this->name.'_categories';

    $helper->token = Tools::getAdminTokenLite('AdminModules');
    $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;

    $quotation_data='';

    $sql = 'SELECT * FROM '._DB_PREFIX_.'quotationforms';
    $results = Db::getInstance()->ExecuteS($sql);
    if (empty($results)) {
        $quotation_data = 'Nothing';
    } else {
        $quotation_data = $results;
    }

    if(Tools::isSubmit('deleteYOUR_OBJ_NAME_HERE')) {}

    return $helper->generateList($quotation_data,$fields_list);
}

public function renderView() {
}

public function renderForm() {

    $this->fields_form['input'][] = array(
        'type' => 'switch',
        'label' => $this->l('Enabled'),
        'name' => 'active',
        'required' => false,
        'class' => 't',
        'is_bool' => true,
        'values' => array(
            array(
                'id' => 'active_on',
                'value' => 1,
                'label' => $this->l('Enabled')
            ),
            array(
                'id' => 'active_off',
                'value' => 0,
                'label' => $this->l('Disabled')
            )
        ),
        'hint' => $this->l('Enable or disable affiliate.')
    );
    $this->fields_form['submit'] = array(
        'title' => $this->l('Save'),
    );
    $this->fields_value = (array)$this->obj;
    return parent::renderForm();
}
public function renderList()
{
    return $this->context->smarty->fetch($this->module->getLocalPath() .
            'views/templates/admin/configure.tpl').$this->createList();
}
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...