New Field In Dispatch=Orders.manage

Hi,

What is the tpl hook to add a new filed in dispatch=orders.manage.

[attachment=14312:2020-04-07 14_49_51-Window.png]

I did design/backend/templates/addons/my_addon/hooks/orders/manage.pre.tpl

but this hook don't works.

Any idea.

Thanks for any help.

Nicolas

2020-04-07 14_49_51-Window.png

Use

design/backend/templates/addons/my_addon/hooks/orders/manage_header.pre.tpl

and

design/backend/templates/addons/my_addon/hooks/orders/manage_data.pre.tpl

You can try our addon - Configurable orders list

Thank you eComLabs,

I have a problem to display the data in manage_data.pre.tpl file

I have a new field in orders table (ng_plenty_order_id)

My file manage_data.pre.tpl look like this:

        
            {$o.ng_plenty_order_id}
        

but nothing is display, if I put (order_id) or (lastname) instead of (ng_plenty_order_id) it works.

What am I missing?

You should extend the fn_get_orders function (app/functions/fn.cart.php) to retrieve additional fields from the cscart_orders table

Thanks it works, but I don't like to modify the core fonctions, do you think it's possible to add the fonctions in my addon? If yes how?

Yes, it is possible, The mentioned functions contains required hooks

Find more details about php hooks here

https://docs.cs-cart.com/latest/developer_guide/addons/hooking/php_hooks.html?

I have read the documentation and I'm having problem with the hooks.

I have created my func.php

...
function fn_ng_plenty_order_id_get_orders($params,$fields,$sortings,$condition,$join,$group)
{
    $fields = [
        "?:orders.ng_plenty_order_id"
    ];
}
...

Then my init.php

...

fn_register_hooks(
‘get_orders’
);


but doesn't works.

What I'm missing?

Thanks for any help,

Check this, use the reference to params variable

function fn_ng_plenty_order_id_get_orders(&$params,$fields,$sortings,$condition,$join,$group)
{
    $fields[] "?:orders.ng_plenty_order_id";
}


&$fields

The correct solution is

function fn_ng_plenty_order_id_get_orders($params, &$fields, $sortings, $condition, $join, $group)
{
    $fields[] = "?:orders.ng_plenty_order_id";
}

Thank you so much sw1 and eComLabs for all your helps :grin:

You are welcome!

Hi,

Now, I have another problem, when I use

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

fn_register_hooks(
‘get_orders’
);

in my init.php file, after sign out I'm not able to login anymore, the page is reloading at the login page.

Nevermind I had a return line before php :shock: