Jump to content

Add new panel in admin order view tab


kizbo

Recommended Posts

Hi, im working on adding additional info in the back panel of my shop, in order view panel to be exact, im starting to get it, found out how to edit template file to add my panel, but i need to query additional data from MySQL Database to fill this panel and pass this data to Smarty template. How can i achieve such thing?

I figured out i can edit AdminOrdersController (override it, not direct edit ofc), but still don't really now how, because i need to create query +/- like this:

`SELECT * FROM myAdditonalTable WHERE myAdditonalTable.order_id = `orderID from actual object`'

I need to extract this actual object id to evaluate this, too.

 

Hope you can help me guys.

  • Thanks 1
Link to comment
Share on other sites

Thank you for your answer, i digged up topic in documentation, only one thing bothers me, should i hook into something on install? Or just use function you mentioned?

 

EDIT: nevermind, i got, i need to call $this->registerHook("displayAdminOrder") in install()

On 21.07.2018 at 6:14 AM, Nishith said:

Hi...

i suggest you please create custom module and use register hook "displayAdminOrder" your module.then after you ca use the this fuction
 


public function hookDisplayAdminOrder($param)
{
// your code here
}

 

read this i hope this help for you

http://doc.prestashop.com/display/PS17/Hooks+in+PrestaShop+1.7.x

Thanks
 

 

Edited by kizbo (see edit history)
  • Thanks 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...

You can use the following hooks:

<?php

    public function install()
    {

        if ( parent::install()
            && $this->registerHook('displayAdminOrder')
            && $this->registerHook('displayAdminOrderLeft')
            && $this->registerHook('displayAdminOrderRight')
            && $this->registerHook('dsplayAdminOrderTabOrder')
            && $this->registerHook('displayAdminOrderContentShip')
            && $this->registerHook('displayAdminOrderContentOrder')
                       

        ) {
            return true;
        }

        $this->uninstall();
        return false;
    }

    /**
     * displayAdminOrderContentShip
     */
    public function hookDisplayAdminOrderContentShip($param)
    {
        return '<b>hookDisplayAdminOrderContentShip</b>';
    }

    /**
     * @hook displayAdminOrderLeft
     */
    public function hookDisplayAdminOrderLeft($param)
    {
        return '<b>hookDisplayAdminOrderLeft</b>';
    }

    /**
     * displayAdminOrderRight
     */
    public function hookDisplayAdminOrderRight($param)
    {
        return '<b>hookDisplayAdminOrderRight</b>';
    }

    /**
     * @hook displayAdminOrder
     */
    public function hookDisplayAdminOrder($param)
    {
        return '<b>hookDisplayAdminOrder</b>';
    }

    /**
     * displayAdminOrderContentOrder
     */
    public function hookDisplayAdminOrderContentOrder($param)
    {
        return '<b>hookDisplayAdminOrderContentOrder</b>';
    }

    /**
     * displayAdminOrderTabOrder
     */
    public function hookDisplayAdminOrderTabOrder($param)
    {
        return '<b>hookDisplayAdminOrderTabOrder</b>';
    }

	
$orderId = $param['id_order'];
$cart = $param['cart'];

Check the attached picture:

hooks.png

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...