// Fixed rounding

This commit is contained in:
Damien Metzger committed 2013-10-24 16:38:48 +02:00
1 parent a44cdf785e
commit 2931c20914
2 files changed
+9 -9

No files matched your search

+6 -5
View File
@@ -206,7 +206,12 @@ class AdminSearchControllerCore extends AdminController
*/ */
public function searchFeatures() public function searchFeatures()
{ {
$this->_list['features'] = array();
global $_LANGADM; global $_LANGADM;
if ($_LANGADM === null)
return;
$tabs = array(); $tabs = array();
$key_match = array(); $key_match = array();
$result = Db::getInstance()->executeS(' $result = Db::getInstance()->executeS('
@@ -225,6 +230,7 @@ class AdminSearchControllerCore extends AdminController
$tabs[strtolower($key)] = $tabs[strtolower($value)]; $tabs[strtolower($key)] = $tabs[strtolower($value)];
$key_match[strtolower($key)] = $key; $key_match[strtolower($key)] = $key;
} }
$this->_list['features'] = array(); $this->_list['features'] = array();
foreach ($_LANGADM as $key => $value) foreach ($_LANGADM as $key => $value)
{ {
@@ -242,11 +248,6 @@ class AdminSearchControllerCore extends AdminController
$this->_list['features'][$tabs[$key]][] = array('link' => Context::getContext()->link->getAdminLink($key_match[$key]), 'value' => Tools::safeOutput($value)); $this->_list['features'][$tabs[$key]][] = array('link' => Context::getContext()->link->getAdminLink($key_match[$key]), 'value' => Tools::safeOutput($value));
} }
} }
if (!count($this->_list['features']))
$this->_list['features'] = false;
else
$this->_list['features'];
} }
protected function initOrderList() protected function initOrderList()
+3 -4
View File
@@ -133,22 +133,21 @@ class Dashgoals extends Module
$goal = ConfigurationKPI::get(strtoupper('dashgoals_traffic_'.$i.'_'.$year)); $goal = ConfigurationKPI::get(strtoupper('dashgoals_traffic_'.$i.'_'.$year));
$value = 0; $value = 0;
if ($goal && isset($visits[$timestamp])) if ($goal && isset($visits[$timestamp]))
$value = round($visits[$timestamp] / $goal); $value = round($visits[$timestamp] / $goal, 2);
$stream1['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value); $stream1['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
$goal = ConfigurationKPI::get(strtoupper('dashgoals_conversion_'.$i.'_'.$year)); $goal = ConfigurationKPI::get(strtoupper('dashgoals_conversion_'.$i.'_'.$year));
$value = 0; $value = 0;
if ($goal && isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp]) if ($goal && isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp])
$value = round((100 * $orders[$timestamp] / $visits[$timestamp]) / $goal); $value = round((100 * $orders[$timestamp] / $visits[$timestamp]) / $goal, 2);
$stream2['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value); $stream2['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
$goal = ConfigurationKPI::get(strtoupper('dashgoals_avg_cart_value_'.$i.'_'.$year)); $goal = ConfigurationKPI::get(strtoupper('dashgoals_avg_cart_value_'.$i.'_'.$year));
$value = 0; $value = 0;
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); $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);
} }
return array('chart_type' => 'bar_chart_goals', 'data' => array($stream1, $stream2, $stream3)); return array('chart_type' => 'bar_chart_goals', 'data' => array($stream1, $stream2, $stream3));
} }
} }