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
This basic BadgeColumn displays a raw field data in Grid, associated with a badge.
Properties | Type | Expected value |
---|---|---|
field | string | required Record field name which column displays. |
badge_type | string | default: success Indicates which field of the row contains the image source. (Allowed values: success, info, danger, warning ) |
<?php
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\BadgeColumn;
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection;
$badgeColumn = new BadgeColumn('total_spent');
$badgeColumn->setName('Sales');
$badgeColumn->setOptions([
'field' => 'total_spent',
'badge_type' => 'success',
'empty_value' => '--',
]);
$columns = new ColumnCollection();
$columns->add($badgeColumn);