Merge branch 'ticket-14436-WP' into develop

This commit is contained in:
Marion Muszynski 2017-11-06 16:52:06 +01:00
commit 9c4b8164e3
2 changed files with 82 additions and 1 deletions

View File

@ -153,13 +153,45 @@ class AdminAntWp extends AdminTab
if($row['ean13']!='' && isset($products[$row['ean13']])){
$products[$row['ean13']] = array_merge($products[$row['ean13']], $row);
$product_found++;
$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'];
}
$ids[] = (int)$row['id_product'];
}
$new_products = count($products) - $product_found;
foreach (Db::getInstance()->executeS('
SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, at.`ean13`, p.`price`, p.`wholesale_price`,
p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.*
FROM
`'._DB_PREFIX_.'product` p
INNER JOIN (SELECT date_add, max(id_product) as maxid FROM `'._DB_PREFIX_.'product` GROUP BY `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`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` at
ON (at.`id_product` = p.`id_product`)
WHERE at.`ean13` IN ("'.implode('","',$eans).'")
ORDER BY c.`position`
') 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'];
} 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'];
}
if(!in_array((int)$row['id_product'],$ids)){
$ids[] = (int)$row['id_product'];
}
}
if(!empty($ids)){
foreach (Db::getInstance()->executeS('
SELECT p.`ean13`, p.`supplier_reference`, pl.*

View File

@ -354,6 +354,55 @@ class GenerateWp
->getStyle('B5:B'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
$this->objPHPExcel->getActiveSheet()
->getStyle('P5:P'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
$this->objPHPExcel->getActiveSheet()
->getStyle('Z5:Z'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AD5:AD'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AE5:AE'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AF5:AF'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AG5:AG'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AI5:AI'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AJ5:AJ'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AK5:AK'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
$this->objPHPExcel->getActiveSheet()
->getStyle('AL5:AL'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
$this->objPHPExcel->getActiveSheet()
->getStyle('AO5:AO'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$this->objPHPExcel->getActiveSheet()
->getStyle('AR5:AR'.$lastLine)
->getNumberFormat()
->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY);
$this->objPHPExcel->setActiveSheetIndex(1);
$this->objPHPExcel->getActiveSheet()
->getStyle('B5:B'.$lastLine)