Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.
You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated 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);