64 lines
2.6 KiB
PHP
64 lines
2.6 KiB
PHP
<?php
|
|
/**
|
|
* TNT OFFICIAL MODULE FOR PRESTASHOP.
|
|
*
|
|
* @author GFI Informatique <www.gfi.fr>
|
|
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
|
|
* @license https://opensource.org/licenses/MIT MIT License
|
|
*/
|
|
|
|
class Order extends OrderCore
|
|
{
|
|
/**
|
|
* Order constructor.
|
|
* @param null $id
|
|
* @param null $id_lang
|
|
*/
|
|
public function __construct($id = null, $id_lang = null)
|
|
{
|
|
// Warning : Dependencies on construct implies to do not create static method using TNTOfficiel class !
|
|
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
|
|
|
|
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
|
|
|
|
parent::__construct($id, $id_lang);
|
|
}
|
|
|
|
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'
|
|
);
|
|
}
|
|
}
|