Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.
You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page
You can define actions for every selected row of your grid. PrestaShop already comes with a list of common bulk actions that you can use in your own Grids.
This action will submit the data of your rows into a specific route.
Properties | Expected value(s) |
---|---|
Type | submit |
Requirements | submit_route |
Defaults | confirm_message => null |
submit_method => “POST” |
|
Allowed Types | submit_route (string) |
confirm_message (string or null) |
|
Allowed Values | submit_method (“POST” or “GET”) |
This action will delete the selected Categories in Catalog > Categories page.
Properties | Expected value(s) |
---|---|
Type | delete_categories |
Requirements | categories_bulk_delete_route |
Allowed Types | submitcategories_bulk_delete_route_route (string) |
This bulk action will delete the selected Customers in Sell > Customers page.
Properties | Expected value(s) |
---|---|
Type | delete_customers |
Requirements | customers_bulk_delete_route |
Allowed Types | customers_bulk_delete_route (string) |
<?php
// /modules/my-module/src/Grid/MyGridDefinitionFactory.php
namespace MyModule\Grid;
use PrestaShop\PrestaShop\Core\Grid\Definition\Factory\AbstractGridDefinitionFactory;
use PrestaShop\PrestaShop\Core\Grid\Action\Bulk\Type\SubmitBulkAction;
use PrestaShop\PrestaShop\Core\Grid\Action\Bulk\BulkActionCollection;
/**
* How to define the Grid's bulk actions?
* You can adapt this example or look at the existing ones
* in PrestaShop's Core.
*/
class MyGridDefinitionFactory extends AbstractGridDefinitionFactory
{
/**
* {@inheritdoc}
*/
protected function getBulkActions()
{
return (new BulkActionCollection())
->add(
(new SubmitBulkAction('enable_selection'))
->setName('Enable selection')
->setOptions([
'submit_route' => 'submit_stuff',
])
)
;
}
}