PrestaShop Developer Conference
PrestaShop Developer Conference
Paris, France - November 6, 2024
Let's talk code, commerce and open source.

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

Learn how to upgrade to the latest version.

DataColumn Type

The most basic column is DataColumn. It is used to display raw field data in Grid.

Available options

Properties Type Expected value
field string required The record field name that the column displays.

Example usage

<?php
use PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn;
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection;

$dataColumn = new DataColumn('id_product');
$dataColumn->setName('ID');
$dataColumn->setOptions([
     'field' => 'id_product',
]);

$columns = new ColumnCollection();
$columns->add($dataColumn);