[+] BO : Added new class ConfigurationKPI for KPI cache storage
This commit is contained in:
1 parent
b71b594ca1
commit
39fdc8c926
9 files changed
+291
-75
No files matched your search
Vendored
+2
@@ -268,6 +268,8 @@
|
|||||||
'CompareProductCore' => 'classes/CompareProduct.php',
|
'CompareProductCore' => 'classes/CompareProduct.php',
|
||||||
'Configuration' => '',
|
'Configuration' => '',
|
||||||
'ConfigurationCore' => 'classes/Configuration.php',
|
'ConfigurationCore' => 'classes/Configuration.php',
|
||||||
|
'ConfigurationKPI' => '',
|
||||||
|
'ConfigurationKPICore' => 'classes/ConfigurationKPI.php',
|
||||||
'ConfigurationTest' => '',
|
'ConfigurationTest' => '',
|
||||||
'ConfigurationTestCore' => 'classes/ConfigurationTest.php',
|
'ConfigurationTestCore' => 'classes/ConfigurationTest.php',
|
||||||
'Connection' => '',
|
'Connection' => '',
|
||||||
|
|||||||
+32
-32
@@ -97,10 +97,10 @@ class ConfigurationCore extends ObjectModel
|
|||||||
if ($id_shop_group === null)
|
if ($id_shop_group === null)
|
||||||
$id_shop_group = Shop::getContextShopGroupID(true);
|
$id_shop_group = Shop::getContextShopGroupID(true);
|
||||||
|
|
||||||
$sql = 'SELECT id_configuration
|
$sql = 'SELECT `'.bqSQL(self::$definition['primary']).'`
|
||||||
FROM '._DB_PREFIX_.'configuration
|
FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'`
|
||||||
WHERE name = \''.pSQL($key).'\''
|
WHERE name = \''.pSQL($key).'\'
|
||||||
.Configuration::sqlRestriction($id_shop_group, $id_shop);
|
'.Configuration::sqlRestriction($id_shop_group, $id_shop);
|
||||||
return (int)Db::getInstance()->getValue($sql);
|
return (int)Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,8 +111,8 @@ class ConfigurationCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
self::$_CONF = array();
|
self::$_CONF = array();
|
||||||
$sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_shop_group, c.id_shop
|
$sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_shop_group, c.id_shop
|
||||||
FROM `'._DB_PREFIX_.'configuration` c
|
FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'configuration_lang` cl ON (c.id_configuration = cl.id_configuration)';
|
LEFT JOIN `'._DB_PREFIX_.bqSQL(self::$definition['table']).'_lang` cl ON (c.`'.bqSQL(self::$definition['primary']).'` = cl.`'.bqSQL(self::$definition['primary']).'`)';
|
||||||
if (!$results = Db::getInstance()->executeS($sql))
|
if (!$results = Db::getInstance()->executeS($sql))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ class ConfigurationCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
Configuration::loadConfiguration();
|
Configuration::loadConfiguration();
|
||||||
if (!self::$_CONF)
|
if (!self::$_CONF)
|
||||||
return Db::getInstance()->getValue('SELECT `value` FROM `'._DB_PREFIX_.'configuration` WHERE `name` = "'.pSQL($key).'"');
|
return Db::getInstance()->getValue('SELECT `value` FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'` WHERE `name` = "'.pSQL($key).'"');
|
||||||
}
|
}
|
||||||
$id_lang = (int)$id_lang;
|
$id_lang = (int)$id_lang;
|
||||||
if ($id_shop === null)
|
if ($id_shop === null)
|
||||||
@@ -323,7 +323,7 @@ class ConfigurationCore extends ObjectModel
|
|||||||
if (!$lang)
|
if (!$lang)
|
||||||
{
|
{
|
||||||
// Update config not linked to lang
|
// Update config not linked to lang
|
||||||
$result &= Db::getInstance()->update('configuration', array(
|
$result &= Db::getInstance()->update(self::$definition['table'], array(
|
||||||
'value' => pSQL($value, $html),
|
'value' => pSQL($value, $html),
|
||||||
'date_upd' => date('Y-m-d H:i:s'),
|
'date_upd' => date('Y-m-d H:i:s'),
|
||||||
), '`name` = \''.pSQL($key).'\''.Configuration::sqlRestriction($id_shop_group, $id_shop), 1, true);
|
), '`name` = \''.pSQL($key).'\''.Configuration::sqlRestriction($id_shop_group, $id_shop), 1, true);
|
||||||
@@ -331,13 +331,13 @@ class ConfigurationCore extends ObjectModel
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Update multi lang
|
// Update multi lang
|
||||||
$sql = 'UPDATE '._DB_PREFIX_.'configuration_lang cl
|
$sql = 'UPDATE `'._DB_PREFIX_.bqSQL(self::$definition['table']).'_lang` cl
|
||||||
SET cl.value = \''.pSQL($value, $html).'\',
|
SET cl.value = \''.pSQL($value, $html).'\',
|
||||||
cl.date_upd = NOW()
|
cl.date_upd = NOW()
|
||||||
WHERE cl.id_lang = '.(int)$lang.'
|
WHERE cl.id_lang = '.(int)$lang.'
|
||||||
AND cl.id_configuration = (
|
AND cl.`'.bqSQL(self::$definition['primary']).'` = (
|
||||||
SELECT c.id_configuration
|
SELECT c.`'.bqSQL(self::$definition['primary']).'`
|
||||||
FROM '._DB_PREFIX_.'configuration c
|
FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'` c
|
||||||
WHERE c.name = \''.pSQL($key).'\''
|
WHERE c.name = \''.pSQL($key).'\''
|
||||||
.Configuration::sqlRestriction($id_shop_group, $id_shop)
|
.Configuration::sqlRestriction($id_shop_group, $id_shop)
|
||||||
.')';
|
.')';
|
||||||
@@ -363,11 +363,11 @@ class ConfigurationCore extends ObjectModel
|
|||||||
|
|
||||||
if ($lang)
|
if ($lang)
|
||||||
{
|
{
|
||||||
$result &= Db::getInstance()->insert('configuration_lang', array(
|
$result &= Db::getInstance()->insert(self::$definition['table'].'_lang', array(
|
||||||
'id_configuration' => $configID,
|
self::$definition['primary'] => $configID,
|
||||||
'id_lang' => $lang,
|
'id_lang' => $lang,
|
||||||
'value' => pSQL($value, $html),
|
'value' => pSQL($value, $html),
|
||||||
'date_upd' => date('Y-m-d H:i:s'),
|
'date_upd' => date('Y-m-d H:i:s'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,15 +390,15 @@ class ConfigurationCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$result = Db::getInstance()->execute('
|
$result = Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'configuration_lang`
|
DELETE FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'_lang`
|
||||||
WHERE `id_configuration` IN (
|
WHERE ``'.bqSQL(self::$definition['primary']).'`` IN (
|
||||||
SELECT `id_configuration`
|
SELECT ``'.bqSQL(self::$definition['primary']).'``
|
||||||
FROM `'._DB_PREFIX_.'configuration`
|
FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'`
|
||||||
WHERE `name` = "'.pSQL($key).'"
|
WHERE `name` = "'.pSQL($key).'"
|
||||||
)');
|
)');
|
||||||
|
|
||||||
$result2 = Db::getInstance()->execute('
|
$result2 = Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'configuration`
|
DELETE FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'`
|
||||||
WHERE `name` = "'.pSQL($key).'"');
|
WHERE `name` = "'.pSQL($key).'"');
|
||||||
|
|
||||||
self::$_CONF = null;
|
self::$_CONF = null;
|
||||||
@@ -423,11 +423,11 @@ class ConfigurationCore extends ObjectModel
|
|||||||
|
|
||||||
$id = Configuration::getIdByName($key, $id_shop_group, $id_shop);
|
$id = Configuration::getIdByName($key, $id_shop_group, $id_shop);
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM '._DB_PREFIX_.'configuration
|
DELETE FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'`
|
||||||
WHERE id_configuration = '.(int)$id);
|
WHERE `'.bqSQL(self::$definition['primary']).'` = '.(int)$id);
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM '._DB_PREFIX_.'configuration_lang
|
DELETE FROM `'._DB_PREFIX_.bqSQL(self::$definition['table']).'_lang`
|
||||||
WHERE id_configuration = '.(int)$id);
|
WHERE `'.bqSQL(self::$definition['primary']).'` = '.(int)$id);
|
||||||
|
|
||||||
self::$_CONF = null;
|
self::$_CONF = null;
|
||||||
}
|
}
|
||||||
@@ -522,15 +522,15 @@ class ConfigurationCore extends ObjectModel
|
|||||||
public function getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
|
public function getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT DISTINCT main.`'.bqSQL($this->def['primary']).'` FROM `'._DB_PREFIX_.bqSQL($this->def['table']).'` main
|
SELECT DISTINCT main.`'.bqSQL($this->def['primary']).'`
|
||||||
|
FROM `'._DB_PREFIX_.bqSQL($this->def['table']).'` main
|
||||||
'.$sql_join.'
|
'.$sql_join.'
|
||||||
WHERE id_configuration NOT IN
|
WHERE id_configuration NOT IN (
|
||||||
( SELECT id_configuration
|
SELECT id_configuration
|
||||||
FROM '._DB_PREFIX_.bqSQL($this->def['table']).'_lang
|
FROM '._DB_PREFIX_.bqSQL($this->def['table']).'_lang
|
||||||
) '.$sql_filter.'
|
) '.$sql_filter.'
|
||||||
'.($sql_sort != '' ? $sql_sort : '').'
|
'.($sql_sort != '' ? $sql_sort : '').'
|
||||||
'.($sql_limit != '' ? $sql_limit : '').'
|
'.($sql_limit != '' ? $sql_limit : '');
|
||||||
';
|
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* 2007-2013 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Open Software License (OSL 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/osl-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-2013 PrestaShop SA
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ConfigurationKPICore extends Configuration
|
||||||
|
{
|
||||||
|
public static $definition_backup;
|
||||||
|
|
||||||
|
public static function setKpiDefinition()
|
||||||
|
{
|
||||||
|
ConfigurationKPI::$definition_backup = Configuration::$definition;
|
||||||
|
Configuration::$definition['table'] = 'configuration_kpi';
|
||||||
|
Configuration::$definition['primary'] = 'id_configuration_kpi';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function unsetKpiDefinition()
|
||||||
|
{
|
||||||
|
Configuration::$definition = ConfigurationKPI::$definition_backup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getIdByName($key, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::getIdByName($key, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadConfiguration()
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::loadConfiguration();
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::get($key, $id_lang, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getGlobalValue($key, $id_lang = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::getGlobalValue($key, $id_lang);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInt($key, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::getInt($key, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMultiple($keys, $id_lang = null, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::getMultiple($keys, $id_lang, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function hasKey($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::hasKey($key, $id_lang, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function set($key, $values, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::set($key, $values, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateGlobalValue($key, $values, $html = false)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::updateGlobalValue($key, $values, $html);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateValue($key, $values, $html = false, $id_shop_group = null, $id_shop = null)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::updateValue($key, $values, $html, $id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function deleteByName($key)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::deleteByName($key);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function deleteFromContext($key)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::deleteFromContext($key);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function hasContext($key, $id_lang, $context)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::hasContext($key, $id_lang, $context);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isOverridenByCurrentContext($key)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::isOverridenByCurrentContext($key);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isLangKey($key)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::isLangKey($key);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function sqlRestriction($id_shop_group, $id_shop)
|
||||||
|
{
|
||||||
|
ConfigurationKPI::setKpiDefinition();
|
||||||
|
$r = parent::sqlRestriction($id_shop_group, $id_shop);
|
||||||
|
ConfigurationKPI::unsetKpiDefinition();
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -347,9 +347,9 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
$helper->icon = 'icon-off';
|
$helper->icon = 'icon-off';
|
||||||
$helper->color = 'color1';
|
$helper->color = 'color1';
|
||||||
$helper->title = $this->l('Disabled Categories');
|
$helper->title = $this->l('Disabled Categories');
|
||||||
if (Configuration::get('PS_KPI_DISABLED_CATS') !== false)
|
if (ConfigurationKPI::get('DISABLED_CATS') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_DISABLED_CATS');
|
$helper->value = ConfigurationKPI::get('DISABLED_CATS');
|
||||||
if (Configuration::get('PS_KPI_DISABLED_CATS_EXPIRE') < $time)
|
if (ConfigurationKPI::get('DISABLED_CATS_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_categories';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_categories';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
@@ -358,9 +358,9 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
$helper->icon = 'icon-bookmark-empty';
|
$helper->icon = 'icon-bookmark-empty';
|
||||||
$helper->color = 'color2';
|
$helper->color = 'color2';
|
||||||
$helper->title = $this->l('Empty Categories');
|
$helper->title = $this->l('Empty Categories');
|
||||||
if (Configuration::get('PS_KPI_EMPTY_CATS') !== false)
|
if (ConfigurationKPI::get('EMPTY_CATS') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_EMPTY_CATS');
|
$helper->value = ConfigurationKPI::get('EMPTY_CATS');
|
||||||
if (Configuration::get('PS_KPI_EMPTY_CATS_EXPIRE') < $time)
|
if (ConfigurationKPI::get('EMPTY_CATS_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=empty_categories';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
|
|||||||
@@ -1252,11 +1252,11 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$helper->color = 'color1';
|
$helper->color = 'color1';
|
||||||
$helper->title = $this->l('Conversion Rate');
|
$helper->title = $this->l('Conversion Rate');
|
||||||
$helper->subtitle = $this->l('30 days');
|
$helper->subtitle = $this->l('30 days');
|
||||||
if (Configuration::get('PS_KPI_CONVERSION_RATE') !== false)
|
if (ConfigurationKPI::get('CONVERSION_RATE') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_CONVERSION_RATE');
|
$helper->value = ConfigurationKPI::get('CONVERSION_RATE');
|
||||||
if (Configuration::get('PS_KPI_CONVERSION_RATE_CHART') !== false)
|
if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false)
|
||||||
$helper->data = Configuration::get('PS_KPI_CONVERSION_RATE_CHART');
|
$helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART');
|
||||||
if (Configuration::get('PS_KPI_CONVERSION_RATE_EXPIRE') < $time)
|
if (ConfigurationKPI::get('CONVERSION_RATE_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
@@ -1266,9 +1266,9 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$helper->color = 'color2';
|
$helper->color = 'color2';
|
||||||
$helper->title = $this->l('Abandoned Carts');
|
$helper->title = $this->l('Abandoned Carts');
|
||||||
$helper->subtitle = $this->l('Today');
|
$helper->subtitle = $this->l('Today');
|
||||||
if (Configuration::get('PS_KPI_ABANDONED_CARTS') !== false)
|
if (ConfigurationKPI::get('ABANDONED_CARTS') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_ABANDONED_CARTS');
|
$helper->value = ConfigurationKPI::get('ABANDONED_CARTS');
|
||||||
if (Configuration::get('PS_KPI_ABANDONED_CARTS_EXPIRE') < $time)
|
if (ConfigurationKPI::get('ABANDONED_CARTS_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
@@ -1278,9 +1278,9 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$helper->color = 'color3';
|
$helper->color = 'color3';
|
||||||
$helper->title = $this->l('Average Order Value');
|
$helper->title = $this->l('Average Order Value');
|
||||||
$helper->subtitle = $this->l('30 days');
|
$helper->subtitle = $this->l('30 days');
|
||||||
if (Configuration::get('PS_KPI_AVG_ORDER_VALUE') !== false)
|
if (ConfigurationKPI::get('AVG_ORDER_VALUE') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_AVERAGE_ORDER_VALUE');
|
$helper->value = ConfigurationKPI::get('AVERAGE_ORDER_VALUE');
|
||||||
if (Configuration::get('PS_KPI_AVG_ORDER_VALUE_EXPIRE') < $time)
|
if (ConfigurationKPI::get('AVG_ORDER_VALUE_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
@@ -1290,9 +1290,9 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$helper->color = 'color4';
|
$helper->color = 'color4';
|
||||||
$helper->title = $this->l('Net Profit per Visitor');
|
$helper->title = $this->l('Net Profit per Visitor');
|
||||||
$helper->subtitle = $this->l('30 days');
|
$helper->subtitle = $this->l('30 days');
|
||||||
if (Configuration::get('PS_KPI_NETPROFIT_VISITOR') !== false)
|
if (ConfigurationKPI::get('NETPROFIT_VISITOR') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_NETPROFIT_VISITOR');
|
$helper->value = ConfigurationKPI::get('NETPROFIT_VISITOR');
|
||||||
if (Configuration::get('PS_KPI_NETPROFIT_VISITOR_EXPIRE') < $time)
|
if (ConfigurationKPI::get('NETPROFIT_VISITOR_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visitor';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visitor';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
|
|||||||
@@ -2299,9 +2299,9 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$helper->icon = 'icon-archive';
|
$helper->icon = 'icon-archive';
|
||||||
$helper->color = 'color1';
|
$helper->color = 'color1';
|
||||||
$helper->title = $this->l('Products in Stock');
|
$helper->title = $this->l('Products in Stock');
|
||||||
if (Configuration::get('PS_KPI_PRODUCTS_STOCK') !== false)
|
if (ConfigurationKPI::get('PRODUCTS_STOCK') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_PRODUCTS_STOCK');
|
$helper->value = ConfigurationKPI::get('PRODUCTS_STOCK');
|
||||||
if (Configuration::get('PS_KPI_PRODUCTS_STOCK_EXPIRE') < $time)
|
if (ConfigurationKPI::get('PRODUCTS_STOCK_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=products_stock';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=products_stock';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
@@ -2310,9 +2310,9 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$helper->icon = 'icon-tags';
|
$helper->icon = 'icon-tags';
|
||||||
$helper->color = 'color2';
|
$helper->color = 'color2';
|
||||||
$helper->title = $this->l('Average Gross Margin');
|
$helper->title = $this->l('Average Gross Margin');
|
||||||
if (Configuration::get('PS_KPI_AVG_GROSS_MARGIN') !== false)
|
if (ConfigurationKPI::get('AVG_GROSS_MARGIN') !== false)
|
||||||
$helper->value = Configuration::get('PS_KPI_AVG_GROSS_MARGIN');
|
$helper->value = ConfigurationKPI::get('AVG_GROSS_MARGIN');
|
||||||
if (Configuration::get('PS_KPI_AVG_GROSS_MARGIN_EXPIRE') < $time)
|
if (ConfigurationKPI::get('AVG_GROSS_MARGIN_EXPIRE') < $time)
|
||||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=avg_gross_margin';
|
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=avg_gross_margin';
|
||||||
$kpis[] = $helper->generate();
|
$kpis[] = $helper->generate();
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
$value = 0;
|
$value = 0;
|
||||||
$value .= '%';
|
$value .= '%';
|
||||||
|
|
||||||
Configuration::updateValue('PS_KPI_CONVERSION_RATE_CHART', Tools::jsonEncode($data));
|
ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', Tools::jsonEncode($data));
|
||||||
Configuration::updateValue('PS_KPI_CONVERSION_RATE', $value);
|
ConfigurationKPI::updateValue('CONVERSION_RATE', $value);
|
||||||
Configuration::updateValue('PS_KPI_CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
ConfigurationKPI::updateValue('CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'abandoned_cart':
|
case 'abandoned_cart':
|
||||||
@@ -92,8 +92,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
WHERE `date_add` BETWEEN "'.pSQL(date('Y-m-d')).' 00:00:00" AND "'.pSQL(date('Y-m-d')).' 23:59:59"
|
WHERE `date_add` BETWEEN "'.pSQL(date('Y-m-d')).' 00:00:00" AND "'.pSQL(date('Y-m-d')).' 23:59:59"
|
||||||
AND id_cart NOT IN (SELECT id_cart FROM `'._DB_PREFIX_.'orders`)
|
AND id_cart NOT IN (SELECT id_cart FROM `'._DB_PREFIX_.'orders`)
|
||||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER));
|
'.Shop::addSqlRestriction(Shop::SHARE_ORDER));
|
||||||
Configuration::updateValue('PS_KPI_ABANDONED_CARTS', $value);
|
ConfigurationKPI::updateValue('ABANDONED_CARTS', $value);
|
||||||
Configuration::updateValue('PS_KPI_ABANDONED_CARTS_EXPIRE', strtotime('+10 min'));
|
ConfigurationKPI::updateValue('ABANDONED_CARTS_EXPIRE', strtotime('+10 min'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'products_stock':
|
case 'products_stock':
|
||||||
@@ -103,8 +103,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
'.Shop::addSqlAssociation('product', 'p').'
|
'.Shop::addSqlAssociation('product', 'p').'
|
||||||
'.Product::sqlStock('p'));
|
'.Product::sqlStock('p'));
|
||||||
$value = round($row['total'] ? $row['stock'] / $row['total'] : 0, 2).'%';
|
$value = round($row['total'] ? $row['stock'] / $row['total'] : 0, 2).'%';
|
||||||
Configuration::updateValue('PS_KPI_PRODUCTS_STOCK', $value);
|
ConfigurationKPI::updateValue('PRODUCTS_STOCK', $value);
|
||||||
Configuration::updateValue('PS_KPI_PRODUCTS_STOCK_EXPIRE', strtotime('+10 min'));
|
ConfigurationKPI::updateValue('PRODUCTS_STOCK_EXPIRE', strtotime('+10 min'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'avg_gross_margin':
|
case 'avg_gross_margin':
|
||||||
@@ -113,8 +113,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.Shop::addSqlAssociation('product', 'p'));
|
'.Shop::addSqlAssociation('product', 'p'));
|
||||||
$value = round(100 * $value, 2).'%';
|
$value = round(100 * $value, 2).'%';
|
||||||
Configuration::updateValue('PS_KPI_AVG_GROSS_MARGIN', $value);
|
ConfigurationKPI::updateValue('AVG_GROSS_MARGIN', $value);
|
||||||
Configuration::updateValue('PS_KPI_AVG_GROSS_MARGIN_EXPIRE', strtotime('+6 hour'));
|
ConfigurationKPI::updateValue('AVG_GROSS_MARGIN_EXPIRE', strtotime('+6 hour'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disabled_categories':
|
case 'disabled_categories':
|
||||||
@@ -123,8 +123,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
'.Shop::addSqlAssociation('category', 'c').'
|
'.Shop::addSqlAssociation('category', 'c').'
|
||||||
WHERE c.active = 0');
|
WHERE c.active = 0');
|
||||||
Configuration::updateValue('PS_KPI_DISABLED_CATS', $value);
|
ConfigurationKPI::updateValue('DISABLED_CATS', $value);
|
||||||
Configuration::updateValue('PS_KPI_DISABLED_CATS_EXPIRE', strtotime('+2 hour'));
|
ConfigurationKPI::updateValue('DISABLED_CATS_EXPIRE', strtotime('+2 hour'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'empty_categories':
|
case 'empty_categories':
|
||||||
@@ -137,8 +137,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
FROM `'._DB_PREFIX_.'category_product` cp
|
FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
'.Shop::addSqlAssociation('category', 'cp'));
|
'.Shop::addSqlAssociation('category', 'cp'));
|
||||||
$value = intval($total - $used);
|
$value = intval($total - $used);
|
||||||
Configuration::updateValue('PS_KPI_EMPTY_CATS', $value);
|
ConfigurationKPI::updateValue('EMPTY_CATS', $value);
|
||||||
Configuration::updateValue('PS_KPI_EMPTY_CATS_EXPIRE', strtotime('+2 hour'));
|
ConfigurationKPI::updateValue('EMPTY_CATS_EXPIRE', strtotime('+2 hour'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'average_order_value':
|
case 'average_order_value':
|
||||||
@@ -150,8 +150,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
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));
|
||||||
$value = Tools::displayPrice($row['orders'] ? $row['total_paid_tax_excl'] / $row['orders'] : 0, $currency);
|
$value = Tools::displayPrice($row['orders'] ? $row['total_paid_tax_excl'] / $row['orders'] : 0, $currency);
|
||||||
Configuration::updateValue('PS_KPI_AVG_ORDER_VALUE', $value);
|
ConfigurationKPI::updateValue('AVG_ORDER_VALUE', $value);
|
||||||
Configuration::updateValue('PS_KPI_AVG_ORDER_VALUE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
ConfigurationKPI::updateValue('AVG_ORDER_VALUE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'netprofit_visitor':
|
case 'netprofit_visitor':
|
||||||
@@ -207,8 +207,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
|||||||
else
|
else
|
||||||
$value = Tools::displayPrice(0, $currency);
|
$value = Tools::displayPrice(0, $currency);
|
||||||
|
|
||||||
Configuration::updateValue('PS_KPI_NETPROFIT_VISITOR', $value);
|
ConfigurationKPI::updateValue('NETPROFIT_VISITOR', $value);
|
||||||
Configuration::updateValue('PS_KPI_NETPROFIT_VISITOR_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
ConfigurationKPI::updateValue('NETPROFIT_VISITOR_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -440,6 +440,28 @@ CREATE TABLE `PREFIX_configuration_lang` (
|
|||||||
PRIMARY KEY (`id_configuration`,`id_lang`)
|
PRIMARY KEY (`id_configuration`,`id_lang`)
|
||||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE `PREFIX_configuration_kpi` (
|
||||||
|
`id_configuration_kpi` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`id_shop_group` INT(11) UNSIGNED DEFAULT NULL,
|
||||||
|
`id_shop` INT(11) UNSIGNED DEFAULT NULL,
|
||||||
|
`name` varchar(32) NOT NULL,
|
||||||
|
`value` text,
|
||||||
|
`date_add` datetime NOT NULL,
|
||||||
|
`date_upd` datetime NOT NULL,
|
||||||
|
PRIMARY KEY (`id_configuration_kpi`),
|
||||||
|
KEY `name` (`name`),
|
||||||
|
KEY `id_shop` (`id_shop`),
|
||||||
|
KEY `id_shop_group` (`id_shop_group`)
|
||||||
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE `PREFIX_configuration_kpi_lang` (
|
||||||
|
`id_configuration_kpi` int(10) unsigned NOT NULL,
|
||||||
|
`id_lang` int(10) unsigned NOT NULL,
|
||||||
|
`value` text,
|
||||||
|
`date_upd` datetime default NULL,
|
||||||
|
PRIMARY KEY (`id_configuration_kpi`,`id_lang`)
|
||||||
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE `PREFIX_connections` (
|
CREATE TABLE `PREFIX_connections` (
|
||||||
`id_connections` int(10) unsigned NOT NULL auto_increment,
|
`id_connections` int(10) unsigned NOT NULL auto_increment,
|
||||||
`id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
`id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||||
|
|||||||
@@ -4,3 +4,25 @@ INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VAL
|
|||||||
|
|
||||||
ALTER TABLE `PREFIX_employee` CHANGE `bo_show_screencast` `bo_menu` TINYINT(1) NOT NULL DEFAULT '0';
|
ALTER TABLE `PREFIX_employee` CHANGE `bo_show_screencast` `bo_menu` TINYINT(1) NOT NULL DEFAULT '0';
|
||||||
UPDATE `PREFIX_employee` SET bo_menu = 0;
|
UPDATE `PREFIX_employee` SET bo_menu = 0;
|
||||||
|
|
||||||
|
CREATE TABLE `PREFIX_configuration_kpi` (
|
||||||
|
`id_configuration_kpi` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`id_shop_group` INT(11) UNSIGNED DEFAULT NULL,
|
||||||
|
`id_shop` INT(11) UNSIGNED DEFAULT NULL,
|
||||||
|
`name` varchar(32) NOT NULL,
|
||||||
|
`value` text,
|
||||||
|
`date_add` datetime NOT NULL,
|
||||||
|
`date_upd` datetime NOT NULL,
|
||||||
|
PRIMARY KEY (`id_configuration_kpi`),
|
||||||
|
KEY `name` (`name`),
|
||||||
|
KEY `id_shop` (`id_shop`),
|
||||||
|
KEY `id_shop_group` (`id_shop_group`)
|
||||||
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE `PREFIX_configuration_kpi_lang` (
|
||||||
|
`id_configuration_kpi` int(10) unsigned NOT NULL,
|
||||||
|
`id_lang` int(10) unsigned NOT NULL,
|
||||||
|
`value` text,
|
||||||
|
`date_upd` datetime default NULL,
|
||||||
|
PRIMARY KEY (`id_configuration_kpi`,`id_lang`)
|
||||||
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
Reference in new issue
Block a user