This commit is contained in:
Michael RICOIS 2018-03-08 11:44:37 +01:00
parent c658d0ec75
commit c86f90f0eb

View File

@ -537,14 +537,17 @@ class AdminBulkUpdate extends AdminTab {
}
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
} elseif(Tools::isSubmit('submitUploadPrices')) {
}
// MAJ Rapide produits (Reduction, Prix d'achat HT, Prix d'achat TTC)
elseif(Tools::isSubmit('submitUploadPrices'))
{
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
fgetcsv($f, 0, ';');
$products = array();
$prices = array();
if(Tools::getValue('price_process') == 2) {
if (Tools::getValue('price_process') == 2) {
while($line = fgetcsv($f, 0, ';')) {
if(empty($line[0])) {
continue;
@ -552,8 +555,7 @@ class AdminBulkUpdate extends AdminTab {
$products[] = (int) $line[0];
}
} elseif(Tools::getValue('price_process') == 3
|| Tools::getValue('price_process') == 4){
} elseif(Tools::getValue('price_process') == 3 || Tools::getValue('price_process') == 4) {
while($line = fgetcsv($f, 0, ';')) {
if(empty($line[0])) {
continue;
@ -564,7 +566,7 @@ class AdminBulkUpdate extends AdminTab {
$line[1]
);
}
}else {
} else {
while($line = fgetcsv($f, 0, ';')) {
if(empty($line[0])) {
continue;
@ -577,7 +579,7 @@ class AdminBulkUpdate extends AdminTab {
$products[] = (int) $line[0];
$prices[] = array(
(int) $line[0],
(float) $line[1] > 1? (float) $line[1] / 100: (float) $line[1]
(float) $line[1] > 1 ? (float) $line[1] / 100: (float) $line[1]
);
}
@ -585,15 +587,14 @@ class AdminBulkUpdate extends AdminTab {
fclose($f);
if(Tools::getValue('price_process') == 1
|| Tools::getValue('price_process') == 2) {
if (Tools::getValue('price_process') == 1 || Tools::getValue('price_process') == 2) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'specific_price`
WHERE `id_product` IN ('.implode(', ', $products).')
');
}
if(Tools::getValue('price_process') == 1) {
if (Tools::getValue('price_process') == 1) {
foreach($prices as $price) {
if((int) $price[0] != 0) {
Db::getInstance()->ExecuteS('
@ -617,7 +618,7 @@ class AdminBulkUpdate extends AdminTab {
}
}
}
if(Tools::getValue('price_process') == 3) {
if (Tools::getValue('price_process') == 3) {
foreach($prices as $price) {
if((int) $price[0] != 0){
$price[1] = str_replace(',', '.', $price[1]);
@ -631,7 +632,7 @@ class AdminBulkUpdate extends AdminTab {
}
}
}
if(Tools::getValue('price_process') == 4) {
if (Tools::getValue('price_process') == 4) {
foreach($prices as $price) {
if((int) $price[0] != 0){
$price[1] = str_replace(',', '.', $price[1]);
@ -647,7 +648,7 @@ class AdminBulkUpdate extends AdminTab {
}
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
} elseif(Tools::isSubmit('submitUploadProductDescriptions')) {
} elseif (Tools::isSubmit('submitUploadProductDescriptions')) {
$id_lang = Tools::getValue('description_process');
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
fgetcsv($f, 0, ';');
@ -675,7 +676,7 @@ class AdminBulkUpdate extends AdminTab {
fclose($f);
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
} elseif(Tools::isSubmit('submitUploadCombinations')) {
} elseif (Tools::isSubmit('submitUploadCombinations')) {
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
fgetcsv($f, 0, ';');
@ -713,7 +714,7 @@ class AdminBulkUpdate extends AdminTab {
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
} elseif(Tools::isSubmit('submitExportDeb')){
} elseif (Tools::isSubmit('submitExportDeb')){
set_time_limit(300);
$id_lang = Tools::getValue('id_lang', $cookie->id_lang);
$deb = Tools::getValue('deb', 0);