1
Customization help / Re: How to add a new field in "Catalog > Products" admin page?
« on: Today at 04:24:05 AM »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: