Jump to content

[solved] transaction_id in ordercontroller column


vermich
 Share

Recommended Posts

Hi everybody,

 

I need your help in order to show the transaction_id in a new column in adminordercontroller.php

I haven't find any solution.

 

I think values are load in $this but i don't know how i can load ps_order_payment table:

 

that's what i should modify ? :

 

public function __construct()
{
 $this->table = 'order';
 $this->className = 'Order';
 $this->lang = false;
 $this->addRowAction('view');
 $this->explicitSelect = true;
 $this->allow_export = true;
 $this->deleted = false;
 $this->context = Context::getContext();
 $this->_select = '
 a.id_currency,
 a.id_order AS id_pdf,
 CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
 osl.`name` AS `osname`,
 os.`color`,
 IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new';
 $this->_join = '
 LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
 LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
 LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
 $this->_orderBy = 'id_order';
 $this->_orderWay = 'DESC';

Edited by vermich (see edit history)

Share this post


Link to post
Share on other sites

Hi,

try that:

 $this->_select = '
 a.id_currency,
 a.id_order AS id_pdf,
 CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
 osl.`name` AS `osname`,
 os.`color`,
    op.`transaction_id`,
 IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new';
 $this->_join = '
 LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
 LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
   LEFT JOIN `'._DB_PREFIX_.'order_payment` op ON (op.`order_reference` = a.`reference`)

 LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';

and in the $this->fields_list add :

'transaction_id' => array(

'title' => $this->l('traid'),

'align' => 'center',

'width' => 65

),

  • Like 1

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More