This commit is contained in:
Michael RICOIS 2018-01-15 15:45:33 +01:00
parent e459ed17c3
commit 6cdeaba17f

View File

@ -130,35 +130,31 @@ if(($id_order = (int) Tools::getValue('id_order'))
$link = new Link(2);
$products = array();
foreach($order->getProductsDetail() as $p) {
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
// LaPoste
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'lapostews`
WHERE `id_order_detail` = '.(int) $p['id_order_detail'].'
');
// Exapaq
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'exapaqws`
WHERE `id_order_detail` = '.(int) $p['id_order_detail'].'
');
/**
* @Override MondialRelay
*/
// MondialRelay
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'mondialrelay_parcel`
WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] . '
');
/**
* @Override Philea
*/
// Philea
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'philea_parcel`
WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] . '
');
/**
* @Override Dropshipping
*/
// DropShipping
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel`
@ -203,7 +199,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
WHERE `id_product` = '.(int) $p['product_id'].' AND id_order = '.(int)$id_order
);
if(!isset($sales_carriers[(int) $p['id_sale']])) {
if (!isset($sales_carriers[(int) $p['id_sale']])) {
$sales_carriers[(int) $p['id_sale']] = array();
foreach(Db::getInstance()->ExecuteS('
SELECT `id_carrier`
@ -215,10 +211,12 @@ if(($id_order = (int) Tools::getValue('id_order'))
}
$p['carriers'] = $sales_carriers[(int) $p['id_sale']];
$p['location'] = isset($locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']])? $locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']]: '';
$p['location'] = isset($locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']]) ?
$locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']]: '';
// Get Shipping Numbers
$shipping_numbers = array();
// LaPoste
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'lapostews` l
@ -228,6 +226,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
// Exapaq
foreach(Db::getInstance()->ExecuteS('
SELECT e.`shipping_number`
FROM `'._DB_PREFIX_.'exapaqws` e
@ -237,9 +236,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
/*
* @Override MondialRelay
*/
// MondialRelay
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
@ -249,9 +246,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
/*
* @Override Philea
*/
// Philea
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'philea_parcel` l
@ -262,8 +257,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
if(((int) $p['product_quantity_sent'] === 0)
&& Db::getInstance()->getRow('
if(((int) $p['product_quantity_sent'] === 0) && Db::getInstance()->getRow('
SELECT h.`id_sale`
FROM `'._DB_PREFIX_.'shipping_history` h
WHERE h.`id_sale` = '.((int) $p['id_sale'] === 999999? 0: (int) $p['id_sale']).'