Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -66,6 +66,7 @@
|
|||||||
$.each(jsonObject, function (index, value) {
|
$.each(jsonObject, function (index, value) {
|
||||||
data.push(value);
|
data.push(value);
|
||||||
});
|
});
|
||||||
|
var data_max = d3.max(data);
|
||||||
|
|
||||||
var chart = d3.select("#{$id|addslashes} .boxchart").append("svg")
|
var chart = d3.select("#{$id|addslashes} .boxchart").append("svg")
|
||||||
.attr("class", "data_chart")
|
.attr("class", "data_chart")
|
||||||
@@ -73,13 +74,13 @@
|
|||||||
.attr("height", 45);
|
.attr("height", 45);
|
||||||
|
|
||||||
var y = d3.scale.linear()
|
var y = d3.scale.linear()
|
||||||
.domain([0, d3.max(data)])
|
.domain([0, data_max])
|
||||||
.range([0, d3.max(data) * 45]);
|
.range([0, data_max * 45]);
|
||||||
|
|
||||||
chart.selectAll("rect")
|
chart.selectAll("rect")
|
||||||
.data(data)
|
.data(data)
|
||||||
.enter().append("rect")
|
.enter().append("rect")
|
||||||
.attr("y", function(d) { return 45 - d * 45 / d3.max(data); })
|
.attr("y", function(d) { return 45 - d * 45 / data_max; })
|
||||||
.attr("x", function(d, i) { return i * 6; })
|
.attr("x", function(d, i) { return i * 6; })
|
||||||
.attr("width", 4)
|
.attr("width", 4)
|
||||||
.attr("height", y);
|
.attr("height", y);
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT
|
SELECT LEFT(`date_add`, 10) as date, COUNT(*) as visits
|
||||||
LEFT(`date_add`, 10) as date,
|
|
||||||
COUNT(*) as visits
|
|
||||||
FROM `'._DB_PREFIX_.'connections`
|
FROM `'._DB_PREFIX_.'connections`
|
||||||
WHERE `date_add` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-31 day'))).' 00:00:00" AND "'.pSQL(date('Y-m-d', strtotime('-1 day'))).' 23:59:59"
|
WHERE `date_add` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-31 day'))).' 00:00:00" AND "'.pSQL(date('Y-m-d', strtotime('-1 day'))).' 23:59:59"
|
||||||
'.Shop::addSqlRestriction(false).'
|
'.Shop::addSqlRestriction(false).'
|
||||||
@@ -55,9 +53,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
}
|
}
|
||||||
$orders = array();
|
$orders = array();
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
SELECT
|
SELECT LEFT(`invoice_date`, 10) as date, COUNT(*) as orders
|
||||||
LEFT(`invoice_date`, 10) as date,
|
|
||||||
COUNT(*) as orders
|
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE `invoice_date` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-31 day'))).' 00:00:00" AND "'.pSQL(date('Y-m-d', strtotime('-1 day'))).' 23:59:59"
|
WHERE `invoice_date` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-31 day'))).' 00:00:00" AND "'.pSQL(date('Y-m-d', strtotime('-1 day'))).' 23:59:59"
|
||||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER).'
|
'.Shop::addSqlRestriction(Shop::SHARE_ORDER).'
|
||||||
@@ -69,11 +65,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
$from = strtotime(date('Y-m-d 00:00:00', strtotime('-31 day')));
|
$from = strtotime(date('Y-m-d 00:00:00', strtotime('-31 day')));
|
||||||
$to = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day')));
|
$to = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day')));
|
||||||
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
|
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
|
||||||
{
|
|
||||||
$data[$date] = 0;
|
|
||||||
if (isset($visits[$date]) && $visits[$date])
|
if (isset($visits[$date]) && $visits[$date])
|
||||||
$data[$date] = round(100 * ((isset($orders[$date]) && $orders[$date]) ? $orders[$date] : 0) / $visits[$date], 2);
|
$data[$date] = round(100 * ((isset($orders[$date]) && $orders[$date]) ? $orders[$date] : 0) / $visits[$date], 2);
|
||||||
}
|
else
|
||||||
|
$data[$date] = 0;
|
||||||
|
|
||||||
$visits_sum = array_sum($visits);
|
$visits_sum = array_sum($visits);
|
||||||
$orders_sum = array_sum($orders);
|
$orders_sum = array_sum($orders);
|
||||||
@@ -89,6 +84,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
Configuration::updateValue('PS_KPI_CONVERSION_RATE', $value);
|
Configuration::updateValue('PS_KPI_CONVERSION_RATE', $value);
|
||||||
Configuration::updateValue('PS_KPI_CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
Configuration::updateValue('PS_KPI_CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'abandoned_cart':
|
case 'abandoned_cart':
|
||||||
$value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
$value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
@@ -99,6 +95,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
Configuration::updateValue('PS_KPI_ABANDONED_CARTS', $value);
|
Configuration::updateValue('PS_KPI_ABANDONED_CARTS', $value);
|
||||||
Configuration::updateValue('PS_KPI_ABANDONED_CARTS_EXPIRE', strtotime('+10 min'));
|
Configuration::updateValue('PS_KPI_ABANDONED_CARTS_EXPIRE', strtotime('+10 min'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'average_order_value':
|
case 'average_order_value':
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT
|
SELECT
|
||||||
@@ -111,6 +108,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
Configuration::updateValue('PS_KPI_AVG_ORDER_VALUE', $value);
|
Configuration::updateValue('PS_KPI_AVG_ORDER_VALUE', $value);
|
||||||
Configuration::updateValue('PS_KPI_AVG_ORDER_VALUE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
Configuration::updateValue('PS_KPI_AVG_ORDER_VALUE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'netprofit_visitor':
|
case 'netprofit_visitor':
|
||||||
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
|
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
|
||||||
if (Validate::isLoadedObject($gapi) && $gapi->isConfigured())
|
if (Validate::isLoadedObject($gapi) && $gapi->isConfigured())
|
||||||
@@ -167,6 +165,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
Configuration::updateValue('PS_KPI_NETPROFIT_VISITOR', $value);
|
Configuration::updateValue('PS_KPI_NETPROFIT_VISITOR', $value);
|
||||||
Configuration::updateValue('PS_KPI_NETPROFIT_VISITOR_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
Configuration::updateValue('PS_KPI_NETPROFIT_VISITOR_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$value = false;
|
$value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user