Page 1 of 1

Row heading add admin catalog

Posted: Mon Jan 13, 2025 7:44 am
by Pierre_P
I am trying to add a qty heading to products in admin example admin/catalog.php?cPath=1 after Status heading i want to put Qty to show how many is in stock for each product.

I tried but not getting it to display.
Also tried siteWide folder.
This code i placed in folder hooks/admin/catalog/show_qty.php

Any help on this pls.

Code: Select all

class hook_admin_catalog_show_qty {

    public function listen_constructPaginator($param) {
        global $table_definition, $db;

        array_splice($table_definition['columns'], 2, 0, [[
            'name' => "Qty",
            'class' => 'text-center',
            'function' => function (&$row) use ($db) {
                $qty_query = $db->query("SELECT products_quantity FROM products WHERE products_id = " . (int)$row['products_id']);
                $qty_result = $qty_query->fetch_assoc();

                return $row($qty_result['products_quantity'] ?? '0');
            },
        ]]);
    }
}

Re: Row heading add admin catalog

Posted: Mon Jan 13, 2025 8:36 am
by heatherbell
The catalog page does not (yet) use the paginator to make the table of contents though it can be injected via JavaScript.

Re: Row heading add admin catalog

Posted: Mon Jan 13, 2025 8:51 am
by Pierre_P
I was also about realizing there is as you say not yet one as i assumed there were one...
Javascript, let me see how i mess up

Thanks heather