diff --git a/modules/dashgoals/dashgoals.php b/modules/dashgoals/dashgoals.php index 98f227fb8..d3376b6f0 100644 --- a/modules/dashgoals/dashgoals.php +++ b/modules/dashgoals/dashgoals.php @@ -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)); } } \ No newline at end of file diff --git a/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl b/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl index ae8938c2d..23aa63eba 100644 --- a/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl @@ -36,8 +36,9 @@
- {l s='Your %s Forecast' mod='dashgoals' sprintf=$goals_year} + {l s='Your forecast' mod='dashgoals'} + {$goals_year}