Merge branch 'ticket-14436-WP'
This commit is contained in:
commit
3f9a62487a
@ -110,23 +110,25 @@ class AdminAntWp extends AdminTab
|
||||
if($line[0] != '') {
|
||||
$ean = trim($line[0]);
|
||||
$products[$ean] = array(
|
||||
'ean' => $ean,
|
||||
'supplier_ref' => trim($line[1]),
|
||||
'name_ha' => trim($line[2]),
|
||||
'quantity' => trim($line[3]),
|
||||
'ppc' => trim($line[4]),
|
||||
'prix_ha' => trim($line[5])
|
||||
'ean' => $ean,
|
||||
'supplier_ref' => trim((String)utf8_encode($line[1])),
|
||||
'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)$line[6])
|
||||
);
|
||||
$eans[] = $ean;
|
||||
} else {
|
||||
$ref = trim($line[1]);
|
||||
$ref = trim((String)utf8_encode($line[1]));
|
||||
$products[$ref] = array(
|
||||
'ean' => trim($line[0]),
|
||||
'supplier_ref' => $ref,
|
||||
'name_ha' => trim($line[2]),
|
||||
'quantity' => trim($line[3]),
|
||||
'ppc' => trim($line[4]),
|
||||
'prix_ha' => trim($line[5])
|
||||
'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]))
|
||||
);
|
||||
$refs[] = $ref;
|
||||
}
|
||||
@ -164,7 +166,8 @@ class AdminAntWp extends AdminTab
|
||||
|
||||
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.`nc8`, cu.`id_country`
|
||||
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 date_add, max(id_product) as maxid FROM `'._DB_PREFIX_.'product` GROUP BY `supplier_reference`) as b
|
||||
@ -175,6 +178,10 @@ class AdminAntWp extends AdminTab
|
||||
ON (cu.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` at
|
||||
ON (at.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` ac
|
||||
ON (ac.`id_product_attribute` = at.`id_product_attribute`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
|
||||
ON (al.`id_attribute` = ac.`id_attribute` AND al.`id_lang` = 2)
|
||||
WHERE at.`ean13` IN ("'.implode('","',$eans).'")
|
||||
AND p.`id_product` IS NOT NULL
|
||||
ORDER BY c.`position`
|
||||
@ -182,28 +189,51 @@ 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'];
|
||||
}
|
||||
if(!in_array((int)$row['id_product'],$ids)){
|
||||
$ids[] = (int)$row['id_product'];
|
||||
}
|
||||
}
|
||||
$new_products = count($products) - $product_found;
|
||||
|
||||
if(!empty($ids)){
|
||||
foreach (Db::getInstance()->executeS('
|
||||
SELECT p.`ean13`, p.`supplier_reference`, pl.*
|
||||
FROM ps_product_lang pl
|
||||
LEFT JOIN ps_product p ON (pl.`id_product` = p.`id_product`)
|
||||
WHERE pl.`id_product` IN ('.implode(',',$ids).')
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.`id_product` = p.`id_product`)
|
||||
WHERE p.`id_product` IN ('.implode(',',$ids).')
|
||||
AND (pl.id_lang = 2 OR pl.id_lang = 3)
|
||||
ORDER BY pl.`id_product`
|
||||
ORDER BY p.`id_product`
|
||||
') as $row) {
|
||||
if($row['ean13']!='' && isset($products[$row['ean13']])){
|
||||
if($row['ean13']!='' && isset($products[(int)$row['ean13']])){
|
||||
if(!isset($products[$row['ean13']]['lang'])){
|
||||
$products[$row['ean13']]['lang'] = array();
|
||||
}
|
||||
if(!isset($products[$row['ean13']]['lang'][(int)$row['id_lang']])){
|
||||
$products[$row['ean13']]['lang'][(int)$row['id_lang']] = $row;
|
||||
}
|
||||
} elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){
|
||||
if(!isset($products[$row['supplier_reference']]['lang'])){
|
||||
$products[$row['supplier_reference']]['lang'] = array();
|
||||
}
|
||||
if(!isset($products[$row['supplier_reference']]['lang'][(int)$row['id_lang']])){
|
||||
$products[$row['supplier_reference']]['lang'][(int)$row['id_lang']] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Db::getInstance()->executeS('
|
||||
SELECT at.`ean13`, p.`supplier_reference`, pl.*
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` at ON (at.`id_product` = p.`id_product`)
|
||||
WHERE p.`id_product` IN ('.implode(',',$ids).')
|
||||
AND (pl.id_lang = 2 OR pl.id_lang = 3)
|
||||
ORDER BY p.`id_product`
|
||||
') as $row) {
|
||||
if($row['ean13']!='' && isset($products[(int)$row['ean13']])){
|
||||
if(!isset($products[$row['ean13']]['lang'])){
|
||||
$products[$row['ean13']]['lang'] = array();
|
||||
}
|
||||
@ -280,7 +310,7 @@ class AdminAntWp extends AdminTab
|
||||
Avec les colonnes suivantes :<br>
|
||||
</p>
|
||||
<ul style="list-style:none;">
|
||||
<li style="font-size:13px;"><i>ean;ref_fournisseur;nom_produit_HA;quantite;PPC;prix_achat</i></li>
|
||||
<li style="font-size:13px;"><i>ean;ref_fournisseur;nom_produit_HA;quantite;PPC;prix_achat;taille_ha</i></li>
|
||||
</ul>
|
||||
<p>Les colonnes suivantes et la première ligne du fichier seront ignorées.</p>
|
||||
<p></p>'
|
||||
|
File diff suppressed because one or more lines are too long
@ -66,6 +66,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
||||
const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-';
|
||||
const FORMAT_CURRENCY_USD = '$#,##0_-';
|
||||
const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-';
|
||||
const FORMAT_CURRENCY_EUR = '#.00 [$€];-#.00 [$€]';
|
||||
|
||||
/**
|
||||
* Excel built-in number formats
|
||||
@ -264,7 +265,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
||||
// 40: "#,##0.00_);[Red](#,##0.00)"
|
||||
// 47: "mm:ss.0"
|
||||
// KOR fmt 55: "yyyy/mm/dd"
|
||||
|
||||
|
||||
// Built-in format codes
|
||||
if (is_null(self::$builtInFormats)) {
|
||||
self::$builtInFormats = array();
|
||||
|
Loading…
Reference in New Issue
Block a user