Jump to content

PS >= 1.7.1 - adding custom column in admin products grid


Recommended Posts

Hello,

 

I would like to add an additional column in products grid in admin area. This column should get data from my custom module table. I modified the query via "hookActionAdminProductsListingFieldsModifier" and in "hookActionAdminProductsListingResultsModifier" the results are proper but how to add my custom column to the products grid (for example right after column "product's reference")?

 

 

Normally the $params variable in every hook "action<AdminControllerName>ListingFieldsModifier" is an array like below:

array(
  'select' => &(string),
  'join' => &(string),
  'where' => &(string),
  'group_by' => &(string),
  'order_by' => &(string),
  'order_way' => &(string),
  'fields' => &(array)
);

In above example, it's very easy to add a custom field. Unfortunately hook "actionAdminProductsListingFieldsModifier" receives $params variable like below:

array(
  '_ps_version' => _PS_VERSION_,
  'sql_select' => &$sqlSelect,
  'sql_table' => &$sqlTable,
  'sql_where' => &$sqlWhere,
  'sql_order' => &$sqlOrder,
  'sql_limit' => &$sqlLimit,
);

Why there is a such a difference and how to add a custom column into products grid in AdminProducts?

 

 

Link to comment
Share on other sites

  • 3 years later...

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...