new duplicates management

fix in formula
This commit is contained in:
David 2018-02-02 15:37:43 +01:00
parent daa9f31bc0
commit cbf9b268ce
2 changed files with 21 additions and 6 deletions

View File

@ -10,8 +10,8 @@ ini_set('max_execution_time', 300);
class AdminAntWp extends AdminTab class AdminAntWp extends AdminTab
{ {
const DUPLICATED_EANS = 'duplicated_ean';
const DUPLICATED_REFS = 'duplicated_refs'; const DUPLICATED_REFS = 'duplicated_refs';
const DUPLICATED_REFS_AND_EAN = 'duplicated_refs_ean';
protected $_html; protected $_html;
public $module_name; public $module_name;
public $config_tab; public $config_tab;
@ -32,7 +32,7 @@ class AdminAntWp extends AdminTab
} }
$this->helperForm = new HelperFormBootstrap(); $this->helperForm = new HelperFormBootstrap();
$this->report = array(); $this->report = array();
$this->report[self::DUPLICATED_EANS] = array(); $this->report[self::DUPLICATED_REFS_AND_EAN] = array();
$this->report[self::DUPLICATED_REFS] = array(); $this->report[self::DUPLICATED_REFS] = array();
// $this->helperForm->_select2 = true; // $this->helperForm->_select2 = true;
// $this->helperForm->_inputSwitch = true; // $this->helperForm->_inputSwitch = true;
@ -130,7 +130,22 @@ class AdminAntWp extends AdminTab
'name_attribute_ha' => trim((String)$line[6]) 'name_attribute_ha' => trim((String)$line[6])
); );
}else{ }else{
$this->report[self::DUPLICATED_EANS][] = $ean; //as the product is using a duplicated EAN we add it by ref
$ref = trim((String)utf8_encode($line[1]));
if(!isset($products[$ref])) {
$products[$ref] = array(
'ean' => trim($line[0]),
'supplier_ref' => $ref,
'name_ha' => trim((String)utf8_encode($line[2])),
'quantity' => trim($line[3]),
'ppc' => trim((float)$line[4]),
'prix_ha' => trim((float)$line[5]),
'name_attribute_ha' => trim((String)utf8_encode($line[6]))
);
}else{
$this->report[self::DUPLICATED_REFS_AND_EAN][] = $ean . "-" . $ref;
}
$refs[] = $ref;
} }
$eans[] = $ean; $eans[] = $ean;
} else { } else {
@ -400,8 +415,8 @@ class AdminAntWp extends AdminTab
if (!empty($this->report[self::DUPLICATED_REFS])) { if (!empty($this->report[self::DUPLICATED_REFS])) {
$duplicated_formatted = '<hr>Duplications de Reférences<br><p style="color:darkred">' . implode('<br>', $this->report[self::DUPLICATED_REFS]). '</p>'; $duplicated_formatted = '<hr>Duplications de Reférences<br><p style="color:darkred">' . implode('<br>', $this->report[self::DUPLICATED_REFS]). '</p>';
} }
if (!empty($this->report[self::DUPLICATED_EANS])) { if (!empty($this->report[self::DUPLICATED_REFS_AND_EAN])) {
$duplicated_formatted .= '<hr>Duplications d\'EANs<br><p style="color:darkred">' . implode('<br>', $this->report[self::DUPLICATED_EANS]) . '</p>'; $duplicated_formatted .= '<hr>Duplications d\'EANs<br><p style="color:darkred">' . implode('<br>', $this->report[self::DUPLICATED_REFS_AND_EAN]) . '</p>';
} }
$this->_html .= HelperFormBootstrap::displaySuccess('Génération complète <br><a class="btn btn-primary btn-xs" href="../modules/ant_wp/'.$filename.'.xlsx" download="'.$filename.'.xlsx">Télécharger le XLS</a>'. $this->_html .= HelperFormBootstrap::displaySuccess('Génération complète <br><a class="btn btn-primary btn-xs" href="../modules/ant_wp/'.$filename.'.xlsx" download="'.$filename.'.xlsx">Télécharger le XLS</a>'.
'<br>Produits trouvés : '.$product_found.'<br>Produits nouveaux : '.$new_products.$duplicated_formatted.'<p style="font-size: 6px"><br>Timers : <br>'.$timer_table_formatted.'</p>'); '<br>Produits trouvés : '.$product_found.'<br>Produits nouveaux : '.$new_products.$duplicated_formatted.'<p style="font-size: 6px"><br>Timers : <br>'.$timer_table_formatted.'</p>');

View File

@ -285,7 +285,7 @@ class GenerateWp
https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg,
https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg,
https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg", https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg",
IF(R'.$i.'='.$i.',"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, IF(R'.$i.'=5,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg,
https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg,
https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg,
https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg,