Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
Christophe Latour 2017-10-24 18:27:10 +02:00
commit 9481dc5e08
7 changed files with 209 additions and 182 deletions

View File

@ -557,11 +557,20 @@ class HelperFormBootstrap{
</div>
</span>
</div>';
if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><a href="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"><span class="anticon anticon-image"></span> Image '.$language['iso_code'].'</a>'.(isset($p['img_delete']) && $p['img_delete']!=''?' - <a href="'.$p['img_delete'].'&id_lang='.$language['id_lang'].'"><span class="anticon anticon-bin"></span></a>':'').'</p>';
}
if(isset($p['url_to_show']) && !empty($p['url_to_show']) && file_exists($p['url_to_show'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><img src="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" />'.(isset($p['img_delete']) && $p['img_delete']!=''?' - <a href="'.$p['img_delete'].'&id_lang='.$language['id_lang'].'"><span class="anticon anticon-bin"></span></a>':'').'</p>';
if(isset($p['name_img_lang'])) {
if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img_lang'][$language['id_lang']].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><a href="'.$p['url_imgs'].$p['name_img_lang'][$language['id_lang']].'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"><span class="anticon anticon-image"></span> Image '.$language['iso_code'].'</a>'.(isset($p['img_delete']) && $p['img_delete']!=''?' - <a href="'.$p['img_delete'].'&id_lang='.$language['id_lang'].'"><span class="anticon anticon-bin"></span></a>':'').'</p>';
}
if(isset($p['url_to_show']) && !empty($p['url_to_show']) && file_exists($p['url_to_show'].$p['name_img_lang'][$language['id_lang']].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><img class="img-responsive" src="'.$p['url_imgs'].$p['name_img_lang'][$language['id_lang']].'_'.$language['id_lang'].'.jpg" />'.(isset($p['img_delete']) && $p['img_delete']!=''?' - <a href="'.$p['img_delete'].'&id_lang='.$language['id_lang'].'"><span class="anticon anticon-bin"></span></a>':'').'</p>';
}
} elseif(isset($p['name_img'])){
if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><a href="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"><span class="anticon anticon-image"></span> Image '.$language['iso_code'].'</a>'.(isset($p['img_delete']) && $p['img_delete']!=''?' - <a href="'.$p['img_delete'].'&id_lang='.$language['id_lang'].'"><span class="anticon anticon-bin"></span></a>':'').'</p>';
}
if(isset($p['url_to_show']) && !empty($p['url_to_show']) && file_exists($p['url_to_show'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><img src="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" />'.(isset($p['img_delete']) && $p['img_delete']!=''?' - <a href="'.$p['img_delete'].'&id_lang='.$language['id_lang'].'"><span class="anticon anticon-bin"></span></a>':'').'</p>';
}
}
$this->_html .='</div>';
$this->_js .= '

View File

@ -26,8 +26,13 @@
*/
spl_autoload_register(function($className) {
if (function_exists('smartyAutoload') AND smartyAutoload($className))
if (function_exists('smartyAutoload') AND smartyAutoload($className))
return true;
if (function_exists('Predis\predisAutoload') AND Predis\predisAutoload($className)) {
return true;
}
$className = str_replace(chr(0), '', $className);
$classDir = dirname(__FILE__).'/../classes/';

View File

@ -60,165 +60,169 @@ class AdminAntDropshippingtracking extends AdminTab
}
if(!empty($orders)) {
foreach ($orders as $id_order => $o) {
$order = new Order((int)$id_order);
$order_details = array();
foreach(Db::getInstance()->ExecuteS('
SELECT DISTINCT `id_order_detail`, `product_name`,`product_id`, `product_attribute_id`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity`
FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int) $id_order.'
') as $key => $row) {
$order_details[(int)$row['id_order_detail']] = $row;
}
if($id_order != 0){
$order = new Order((int)$id_order);
if(Validate::isLoadedObject($order)) {
$order_details = array();
foreach(Db::getInstance()->ExecuteS('
SELECT DISTINCT `id_order_detail`, `product_name`,`product_id`, `product_attribute_id`, `product_quantity` - GREATEST(`product_quantity_return`, `product_quantity_refunded`) AS `quantity`
FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int) $id_order.'
') as $key => $row) {
$order_details[(int)$row['id_order_detail']] = $row;
}
$fully_sent = false;
$products_sent = array();
$fully_sent = false;
$products_sent = array();
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'lapostews` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'lapostews` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'exapaqws` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'exapaqws` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'mondialrelay_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'mondialrelay_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'philea_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'philea_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'ant_dropshipping_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
$remaining = array();
$html_products_sent = '';
foreach($order_details as $id_order_detail => $d) {
if(!in_array($id_order_detail, $products_sent) && !in_array($d['product_id'],$sale_products)) {
$remaining[] = (int)$id_order_detail;
} elseif(!in_array($id_order_detail, $products_sent) && in_array((int)$d['product_id'],$sale_products)) {
$html_products_sent .= '<br />'."\r\n".$d['quantity'] . 'x' . ' ' . $p['product_name'];
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'ant_dropshipping_parcel`
VALUES (
'.(int) $id_order_detail.',
'.(int) $d['quantity'].',
"'.pSQL($o['tracking_number']).'",
"'.pSQL($o['carrier']).'",
"'.pSQL($o['link']).'",
NOW()
)
');
}
}
if(count($remaining) == 0) {
$fully_sent = true;
} else {
$fully_sent = false;
}
$customer = new Customer((int) $order->id_customer);
$templateVars = array(
'{followup}' => $o['link'],
'{carrier}' => $o['carrier'],
'{tracking_number}' => $o['tracking_number'],
'{sale}' => $sale_names[(int)$order->id_lang],
'{firstname}' => $customer->firstname,
'{lastname}' => $customer->lastname,
'{id_order}' => (int) $order->id,
// '{product_list}' => !empty($html_products_sent)? $content_html.$html_products_sent: '',
// '{product_list_txt}' => !empty($html_products_sent)? $content_txt.strip_tags($html_products_sent): '',
);
$history = new OrderHistory();
$history->id_order = (int) $order->id;
$history->changeIdOrderState(($fully_sent? Configuration::get('PS_OS_SHIPPING'): 17), (int) $order->id);
$history->id_employee = 0;
$history->add();
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'ant_dropshipping_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
$remaining = array();
$html_products_sent = '';
foreach($order_details as $id_order_detail => $d) {
if(!in_array($id_order_detail, $products_sent) && !in_array($d['product_id'],$sale_products)) {
$remaining[] = (int)$id_order_detail;
} elseif(!in_array($id_order_detail, $products_sent) && in_array((int)$d['product_id'],$sale_products)) {
$html_products_sent .= '<br />'."\r\n".$d['quantity'] . 'x' . ' ' . $p['product_name'];
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'ant_dropshipping_parcel`
INSERT INTO `'._DB_PREFIX_.'shipping_history`
VALUES (
'.(int) $id_order_detail.',
'.(int) $d['quantity'].',
"'.pSQL($o['tracking_number']).'",
"'.pSQL($o['carrier']).'",
"'.pSQL($o['link']).'",
NOW()
'.(int) $order->id.',
"'.pSQL($o['shipping_number']).'",
NOW(),
0,
'.(int)$id_sale.'
)
');
global $_LANGMAIL;
$subject = 'Package in transit';
if(!Mail::Send(intval($order->id_lang), 'in_transit_dropshipping', ((is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname)){
$errors++;
}
}
}
if(count($remaining) == 0) {
$fully_sent = true;
} else {
$fully_sent = false;
}
$customer = new Customer((int) $order->id_customer);
$templateVars = array(
'{followup}' => $o['link'],
'{carrier}' => $o['carrier'],
'{tracking_number}' => $o['tracking_number'],
'{sale}' => $sale_names[(int)$order->id_lang],
'{firstname}' => $customer->firstname,
'{lastname}' => $customer->lastname,
'{id_order}' => (int) $order->id,
// '{product_list}' => !empty($html_products_sent)? $content_html.$html_products_sent: '',
// '{product_list_txt}' => !empty($html_products_sent)? $content_txt.strip_tags($html_products_sent): '',
);
$history = new OrderHistory();
$history->id_order = (int) $order->id;
$history->changeIdOrderState(($fully_sent? Configuration::get('PS_OS_SHIPPING'): 17), (int) $order->id);
$history->id_employee = 0;
$history->add();
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'shipping_history`
VALUES (
'.(int) $order->id.',
"'.pSQL($o['shipping_number']).'",
NOW(),
0,
'.(int)$id_sale.'
)
');
global $_LANGMAIL;
$subject = 'Package in transit';
if(!Mail::Send(intval($order->id_lang), 'in_transit_dropshipping', ((is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname)){
$errors++;
}
}
if(!isset($_COOKIE['logistics_sales'])){
setcookie('logistics_sales', $id_sale, 0, __PS_BASE_URI__);

View File

@ -27,9 +27,17 @@ class AdminAntPromobanner extends AdminTab
Configuration::updateValue('ANT_PROMO_BANNERURL_3',Tools::getValue('url_3', ''));
foreach(array_keys($this->imagelist) as $img) {
if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') {
if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_'.$language['id_lang'].'.jpg')) {
$random = Tools::passwdGen(7);
if (glob(_PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_*_'.$language['id_lang'].'.jpg')) {
foreach (glob(_PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_*_'.$language['id_lang'].'.jpg') as $filename) {
unlink($filename);
}
}
if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_'.$random.'_'.$language['id_lang'].'.jpg')) {
HelperFormBootstrap::displayErrors($this->l('An error occured during the image upload.'));
}
Configuration::updateValue('ANT_PROMO_BANNERNAME_'.$language['id_lang'], $random);
}
}
}
@ -115,7 +123,10 @@ class AdminAntPromobanner extends AdminTab
'lang' => true,
'label' => $v[0],
'name' => 'img_'.$k,
'name_img' => 'img_'.$k,
'name_img_lang' => array(
2 => 'img_'.$k.'_'.Configuration::get('ANT_PROMO_BANNERNAME_2'),
3 => 'img_'.$k.'_'.Configuration::get('ANT_PROMO_BANNERNAME_3'),
),
'id' => $k,
'help' => 'L\'image sera la même sur tous les écrans (évitez de charger un image trop lourde).<br>Privilégiez un ratio 500*178',
'languages' => $languages,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

View File

@ -131,7 +131,6 @@ foreach ($iterator as $fileinfo) {
$fully_sent = FALSE;
$products_sent = array();
$remaining = array();
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
@ -147,8 +146,6 @@ foreach ($iterator as $fileinfo) {
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
} elseif ((int) $quantity_remain['remain'] == 1) {
$remaining[] = (int) $quantity_remain['id_order_detail'];
}
}
@ -166,8 +163,6 @@ foreach ($iterator as $fileinfo) {
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
} elseif ((int) $quantity_remain['remain'] == 1) {
$remaining[] = (int) $quantity_remain['id_order_detail'];
}
}
@ -185,8 +180,6 @@ foreach ($iterator as $fileinfo) {
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
} elseif ((int) $quantity_remain['remain'] == 1) {
$remaining[] = (int) $quantity_remain['id_order_detail'];
}
}
@ -204,33 +197,21 @@ foreach ($iterator as $fileinfo) {
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
} elseif ((int) $quantity_remain['remain'] == 1) {
$remaining[] = (int) $quantity_remain['id_order_detail'];
}
}
$_order_details = array();
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'ant_dropshipping_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
} elseif ((int) $quantity_remain['remain'] == 1) {
$remaining[] = (int) $quantity_remain['id_order_detail'];
}
SELECT `id_order_detail`
FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int) $order->id.'
') as $row) {
$_order_details[] = (int) $row['id_order_detail'];
}
$remaining = array();
foreach($order_details as $d) {
if(!in_array($d, $products_sent) && !in_array($d, $remaining)) {
foreach($_order_details as $d) {
if(!in_array($d, $products_sent)) {
$remaining[] = (int) $d;
}
}

View File

@ -906,6 +906,23 @@ class MondialrelayCarrier {
}
}
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, IF(
(d.`product_quantity` - IF(
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
) AS `remain`
FROM `'._DB_PREFIX_.'order_detail` d
LEFT OUTER JOIN `'._DB_PREFIX_.'philea_parcel` s
ON s.`id_order_detail` = d.`id_order_detail`
WHERE d.`id_order` = '.(int) $order->id.'
GROUP BY d.`id_order_detail`
') as $quantity_remain) {
if((int) $quantity_remain['remain'] == 0) {
$products_sent[] = (int) $quantity_remain['id_order_detail'];
}
}
$remaining = array();
foreach($order_details as $d) {
if(!in_array($d, $products_sent)) {