Jump to content

Creating back-office module: search in helper-list doesn't work


roger972

Recommended Posts

HI.

 

I'm creating a back-office module. I don't understand why it does not work the search or filters, if I'm inheriting from the parent.

 

Someone can help me? This is mi code.

 

Model

<?php

class TestModel extends ObjectModel
{
    public $id_test;
    public $name;
    public static $definition = array(
        'table' => 'test',
        'primary' => 'id_test',
        'fields' => array(
            'name' => array('type' => self::TYPE_STRING),
        )
    );
}

Controller

if (defined('__PS_VERSION_'))
    exit('Restricted Access!!!');

class AdminTestController extends ModuleAdminController
{
    public function __construct()
    {
        $this->table = 'test';
        $this->className = 'TestModel';
        $this->lang = false;
        $this->bootstrap = true;
        parent::__construct();
    }
    
    /**
     * This method generates the list of results
     */
    public function renderList()
    {
    	if(isset($_GET['deletetest']))
            $this->delete((int)$_GET['id_test']);
    		
        $this->addRowAction('edit');
        $this->addRowAction('delete');
        
        $this->fields_list = array(
            'id_test' => array(
                'title' => 'ID',
                'align' => 'center',
                'width' => 25
            ),
            'name' => array(
                'title' => 'Name',
                'width' => 'auto',
            )
        );
        
        $this->bulk_actions = array(
            'delete' => array(
                'text' => 'Delete selected',
                'confirm' => 'Do you want to delete the selected items'
            )
        );
        
        $this->_defaultOrderBy = 'name';
        $this->list_simple_header = false;
        return parent::renderList();
    }

    //...
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...