Merge branch 'ticket-newExtracts' into develop

This commit is contained in:
Marion Muszynski 2016-04-20 11:38:26 +02:00
commit 7ff21f8a76
3 changed files with 564 additions and 23 deletions

View File

@ -157,8 +157,8 @@ if (!defined('_PS_CACHE_ENABLED_'))
/* Consumable */
if (!defined('_SHOP_CATEGORYROOT'))
define('_SHOP_CATEGORYROOT', 8711761);
define('_SHOP_CATEGORYROOT', 8720307);
if (!defined('_SHOP_CATEGORYENABLED'))
define('_SHOP_CATEGORYENABLED', 1);
if (!defined('_SHOP_PRIVATESALES_CONSUMABLE'))
define('_SHOP_PRIVATESALES_CONSUMABLE', 3963);
define('_SHOP_PRIVATESALES_CONSUMABLE', 5158);

View File

@ -590,10 +590,472 @@ class AdminBulkUpdate extends AdminTab {
fclose($f);
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
} elseif(Tools::isSubmit('submitExportDeb')){
set_time_limit(300);
$id_lang = Tools::getValue('id_lang', $cookie->id_lang);
$deb = Tools::getValue('deb', 0);
if (!$deb) {
$output .= '<p class="error">Erreur produit: Vous devez choisir une date</p>';
}
if (!Tools::getValue('date_start') || !Tools::getValue('date_end')) {
$output .= '<p class="error">Erreur produit: Vous devez choisir une date</p>';
}
$date_start = Tools::getValue('date_start');
$date_end = Tools::getValue('date_end');
switch ($deb) {
case '1':
// DEB INTRODUCTION
$ids = Db::getInstance()->ExecuteS('
SELECT c.id_category
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `'._DB_PREFIX_.'privatesale_category` c ON c.id_sale = p.id_sale
WHERE date_start BETWEEN "'. $date_start .' 00:00:00" AND "'. $date_end .' 00:00:00"
ORDER BY date_start ASC
');
if (!$ids) {
$output .= '<p class="error">Erreur produit: Pas de ventes trouvées</p>';
break;
}
setlocale(LC_TIME, "fr_FR");
$products = array();
$category_properties = array();
foreach($ids as $id) {
$id_category = $id['id_category'];
foreach(Category::getProductsWsSold((int)$id_category) as $p) {
$products[] = $p['id'];
if (!is_array($category_properties[(int)$p['id']])) {
$privatesale = Sale::getSaleFromCategory((int) $id_category);
$country_ps = '';
if ($privatesale->id_country > 0) {
$country_ps = Country::getNameById((int)$id_lang,(int)$privatesale->id_country);
}
$category_properties[(int)$p['id']] = array(
'name' => $privatesale->title[(int)$id_lang],
'country' => $country_ps,
'month' => strftime("%B", strtotime($privatesale->date_start)),
'id_country' => (int)$privatesale->id_country
);
}
}
}
$products = array_unique($products);
if(count($products) > 20000){
$output .= '<p class="conf">Choisir une plage moins grande. <br /> Export > 20000 produits</p>';
break;
};
foreach(glob(dirname(__FILE__).'/*.csv') as $filename) {
unlink($filename);
}
$fname = date( "Ymd", strtotime($date_start)).'-'.date( "Ymd", strtotime($date_end)).'.csv';
$f = fopen(dirname(__FILE__).'/'.$fname, 'w');
// uft8 sans bom pour accent
$BOM = "\xEF\xBB\xBF"; // UTF-8 BOM
fwrite($f, $BOM); // NEW LINE
fputcsv($f, array(
'Ordre',
'Pays de provenance',
'Marque',
'Mois',
'Référence fournisseur',
'Produit',
'Nomenclature',
'NGP9',
'Pays dorigine',
'Valeur',
'Régime',
'Masse',
'Unité supplémentaire',
'Nature de transaction',
'Mode de transport',
'Département '
), ';', '"');
foreach($products as $product) {
$p = new Product((int) $product, $id_lang);
if(!Validate::isLoadedObject($p)) {
$output .= '<p class="error">Erreur produit: '.serialize($product).' ce produit ne figure pas dans l\'export</p>';
} else {
$customs = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE `id_product` = '.(int) $p->id
);
if (strtolower($customs['id_country']) == 'france') {
continue;
}
$ue_countries = array(1,2,3,6,7,9,10,12,13,14,15,16,17,18,19,20,26,36,37);
if (!in_array($category_properties[$p->id]['id_country'], $ue_countries)) {
continue;
}
/*$country_product = Db::getInstance()->getRow('
SELECT `id_country`
FROM `'._DB_PREFIX_.'country_lang`
WHERE `name` LIKE \''.pSQL(ucfirst(strtolower($customs['id_country']))).'\'
AND `id_lang` = '.(int)($id_lang)
);
if (!in_array((int)$country_product['id_country'], $ue_countries)) {
continue;
}*/
$position = Db::getInstance()->getValue('
SELECT `position`
FROM `'._DB_PREFIX_.'category_product`
WHERE `id_category` = '.(int) $p->id_category_default.'
AND id_product = '. (int) $p->id . '
');
$p->position = $position;
$combinations = array();
foreach($p->getAttributeCombinaisons($id_lang) as $combi) {
if(!isset($combinations[$combi['id_product_attribute']])) {
$combinations[$combi['id_product_attribute']] = array(
'qty' => $combi['quantity'],
'name' => array($combi['attribute_name']),
'ean13' => $combi['ean13'],
'location' => empty($combi['location'])? $p->location: $combi['location'],
'brand' => $p->manufacturer_name,
'supplier_reference' => empty($combi['supplier_reference'])? $p->supplier_reference: $combi['supplier_reference'],
);
} else {
$combinations[$combi['id_product_attribute']]['name'][] = $combi['attribute_name'];
}
}
if(count($combinations) > 0) {
foreach($combinations as $k => $v) {
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=d.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
');
if ($quantity_sold == 0) {
continue;
}
$names = array_unique($v['name']);
sort($names, SORT_STRING);
fputcsv($f, array(
$p->position,
$category_properties[$p->id]['country'],
$category_properties[$p->id]['name'],
$category_properties[$p->id]['month'],
$v['supplier_reference'],
$p->name[$id_lang].' - '.implode(' ', $names),
$customs['nc8'],
'',
$customs['id_country'],
str_replace('.', ',', Tools::ps_round(($quantity_sold * $p->wholesale_price),2)),
11,
str_replace('.', ',', Tools::ps_round(($p->weight * $quantity_sold),2)),
$quantity_sold,
11,
3,
31
), ';', '"');
}
} else {
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = 0
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=d.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
');
if ($quantity_sold == 0) {
continue;
}
fputcsv($f, array(
$p->position,
$category_properties[$p->id]['country'],
$category_properties[$p->id]['name'],
$category_properties[$p->id]['month'],
$p->supplier_reference,
$p->name[$id_lang],
$customs['nc8'],
'',
$customs['id_country'],
str_replace('.', ',', Tools::ps_round(($quantity_sold * $p->wholesale_price),2)),
11,
str_replace('.', ',', Tools::ps_round(($p->weight * $quantity_sold),2)),
$quantity_sold,
11,
3,
31
), ';', '"');
}
}
}
fclose($f);
$output .= '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/bulkupdate/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
break;
case '2':
// DEB EXPEDITION
// Seulement les expeditions vers Espagne et Belgique
$orders = Db::getInstance()->ExecuteS('
SELECT DISTINCT od.`id_order_detail`, od.`product_id`, psc.`id_sale`
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = od.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` psc ON (psc.`id_product` = od.`product_id`)
LEFT JOIN `'._DB_PREFIX_.'address` a ON (a.`id_address` = o.`id_address_delivery`)
WHERE o.`date_add` BETWEEN "'. $date_start .' 00:00:00" AND "'. $date_end .' 00:00:00"
AND a.`id_country` IN (3,6)
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=od.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
ORDER BY od.`product_id` ASC
');
if (!$orders) {
$output .= '<p class="error">Erreur produit: Pas de commandes trouvées pour ces dates</p>';
break;
}
setlocale(LC_TIME, "fr_FR");
$products = array();
$orders_detail = array();
$category_properties = array();
$by_sale = array();
foreach($orders as $order) {
$products[] = $order['product_id'];
$orders_detail[] = $order['id_order_detail'];
if (!is_array($category_properties[(int)$order['product_id']])) {
$by_sale[(int)$order['id_sale']] = array();
$privatesale = new Sale((int) $order['id_sale']);
$country_ps = '';
if ($privatesale->id_country > 0) {
$country_ps = Country::getNameById((int)$id_lang,(int)$privatesale->id_country);
}
$category_properties[(int)$order['product_id']] = array(
'name' => $privatesale->title[(int)$id_lang],
'country' => $country_ps,
'month' => strftime("%B", strtotime($privatesale->date_start)),
'date' => strtotime($privatesale->date_start),
'id_sale' => (int) $order['id_sale'],
);
}
}
//echo "<pre>";var_dump($orders_detail);echo "</pre>";die();
$products = array_unique($products);
if(count($products) > 20000){
$output .= '<p class="conf">Choisir une plage moins grande. <br /> Export > 20000 produits</p>';
break;
};
foreach(glob(dirname(__FILE__).'/*.csv') as $filename) {
unlink($filename);
}
$fname = date( "Ymd", strtotime($date_start)).'-'.date( "Ymd", strtotime($date_end)).'.csv';
$f = fopen(dirname(__FILE__).'/'.$fname, 'w');
// uft8 sans bom pour accent
$BOM = "\xEF\xBB\xBF"; // UTF-8 BOM
fwrite($f, $BOM); // NEW LINE
fputcsv($f, array(
'Ordre',
'Pays de provenance',
'Marque',
'Mois',
'Référence fournisseur',
'Produit',
'Nomenclature',
'NGP9',
//'Pays dorigine',
'Valeur',
'Régime',
'Masse',
'Unité supplémentaire',
'Nature de transaction',
'Mode de transport',
'Département '
), ';', '"');
$products_detail = array();
foreach($products as $product) {
$p = new Product((int) $product, $id_lang);
if(!Validate::isLoadedObject($p)) {
$output .= '<p class="error">Erreur produit: '.serialize($product).' ce produit ne figure pas dans l\'export</p>';
} else {
$customs = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE `id_product` = '.(int) $p->id
);
$position = Db::getInstance()->getValue('
SELECT `position`
FROM `'._DB_PREFIX_.'category_product`
WHERE `id_category` = '.(int) $p->id_category_default.'
AND id_product = '. (int) $p->id . '
');
$p->position = $position;
$combinations = array();
foreach($p->getAttributeCombinaisons($id_lang) as $combi) {
if(!isset($combinations[$combi['id_product_attribute']])) {
$combinations[$combi['id_product_attribute']] = array(
'qty' => $combi['quantity'],
'name' => array($combi['attribute_name']),
'ean13' => $combi['ean13'],
'location' => empty($combi['location'])? $p->location: $combi['location'],
'brand' => $p->manufacturer_name,
'supplier_reference' => empty($combi['supplier_reference'])? $p->supplier_reference: $combi['supplier_reference'],
);
} else {
$combinations[$combi['id_product_attribute']]['name'][] = $combi['attribute_name'];
}
}
if(count($combinations) > 0) {
foreach($combinations as $k => $v) {
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND d.`id_order_detail` IN ('.(count($orders_detail)>1?implode(',',$orders_detail):$orders_detail[0]).')
');
if ($quantity_sold == 0) {
continue;
}
$names = array_unique($v['name']);
sort($names, SORT_STRING);
$products_detail[] = array(
'position' => $p->position,
'sale_country' => $category_properties[$p->id]['country'],
'sale_name' => $category_properties[$p->id]['name'],
'sale_month' => $category_properties[$p->id]['month'],
'supplier_reference' => $v['supplier_reference'],
'product_name' => $p->name[$id_lang].' - '.implode(' ', $names),
'nc8' => $customs['nc8'],
'NGP9' => '',
'value' => str_replace('.', ',', ($quantity_sold * $p->wholesale_price)),
'regime' => 21,
'weight' => str_replace('.', ',', Tools::ps_round(($p->weight * $quantity_sold),2)),
'quantity_sold' => $quantity_sold,
'transaction_type' => 11,
'transport' => 3,
'department' => 31,
'sale_date' => $category_properties[$p->id]['date'],
'id_sale' => $category_properties[$p->id]['id_sale'],
);
}
} else {
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`id_order_detail` IN ('.(count($orders_detail)>1?implode(',',$orders_detail):$orders_detail[0]).')
');
if ($quantity_sold == 0) {
continue;
}
$products_detail[] = array(
'position' => $p->position,
'sale_country' => $category_properties[$p->id]['country'],
'sale_name' => $category_properties[$p->id]['name'],
'sale_month' => $category_properties[$p->id]['month'],
'supplier_reference' => $p->supplier_reference,
'product_name' => $p->name[$id_lang],
'nc8' => $customs['nc8'],
'NGP9' => '',
'value' => str_replace('.', ',', ($quantity_sold * $p->wholesale_price)),
'regime' => 21,
'weight' => str_replace('.', ',', Tools::ps_round(($p->weight * $quantity_sold),2)),
'quantity_sold' => $quantity_sold,
'transaction_type' => 11,
'transport' => 3,
'department' => 31,
'sale_date' => $category_properties[$p->id]['date'],
'id_sale' => $category_properties[$p->id]['id_sale'],
);
}
}
}
foreach ($products_detail as $key => $row) {
$id_sale[$key] = (int)$row['id_sale'];
$sale_date[$key] = (int)$row['sale_date'];
}
array_multisort($sale_date, SORT_ASC, $id_sale, SORT_DESC, $products_detail);
foreach ($products_detail as $key => $product_d) {
fputcsv($f, array(
$product_d['position'],
$product_d['sale_country'],
$product_d['sale_name'],
$product_d['sale_month'],
$product_d['supplier_reference'],
$product_d['product_name'],
$product_d['nc8'],
$product_d['NGP9'],
//$product_d['id_country'],
$product_d['value'],
$product_d['regime'],
$product_d['weight'],
$product_d['quantity_sold'],
$product_d['transaction_type'],
$product_d['transport'],
$product_d['department']
), ';', '"');
}
fclose($f);
$output .= '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/bulkupdate/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
break;
default:
$output .= '<p class="error">Veuillez choisir un type d\'export</p>';
break;
}
} elseif(Tools::isSubmit('submitExport')) {
set_time_limit(300);
$id_lang = Tools::getValue('id_lang', $cookie->id_lang);
if($id_category = (int) Tools::getValue('category')) {
if ($id_category = (int) Tools::getValue('category')) {
$c = new Category($id_category, $cookie->id_lang);
$children = $c->recurseLiteCategTree(5, 0, $id_lang);
$ids = $this->_recurse_array(array($children));
@ -725,6 +1187,12 @@ class AdminBulkUpdate extends AdminTab {
$images[] = 'http://static.bebeboutik.com/img/p/'.implode('/', $link_image) .'/'. $img['id_image'].'.jpg';
}
$customs = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE `id_product` = '.(int) $p->id
);
if(count($combinations) > 0) {
foreach($combinations as $k => $v) {
$c_images = array();
@ -744,7 +1212,7 @@ class AdminBulkUpdate extends AdminTab {
// $c_images[] = 'http://static.bebeboutik.com/'.(int) $p->id.'-'.$img['id_image'].'.jpg';
}
$quantity_sold = (int) Db::getInstance()->getValue('
/*$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o
@ -754,14 +1222,21 @@ class AdminBulkUpdate extends AdminTab {
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND h.`id_order_state` = 2
');*/
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=d.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
');
$customs = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE `id_product` = '.(int) $p->id
);
$names = array_unique($v['name']);
sort($names, SORT_STRING);
fputcsv($f, array(
@ -798,7 +1273,7 @@ class AdminBulkUpdate extends AdminTab {
), ';', '"');
}
} else {
$quantity_sold = (int) Db::getInstance()->getValue('
/*$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o
@ -807,14 +1282,20 @@ class AdminBulkUpdate extends AdminTab {
ON h.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND h.`id_order_state` = 2
');*/
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=d.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
');
$customs = Db::getInstance()->getRow('
SELECT `nc8`, `id_country`
FROM `'._DB_PREFIX_.'product_customs`
WHERE `id_product` = '.(int) $p->id
);
fputcsv($f, array(
$p->supplier_reference,
$p->id,
@ -991,7 +1472,7 @@ class AdminBulkUpdate extends AdminTab {
AND i.`id_product` = '.(int) $p->id.'
ORDER BY i.`position`
') as $img) {
$link_image = str_split($img['id_image']);
$link_image = str_split($img['id_image']);
$images[] = 'http://static.bebeboutik.com/img/p/'.implode('/', $link_image) .'/'. $img['id_image'].'.jpg';
}
@ -1016,7 +1497,7 @@ class AdminBulkUpdate extends AdminTab {
$names = array_unique($v['name']);
sort($names, SORT_STRING);
$quantity_sold = (int) Db::getInstance()->getValue('
/*$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o
@ -1026,6 +1507,19 @@ class AdminBulkUpdate extends AdminTab {
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND h.`id_order_state` = 2
');*/
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=d.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
');
$customs = Db::getInstance()->getRow('
@ -1066,7 +1560,7 @@ class AdminBulkUpdate extends AdminTab {
}
} else {
$quantity_sold = (int) Db::getInstance()->getValue('
/*$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o
@ -1075,6 +1569,18 @@ class AdminBulkUpdate extends AdminTab {
ON h.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND h.`id_order_state` = 2
');*/
$quantity_sold = (int) Db::getInstance()->getValue('
SELECT SUM(d.`product_quantity`)
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
AND (
SELECT `id_order_state`
FROM `'._DB_PREFIX_.'order_history`
WHERE `id_order`=d.`id_order`
ORDER BY `date_add` DESC LIMIT 1
) NOT IN (1,6,8,9,10,11,14,15,18)
');
$customs = Db::getInstance()->getRow('
@ -1490,7 +1996,8 @@ class AdminBulkUpdate extends AdminTab {
foreach(Language::getLanguages(FALSE) as $lang) {
$output .= '<option value="'.$lang['id_lang'].'"'.($cookie->id_lang == $lang['id_lang']? ' selected="selected"': '').'>'.$lang['name'].'</option>';
}
$output .= '</select>
$output.= '</select>
</div>
<p> </p>
<center><input type="submit" name="submitExport" value="'.$this->l('Export').'" class="button" /></center>
@ -1498,6 +2005,29 @@ class AdminBulkUpdate extends AdminTab {
</form>';
$output .= '<p><br /></p>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="/modules/bulkupdate/logo.gif" alt="" title="" />'.$this->l('Export DEB').'</legend>
<label>'.$this->l('Select a DEB:').'</label>
<div class="margin-form">
<select id="deb" name="deb">
<option value="1">DEB introduction</option>
<option value="2">DEB expedition</option>
</select>
<p>Introduction : selon date des ventes</p>
<p>Expedition : selon date des commandes</p>
</div><p> </p>
<label>'.$this->l('Par date de début :').'</label>
<div class="margin-form">
Du <input type="text" name="date_start">
au <input type="text" name="date_end">
<p>Format : AAAA-MM-JJ</p>
</div>
<center><input type="submit" name="submitExportDeb" value="'.$this->l('Export').'" class="button" /></center>
</fieldset>
</form>';
echo '<link type="text/css" rel="stylesheet" href="'._MODULE_DIR_.'bulkupdate/chosen.min.css" />';
echo '<script type="text/javascript" src="'._MODULE_DIR_.'bulkupdate/chosen.jquery.min.js"></script>';
echo '<script type="text/javascript">
@ -1570,5 +2100,4 @@ class AdminBulkUpdate extends AdminTab {
}
return $result;
}
}
}

View File

@ -403,4 +403,16 @@
return $results;
}
public static function getProductsWsSold($id)
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT cp.`id_product` as id
FROM `'._DB_PREFIX_.'category_product` cp
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`product_id` = cp.`id_product`)
WHERE cp.`id_category` = '.(int)($id).'
ORDER BY `position` ASC
');
return $result;
}
}