/** * Delete list rows */ public function index_onDelete() { $successful = TRUE; if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { foreach ($checkedIds as $recordId) { if (!($record = Product::find($recordId))) { continue; } if (!$record->delete()) { $successful = FALSE; } } } if ($successful) { Flash::success('Successfully deleted products.'); } return $this->listRefresh(); }