From fd1cfe0c8c332eb2482ce31eec82f52036823cab Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Wed, 25 Sep 2013 20:16:34 +0200 Subject: [PATCH] // Fixed group information label and a customer KPI --- controllers/admin/AdminGroupsController.php | 2 +- controllers/admin/AdminStatsController.php | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index bfd507726..362e44d7a 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -538,7 +538,7 @@ class AdminGroupsControllerCore extends AdminController ''.$default->name[$this->context->language->id].'' ); - $this->displayInformation($this->l('You now have three default customer groups.')); + $this->displayInformation($this->l('PrestaShop implements three default customer groups:')); $this->displayInformation($unidentified_group_information); $this->displayInformation($guest_group_information); $this->displayInformation($default_group_information); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 39ad801e4..257a33a17 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -208,14 +208,12 @@ class AdminStatsControllerCore extends AdminStatsTabController LEFT JOIN `'._DB_PREFIX_.'gender` g ON c.id_gender = g.id_gender WHERE c.active = 1'); if (!$row['total']) - $value = $this->l('No customers'); + return false; elseif ($row['male'] > $row['female'] && $row['male'] > $row['neutral']) - $value = sprintf($this->l('%d%% Men Customers'), round(100 * $row['male'] / $row['total'])); + return array('type' => 'male', 'value' => round(100 * $row['male'] / $row['total'])); elseif ($row['female'] > $row['male'] && $row['female'] > $row['neutral']) - $value = sprintf($this->l('%d%% Women Customers'), round(100 * $row['female'] / $row['total'])); - else - $value = sprintf($this->l('%d%% Neutral Customers'), round(100 * $row['neutral'] / $row['total'])); - return $value; + return array('type' => 'female', 'value' => round(100 * $row['female'] / $row['total'])); + return array('type' => 'neutral', 'value' => round(100 * $row['neutral'] / $row['total'])); } public static function getAverageCustomerAge() @@ -353,6 +351,16 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'customer_main_gender': $value = AdminStatsController::getCustomerMainGender(); + + if ($value === false) + $value = $this->l('No customers'); + elseif ($value['type'] == 'male') + $value = sprintf($this->l('%d%% Men Customers'), $value['value']); + elseif ($value['type'] == 'female') + $value = sprintf($this->l('%d%% Women Customers'), $value['value']); + else + $value = sprintf($this->l('%d%% Neutral Customers'), $value['value']); + ConfigurationKPI::updateValue('CUSTOMER_MAIN_GENDER', $value); ConfigurationKPI::updateValue('CUSTOMER_MAIN_GENDER_EXPIRE', strtotime('+1 day')); break;