Jump to content

Add additional column (EAN13) in Catalog > Product in Back Office Prestashop 8


iluvolu

Recommended Posts

Hi,

1. In the src/Core/Grid/Definition/Factory/ProductGridDefinitionFactory.php, add below code in the function getColumns() before the return statement-
$columns->addAfter(
'reference',
(new DataColumn('ean13'))
->setName($this->trans('EAN13', [], 'Admin.Global'))
->setOptions([
'field' => 'ean13',
])
);

2. In the file src\Core\Grid\Query\ProductQueryBuilder.php, in the function getSearchQueryBuilder() add below code at the end of the $qb variable definition.
->addSelect('p.`ean13`')

Eg:-
$qb
->addSelect('p.`id_tax_rules_group`')
->addSelect('p.`ean13`') ;

3. In the file src\PrestaShopBundle\Resources\views\Admin\Product\CatalogPage\Lists\products_table.html.twig, add below code in the container <tr class="column-headers">

<th scope="col" style="width: 9%">
{{ 'EAN13'|trans({}, 'Admin.Global') }}
</th>

After making these changes, the EAN13 column will be visible in the Product Listing.
Screenshot:- https://prnt.sc/9jnZ3viqxsAq

Please confirm if these changes are working fine so that we can further provide the changes to show the column values also.

Regards.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...