Merge branch 'ticket-12218-extractVP' into develop
This commit is contained in:
commit
c683c0dc86
@ -1228,6 +1228,7 @@ class AdminBulkUpdate extends AdminTab {
|
||||
} elseif(Tools::isSubmit('submitExport')) {
|
||||
set_time_limit(300);
|
||||
$id_lang = Tools::getValue('id_lang', $cookie->id_lang);
|
||||
$order_states = explode(',', Configuration::get('PS_IT_OF_ORDER_STATES'));
|
||||
|
||||
if ($id_category = (int) Tools::getValue('category')) {
|
||||
$c = new Category($id_category, $cookie->id_lang);
|
||||
@ -1394,29 +1395,30 @@ class AdminBulkUpdate extends AdminTab {
|
||||
}
|
||||
|
||||
$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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
ON h.`id_order` = d.`id_order`
|
||||
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`)
|
||||
SELECT SUM(d.`product_quantity` - d.`product_quantity_reinjected`)
|
||||
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)
|
||||
');*/
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
WHERE o.`id_order` = oh.`id_order`
|
||||
ORDER BY `id_order_history` DESC
|
||||
LIMIT 1
|
||||
) IN ("'.implode('","', $order_states).'")
|
||||
');
|
||||
// $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`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
// ON h.`id_order` = d.`id_order`
|
||||
// WHERE d.`product_id` = '.(int) $p->id.'
|
||||
// AND d.`product_attribute_id` = '.(int) $k.'
|
||||
// AND h.`id_order_state` = 2
|
||||
// ');
|
||||
|
||||
$names = array_unique($v['name']);
|
||||
sort($names, SORT_STRING);
|
||||
@ -1459,27 +1461,29 @@ class AdminBulkUpdate extends AdminTab {
|
||||
}
|
||||
} 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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
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`)
|
||||
SELECT SUM(d.`product_quantity` - d.`product_quantity_reinjected`)
|
||||
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)
|
||||
');*/
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
WHERE o.`id_order` = oh.`id_order`
|
||||
ORDER BY `id_order_history` DESC
|
||||
LIMIT 1
|
||||
) IN ("'.implode('","', $order_states).'")
|
||||
');
|
||||
// $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`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
// ON h.`id_order` = d.`id_order`
|
||||
// WHERE d.`product_id` = '.(int) $p->id.'
|
||||
// AND h.`id_order_state` = 2
|
||||
// ');
|
||||
|
||||
fputcsv($f, array(
|
||||
$p->supplier_reference,
|
||||
@ -1524,6 +1528,7 @@ class AdminBulkUpdate extends AdminTab {
|
||||
} elseif (Tools::getValue('date_start') && Tools::getValue('date_end')) {
|
||||
$date_start = Tools::getValue('date_start');
|
||||
$date_end = Tools::getValue('date_end');
|
||||
$order_states = explode(',', Configuration::get('PS_IT_OF_ORDER_STATES'));
|
||||
|
||||
$ids = Db::getInstance()->ExecuteS('
|
||||
SELECT c.id_category
|
||||
@ -1692,29 +1697,30 @@ class AdminBulkUpdate extends AdminTab {
|
||||
sort($names, SORT_STRING);
|
||||
|
||||
$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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
ON h.`id_order` = d.`id_order`
|
||||
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`)
|
||||
SELECT SUM(d.`product_quantity` - d.`product_quantity_reinjected`)
|
||||
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)
|
||||
');*/
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
WHERE o.`id_order` = oh.`id_order`
|
||||
ORDER BY `id_order_history` DESC
|
||||
LIMIT 1
|
||||
) IN ("'.implode('","', $order_states).'")
|
||||
');
|
||||
// $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`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
// ON h.`id_order` = d.`id_order`
|
||||
// WHERE d.`product_id` = '.(int) $p->id.'
|
||||
// AND d.`product_attribute_id` = '.(int) $k.'
|
||||
// AND h.`id_order_state` = 2
|
||||
// ');
|
||||
|
||||
$customs = Db::getInstance()->getRow('
|
||||
SELECT `nc8`, `id_country`
|
||||
@ -1759,27 +1765,27 @@ class AdminBulkUpdate extends AdminTab {
|
||||
} 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`
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
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`)
|
||||
SELECT SUM(d.`product_quantity` - d.`product_quantity_reinjected`)
|
||||
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)
|
||||
');*/
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
WHERE o.`id_order` = oh.`id_order`
|
||||
ORDER BY `id_order_history` DESC
|
||||
LIMIT 1
|
||||
) IN ("'.implode('","', $order_states).'")
|
||||
');
|
||||
// SELECT SUM(d.`product_quantity`)
|
||||
// FROM `'._DB_PREFIX_.'order_detail` d
|
||||
// LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
// ON o.`id_order` = d.`id_order`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
// ON h.`id_order` = d.`id_order`
|
||||
// WHERE d.`product_id` = '.(int) $p->id.'
|
||||
// AND h.`id_order_state` = 2
|
||||
|
||||
$customs = Db::getInstance()->getRow('
|
||||
SELECT `nc8`, `id_country`
|
||||
|
Loading…
Reference in New Issue
Block a user