Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Dashboard Trends
## About
Adds a block whith the evolution of your stores main numbers along with a graphic.
## Contributing
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
### Requirements
Contributors **must** follow the following rules:
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].
### Process in details
Contributors wishing to edit a module's files should follow the following process:
1. Create your GitHub account, if you do not have one already.
2. Fork the dashtrends project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
That's it: you have contributed to this open-source project! Congratulations!
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests

View File

@@ -0,0 +1,19 @@
{
"name": "prestashop/dashtrends",
"description": "PrestaShop module dashtrends",
"homepage": "https://github.com/PrestaShop/dashtrends",
"license": "AFL - Academic Free License (AFL 3.0)",
"authors": [
{
"name": "PrestaShop SA",
"email": "contact@prestashop.com"
}
],
"require": {
"php": ">=5.4"
},
"config": {
"preferred-install": "dist"
},
"type": "prestashop-module"
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>dashtrends</name>
<displayName><![CDATA[Dashboard Trends]]></displayName>
<version><![CDATA[2.0.2]]></version>
<description><![CDATA[Adds a block whith the evolution of your stores main numbers along with a graphic.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[dashboard]]></tab>
<is_configurable>0</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>dashtrends</name>
<displayName><![CDATA[Tableau de bord des tendances]]></displayName>
<version><![CDATA[2.0.2]]></version>
<description><![CDATA[Ajoute &agrave; votre tableau de bord un graphique repr&eacute;sentant l&#039;&eacute;volution des indicateurs cl&eacute;s de votre boutique.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[dashboard]]></tab>
<is_configurable>0</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,352 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class dashtrends extends Module
{
protected $dashboard_data;
protected $dashboard_data_compare;
protected $dashboard_data_sum;
protected $dashboard_data_sum_compare;
protected $data_trends;
public function __construct()
{
$this->name = 'dashtrends';
$this->tab = 'dashboard';
$this->version = '2.0.2';
$this->author = 'PrestaShop';
$this->push_filename = _PS_CACHE_DIR_.'push/trends';
$this->allow_push = true;
parent::__construct();
$this->displayName = $this->trans('Dashboard Trends', array(), 'Modules.Dashtrends.Admin');
$this->description = $this->trans('Adds a block with a graphical representation of the development of your store(s) based on selected key data.', array(), 'Modules.Dashtrends.Admin');
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
}
public function install()
{
return (parent::install()
&& $this->registerHook('dashboardZoneTwo')
&& $this->registerHook('dashboardData')
&& $this->registerHook('actionAdminControllerSetMedia')
&& $this->registerHook('actionOrderStatusPostUpdate')
);
}
public function hookActionAdminControllerSetMedia()
{
if (get_class($this->context->controller) == 'AdminDashboardController') {
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');
}
}
public function hookDashboardZoneTwo($params)
{
$this->context->smarty->assign(array(
'currency' => $this->context->currency,
'_PS_PRICE_DISPLAY_PRECISION_' => _PS_PRICE_DISPLAY_PRECISION_
));
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
}
protected function getData($date_from, $date_to)
{
// We need the following figures to calculate our stats
$tmp_data = array(
'visits' => array(),
'orders' => array(),
'total_paid_tax_excl' => array(),
'total_purchases' => array(),
'total_expenses' => array()
);
if (Configuration::get('PS_DASHBOARD_SIMULATION')) {
$from = strtotime($date_from.' 00:00:00');
$to = min(time(), strtotime($date_to.' 23:59:59'));
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date)) {
$tmp_data['visits'][$date] = round(rand(2000, 20000));
$tmp_data['conversion_rate'][$date] = rand(80, 250) / 100;
$tmp_data['average_cart_value'][$date] = round(rand(60, 200), 2);
$tmp_data['orders'][$date] = round($tmp_data['visits'][$date] * $tmp_data['conversion_rate'][$date] / 100);
$tmp_data['total_paid_tax_excl'][$date] = $tmp_data['orders'][$date] * $tmp_data['average_cart_value'][$date];
$tmp_data['total_purchases'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(50, 70) / 100;
$tmp_data['total_expenses'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 10) / 100;
}
} else {
$tmp_data['visits'] = AdminStatsController::getVisits(false, $date_from, $date_to, 'day');
$tmp_data['orders'] = AdminStatsController::getOrders($date_from, $date_to, 'day');
$tmp_data['total_paid_tax_excl'] = AdminStatsController::getTotalSales($date_from, $date_to, 'day');
$tmp_data['total_purchases'] = AdminStatsController::getPurchases($date_from, $date_to, 'day');
$tmp_data['total_expenses'] = AdminStatsController::getExpenses($date_from, $date_to, 'day');
}
return $tmp_data;
}
protected function refineData($date_from, $date_to, $gross_data)
{
$refined_data = array(
'sales' => array(),
'orders' => array(),
'average_cart_value' => array(),
'visits' => array(),
'conversion_rate' => array(),
'net_profits' => array()
);
$from = strtotime($date_from.' 00:00:00');
$to = min(time(), strtotime($date_to.' 23:59:59'));
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date)) {
$refined_data['sales'][$date] = 0;
if (isset($gross_data['total_paid_tax_excl'][$date])) {
$refined_data['sales'][$date] += $gross_data['total_paid_tax_excl'][$date];
}
$refined_data['orders'][$date] = isset($gross_data['orders'][$date]) ? $gross_data['orders'][$date] : 0;
$refined_data['average_cart_value'][$date] = $refined_data['orders'][$date] ? $refined_data['sales'][$date] / $refined_data['orders'][$date] : 0;
$refined_data['visits'][$date] = isset($gross_data['visits'][$date]) ? $gross_data['visits'][$date] : 0;
$refined_data['conversion_rate'][$date] = $refined_data['visits'][$date] ? $refined_data['orders'][$date] / $refined_data['visits'][$date] : 0;
$refined_data['net_profits'][$date] = 0;
if (isset($gross_data['total_paid_tax_excl'][$date])) {
$refined_data['net_profits'][$date] += $gross_data['total_paid_tax_excl'][$date];
}
if (isset($gross_data['total_purchases'][$date])) {
$refined_data['net_profits'][$date] -= $gross_data['total_purchases'][$date];
}
if (isset($gross_data['total_expenses'][$date])) {
$refined_data['net_profits'][$date] -= $gross_data['total_expenses'][$date];
}
}
return $refined_data;
}
protected function addupData($data)
{
$summing = array(
'sales' => 0,
'orders' => 0,
'average_cart_value' => 0,
'visits' => 0,
'conversion_rate' => 0,
'net_profits' => 0
);
$summing['sales'] = array_sum($data['sales']);
$summing['orders'] = array_sum($data['orders']);
$summing['average_cart_value'] = $summing['sales'] ? $summing['sales'] / $summing['orders'] : 0;
$summing['visits'] = array_sum($data['visits']);
$summing['conversion_rate'] = $summing['visits'] ? $summing['orders'] / $summing['visits'] : 0;
$summing['net_profits'] = array_sum($data['net_profits']);
return $summing;
}
protected function compareData($data1, $data2)
{
return array(
'sales_score_trends' => array(
'way' => ($data1['sales'] == $data2['sales'] ? 'right' : ($data1['sales'] > $data2['sales'] ? 'up' : 'down')),
'value' => ($data1['sales'] > $data2['sales'] ? '+' : '').($data2['sales'] ? round(100 * $data1['sales'] / $data2['sales'] - 100, 2).'%' : '&infin;')
),
'orders_score_trends' => array(
'way' => ($data1['orders'] == $data2['orders'] ? 'right' : ($data1['orders'] > $data2['orders'] ? 'up' : 'down')),
'value' => ($data1['orders'] > $data2['orders'] ? '+' : '').($data2['orders'] ? round(100 * $data1['orders'] / $data2['orders'] - 100, 2).'%' : '&infin;')
),
'cart_value_score_trends' => array(
'way' => ($data1['average_cart_value'] == $data2['average_cart_value'] ? 'right' : ($data1['average_cart_value'] > $data2['average_cart_value'] ? 'up' : 'down')),
'value' => ($data1['average_cart_value'] > $data2['average_cart_value'] ? '+' : '').($data2['average_cart_value'] ? round(100 * $data1['average_cart_value'] / $data2['average_cart_value'] - 100, 2).'%' : '&infin;')
),
'visits_score_trends' => array(
'way' => ($data1['visits'] == $data2['visits'] ? 'right' : ($data1['visits'] > $data2['visits'] ? 'up' : 'down')),
'value' => ($data1['visits'] > $data2['visits'] ? '+' : '').($data2['visits'] ? round(100 * $data1['visits'] / $data2['visits'] - 100, 2).'%' : '&infin;')
),
'conversion_rate_score_trends' => array(
'way' => ($data1['conversion_rate'] == $data2['conversion_rate'] ? 'right' : ($data1['conversion_rate'] > $data2['conversion_rate'] ? 'up' : 'down')),
'value' => ($data1['conversion_rate'] > $data2['conversion_rate'] ? '+' : '') . ($data2['conversion_rate'] ? sprintf($this->trans('%s points', array(), 'Modules.Dashtrends.Admin'), round(100 * ($data1['conversion_rate'] - $data2['conversion_rate']), 2)) : '&infin;')
),
'net_profits_score_trends' => array(
'way' => ($data1['net_profits'] == $data2['net_profits'] ? 'right' : ($data1['net_profits'] > $data2['net_profits'] ? 'up' : 'down')),
'value' => ($data1['net_profits'] > $data2['net_profits'] ? '+' : '').($data2['net_profits'] ? round(100 * $data1['net_profits'] / $data2['net_profits'] - 100, 2).'%' : '&infin;')
)
);
}
public function hookDashboardData($params)
{
$this->currency = clone $this->context->currency;
// Retrieve, refine and add up data for the selected period
$tmp_data = $this->getData($params['date_from'], $params['date_to']);
$this->dashboard_data = $this->refineData($params['date_from'], $params['date_to'], $tmp_data);
$this->dashboard_data_sum = $this->addupData($this->dashboard_data);
if ($params['compare_from'] && $params['compare_from'] != '0000-00-00') {
// Retrieve, refine and add up data for the comparison period
$tmp_data_compare = $this->getData($params['compare_from'], $params['compare_to']);
$this->dashboard_data_compare = $this->refineData($params['compare_from'], $params['compare_to'], $tmp_data_compare);
$this->dashboard_data_sum_compare = $this->addupData($this->dashboard_data_compare);
$this->data_trends = $this->compareData($this->dashboard_data_sum, $this->dashboard_data_sum_compare);
$this->dashboard_data_compare = $this->translateCompareData($this->dashboard_data, $this->dashboard_data_compare);
}
$sales_score = Tools::displayPrice($this->dashboard_data_sum['sales'], $this->currency).
$this->addTaxSuffix();
$cart_value_score = Tools::displayPrice($this->dashboard_data_sum['average_cart_value'], $this->currency).
$this->addTaxSuffix();
$net_profit_score = Tools::displayPrice($this->dashboard_data_sum['net_profits'], $this->currency).
$this->addTaxSuffix();
return array(
'data_value' => array(
'sales_score' => $sales_score,
'orders_score' => Tools::displayNumber($this->dashboard_data_sum['orders'], $this->currency),
'cart_value_score' => $cart_value_score,
'visits_score' => Tools::displayNumber($this->dashboard_data_sum['visits'], $this->currency),
'conversion_rate_score' => round(100 * $this->dashboard_data_sum['conversion_rate'], 2).'%',
'net_profits_score' => $net_profit_score,
),
'data_trends' => $this->data_trends,
'data_chart' => array('dash_trends_chart1' => $this->getChartTrends()),
);
}
protected function addTaxSuffix()
{
return ' <small>'.$this->trans('Tax excl.', array(), 'Admin.Global').'</small>';
}
protected function translateCompareData($normal, $compare)
{
$translated_array = array();
foreach ($compare as $key => $date_array) {
$normal_min = key($normal[$key]);
end($normal[$key]); // move the internal pointer to the end of the array
$normal_max = key($normal[$key]);
reset($normal[$key]);
$normal_size = $normal_max - $normal_min;
$compare_min = key($compare[$key]);
end($compare[$key]); // move the internal pointer to the end of the array
$compare_max = key($compare[$key]);
reset($compare[$key]);
$compare_size = $compare_max - $compare_min;
$translated_array[$key] = array();
foreach ($date_array as $compare_date => $value) {
$translation = $normal_min + ($compare_date - $compare_min) * ($normal_size / $compare_size);
$translated_array[$key][number_format($translation, 0, '', '')] = $value;
}
}
return $translated_array;
}
public function getChartTrends()
{
$chart_data = array();
$chart_data_compare = array();
foreach (array_keys($this->dashboard_data) as $chart_key) {
$chart_data[$chart_key] = $chart_data_compare[$chart_key] = array();
if (!$count = count($this->dashboard_data[$chart_key])) {
continue;
}
// We calibrate 100% to the mean
$calibration = array_sum($this->dashboard_data[$chart_key]) / $count;
foreach ($this->dashboard_data[$chart_key] as $key => $value) {
$chart_data[$chart_key][] = array($key, $value);
}
// min(10) is there to limit the growth to 1000%, beyond this limit it becomes unreadable
//$chart_data[$chart_key][] = array(1000 * $key, $calibration ? min(10, $value / $calibration) : 0);
if ($this->dashboard_data_compare) {
foreach ($this->dashboard_data_compare[$chart_key] as $key => $value) {
$chart_data_compare[$chart_key][] = array($key, $value);
}
}
// min(10) is there to limit the growth to 1000%, beyond this limit it becomes unreadable
/*$chart_data_compare[$chart_key][] = array(
1000 * $key,
$calibration ? min(10, $value / $calibration) : 0
);*/
}
$charts = array(
'sales' => $this->trans('Sales', array(), 'Admin.Global'),
'orders' => $this->trans('Orders', array(), 'Admin.Global'),
'average_cart_value' => $this->trans('Average Cart Value', array(), 'Modules.Dashtrends.Admin'),
'visits' => $this->trans('Visits', array(), 'Admin.Shopparameters.Feature'),
'conversion_rate' => $this->trans('Conversion Rate', array(), 'Modules.Dashtrends.Admin'),
'net_profits' => $this->trans('Net Profit', array(), 'Modules.Dashtrends.Admin')
);
$gfx_color = array('#1777B6','#2CA121','#E61409','#FF7F00','#6B399C','#B3591F');
$gfx_color_compare = array('#A5CEE4','#B1E086','#FD9997','#FFC068','#CAB1D7','#D2A689');
$i = 0;
$data = array('chart_type' => 'line_chart_trends', 'date_format' => $this->context->language->date_format_lite, 'data' => array());
foreach ($charts as $key => $title) {
$data['data'][] = array(
'id' => $key,
'key' => $title,
'color' => $gfx_color[$i],
'values' => $chart_data[$key],
'disabled' => ($key == 'sales' ? false : true)
);
if ($this->dashboard_data_compare) {
$data['data'][] = array(
'id' => $key.'_compare',
'color' => $gfx_color_compare[$i],
'key' => sprintf($this->trans('%s (previous period)', array(), 'Modules.Dashtrends.Admin'), $title),
'values' => $chart_data_compare[$key],
'disabled' => ($key == 'sales' ? false : true)
);
}
$i++;
}
return $data;
}
public function hookActionOrderStatusPostUpdate($params)
{
Tools::changeFileMTime($this->push_filename);
}
}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,85 @@
var dashtrends_data;
var dashtrends_chart;
function line_chart_trends(widget_name, chart_details)
{
if (chart_details.data[0].values.length <= 1)
$('#dash_trends_chart1').hide();
else
$('#dash_trends_chart1').show();
nv.addGraph(function() {
var chart = nv.models.lineChart()
.useInteractiveGuideline(true)
.x(function(d) { return (d !== undefined ? d[0] : 0); })
.y(function(d) { return (d !== undefined ? parseInt(d[1]) : 0); })
.margin({left: 80});
chart.xAxis.tickFormat(function(d) {
date = new Date(d*1000);
return date.format(chart_details['date_format']);
});
first_data = new Array();
$.each(chart_details.data, function(index, value) {
if (value.id == 'sales' || value.id == 'sales_compare')
{
if (value.id == 'sales')
$('#dashtrends_toolbar dl:first').css('background-color', chart_details.data[index].color).addClass('active');
first_data.push(chart_details.data[index]);
}
});
chart.yAxis.tickFormat(function(d) {
return formatCurrency(parseFloat(d), currency_format, currency_sign, currency_blank);
});
dashtrends_data = chart_details.data;
dashtrends_chart = chart;
d3.select('#dash_trends_chart1 svg')
.datum(first_data)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
function selectDashtrendsChart(element, type)
{
$('#dashtrends_toolbar dl').removeClass('active');
current_charts = new Array();
$.each(dashtrends_data, function(index, value) {
if (value.id == type || value.id == type + '_compare')
{
if (value.id == type)
{
$(element).siblings().css('background-color', 'none').removeClass('active');
$(element).css('background-color', dashtrends_data[index].color).addClass('active');
}
current_charts.push(dashtrends_data[index]);
value.disabled = false;
}
});
dashtrends_chart.yAxis.tickFormat(d3.format('.f'));
if (type == 'sales' || type == 'average_cart_value' || type == 'net_profits')
dashtrends_chart.yAxis.tickFormat(function(d) {
return formatCurrency(parseFloat(d), currency_format, currency_sign, currency_blank);
});
if (type == 'conversion_rate')
dashtrends_chart.yAxis.tickFormat(function(d) {
return d3.round(d*100, 2)+' %';
});
d3.select('#dash_trends_chart1 svg')
.datum(current_charts)
.call(dashtrends_chart);
}
$(document).ready(function(){
$("dl").tooltip();
});

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,79 @@
{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<script>
var currency_format = {$currency->format|floatval};
var currency_sign = '{$currency->sign|@addcslashes:'\''}';
var currency_blank = {$currency->blank|intval};
var priceDisplayPrecision = {$_PS_PRICE_DISPLAY_PRECISION_|intval};
</script>
<div class="clearfix"></div>
<section id="dashtrends" class="panel widget{if $allow_push} allow_push{/if}">
<header class="panel-heading">
<i class="icon-bar-chart"></i> {l s='Dashboard' d='Modules.Dashtrends.Admin'}
<span class="panel-heading-action">
<a class="list-toolbar-btn" href="{$link->getAdminLink('AdminDashboard')|escape:'html':'UTF-8'}&amp;profitability_conf=1" title="{l s='Configure' d='Admin.Actions'}">
<i class="process-icon-configure"></i>
</a>
<a class="list-toolbar-btn" href="#" onclick="refreshDashboard('dashtrends'); return false;" title="{l s='Refresh' d='Admin.Actions'}">
<i class="process-icon-refresh"></i>
</a>
</span>
</header>
<div id="dashtrends_toolbar" class="row">
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'sales');" data-toggle="tooltip" data-original-title="{l s='Sum of revenue (excl. tax) generated within the date range by orders considered validated.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
<dt>{l s='Sales' d='Admin.Global'}</dt>
<dd class="data_value size_l"><span id="sales_score"></span></dd>
<dd class="dash_trend"><span id="sales_score_trends"></span></dd>
</dl>
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'orders');" data-toggle="tooltip" data-original-title="{l s='Total number of orders received within the date range that are considered validated.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
<dt>{l s='Orders' d='Admin.Global'}</dt>
<dd class="data_value size_l"><span id="orders_score"></span></dd>
<dd class="dash_trend"><span id="orders_score_trends"></span></dd>
</dl>
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'average_cart_value');" data-toggle="tooltip" data-original-title="{l s='Average Cart Value is a metric representing the value of an average order within the date range. It is calculated by dividing Sales by Orders.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
<dt>{l s='Cart Value' d='Modules.Dashtrends.Admin'}</dt>
<dd class="data_value size_l"><span id="cart_value_score"></span></dd>
<dd class="dash_trend"><span id="cart_value_score_trends"></span></dd>
</dl>
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'visits');" data-toggle="tooltip" data-original-title="{l s='Total number of visits within the date range. A visit is the period of time a user is actively engaged with your website.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
<dt>{l s='Visits' d='Admin.Global'}</dt>
<dd class="data_value size_l"><span id="visits_score"></span></dd>
<dd class="dash_trend"><span id="visits_score_trends"></span></dd>
</dl>
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'conversion_rate');" data-toggle="tooltip" data-original-title="{l s='Ecommerce Conversion Rate is the percentage of visits that resulted in an validated order.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
<dt>{l s='Conversion Rate' d='Admin.Global'}</dt>
<dd class="data_value size_l"><span id="conversion_rate_score"></span></dd>
<dd class="dash_trend"><span id="conversion_rate_score_trends"></span></dd>
</dl>
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'net_profits');" data-toggle="tooltip" data-original-title="{l s='Net profit is a measure of the profitability of a venture after accounting for all Ecommerce costs. You can provide these costs by clicking on the configuration icon right above here.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
<dt>{l s='Net Profit' d='Modules.Dashtrends.Admin'}</dt>
<dd class="data_value size_l"><span id="net_profits_score"></span></dd>
<dd class="dash_trend"><span id="net_profits_score_trends"></span></dd>
</dl>
</div>
<div id="dash_trends_chart1" class="chart with-transitions">
<svg></svg>
</div>
</section>

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;