// Use date_from and date_to in dashboard stats
This commit is contained in:
1 parent
7b902ac99d
commit
61d10abc76
3 files changed
+12
-6
No files matched your search
@@ -81,9 +81,9 @@ class AdminDashboardControllerCore extends AdminController
|
|||||||
$params = array(
|
$params = array(
|
||||||
'date_from' => $this->context->employee->stats_date_from,
|
'date_from' => $this->context->employee->stats_date_from,
|
||||||
'date_to' => $this->context->employee->stats_date_to,
|
'date_to' => $this->context->employee->stats_date_to,
|
||||||
);
|
);
|
||||||
|
|
||||||
$datas = Hook::exec('dashboardDatas', array(), $id_module, true);
|
$datas = Hook::exec('dashboardDatas', $params, $id_module, true);
|
||||||
die(Tools::jsonEncode($datas));
|
die(Tools::jsonEncode($datas));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,9 +54,15 @@ class Dashactivity extends Module
|
|||||||
|
|
||||||
public function hookDashboardDatas($params)
|
public function hookDashboardDatas($params)
|
||||||
{
|
{
|
||||||
|
$order_nbr = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT COUNT(o.`id_order`)
|
||||||
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
|
WHERE o.`invoice_date` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||||
|
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o'));
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'data_value' => array(
|
'data_value' => array(
|
||||||
'order_nbr' => 365,
|
'order_nbr' => $order_nbr,
|
||||||
'pending_orders' => 120,
|
'pending_orders' => 120,
|
||||||
'return_exchanges' => 35,
|
'return_exchanges' => 35,
|
||||||
'abandoned_cart' => 12,
|
'abandoned_cart' => 12,
|
||||||
@@ -72,7 +78,7 @@ class Dashactivity extends Module
|
|||||||
'unique_visitors' => 3500,
|
'unique_visitors' => 3500,
|
||||||
),
|
),
|
||||||
'data_trends' => array(
|
'data_trends' => array(
|
||||||
'orders_trends' => array('way' => 'down', 'value' => 0.66),
|
'orders_trends' => array('way' => 'down', 'value' => 0.42),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ class Dashtrends extends Module
|
|||||||
$visits_score = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
$visits_score = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT COUNT(c.`id_connections`)
|
SELECT COUNT(c.`id_connections`)
|
||||||
FROM `'._DB_PREFIX_.'connections` c
|
FROM `'._DB_PREFIX_.'connections` c
|
||||||
WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
WHERE c.`date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||||
'.Shop::addSqlRestriction(false, 'c'));
|
'.Shop::addSqlRestriction(false, 'c'));
|
||||||
}
|
}
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT COUNT(o.`id_order`) as orders_score, SUM(o.`total_paid_tax_excl` / o.conversion_rate) as sales_score
|
SELECT COUNT(o.`id_order`) as orders_score, SUM(o.`total_paid_tax_excl` / o.conversion_rate) as sales_score
|
||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
WHERE o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
WHERE o.`invoice_date` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o'));
|
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o'));
|
||||||
extract($row);
|
extract($row);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user