Jump to content

submitBulkdelete and run additional method in controller


Recommended Posts

Hello, 

 

in my module, in controller I want to delete object and I do it using bulk actions:

$this->bulk_actions = array(
            'delete' => array(
                'text' => $this->l('Delete selected'),
				'icon' => 'icon-trash',
                'confirm' => $this->l('Delete selected items?')
            )

after this action I want to delete other row in database in second table of module using method created in Model, I don't know how to do it. 

I try conditional statement but it doesn't work

if(Tools::isSubmit('submitBulkdelete'.$this->table) || Tools::isSubmit('delete'.$this->table))

or

if(Tools::getIsset('submitBulkdelete'.$this->table)


If I delete one row, my method works.

 

 

Link to comment
Share on other sites

ok, i found a solutions: bulkaction send parametr as array, I try send int variable, and my method doesm;t work

$row_array = Tools::getValue($this->table.'Box');
	if (count($row_array))
	{
		foreach ($row_array as $id_gallery)
		{
			CategoryGalleryModel::deleteGallery((int)$id_gallery);
		}
	}
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...