// Dashgoals improvements
This commit is contained in:
1 parent
35fc864e0b
commit
51bd377a67
2 files changed
+13
-3
No files matched your search
@@ -153,9 +153,10 @@ class Dashgoals extends Module
|
|||||||
$orders = AdminStatsController::getOrders($year.date('-01-01'), $year.date('-12-31'), 'month');
|
$orders = AdminStatsController::getOrders($year.date('-01-01'), $year.date('-12-31'), 'month');
|
||||||
$sales = AdminStatsController::getTotalSales($year.date('-01-01'), $year.date('-12-31'), 'month');
|
$sales = AdminStatsController::getTotalSales($year.date('-01-01'), $year.date('-12-31'), 'month');
|
||||||
|
|
||||||
$stream1 = array('key' => $this->l('Traffic'), 'values' => array());
|
$stream1 = array('key' => $this->l('Traffic'), 'values' => array(), 'disabled' => true);
|
||||||
$stream2 = array('key' => $this->l('Conversion Rate'), 'values' => array());
|
$stream2 = array('key' => $this->l('Conversion Rate'), 'values' => array());
|
||||||
$stream3 = array('key' => $this->l('Average Cart Value'), 'values' => array());
|
$stream3 = array('key' => $this->l('Average Cart Value'), 'values' => array());
|
||||||
|
$stream4 = array('key' => $this->l('Sales'), 'values' => array());
|
||||||
|
|
||||||
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
||||||
{
|
{
|
||||||
@@ -178,7 +179,15 @@ class Dashgoals extends Module
|
|||||||
if ($goal && isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp])
|
if ($goal && isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp])
|
||||||
$value = round(($sales[$timestamp] / $orders[$timestamp]) / $goal, 2);
|
$value = round(($sales[$timestamp] / $orders[$timestamp]) / $goal, 2);
|
||||||
$stream3['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
|
$stream3['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
|
||||||
|
|
||||||
|
$goal = ConfigurationKPI::get(strtoupper('dashgoals_traffic_'.$i.'_'.$year))
|
||||||
|
* ConfigurationKPI::get(strtoupper('dashgoals_conversion_'.$i.'_'.$year)) / 100
|
||||||
|
* ConfigurationKPI::get(strtoupper('dashgoals_avg_cart_value_'.$i.'_'.$year));
|
||||||
|
$value = 0;
|
||||||
|
if ($goal && isset($sales[$timestamp]) && $sales[$timestamp])
|
||||||
|
$value = round($sales[$timestamp] / $goal, 2);
|
||||||
|
$stream4['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
|
||||||
}
|
}
|
||||||
return array('chart_type' => 'bar_chart_goals', 'data' => array($stream1, $stream2, $stream3));
|
return array('chart_type' => 'bar_chart_goals', 'data' => array($stream1, $stream2, $stream3, $stream4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,9 @@
|
|||||||
|
|
||||||
<section id="dashgoals" class="panel widget">
|
<section id="dashgoals" class="panel widget">
|
||||||
<header class="panel-heading">
|
<header class="panel-heading">
|
||||||
<i class="icon-bar-chart"></i> <span id="dashgoals_title">{l s='Your %s Forecast' mod='dashgoals' sprintf=$goals_year}</span>
|
<i class="icon-bar-chart"></i> {l s='Your forecast' mod='dashgoals'}
|
||||||
<a href="javascript:void(0);" onclick="dashgoals_changeYear('backward');" class="icon-backward"></a>
|
<a href="javascript:void(0);" onclick="dashgoals_changeYear('backward');" class="icon-backward"></a>
|
||||||
|
<span id="dashgoals_title">{$goals_year}</span>
|
||||||
<a href="javascript:void(0);" onclick="dashgoals_changeYear('forward');" class="icon-forward"></a>
|
<a href="javascript:void(0);" onclick="dashgoals_changeYear('forward');" class="icon-forward"></a>
|
||||||
<span class="panel-heading-action">
|
<span class="panel-heading-action">
|
||||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="toggleDashConfig('dashgoals');" title="configure">
|
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="toggleDashConfig('dashgoals');" title="configure">
|
||||||
|
|||||||
Reference in new issue
Block a user