lundi 19 avril 2021

How to render active checkbox using controller in prestashop 1.7?

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();
}

Admin panel DevTools




Aucun commentaire:

Enregistrer un commentaire