Task Global Grid Advanced Configuration

It can often be useful to set the same value to several different tasks. In these cases, the use of massive actions is effective.

At the moment, the only massive action already prepared by the system in the global task grid is that for the (physical) elimination of one or more tasks.

You can still configure a custom massive action by accessing the grid change. Below the Mass Action checkbox is the </> button that allows the opening of the custom PHP script area.

The following example shows the custom code that implements a massive custom action to massively change the state of one or more different tasks.

The code must be inserted directly into the custom PHP script area.

// retrieve all states from the list task_task_status as associative arrays
$taskStatusArray = Deep::helper('deep_list')->loadListValues('task_task_status')->toOptionHash();

// initialize html component
$this->addMassActionItem('status', [
    'label' => 'Change Status',
    'additional' => array(
        'status' => array(
            'name'   => 'status',
            'type'   => 'select',
            'class'  => 'required-entry',
            'label'  => 'New Status',
            'disable_js_select' => true,
            'values' => $taskStatusArray,
    //callback is the method that contains the logic of the action
    'callback' => function() {
        /** @var Deep_Grid_Model_Grid_Massaction_Callback $this */
        /** @var Mage_Core_Model_Resource_Db_Collection_Abstract $collection */
        $collection = $this->getGrid()->getModelInstance()->getCollection();
        //$this->getIds() returns the id of the selected tasks
        $collection->addFieldToFilter('entity_id', ['in' => $this->getIds()]);
        // $collection contains the instances of the selected tasks and we iterate on them
        foreach($collection as $task){
            //$this->getValue() contains the id of the new status, the selected one
            //set the new status
            //save the task

By entering this script, you can then select one or more tasks and change their status to the selected one.