Added doubled ean recovery options
This commit is contained in:
parent
cbf9b268ce
commit
7c218242be
@ -817,13 +817,14 @@ class HelperFormBootstrap{
|
|||||||
|
|
||||||
public function inputCheckbox($p = array()){
|
public function inputCheckbox($p = array()){
|
||||||
$checked = ((isset($p['checked']) && $p['checked']) ? $p['checked'] : false);
|
$checked = ((isset($p['checked']) && $p['checked']) ? $p['checked'] : false);
|
||||||
if ($this->_object)
|
if ($this->_object) {
|
||||||
$checked = $this->_object->{$p['name']};
|
$checked = $this->_object->{$p['name']};
|
||||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
}
|
||||||
<div class="margin-form checkbox' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
$this->_html .='
|
||||||
<input type="checkbox" id="'.$p['name'].'" name="'.$p['name'].'" value="1" id="'.$p['name'].'"'.($checked ? ' checked="checked"' : '').'/>
|
<div class="checkbox '.(isset($p['class-group'])?$p['class-group']:'').'">
|
||||||
' . (isset($p['text']) && $p['text'] ? '<label class="checkbox_label" for="'.$p['name'].'">'.$p['text'].'</label>' : '') . '
|
' . (isset($p['text']) && $p['text'] ? ' <label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">': '') .
|
||||||
<div class="clear"></div>
|
'<input type="checkbox" id="'.$p['name'].'" name="'.$p['name'].'" value="1" id="'.$p['name'].'"'.($checked ? ' checked="checked"' : '').'/>' .
|
||||||
|
(isset($p['text']) && $p['text'] ? $p['text'].'</label>' : '') . '
|
||||||
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
||||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
@ -104,7 +104,7 @@ class AdminAntWp extends AdminTab
|
|||||||
$filename = Tools::getValue('filename')?'WP-Vente '.Tools::getValue('filename'):'WP-Vente';
|
$filename = Tools::getValue('filename')?'WP-Vente '.Tools::getValue('filename'):'WP-Vente';
|
||||||
$marque = Tools::getValue('filename')?Tools::getValue('filename'):'Marque';
|
$marque = Tools::getValue('filename')?Tools::getValue('filename'):'Marque';
|
||||||
$params = array('marque' => $marque, 'filename' => $filename, 'lines' => array());
|
$params = array('marque' => $marque, 'filename' => $filename, 'lines' => array());
|
||||||
|
$debug = (Tools::getValue('debug') !== false);
|
||||||
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
|
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
|
||||||
fgetcsv($f, 0, ';');
|
fgetcsv($f, 0, ';');
|
||||||
$products = array();
|
$products = array();
|
||||||
@ -113,6 +113,7 @@ class AdminAntWp extends AdminTab
|
|||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$refs = array();
|
$refs = array();
|
||||||
$eans = array();
|
$eans = array();
|
||||||
|
$refs_ean = array();
|
||||||
while($line = fgetcsv($f, 0, ';')) {
|
while($line = fgetcsv($f, 0, ';')) {
|
||||||
if($line[0] == '' && $line[1] == '') {
|
if($line[0] == '' && $line[1] == '') {
|
||||||
continue;
|
continue;
|
||||||
@ -122,48 +123,60 @@ class AdminAntWp extends AdminTab
|
|||||||
if(!isset($products[$ean])){
|
if(!isset($products[$ean])){
|
||||||
$products[$ean] = array(
|
$products[$ean] = array(
|
||||||
'ean' => $ean,
|
'ean' => $ean,
|
||||||
'supplier_ref' => trim((String)utf8_encode($line[1])),
|
'supplier_ref' => trim(utf8_encode($line[1])),
|
||||||
'name_ha' => trim((String)utf8_encode($line[2])),
|
'name_ha' => trim(utf8_encode($line[2])),
|
||||||
'quantity' => trim($line[3]),
|
'quantity' => trim($line[3]),
|
||||||
'ppc' => trim((float)$line[4]),
|
'ppc' => trim((float)$line[4]),
|
||||||
'prix_ha' => trim((float)$line[5]),
|
'prix_ha' => trim((float)$line[5]),
|
||||||
'name_attribute_ha' => trim((String)$line[6])
|
'name_attribute_ha' => trim((String)$line[6])
|
||||||
);
|
);
|
||||||
}else{
|
|
||||||
//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{
|
||||||
$ref = trim((String)utf8_encode($line[1]));
|
//as the product is using a duplicated EAN we add it by ean¤ref
|
||||||
|
$ean = trim($line[0]);
|
||||||
|
$ref = trim(utf8_encode($line[1]));
|
||||||
|
$key_ean_ref = $ean . '¤' . $ref;
|
||||||
|
//we need to clean the old ean entry to add the ref
|
||||||
|
if(isset($products[$ean]) && $products[$ean]['supplier_ref'] != ''){
|
||||||
|
$products[$ean . '¤' . $products[$ean]['supplier_ref']] = $products[$ean];
|
||||||
|
$refs_ean[] = $ean . '¤' . $products[$ean]['supplier_ref'];
|
||||||
|
unset($products[$ean]);
|
||||||
|
$ean_array_key = array_search($ean,$eans,true);
|
||||||
|
if($ean_array_key !== false){
|
||||||
|
unset($eans[$ean_array_key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!isset($products[$key_ean_ref])) {
|
||||||
|
$products[$key_ean_ref] = array(
|
||||||
|
'ean' => trim($line[0]),
|
||||||
|
'supplier_ref' => $ref,
|
||||||
|
'name_ha' => trim(utf8_encode($line[2])),
|
||||||
|
'quantity' => trim($line[3]),
|
||||||
|
'ppc' => trim((float)$line[4]),
|
||||||
|
'prix_ha' => trim((float)$line[5]),
|
||||||
|
'name_attribute_ha' => trim(utf8_encode($line[6]))
|
||||||
|
);
|
||||||
|
$refs_ean[] = $key_ean_ref;
|
||||||
|
}else{
|
||||||
|
$this->report[self::DUPLICATED_REFS_AND_EAN][] = $key_ean_ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ref = trim(utf8_encode($line[1]));
|
||||||
if(!isset($products[$ref])) {
|
if(!isset($products[$ref])) {
|
||||||
$products[$ref] = array(
|
$products[$ref] = array(
|
||||||
'ean' => trim($line[0]),
|
'ean' => trim($line[0]),
|
||||||
'supplier_ref' => $ref,
|
'supplier_ref' => $ref,
|
||||||
'name_ha' => trim((String)utf8_encode($line[2])),
|
'name_ha' => trim(utf8_encode($line[2])),
|
||||||
'quantity' => trim($line[3]),
|
'quantity' => trim($line[3]),
|
||||||
'ppc' => trim((float)$line[4]),
|
'ppc' => trim((float)$line[4]),
|
||||||
'prix_ha' => trim((float)$line[5]),
|
'prix_ha' => trim((float)$line[5]),
|
||||||
'name_attribute_ha' => trim((String)utf8_encode($line[6]))
|
'name_attribute_ha' => trim(utf8_encode($line[6]))
|
||||||
);
|
);
|
||||||
|
$refs[] = $ref;
|
||||||
}else{
|
}else{
|
||||||
$this->report[self::DUPLICATED_REFS][] = $ref;
|
$this->report[self::DUPLICATED_REFS][] = $ref;
|
||||||
}
|
}
|
||||||
$refs[] = $ref;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$product_info = array();
|
$product_info = array();
|
||||||
@ -171,6 +184,7 @@ class AdminAntWp extends AdminTab
|
|||||||
$ids = array();
|
$ids = array();
|
||||||
$exclude_ids = $this->getBraderieProducts();
|
$exclude_ids = $this->getBraderieProducts();
|
||||||
$timer_table[] = 'Excluded products gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Excluded products gathered at '.(microtime(true)-$callStartTime);
|
||||||
|
$timer_table[] = 'Found by ean '.count($eans).', by ref'.count($refs).', duplicates ean '. count($refs_ean);
|
||||||
if(count($eans) > 0) {
|
if(count($eans) > 0) {
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`,
|
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`,
|
||||||
@ -195,19 +209,11 @@ class AdminAntWp extends AdminTab
|
|||||||
$result = Db::getInstance()->executeS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
if($row['ean13'] == '8427077902761'){
|
|
||||||
$timer_table[] = json_encode($row);
|
|
||||||
}
|
|
||||||
if ($row['ean13'] != '' && isset($products[$row['ean13']])) {
|
if ($row['ean13'] != '' && isset($products[$row['ean13']])) {
|
||||||
$products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
|
$products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
|
||||||
$product_found++;
|
$product_found++;
|
||||||
$ids[] = (int)$row['id_product'];
|
$ids[] = (int)$row['id_product'];
|
||||||
}
|
}
|
||||||
// elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){
|
|
||||||
// $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row);
|
|
||||||
// $product_found++;
|
|
||||||
// $ids[] = (int)$row['id_product'];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timer_table[] = 'Ean product gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Ean product gathered at '.(microtime(true)-$callStartTime);
|
||||||
@ -232,11 +238,6 @@ class AdminAntWp extends AdminTab
|
|||||||
AND p.`id_product` IS NOT NULL
|
AND p.`id_product` IS NOT NULL
|
||||||
ORDER BY c.`position`
|
ORDER BY c.`position`
|
||||||
') as $row) {
|
') as $row) {
|
||||||
// if($row['ean13']!='' && isset($products[$row['ean13']])){
|
|
||||||
// $products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
|
|
||||||
// $product_found++;
|
|
||||||
// $ids[] = (int)$row['id_product'];
|
|
||||||
// } else
|
|
||||||
if ($row['supplier_reference'] != '' && isset($products[$row['supplier_reference']])) {
|
if ($row['supplier_reference'] != '' && isset($products[$row['supplier_reference']])) {
|
||||||
$products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row);
|
$products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row);
|
||||||
$product_found++;
|
$product_found++;
|
||||||
@ -245,6 +246,42 @@ class AdminAntWp extends AdminTab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timer_table[] = 'Ref product gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Ref product gathered at '.(microtime(true)-$callStartTime);
|
||||||
|
if(count($refs_ean) > 0) {
|
||||||
|
foreach($refs_ean as $key) {
|
||||||
|
$result[] = $key;
|
||||||
|
$sql = '
|
||||||
|
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`,
|
||||||
|
p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country`
|
||||||
|
FROM
|
||||||
|
`' . _DB_PREFIX_ . 'product` p
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT date_add, max(id_product) as maxid
|
||||||
|
FROM `' . _DB_PREFIX_ . 'product`
|
||||||
|
WHERE id_product NOT IN (' . implode(',', $exclude_ids) . ')
|
||||||
|
GROUP BY ean13, supplier_reference
|
||||||
|
) as b
|
||||||
|
ON p.`id_product` = b.maxid
|
||||||
|
LEFT JOIN `' . _DB_PREFIX_ . 'category_product` c
|
||||||
|
ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`)
|
||||||
|
LEFT JOIN `' . _DB_PREFIX_ . 'product_customs` cu
|
||||||
|
ON (cu.`id_product` = p.`id_product`)
|
||||||
|
WHERE p.`ean13` = "' . explode('¤', $key)[0] . '" AND p.`supplier_reference` = "' . explode('¤', $key)[1] . '"
|
||||||
|
AND p.`id_product` IS NOT NULL
|
||||||
|
ORDER BY c.`position`
|
||||||
|
';
|
||||||
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
|
foreach ($result as $row) {
|
||||||
|
//$key = $row['ean13'] . '-' . $row['supplier_reference'];
|
||||||
|
if ($row['ean13'] != '' && $row['supplier_reference'] != '' && isset($products[$key])) {
|
||||||
|
$products[$key] = array_merge($products[$key], $row);
|
||||||
|
$product_found++;
|
||||||
|
$ids[] = (int)$row['id_product'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$timer_table[] = 'Ean-Ref product gathered at '.(microtime(true)-$callStartTime);
|
||||||
if(count($eans) > 0) {
|
if(count($eans) > 0) {
|
||||||
foreach (Db::getInstance()->executeS('
|
foreach (Db::getInstance()->executeS('
|
||||||
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, b.`id_product_attribute`, b.`ean13`, b.`supplier_reference` as at_ref, p.`price`, p.`wholesale_price`,
|
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, b.`id_product_attribute`, b.`ean13`, b.`supplier_reference` as at_ref, p.`price`, p.`wholesale_price`,
|
||||||
@ -278,19 +315,6 @@ class AdminAntWp extends AdminTab
|
|||||||
$ids[] = (int)$row['id_product'];
|
$ids[] = (int)$row['id_product'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){
|
|
||||||
// $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row);
|
|
||||||
// $product_found++;
|
|
||||||
// if(!in_array((int)$row['id_product'],$ids)){
|
|
||||||
// $ids[] = (int)$row['id_product'];
|
|
||||||
// }
|
|
||||||
// } elseif($row['at_ref']!='' && isset($products[$row['at_ref']])){
|
|
||||||
// $products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row);
|
|
||||||
// $product_found++;
|
|
||||||
// if(!in_array((int)$row['id_product'],$ids)){
|
|
||||||
// $ids[] = (int)$row['id_product'];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timer_table[] = 'Ean product attr gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Ean product attr gathered at '.(microtime(true)-$callStartTime);
|
||||||
@ -320,13 +344,6 @@ class AdminAntWp extends AdminTab
|
|||||||
AND p.`id_product` IS NOT NULL
|
AND p.`id_product` IS NOT NULL
|
||||||
ORDER BY c.`position`
|
ORDER BY c.`position`
|
||||||
') as $row) {
|
') as $row) {
|
||||||
// if($row['ean13']!='' && isset($products[$row['ean13']])){
|
|
||||||
// $products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
|
|
||||||
// $product_found++;
|
|
||||||
// if(!in_array((int)$row['id_product'],$ids)){
|
|
||||||
// $ids[] = (int)$row['id_product'];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if ($row['at_ref'] != '' && isset($products[$row['at_ref']])) {
|
if ($row['at_ref'] != '' && isset($products[$row['at_ref']])) {
|
||||||
$products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row);
|
$products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row);
|
||||||
$product_found++;
|
$product_found++;
|
||||||
@ -343,6 +360,47 @@ class AdminAntWp extends AdminTab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timer_table[] = 'Ref product attr gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Ref product attr gathered at '.(microtime(true)-$callStartTime);
|
||||||
|
if(count($refs_ean) > 0) {
|
||||||
|
foreach($refs_ean as $key){
|
||||||
|
$sql = '
|
||||||
|
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, b.`id_product_attribute`, b.`ean13`, b.`supplier_reference` as at_ref, p.`price`, p.`wholesale_price`,
|
||||||
|
p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country`,
|
||||||
|
al.`name` as attribute_name
|
||||||
|
FROM
|
||||||
|
`' . _DB_PREFIX_ . 'product` p
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT max(id_product) as maxid, ean13, `supplier_reference`, `id_product_attribute`
|
||||||
|
FROM `' . _DB_PREFIX_ . 'product_attribute`
|
||||||
|
WHERE id_product NOT IN (' . implode(',', $exclude_ids) . ')
|
||||||
|
GROUP BY ean13
|
||||||
|
) as b
|
||||||
|
ON p.`id_product`= b.maxid
|
||||||
|
LEFT JOIN `' . _DB_PREFIX_ . 'category_product` c
|
||||||
|
ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`)
|
||||||
|
LEFT JOIN `' . _DB_PREFIX_ . 'product_customs` cu
|
||||||
|
ON (cu.`id_product` = p.`id_product`)
|
||||||
|
LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` ac
|
||||||
|
ON (ac.`id_product_attribute` = b.`id_product_attribute`)
|
||||||
|
LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al
|
||||||
|
ON (al.`id_attribute` = ac.`id_attribute` AND al.`id_lang` = 2)
|
||||||
|
WHERE b.`ean13` = "'.explode('¤',$key)[0].'" AND b.`supplier_reference` = "' . explode('¤',$key)[1] . '"
|
||||||
|
AND p.`id_product` IS NOT NULL
|
||||||
|
ORDER BY c.`position`
|
||||||
|
';
|
||||||
|
|
||||||
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
foreach ($result as $row) {
|
||||||
|
if ($row[$key] != '' && isset($products[$key])) {
|
||||||
|
$products[$key] = array_merge($products[$key], $row);
|
||||||
|
$product_found++;
|
||||||
|
if (!in_array((int)$row['id_product'], $ids)) {
|
||||||
|
$ids[] = (int)$row['id_product'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$timer_table[] = 'Ean - Ref product attr gathered at '.(microtime(true)-$callStartTime);
|
||||||
$new_products = count($products) - $product_found;
|
$new_products = count($products) - $product_found;
|
||||||
if(!empty($ids)){
|
if(!empty($ids)){
|
||||||
foreach (Db::getInstance()->executeS('
|
foreach (Db::getInstance()->executeS('
|
||||||
@ -367,6 +425,14 @@ class AdminAntWp extends AdminTab
|
|||||||
if (!isset($products[$row['supplier_reference']]['lang'][(int)$row['id_lang']])) {
|
if (!isset($products[$row['supplier_reference']]['lang'][(int)$row['id_lang']])) {
|
||||||
$products[$row['supplier_reference']]['lang'][(int)$row['id_lang']] = $row;
|
$products[$row['supplier_reference']]['lang'][(int)$row['id_lang']] = $row;
|
||||||
}
|
}
|
||||||
|
} elseif ($row['supplier_reference'] != '' && $row['ean13'] != '' && isset($products[$row['ean13'] . '¤' . $row['supplier_reference']])) {
|
||||||
|
$key = $row['ean13'] . '¤' . $row['supplier_reference'];
|
||||||
|
if (!isset($products[$key]['lang'])) {
|
||||||
|
$products[$key]['lang'] = array();
|
||||||
|
}
|
||||||
|
if (!isset($products[$key]['lang'][(int)$row['id_lang']])) {
|
||||||
|
$products[$key]['lang'][(int)$row['id_lang']] = $row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timer_table[] = 'Additional info gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Additional info gathered at '.(microtime(true)-$callStartTime);
|
||||||
@ -400,10 +466,21 @@ class AdminAntWp extends AdminTab
|
|||||||
if (!isset($products[$row['at_ref']]['lang'][(int)$row['id_lang']])) {
|
if (!isset($products[$row['at_ref']]['lang'][(int)$row['id_lang']])) {
|
||||||
$products[$row['at_ref']]['lang'][(int)$row['id_lang']] = $row;
|
$products[$row['at_ref']]['lang'][(int)$row['id_lang']] = $row;
|
||||||
}
|
}
|
||||||
|
} elseif ($row['supplier_reference'] != '' && $row['ean13'] != '' && isset($products[$row['ean13'] . '¤' . $row['supplier_reference']])) {
|
||||||
|
$key = $row['ean13'] . '¤' . $row['supplier_reference'];
|
||||||
|
if (!isset($products[$key]['lang'])) {
|
||||||
|
$products[$key]['lang'] = array();
|
||||||
|
}
|
||||||
|
if (!isset($products[$key]['lang'][(int)$row['id_lang']])) {
|
||||||
|
$products[$key]['lang'][(int)$row['id_lang']] = $row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timer_table[] = 'Additional info (attr) gathered at '.(microtime(true)-$callStartTime);
|
$timer_table[] = 'Additional info (attr) gathered at '.(microtime(true)-$callStartTime);
|
||||||
}
|
}
|
||||||
|
foreach($products as $product_key => $product_values){
|
||||||
|
$timer_table[] = $product_key . ' - ' . $product_values['id_product'];
|
||||||
|
}
|
||||||
$params['lines'] = $products;
|
$params['lines'] = $products;
|
||||||
if(!empty($params['lines'])){
|
if(!empty($params['lines'])){
|
||||||
$wp = new GenerateWp();
|
$wp = new GenerateWp();
|
||||||
@ -418,8 +495,12 @@ class AdminAntWp extends AdminTab
|
|||||||
if (!empty($this->report[self::DUPLICATED_REFS_AND_EAN])) {
|
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_REFS_AND_EAN]) . '</p>';
|
$duplicated_formatted .= '<hr>Duplications d\'EANs<br><p style="color:darkred">' . implode('<br>', $this->report[self::DUPLICATED_REFS_AND_EAN]) . '</p>';
|
||||||
}
|
}
|
||||||
|
$debug_output ='';
|
||||||
|
if($debug){
|
||||||
|
$debug_output = $duplicated_formatted.'<p style="font-size: 6px"><br>Timers : <br>'.$timer_table_formatted.'</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. $debug_output);
|
||||||
} else {
|
} else {
|
||||||
$this->_html .= HelperFormBootstrap::displayErrors($this->l('Veuillez charger un fichier correct !'));
|
$this->_html .= HelperFormBootstrap::displayErrors($this->l('Veuillez charger un fichier correct !'));
|
||||||
}
|
}
|
||||||
@ -459,6 +540,13 @@ class AdminAntWp extends AdminTab
|
|||||||
'label-class' => 'col-md-12 text-left',
|
'label-class' => 'col-md-12 text-left',
|
||||||
'input-class' => 'col-md-6',
|
'input-class' => 'col-md-6',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'label' => $this->l('Debug'),
|
||||||
|
'name' => 'debug',
|
||||||
|
'text' => $this->l('Debug'),
|
||||||
|
'class-group' => 'col-md-12 text-left',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'actions' => array(),
|
'actions' => array(),
|
||||||
'actions-class' => 'text-right',
|
'actions-class' => 'text-right',
|
||||||
|
Loading…
Reference in New Issue
Block a user