add expedition date on adminorder

This commit is contained in:
Marion Muszynski 2017-09-22 15:31:16 +02:00
parent 4b985fb501
commit 7bbcc3eb59

View File

@ -1244,6 +1244,31 @@ class AdminOrders extends AdminTab
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
}
}
// assign delay to Products
if (Module::isInstalled('privatesales_delay')) {
if (!class_exists('SaleDelay')) {
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
}
$delay_products = SaleDelay::associateDelay($products);
$delays = array_keys($delay_products);
$date = new DateTime($order->date_add);
$delivery_date = SaleDelay::getDeliveryDate($delays, null, $date, true);
foreach($delivery_date as $k => $date) {
if($k == 1) {
echo '<p class="delivery-date">
'.$this->l('Date d\'expédition : entre le').' <strong>'.$date['date_start']->format('d/m/Y').'</strong> '.$this->l('et le').' <strong>'.$date['date_end']->format('d/m/Y').'</strong>
</p>';
} elseif ($k == 5){
echo '<p class="delivery-date">'.$this->l('Date d\'expédition :').' <strong>'.$this->l('avant le 24/12').'</strong></p>';
} elseif ($k == 8){
echo '<p class="delivery-date">'.$this->l('Date d\'expédition :').' <strong>'.$this->l('envoi en 48h').'</strong></p>';
} elseif ($k == 9){
echo '<p class="delivery-date">'.$this->l('Date d\'expédition :').' '.$this->l('Delai indiqué sur la fiche produit').'</p>';
}
}
}
echo '<legend><img src="../img/admin/delivery.gif" /> '.$this->l('Shipping information').'</legend>
'.$this->l('Total weight:').' <b>'.number_format($order->getTotalWeight(), 3).' '.Configuration::get('PS_WEIGHT_UNIT').'</b><br />
'.$this->l('Carrier:').' <b>'.($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name).'</b><br />