Row heading add admin catalog

Open to all! Ask other shopowners for help.
Post Reply
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Row heading add admin catalog

Post 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');
            },
        ]]);
    }
}


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Row heading add admin catalog

Post by heatherbell »

The catalog page does not (yet) use the paginator to make the table of contents though it can be injected via JavaScript.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Row heading add admin catalog

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply