changement how to show sale delay

This commit is contained in:
Marion Muszynski 2017-01-24 17:32:22 +01:00
parent 038dbec401
commit 25fea84b8c
3 changed files with 74 additions and 6 deletions

View File

@ -51,7 +51,7 @@ if (isset($_GET['getSales'])){
$export = true;
foreach($sales as $key => $sale) {
$delay = SaleDelay::getDelay($sale->delivery_delay,2);
$delay = SaleDelay::getDelaySmallName($sale->delivery_delay,2);
echo '<tr id="item_'.$sale->id. '">
<td>'.$sale->id.'</td>
<td>'.$sale->id_category.'</td>
@ -73,7 +73,7 @@ if (isset($_GET['getSales'])){
echo '<td>'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'</td>
<td '.(in_array('fr', $sale->versions) ? 'class="green"' : 'class="red"').'>FR</td>
<td '.(in_array('es', $sale->versions) ? 'class="green"' : 'class="red"').'>ES</td>
<td>'.$delay['name'].'</td>
<td>'.$delay.'</td>
<td class="position">';
if($key != 0){
echo '<a href="" class="updatePosition" data-way="0" data-position='. $sale->position .'><img title="Haut" alt="Haut" src="../img/admin/up.gif"></a>';

View File

@ -813,7 +813,7 @@ class AdminPrivateSalesSales extends AdminTab {
$extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids);
foreach($sales as $key => $sale) {
$delay = SaleDelay::getDelay($sale->delivery_delay,2);
$delay = SaleDelay::getDelaySmallName($sale->delivery_delay,2);
echo '<tr id="item_'.$sale->id. '" class="sale_'.($key%2).'">
<td>'.$sale->id.'</td>
<td>'.$sale->id_category.'</td>
@ -839,7 +839,7 @@ class AdminPrivateSalesSales extends AdminTab {
<td>'.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').'</td>
<td>'.$delay['name'].'</td>
<td>'.$delay.'</td>
<td>'. $sale->forward_news .'</td>

View File

@ -13,7 +13,7 @@ if (!class_exists('SaleDelay')) {
$products_final = array();
$categories_cached = array();
$sales_cached = array();
foreach ($products as $key => $product) {
if (!isset($product['id_category_default'])) {
$product['id_category_default'] = Db::getInstance()->getValue('
@ -29,7 +29,7 @@ if (!class_exists('SaleDelay')) {
} else {
$sale = $sales_cached[(int) $product['id_category_default']];
}
$delay = !empty($sale->delivery_delay) ? $sale->delivery_delay : 1;
$delay = !empty($sale->delivery_delay) ? $sale->delivery_delay : 1;
if(!isset($products_final[(int)$delay])) {
$products_final[(int)$delay] = array();
@ -118,6 +118,74 @@ if (!class_exists('SaleDelay')) {
');
}
/**
* @todo - remove this function to use short name
*/
public static function getDelaySmallName($id_delay, $id_lang) {
if($id_lang == 2) {
switch ($id_delay) {
case '1':
return 'Classique';
break;
case '2':
return '48h';
break;
case '3':
return '7j';
break;
case '4':
return '10j';
break;
case '5':
return 'Noël';
break;
case '6':
return 'Star';
break;
case '7':
return '72h';
break;
case '8':
return '48h Noël';
break;
default:
return 'Inconnu';
break;
}
} elseif($id_lang == 3){
switch ($id_delay) {
case '1':
return 'Classic';
break;
case '2':
return '48h';
break;
case '3':
return '7j';
break;
case '4':
return '10j';
break;
case '5':
return 'Noël';
break;
case '6':
return 'Star';
break;
case '7':
return '72h';
break;
case '8':
return '48h Noël';
break;
default:
return 'Unknown';
break;
}
}
return 'Unknown';
}
}
}