diff --git a/modules/blockordersummary/blockordersummary.php b/modules/blockordersummary/blockordersummary.php index ccddd9af..cc073c0a 100644 --- a/modules/blockordersummary/blockordersummary.php +++ b/modules/blockordersummary/blockordersummary.php @@ -70,9 +70,10 @@ class BlockOrderSummary extends Module { } public function hookRightColumnSav($params) { + global $cookie; if(isset($params['order'])) { $cart = new Cart((int)$params['order']->id_cart); - $data = $this->getOrderDetail($cart,(int)$cart->id_lang); + $data = $this->getOrderDetail($cart,(int)$cart->id_lang,$params['order']); echo ""; $currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); + $currentState = OrderHistory::getLastOrderState((int)$params['order']->id); + $tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)); echo '
-

'.$this->l('Summary of my order' ).'

+

'.$this->l('Summary of my order' ).' (#'.(int)$params['order']->id.')

+
+
'.$this->l('Order Status').'
+

'.($currentState->id == 8?'':($currentState->id == 18?'':'')).' '.$currentState->name.'

+
'.$this->l('My Cart').'
    '; @@ -192,7 +199,7 @@ class BlockOrderSummary extends Module { foreach($data['delivery_date'] as $k => $date) { if($k == 1) { echo '

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

    '; } elseif ($k == 5){ echo '

    '.$this->l('Livraison prévue avant le').' '.$this->l('24/12').'

    '; @@ -213,7 +220,7 @@ class BlockOrderSummary extends Module { } } - public function getOrderDetail($cart,$id_lang){ + public function getOrderDetail($cart,$id_lang, $order = null){ if(Db::getInstance()->getValue(' SELECT `id_carrier` FROM `'._DB_PREFIX_.'carrier` @@ -278,7 +285,11 @@ class BlockOrderSummary extends Module { $delay_products = SaleDelay::associateDelay($products); $delays = array_keys($delay_products); - $date = new DateTime(); + if ($order!=null) { + $date = new DateTime($order->date_add); + } else { + $date = new DateTime(); + } $delivery_date = SaleDelay::getDeliveryDate($delays, null, $date, true); foreach($delays as $delay) {