id_cart); $data = $module->getOrderDetail($cart,(int)$cart->id_lang,$order); $status = array( 2 => array('anticon-credit-card','text-green-light'), 4 => array('anticon-truck','text-purple-light'), 5 => array('anticon-home3','text-purple'), 6 => array('anticon-blocked','text-rose'), 7 => array('anticon-blocked','text-rose'), 8 => array('anticon-blocked','text-rose'), 17 => array('anticon-truck','text-orange'), 18 => array('anticon-warning','text-orange'), 19 => array('anticon-pause','text-orange'), ); $currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); $currentState = OrderHistory::getLastOrderState((int)$order->id); $addressDelivery = new Address($order->id_address_delivery, (int)($cart->id_lang)); $addressInvoice = new Address($order->id_address_invoice, (int)($cookie->id_lang)); $shipping_numbers = Db::getInstance()->ExecuteS(' SELECT DISTINCT lpws.`shipping_number`, lpws.`date_add` FROM `'._DB_PREFIX_.'lapostews` lpws LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = lpws.`id_order_detail`) WHERE `id_order` ='. (int)$order->id ); $shipping_numbers2 = Db::getInstance()->ExecuteS(' SELECT DISTINCT ppp.`shipping_number`, ppp.`date_add` FROM `'._DB_PREFIX_.'philea_parcel` ppp LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = ppp.`id_order_detail`) WHERE od.`id_order` ='. (int)$order->id ); //$carrier_socol = array(38,40,45);// local //$carrier_socol = array(45,47,48);// dev $carrier_socol = array(87,88,89);// prod $html = '

Récapitulatif (#'.(int)$order->id.')

Statut de la commande

'.$currentState->name.'

'; if(count($shipping_numbers) > 0 || count($shipping_numbers2) > 0) { $html .= '
Numéros de suivi
'; if(count($shipping_numbers) > 0){ foreach ($shipping_numbers as $key => $number) { $date = new DateTime($number['date_add']); $html .= '

'. $number['shipping_number'] .' ajouté le '. $date->format('d/m/Y') .'

'; } } if(count($shipping_numbers2) > 0){ foreach ($shipping_numbers2 as $key => $number) { $date = new DateTime($number['date_add']); $html .= '

'. $number['shipping_number'] .' ajouté le '. $date->format('d/m/Y') .'

'; } } } $html .= '
Paiement

'.$order->payment.'

Produits

Total produits '.Tools::displayPrice($cart->getOrderTotal(TRUE,1),$currency).'

'; if ($cart->getOrderTotal(TRUE, 2) != 0){ $html .= '

Total réduction '.Tools::displayPrice($cart->getOrderTotal(TRUE,2),$currency).'

'; } $html .= '
Transport

'.$data['carrier_name'].' '.Tools::displayPrice($cart->getOrderTotal(TRUE, 5),$currency).'

Délai de livraison

'.$data['delay_name'].'

'; if(isset($data['delivery_date'])){ foreach($data['delivery_date'] as $k => $date) { if($k == 1) { $html .= '

Date de réception prévue entre le '.$date['date_start']->format('d/m/Y').' et le '.$date['date_end']->format('d/m/Y').'

'; } elseif ($k == 5){ $html .= '

Livraison prévue avant le 24/12

'; } elseif ($k == 8){ $html .= '

Envoi en 48h

'; } } } $html .= '
Adresse de livraison '. ( ($currentState->id != 8 && $currentState->id != 18 && in_array((int)$order->id_carrier, $carrier_socol)) ?'' :( ($currentState->id != 8 && $currentState->id != 18 && !in_array((int)$order->id_carrier, $carrier_socol)) ?'' :'' ) ). '

'.$data['order_address'].'

Paiement

Total à régler '.Tools::displayPrice($cart->getOrderTotal(TRUE),$currency).'

'; if(!empty($html)) { echo $html; die(); } else { echo '

Order not found

'; die(); } } else { echo '

An error occured, order not found.

'; die(); } die();