Jump to content

How to render active checkbox using controller in prestashop 1.7?


Viktor-Vladimirov

Recommended Posts

HI i want to render active checkbox by default via controller in bulk_actions. How can this be solved? Is it possible to do using tools symfony ?

public function renderView()
{
    $this->table = 'feature'; // SQL table name, will be prefixed with _DB_PREFIX_
    $this->identifier = 'id_feature'; // SQL column to be used as primary key
    $this->className = 'Feature'; // PHP class name
    $this->lang = true;
    $this->allow_export = true; // allow export in CSV, XLS..

    $this->_defaultOrderBy = 'id_feature'; // the table alias is always `a`
    $this->_defaultOrderWay = 'ASC';
    $featuregoup = Tools::getValue('id'); // id_featuregroup   [enter image description here][1]

    $this->fields_list = [
        'id_feature' => array(
            'title' => $this->trans('ID', array(), 'Admin.Global'),
            'align' => 'center',
            'class' => 'fixed-width-xs',
        ),
        "$featuregoup" => array(
            'title' => $this->trans('ID Groups', array(), 'Admin.Global'),
            'align' => 'center',
            'class' => 'fixed-width-xs',
        ),
        'name' => [
            'title' => $this->trans('Name', [], 'Admin.Global'),
            'width' => 'auto',
            'filter_key' => 'b!name',
        ],
    ];

    $this->bulk_actions = array(
        'hash' => array(
            'text' => 'Save',
            'icon' => 'done_all',
            'confirm' => $this->trans('Save', array(), 'Admin.Notifications.Info'),
        ),
    );

    return parent::renderList();
}

 

image.thumb.png.791c482b8d36d572e8f069f21490e7c9.png

Link to comment
Share on other sites

  • 1 month later...

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