// Dashgoals improvements
This commit is contained in:
@@ -153,9 +153,10 @@ class Dashgoals extends Module
|
||||
$orders = AdminStatsController::getOrders($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());
|
||||
$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))
|
||||
{
|
||||
@@ -178,7 +179,15 @@ class Dashgoals extends Module
|
||||
if ($goal && isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp])
|
||||
$value = round(($sales[$timestamp] / $orders[$timestamp]) / $goal, 2);
|
||||
$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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user