override tnt order

This commit is contained in:
Preprod mutu 2017-09-22 17:54:17 +02:00
parent 928a0164a0
commit 1121ca8089

View File

@ -1,11 +1,7 @@
<?php
class Order extends OrderCore
{
/**
* Get order products
*
* @return array Products with price, quantity (with taxe and without)
*/
/*
* module: antadisconfigurator
* date: 2017-06-27 12:10:06
@ -51,4 +47,62 @@ class Order extends OrderCore
}
return $result_array;
}
/*
* module: tntofficiel
* date: 2017-09-19 12:27:32
* version: 1.2.21
*/
public function __construct($id = null, $id_lang = null)
{
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
parent::__construct($id, $id_lang);
}
/*
* module: tntofficiel
* date: 2017-09-19 12:27:32
* version: 1.2.21
*/
public function getShipping()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
return Db::getInstance()->executeS(
'SELECT DISTINCT oc.`id_order_invoice`,
oc.`weight`,
oc.`shipping_cost_tax_excl`,
oc.`shipping_cost_tax_incl`,
c.`url`, oc.`id_carrier`,
IF((tnt.`carrier_label` IS NULL OR tnt.`carrier_label` = ""),
c.`name`,
CONCAT(c.`name` ,\' (\', tnt.`carrier_label`,\')\')) as `carrier_name`,
oc.`date_add`,
"Delivery" as `type`,
"true" as `can_edit`,
oc.`tracking_number`,
oc.`id_order_carrier`,
osl.`name` as order_state_name,
c.`name` as state_name
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_history` oh
ON (o.`id_order` = oh.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'order_carrier` oc
ON (o.`id_order` = oc.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'carrier` c
ON (oc.`id_carrier` = c.`id_carrier`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
ON (oh.`id_order_state` = osl.`id_order_state`
AND osl.`id_lang` = '.((int) Context::getContext()->language->id).')
LEFT JOIN `'._DB_PREFIX_.'tntofficiel_order` tnt
ON (o.`id_order` = tnt.`id_order`)
WHERE o.`id_order` = '.(int) $this->id.'
GROUP BY c.id_carrier'
);
}
}