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.

BadgeColumn Type

This basic BadgeColumn displays a raw field data in Grid, associated with a badge.

Available options

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)

Example usage

<?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);