Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

How to add a new field in "Catalog > Products" admin page?

Started by OneMore, July 15, 2025, 01:11:34 PM

Previous topic - Next topic

OneMore

Hi everyone,

My product titles are often long for fitting well in the frontend thumbnails.
I would like to split them in a shorter title and a subtitle.

So, I already added a "subtitle" column to the "product_descriptions" table, and for the admin side, edited "admin/model/catalog/product.php".

But how to add a "subtitle" field in "Catalog > Products" admin page?

I had a look at "admin/view/default/template/pages/catalog/product_list.tpl.", "admin/controller/common/listing_grid.php" and "admin/view/default/template/common/listing_grid.tpl".

I understand that jqGrid is used but could not find where the list of columns for the grid is being set.

Thank you for your help.

(N.B. I am aware of the existence of the blurb column, but I am planning using it for short product descriptions.)

abolabo


Hi,
The first thing you need to know about modifying the product grid is that AbanteCart uses several types of controllers.
The grid configuration itself is defined in the page controller — in your case, `catalog/product`.
This configuration is passed to the `common/listing_grid` controller, which renders the grid using jqGrid.

Right after loading, an AJAX request is sent to a response controller. You can find all the response controllers for grids under the `responses/listing_grid` path.

As you've probably guessed, at each stage of the code execution path, you can make changes to the controllers using our hook system.
Each controller has calls like `$this->extension->hk_InitData()` or `$this->extension->hk_UpdateData()` (there are actually more),
which allow you to modify public properties of the controller from a hook, both before and after execution.

So, to add a column, you need to modify the configuration before the `common/listing_grid` controller executes.
(The configuration data contains a `table_id`, so you can easily detect which grid is being called. In your case, it's `'table_id' == 'product_grid'`).

You'll also need to modify the response controller `listing_grid/product` to include `title` in the data list.
As an example, check the method `public function onControllerResponsesListingGridExtension_UpdateData()` from the `avatax_integration` extension.

It's best to work with Xdebug so you can see which data is available at each step.

For more details on how hooks work, refer to (https://abantecart.atlassian.net/wiki/spaces/DOC/pages/17793156/Hooks]our documentation:


"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

Forum Rules Code of conduct
AbanteCart.com 2010 -