putain de module de merde
@ -1 +0,0 @@
|
||||
Subproject commit df8eefd8a7289658acbb2171d08853ccf5158ed6
|
6
modules/dashactivity/CHANGELOG.txt
Normal file
@ -0,0 +1,6 @@
|
||||
2014-04-22 18:58:15 +0200 // Changelog updated
|
||||
2014-04-16 14:41:07 +0200 // Add link for Total Subscriber
|
||||
2014-04-14 15:17:25 +0200 [-] MO : Dashactivity - Improvement #PSCSX-582
|
||||
2014-04-07 14:20:47 +0200 [-] MO : dashactivity - FixBug #PSCSX-1467 online user
|
||||
2014-03-24 15:21:03 +0100 / MO dashactivity : ps_versions_compliancy added
|
||||
2014-03-20 14:32:23 +0100 Initial commit
|
37
modules/dashactivity/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
|
||||
## About
|
||||
|
||||
|
||||
|
||||
## 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 dashactivity 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
|
||||
|
12
modules/dashactivity/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashactivity</name>
|
||||
<displayName><![CDATA[Dashboard Activity]]></displayName>
|
||||
<version><![CDATA[0.4.7]]></version>
|
||||
<description><![CDATA[]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[dashboard]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/dashactivity/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashactivity</name>
|
||||
<displayName><![CDATA[Tableau de bord de l'activité]]></displayName>
|
||||
<version><![CDATA[0.4.7]]></version>
|
||||
<description><![CDATA[]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[dashboard]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
530
modules/dashactivity/dashactivity.php
Normal file
@ -0,0 +1,530 @@
|
||||
<?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 Dashactivity extends Module
|
||||
{
|
||||
protected static $colors = array('#1F77B4', '#FF7F0E', '#2CA02C');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'dashactivity';
|
||||
$this->tab = 'dashboard';
|
||||
$this->version = '0.4.7';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->push_filename = _PS_CACHE_DIR_.'push/activity';
|
||||
$this->allow_push = true;
|
||||
$this->push_time_limit = 180;
|
||||
|
||||
parent::__construct();
|
||||
$this->displayName = $this->l('Dashboard Activity');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
Configuration::updateValue('DASHACTIVITY_CART_ACTIVE', 30);
|
||||
Configuration::updateValue('DASHACTIVITY_CART_ABANDONED_MIN', 24);
|
||||
Configuration::updateValue('DASHACTIVITY_CART_ABANDONED_MAX', 48);
|
||||
Configuration::updateValue('DASHACTIVITY_VISITOR_ONLINE', 30);
|
||||
|
||||
return (parent::install()
|
||||
&& $this->registerHook('dashboardZoneOne')
|
||||
&& $this->registerHook('dashboardData')
|
||||
&& $this->registerHook('actionObjectOrderAddAfter')
|
||||
&& $this->registerHook('actionObjectCustomerAddAfter')
|
||||
&& $this->registerHook('actionObjectCustomerMessageAddAfter')
|
||||
&& $this->registerHook('actionObjectCustomerThreadAddAfter')
|
||||
&& $this->registerHook('actionObjectOrderReturnAddAfter')
|
||||
&& $this->registerHook('actionAdminControllerSetMedia')
|
||||
);
|
||||
}
|
||||
|
||||
public function hookActionAdminControllerSetMedia()
|
||||
{
|
||||
if (get_class($this->context->controller) == 'AdminDashboardController')
|
||||
{
|
||||
if (method_exists($this->context->controller, 'addJquery'))
|
||||
$this->context->controller->addJquery();
|
||||
|
||||
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');
|
||||
$this->context->controller->addJs(
|
||||
array(
|
||||
_PS_JS_DIR_.'date.js',
|
||||
_PS_JS_DIR_.'tools.js'
|
||||
) // retro compat themes 1.5
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function hookDashboardZoneOne($params)
|
||||
{
|
||||
$gapi_mode = 'configure';
|
||||
if (!Module::isInstalled('gapi'))
|
||||
$gapi_mode = 'install';
|
||||
elseif (($gapi = Module::getInstanceByName('gapi')) && Validate::isLoadedObject($gapi) && $gapi->isConfigured())
|
||||
$gapi_mode = false;
|
||||
|
||||
$this->context->smarty->assign($this->getConfigFieldsValues());
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'gapi_mode' => $gapi_mode,
|
||||
'dashactivity_config_form' => $this->renderConfigForm(),
|
||||
'date_subtitle' => $this->l('(from %s to %s)'),
|
||||
'date_format' => $this->context->language->date_format_lite,
|
||||
'link' => $this->context->link
|
||||
)
|
||||
);
|
||||
|
||||
return $this->display(__FILE__, 'dashboard_zone_one.tpl');
|
||||
}
|
||||
|
||||
public function hookDashboardData($params)
|
||||
{
|
||||
if (Tools::strlen($params['date_from']) == 10)
|
||||
$params['date_from'] .= ' 00:00:00';
|
||||
if (Tools::strlen($params['date_to']) == 10)
|
||||
$params['date_to'] .= ' 23:59:59';
|
||||
|
||||
if (Configuration::get('PS_DASHBOARD_SIMULATION'))
|
||||
{
|
||||
$days = (strtotime($params['date_to']) - strtotime($params['date_from'])) / 3600 / 24;
|
||||
$online_visitor = rand(10, 50);
|
||||
$visits = rand(200, 2000) * $days;
|
||||
|
||||
return array(
|
||||
'data_value' => array(
|
||||
'pending_orders' => round(rand(0, 5)),
|
||||
'return_exchanges' => round(rand(0, 5)),
|
||||
'abandoned_cart' => round(rand(5, 50)),
|
||||
'products_out_of_stock' => round(rand(1, 10)),
|
||||
'new_messages' => round(rand(1, 10) * $days),
|
||||
'product_reviews' => round(rand(5, 50) * $days),
|
||||
'new_customers' => round(rand(1, 5) * $days),
|
||||
'online_visitor' => round($online_visitor),
|
||||
'active_shopping_cart' => round($online_visitor / 10),
|
||||
'new_registrations' => round(rand(1, 5) * $days),
|
||||
'total_suscribers' => round(rand(200, 2000)),
|
||||
'visits' => round($visits),
|
||||
'unique_visitors' => round($visits * 0.6),
|
||||
),
|
||||
'data_trends' => array(
|
||||
'orders_trends' => array('way' => 'down', 'value' => 0.42),
|
||||
),
|
||||
'data_list_small' => array(
|
||||
'dash_traffic_source' => array(
|
||||
'<i class="icon-circle" style="color:'.self::$colors[0].'"></i> prestashop.com' => round($visits / 2),
|
||||
'<i class="icon-circle" style="color:'.self::$colors[1].'"></i> google.com' => round($visits / 3),
|
||||
'<i class="icon-circle" style="color:'.self::$colors[2].'"></i> Direct Traffic' => round($visits / 4)
|
||||
)
|
||||
),
|
||||
'data_chart' => array(
|
||||
'dash_trends_chart1' => array(
|
||||
'chart_type' => 'pie_chart_trends',
|
||||
'data' => array(
|
||||
array('key' => 'prestashop.com', 'y' => round($visits / 2), 'color' => self::$colors[0]),
|
||||
array('key' => 'google.com', 'y' => round($visits / 3), 'color' => self::$colors[1]),
|
||||
array('key' => 'Direct Traffic', 'y' => round($visits / 4), 'color' => self::$colors[2])
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
|
||||
if (Validate::isLoadedObject($gapi) && $gapi->isConfigured())
|
||||
{
|
||||
$visits = $unique_visitors = $online_visitor = 0;
|
||||
if ($result = $gapi->requestReportData('', 'ga:visits,ga:visitors', Tools::substr($params['date_from'], 0, 10), Tools::substr($params['date_to'], 0, 10), null, null, 1, 1))
|
||||
{
|
||||
$visits = $result[0]['metrics']['visits'];
|
||||
$unique_visitors = $result[0]['metrics']['visitors'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(*) as visits, COUNT(DISTINCT `id_guest`) as unique_visitors
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE `date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(false)
|
||||
);
|
||||
extract($row);
|
||||
}
|
||||
|
||||
// Online visitors is only available with Analytics Real Time still in private beta at this time (October 18th, 2013).
|
||||
// if ($result = $gapi->requestReportData('', 'ga:activeVisitors', null, null, null, null, 1, 1))
|
||||
// $online_visitor = $result[0]['metrics']['activeVisitors'];
|
||||
if ($maintenance_ips = Configuration::get('PS_MAINTENANCE_IP'))
|
||||
$maintenance_ips = implode(',', array_map('ip2long', array_map('trim', explode(',', $maintenance_ips))));
|
||||
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
|
||||
{
|
||||
$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, pt.name as page
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` p ON p.id_page = cp.id_page
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.id_page_type = pt.id_page_type
|
||||
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
|
||||
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND cp.`time_end` IS NULL
|
||||
AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', cp.`time_start`)) < 900
|
||||
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '').'
|
||||
GROUP BY c.id_connections
|
||||
ORDER BY c.date_add DESC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, "-" as page
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
|
||||
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', c.`date_add`)) < 900
|
||||
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '').'
|
||||
ORDER BY c.date_add DESC';
|
||||
}
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$online_visitor = Db::getInstance()->NumRows();
|
||||
|
||||
$pending_orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state)
|
||||
WHERE os.paid = 1 AND os.shipped = 0
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
|
||||
$abandoned_cart = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'cart`
|
||||
WHERE `date_upd` BETWEEN "'.pSQL(date('Y-m-d H:i:s', strtotime('-'.(int)Configuration::get('DASHACTIVITY_CART_ABANDONED_MAX').' MIN'))).'" AND "'.pSQL(date('Y-m-d H:i:s', strtotime('-'.(int)Configuration::get('DASHACTIVITY_CART_ABANDONED_MIN').' MIN'))).'"
|
||||
AND id_cart NOT IN (SELECT id_cart FROM `'._DB_PREFIX_.'orders`)
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
|
||||
$return_exchanges = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_return` or2 ON o.id_order = or2.id_order
|
||||
WHERE or2.`date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o')
|
||||
);
|
||||
|
||||
$products_out_of_stock = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT SUM(IF(IFNULL(stock.quantity, 0) > 0, 0, 1))
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON p.id_product = pa.id_product
|
||||
'.Product::sqlStock('p', 'pa').'
|
||||
WHERE p.active = 1'
|
||||
);
|
||||
|
||||
$new_messages = AdminStatsController::getPendingMessages();
|
||||
|
||||
$active_shopping_cart = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'cart`
|
||||
WHERE date_upd > "'.pSQL(date('Y-m-d H:i:s', strtotime('-'.(int)Configuration::get('DASHACTIVITY_CART_ACTIVE').' MIN'))).'"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
|
||||
$new_customers = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
|
||||
$new_registrations = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `newsletter_date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
AND newsletter = 1
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
$total_suscribers = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE newsletter = 1
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
if (Module::isInstalled('blocknewsletter'))
|
||||
{
|
||||
$new_registrations += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'newsletter`
|
||||
WHERE active = 1
|
||||
AND `newsletter_date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
$total_suscribers += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
|
||||
'
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'newsletter`
|
||||
WHERE active = 1
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
}
|
||||
|
||||
$product_reviews = 0;
|
||||
if (Module::isInstalled('productcomments'))
|
||||
{
|
||||
$product_reviews += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'product_comment` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (pc.id_product = p.id_product)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE pc.deleted = 0
|
||||
AND pc.`date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER)
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'data_value' => array(
|
||||
'pending_orders' => (int)$pending_orders,
|
||||
'return_exchanges' => (int)$return_exchanges,
|
||||
'abandoned_cart' => (int)$abandoned_cart,
|
||||
'products_out_of_stock' => (int)$products_out_of_stock,
|
||||
'new_messages' => (int)$new_messages,
|
||||
'product_reviews' => (int)$product_reviews,
|
||||
'new_customers' => (int)$new_customers,
|
||||
'online_visitor' => (int)$online_visitor,
|
||||
'active_shopping_cart' => (int)$active_shopping_cart,
|
||||
'new_registrations' => (int)$new_registrations,
|
||||
'total_suscribers' => (int)$total_suscribers,
|
||||
'visits' => (int)$visits,
|
||||
'unique_visitors' => (int)$unique_visitors,
|
||||
),
|
||||
'data_trends' => array(
|
||||
'orders_trends' => array('way' => 'down', 'value' => 0.42),
|
||||
),
|
||||
'data_list_small' => array(
|
||||
'dash_traffic_source' => $this->getTrafficSources($params['date_from'], $params['date_to']),
|
||||
),
|
||||
'data_chart' => array(
|
||||
'dash_trends_chart1' => $this->getChartTrafficSource($params['date_from'], $params['date_to']),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getChartTrafficSource($date_from, $date_to)
|
||||
{
|
||||
$referers = $this->getReferer($date_from, $date_to);
|
||||
$return = array('chart_type' => 'pie_chart_trends', 'data' => array());
|
||||
$i = 0;
|
||||
foreach ($referers as $referer_name => $n)
|
||||
$return['data'][] = array('key' => $referer_name, 'y' => $n, 'color' => self::$colors[$i++]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function getTrafficSources($date_from, $date_to)
|
||||
{
|
||||
$referrers = $this->getReferer($date_from, $date_to, 3);
|
||||
$traffic_sources = array();
|
||||
$i = 0;
|
||||
foreach ($referrers as $referrer_name => $n)
|
||||
$traffic_sources['<i class="icon-circle" style="color:'.self::$colors[$i++].'"></i> '.$referrer_name] = $n;
|
||||
|
||||
return $traffic_sources;
|
||||
}
|
||||
|
||||
protected function getReferer($date_from, $date_to, $limit = 3)
|
||||
{
|
||||
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
|
||||
if (Validate::isLoadedObject($gapi) && $gapi->isConfigured())
|
||||
{
|
||||
$websites = array();
|
||||
if ($result = $gapi->requestReportData(
|
||||
'ga:source',
|
||||
'ga:visitors',
|
||||
Tools::substr($date_from, 0, 10),
|
||||
Tools::substr($date_to, 0, 10),
|
||||
'-ga:visitors',
|
||||
null,
|
||||
1,
|
||||
$limit
|
||||
))
|
||||
foreach ($result as $row)
|
||||
$websites[$row['dimensions']['source']] = $row['metrics']['visitors'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$direct_link = $this->l('Direct link');
|
||||
$websites = array($direct_link => 0);
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
SELECT http_referer
|
||||
FROM '._DB_PREFIX_.'connections
|
||||
WHERE date_add BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
|
||||
'.Shop::addSqlRestriction().'
|
||||
LIMIT '.(int)$limit
|
||||
);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (!isset($row['http_referer']) || empty($row['http_referer']))
|
||||
++$websites[$direct_link];
|
||||
else
|
||||
{
|
||||
$website = preg_replace('/^www./', '', parse_url($row['http_referer'], PHP_URL_HOST));
|
||||
if (!isset($websites[$website]))
|
||||
$websites[$website] = 1;
|
||||
else
|
||||
++$websites[$website];
|
||||
}
|
||||
}
|
||||
arsort($websites);
|
||||
}
|
||||
|
||||
return $websites;
|
||||
}
|
||||
|
||||
public function renderConfigForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'id_form' => 'step_carrier_general',
|
||||
'input' => array(),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default pull-right submit_dash_config',
|
||||
'reset' => array(
|
||||
'title' => $this->l('Cancel'),
|
||||
'class' => 'btn btn-default cancel_dash_config',
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$fields_form['form']['input'][] = array(
|
||||
'label' => $this->l('Active cart'),
|
||||
'hint' => $this->l('How long (in minutes) a cart is to be considered as active after the last recorded change (default: 30 min).'),
|
||||
'name' => 'DASHACTIVITY_CART_ACTIVE',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 15, 'name' => 15),
|
||||
array('id' => 30, 'name' => 30),
|
||||
array('id' => 45, 'name' => 45),
|
||||
array('id' => 60, 'name' => 60),
|
||||
array('id' => 90, 'name' => 90),
|
||||
array('id' => 120, 'name' => 120),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
),
|
||||
);
|
||||
$fields_form['form']['input'][] = array(
|
||||
'label' => $this->l('Online visitor'),
|
||||
'hint' => $this->l('How long (in minutes) a visitor is to be considered as online after their last action (default: 30 min).'),
|
||||
'name' => 'DASHACTIVITY_VISITOR_ONLINE',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 15, 'name' => 15),
|
||||
array('id' => 30, 'name' => 30),
|
||||
array('id' => 45, 'name' => 45),
|
||||
array('id' => 60, 'name' => 60),
|
||||
array('id' => 90, 'name' => 90),
|
||||
array('id' => 120, 'name' => 120),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
),
|
||||
);
|
||||
$fields_form['form']['input'][] = array(
|
||||
'label' => $this->l('Abandoned cart (min)'),
|
||||
'hint' => $this->l('How long (in hours) after the last action a cart is to be considered as abandoned (default: 24 hrs).'),
|
||||
'name' => 'DASHACTIVITY_CART_ABANDONED_MIN',
|
||||
'type' => 'text',
|
||||
'suffix' => $this->l('hrs'),
|
||||
);
|
||||
$fields_form['form']['input'][] = array(
|
||||
'label' => $this->l('Abandoned cart (max)'),
|
||||
'hint' => $this->l('How long (in hours) after the last action a cart is no longer to be considered as abandoned (default: 24 hrs).'),
|
||||
'name' => 'DASHACTIVITY_CART_ABANDONED_MAX',
|
||||
'type' => 'text',
|
||||
'suffix' => $this->l('hrs'),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
$helper->id = (int)Tools::getValue('id_carrier');
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitDashConfig';
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'DASHACTIVITY_CART_ACTIVE' => Tools::getValue('DASHACTIVITY_CART_ACTIVE', Configuration::get('DASHACTIVITY_CART_ACTIVE')),
|
||||
'DASHACTIVITY_CART_ABANDONED_MIN' => Tools::getValue('DASHACTIVITY_CART_ABANDONED_MIN', Configuration::get('DASHACTIVITY_CART_ABANDONED_MIN')),
|
||||
'DASHACTIVITY_CART_ABANDONED_MAX' => Tools::getValue('DASHACTIVITY_CART_ABANDONED_MAX', Configuration::get('DASHACTIVITY_CART_ABANDONED_MAX')),
|
||||
'DASHACTIVITY_VISITOR_ONLINE' => Tools::getValue('DASHACTIVITY_VISITOR_ONLINE', Configuration::get('DASHACTIVITY_VISITOR_ONLINE')),
|
||||
);
|
||||
}
|
||||
|
||||
public function hookActionObjectCustomerMessageAddAfter($params)
|
||||
{
|
||||
return $this->hookActionObjectOrderAddAfter($params);
|
||||
}
|
||||
|
||||
public function hookActionObjectCustomerThreadAddAfter($params)
|
||||
{
|
||||
return $this->hookActionObjectOrderAddAfter($params);
|
||||
}
|
||||
|
||||
public function hookActionObjectCustomerAddAfter($params)
|
||||
{
|
||||
return $this->hookActionObjectOrderAddAfter($params);
|
||||
}
|
||||
|
||||
public function hookActionObjectOrderReturnAddAfter($params)
|
||||
{
|
||||
return $this->hookActionObjectOrderAddAfter($params);
|
||||
}
|
||||
|
||||
public function hookActionObjectOrderAddAfter($params)
|
||||
{
|
||||
Tools::changeFileMTime($this->push_filename);
|
||||
}
|
||||
}
|
BIN
modules/dashactivity/gapi-logo.gif
Normal file
After Width: | Height: | Size: 946 B |
35
modules/dashactivity/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
BIN
modules/dashactivity/logo.gif
Normal file
After Width: | Height: | Size: 1018 B |
BIN
modules/dashactivity/logo.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
46
modules/dashactivity/translations/fr.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_0369e7f54bf8a30b2766e6a9a708de0b'] = 'Tableau de bord de l\'activité';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_02b5205ddff3073efc5c8b5b9cc165ba'] = '(du %s au %s)';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_14542f5997c4a02d4276da364657f501'] = 'Lien direct';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_914030b0a079e4eec3b3f5090c0fc35a'] = 'Panier actif';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_78fa968db0e87c6fc302614b26f93b5d'] = 'La durée (en minutes) durant laquelle un panier est considéré comme étant actif, en fonction de la dernière modification enregistrée (par défaut : 30 min).';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_47b8a33a5335cce8d4e353c4d1743f31'] = 'Visiteur en ligne';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_b13a895857368f29e5e127767388b0ab'] = 'La durée (en minute) durant laquelle un visiteur en considéré comme actif en fonction de leur dernière action (par défaut : 30 min).';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_6ad366c171531a83ffbc5625e159f340'] = 'Panier abandonné (min)';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_8f1f252cfd3cbbcba7a2325f12e3dbc4'] = 'Durée (en heures) au delà de laquelle un panier est considéré comme abandonné après la dernière action enregistrée (valeur par défaut : 24 h).';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_c760237f74bcc7e3f90ad956086edb66'] = 'h';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_a5493eb7cba36f452249d093e7757adc'] = 'Panier abandonné (max)';
|
||||
$_MODULE['<{dashactivity}prestashop>dashactivity_45e9c82415a3bee4413485c6bcb4347f'] = 'Durée (en heures) au delà de laquelle un panier cesse d\'être considéré comme abandonné après la dernière action enregistrée (valeur par défaut : 48 h).';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_91b1b529580f2bb429493a51a1af932b'] = 'Aperçu de l\'activité';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_63a6a88c066880c5ac42394a22803ca6'] = 'Rafraîchir';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_254f642527b45bc260048e30704edb39'] = 'Paramètres';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_edfc5fccc0439856b5bd432522ef47aa'] = 'Visiteurs en ligne';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_962b7da7912bc637b03626e23b5832b5'] = 'Dans les %d dernières minutes';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_7aaacf26dbf7d8929916618bb57d81f8'] = 'Paniers actifs';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_24042b0e4b783724dac4178df4db5d68'] = 'Actuellement en attente';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_247d96cbab5bfc79dff10eb2ce6d8897'] = 'Retours/Échanges';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_54e85d70ea67acdcc86963b14d6223a8'] = 'Paniers abandonnés';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_1c4407dd95b9ef941d30c2838208977e'] = 'Produits en rupture de stock';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_a274f4d4670213a9045ce258c6c56b80'] = 'Notifications';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_a644e8cd597f2b92aa52861632c0363d'] = 'Nouveaux Messages';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_56d4e9a4c8e9f47549e8129393b3740f'] = 'Revues de produits';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_e539ae01694149c9e12295fe564a376b'] = 'Clients & Newsletters';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_8471314b4a53476fbf2379d9a0f7ac28'] = 'Nouveaux Clients';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_d833d1b3c98b980090f79ad42badcf9f'] = 'Nouveaux Abonnements';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_e42bc03dcf18091455cb8a06ce1d56e9'] = 'Total des Abonnés';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_e7935ae6c516d89405ec532359d2d75a'] = 'Trafic';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_1a4aeb4ca6cd736a4a7b25d8657d9972'] = 'Lien vers votre compte Google Analytics';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_d7e637a6e9ff116de2fa89551240a94d'] = 'Visites';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_945f170a18e4894c90381a3d01bdef8b'] = 'Visiteurs Uniques';
|
||||
$_MODULE['<{dashactivity}prestashop>dashboard_zone_one_0fcff541ec15c6ed895d5dec49436488'] = 'Sources de Trafic';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/dashactivity/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
35
modules/dashactivity/views/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
156
modules/dashactivity/views/js/dashactivity.js
Normal file
@ -0,0 +1,156 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
function pie_chart_trends(widget_name, chart_details)
|
||||
{
|
||||
nv.addGraph(function() {
|
||||
var chart = nv.models.pieChart()
|
||||
.x(function(d) { return d.key })
|
||||
.y(function(d) { return d.y })
|
||||
.color(d3.scale.category10().range())
|
||||
.donut(true)
|
||||
.showLabels(false)
|
||||
.showLegend(false);
|
||||
|
||||
d3.select("#dash_traffic_chart2 svg")
|
||||
.datum(chart_details.data)
|
||||
.transition().duration(1200)
|
||||
.call(chart);
|
||||
|
||||
nv.utils.windowResize(chart.update);
|
||||
|
||||
return chart;
|
||||
});
|
||||
}
|
||||
|
||||
//TODO unify this with other function in calenda.js and replace date.js functions
|
||||
Date.parseDate = function(date, format) {
|
||||
if (format === undefined)
|
||||
format = 'Y-m-d';
|
||||
|
||||
var formatSeparator = format.match(/[.\/\-\s].*?/);
|
||||
var formatParts = format.split(/\W+/);
|
||||
var parts = date.split(formatSeparator);
|
||||
var date = new Date();
|
||||
|
||||
if (parts.length === formatParts.length) {
|
||||
date.setHours(0);
|
||||
date.setMinutes(0);
|
||||
date.setSeconds(0);
|
||||
date.setMilliseconds(0);
|
||||
|
||||
for (var i=0; i<=formatParts.length; i++) {
|
||||
switch(formatParts[i]) {
|
||||
case 'dd':
|
||||
case 'd':
|
||||
case 'j':
|
||||
date.setDate(parseInt(parts[i], 10)||1);
|
||||
break;
|
||||
|
||||
case 'mm':
|
||||
case 'm':
|
||||
date.setMonth((parseInt(parts[i], 10)||1) - 1);
|
||||
break;
|
||||
|
||||
case 'yy':
|
||||
case 'y':
|
||||
date.setFullYear(2000 + (parseInt(parts[i], 10)||1));
|
||||
break;
|
||||
|
||||
case 'yyyy':
|
||||
case 'Y':
|
||||
date.setFullYear(parseInt(parts[i], 10)||1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return date;
|
||||
};
|
||||
|
||||
Date.prototype.format = function(format) {
|
||||
if (format === undefined)
|
||||
return this.toString();
|
||||
|
||||
var formatSeparator = format.match(/[.\/\-\s].*?/);
|
||||
var formatParts = format.split(/\W+/);
|
||||
var result = '';
|
||||
|
||||
for (var i=0; i<=formatParts.length; i++) {
|
||||
switch(formatParts[i]) {
|
||||
case 'd':
|
||||
case 'j':
|
||||
result += this.getDate() + formatSeparator;
|
||||
break;
|
||||
|
||||
case 'dd':
|
||||
result += (this.getDate() < 10 ? '0' : '')+this.getDate() + formatSeparator;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
result += (this.getMonth() + 1) + formatSeparator;
|
||||
break;
|
||||
|
||||
case 'mm':
|
||||
result += (this.getMonth() < 9 ? '0' : '')+(this.getMonth() + 1) + formatSeparator;
|
||||
break;
|
||||
|
||||
case 'yy':
|
||||
case 'y':
|
||||
result += this.getFullYear() + formatSeparator;
|
||||
break;
|
||||
|
||||
case 'yyyy':
|
||||
case 'Y':
|
||||
result += this.getFullYear() + formatSeparator;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if (typeof date_subtitle === "undefined")
|
||||
var date_subtitle = '(from %s to %s)';
|
||||
|
||||
if (typeof date_format === "undefined")
|
||||
var date_format = 'Y-mm-dd';
|
||||
|
||||
$('#date-start').change(function() {
|
||||
start = Date.parseDate($('#date-start').val(), 'Y-m-d');
|
||||
end = Date.parseDate($('#date-end').val(), 'Y-m-d');
|
||||
$('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format)));
|
||||
$('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format)));
|
||||
});
|
||||
|
||||
$('#date-end').change(function() {
|
||||
start = Date.parseDate($('#date-start').val(), 'Y-m-d');
|
||||
end = Date.parseDate($('#date-end').val(), 'Y-m-d');
|
||||
|
||||
$('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format)));
|
||||
$('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format)));
|
||||
});
|
||||
});
|
35
modules/dashactivity/views/js/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
176
modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl
Normal file
@ -0,0 +1,176 @@
|
||||
{*
|
||||
* 2007-2014 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
|
||||
*}
|
||||
<section id="dashactivity" class="panel widget{if $allow_push} allow_push{/if}">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-time"></i> {l s='Activity overview' mod='dashactivity'}
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-toolbar-btn" href="#" onclick="toggleDashConfig('dashactivity'); return false;" title="{l s='Configure' mod='dashactivity'}">
|
||||
<i class="process-icon-configure"></i>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="#" onclick="refreshDashboard('dashactivity'); return false;" title="{l s='Refresh' mod='dashactivity'}">
|
||||
<i class="process-icon-refresh"></i>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<section id="dashactivity_config" class="dash_config hide">
|
||||
<header><i class="icon-wrench"></i> {l s='Configuration' mod='dashactivity'}</header>
|
||||
{$dashactivity_config_form}
|
||||
</section>
|
||||
<section id="dash_live" class="loading">
|
||||
<ul class="data_list_large">
|
||||
<li>
|
||||
<span class="data_label size_l">
|
||||
<a href="{$link->getAdminLink('AdminStats')|escape:'html':'UTF-8'}&module=statslive">{l s='Online Visitors' mod='dashactivity'}</a>
|
||||
<small class="text-muted"><br/>
|
||||
{l s='in the last %d minutes' sprintf=$DASHACTIVITY_VISITOR_ONLINE|intval mod='dashactivity'}
|
||||
</small>
|
||||
</span>
|
||||
<span class="data_value size_xxl">
|
||||
<span id="online_visitor"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label size_l">
|
||||
<a href="{$link->getAdminLink('AdminCarts')|escape:'html':'UTF-8'}">{l s='Active Shopping Carts' mod='dashactivity'}</a>
|
||||
<small class="text-muted"><br/>
|
||||
{l s='in the last %d minutes' sprintf=$DASHACTIVITY_CART_ACTIVE|intval mod='dashactivity'}
|
||||
</small>
|
||||
</span>
|
||||
<span class="data_value size_xxl">
|
||||
<span id="active_shopping_cart"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section id="dash_pending" class="loading">
|
||||
<header><i class="icon-time"></i> {l s='Currently Pending' mod='dashactivity'}</header>
|
||||
<ul class="data_list">
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}">{l s='Orders' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_l">
|
||||
<span id="pending_orders"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminReturn')|escape:'html':'UTF-8'}">{l s='Return/Exchanges' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_l">
|
||||
<span id="return_exchanges"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminCarts')|escape:'html':'UTF-8'}">{l s='Abandoned Carts' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_l">
|
||||
<span id="abandoned_cart"></span>
|
||||
</span>
|
||||
</li>
|
||||
{if isset($stock_management) && $stock_management}
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminTracking')|escape:'html':'UTF-8'}">{l s='Out of Stock Products' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_l">
|
||||
<span id="products_out_of_stock"></span>
|
||||
</span>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</section>
|
||||
<section id="dash_notifications" class="loading">
|
||||
<header><i class="icon-exclamation-sign"></i> {l s='Notifications' mod='dashactivity'}</header>
|
||||
<ul class="data_list_vertical">
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}">{l s='New Messages' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_l">
|
||||
<span id="new_messages"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminModules')|escape:'html':'UTF-8'}&configure=productcomments&tab_module=front_office_features&module_name=productcomments">{l s='Product Reviews' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_l">
|
||||
<span id="product_reviews"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section id="dash_customers" class="loading">
|
||||
<header><i class="icon-user"></i> {l s='Customers & Newsletters' mod='dashactivity'} <span class="subtitle small" id="customers-newsletters-subtitle"></span></header>
|
||||
<ul class="data_list">
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminCustomers')|escape:'html':'UTF-8'}">{l s='New Customers' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_md">
|
||||
<span id="new_customers"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminStats')|escape:'html':'UTF-8'}&module=statsnewsletter">{l s='New Subscriptions' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_md">
|
||||
<span id="new_registrations"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminModules')|escape:'html':'UTF-8'}&configure=blocknewsletter&module_name=blocknewsletter">{l s='Total Subscribers' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_md">
|
||||
<span id="total_suscribers"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section id="dash_traffic" class="loading">
|
||||
<header>
|
||||
<i class="icon-globe"></i> {l s='Traffic' mod='dashactivity'} <span class="subtitle small" id="traffic-subtitle"></span>
|
||||
</header>
|
||||
<ul class="data_list">
|
||||
{if $gapi_mode}
|
||||
<li>
|
||||
<span class="data_label">
|
||||
<img src="../modules/dashactivity/gapi-logo.gif" width="16" height="16" alt=""/> <a href="{$link->getAdminLink('AdminModules')|escape:'html':'UTF-8'}&{$gapi_mode}=gapi">{l s='Link to your Google Analytics account' mod='dashactivity'}</a>
|
||||
</span>
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminStats')|escape:'html':'UTF-8'}&module=statsforecast">{l s='Visits' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_md">
|
||||
<span id="visits"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label"><a href="{$link->getAdminLink('AdminStats')|escape:'html':'UTF-8'}&module=statsvisits">{l s='Unique Visitors' mod='dashactivity'}</a></span>
|
||||
<span class="data_value size_md">
|
||||
<span id="unique_visitors"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label">{l s='Traffic Sources' mod='dashactivity'}</span>
|
||||
<ul class="data_list_small" id="dash_traffic_source">
|
||||
</ul>
|
||||
<div id="dash_traffic_chart2" class='chart with-transitions'>
|
||||
<svg></svg>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
date_subtitle = "{$date_subtitle|escape:'html':'UTF-8'}";
|
||||
date_format = "{$date_format|escape:'html':'UTF-8'}";
|
||||
</script>
|
35
modules/dashactivity/views/templates/hook/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
35
modules/dashactivity/views/templates/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
@ -1 +0,0 @@
|
||||
Subproject commit 028d5974aec14efd911526dac6239a02a246bda5
|
8
modules/dashgoals/CHANGELOG.txt
Normal file
@ -0,0 +1,8 @@
|
||||
2014-04-22 18:58:17 +0200 // Changelog updated
|
||||
2014-04-09 16:43:28 +0200 // Fix undefined index
|
||||
2014-04-03 10:12:32 +0200 [-] BO : FixBug #PSCSX-1534 - Illegal offset type
|
||||
2014-03-29 12:04:59 +0100 // Update dashgoal version
|
||||
2014-03-29 12:03:02 +0100 [-] MO : Dashgoals - FixBug #PSCSX-1352 - Undefined dashgoal char value
|
||||
2014-03-29 11:00:18 +0100 [-] MO : Dashgoals - FixBug #PSCSX-1413 - Wrong dashgoals stats
|
||||
2014-03-24 15:21:10 +0100 / MO dashgoals : ps_versions_compliancy added
|
||||
2014-03-20 14:32:25 +0100 Initial commit
|
37
modules/dashgoals/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Dashboard Goals
|
||||
|
||||
## About
|
||||
|
||||
Adds a block with your store\'s forecast.
|
||||
|
||||
## 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 dashgoals 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
|
||||
|
12
modules/dashgoals/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashgoals</name>
|
||||
<displayName><![CDATA[Dashboard Goals]]></displayName>
|
||||
<version><![CDATA[0.6.6]]></version>
|
||||
<description><![CDATA[Adds a block with your store's forecast.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[dashboard]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/dashgoals/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashgoals</name>
|
||||
<displayName><![CDATA[Tableau de bord des objectifs]]></displayName>
|
||||
<version><![CDATA[0.6.6]]></version>
|
||||
<description><![CDATA[Affiche un bloc avec les prévisions 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>
|
@ -0,0 +1,48 @@
|
||||
<?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
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminDashgoalsController extends ModuleAdminController
|
||||
{
|
||||
public function ajaxProcessChangeConfYear()
|
||||
{
|
||||
$year = (int)Tools::getValue('year');
|
||||
Configuration::updateValue('PS_DASHGOALS_CURRENT_YEAR', $year);
|
||||
$months = $this->module->setMonths($year);
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'currency' => $this->context->currency,
|
||||
'goals_year' => $year,
|
||||
'goals_months' => $months,
|
||||
'link' => $this->context->link
|
||||
)
|
||||
);
|
||||
|
||||
die($this->module->display(_PS_MODULE_DIR_.$this->module->name.DIRECTORY_SEPARATOR.$this->module->name.'.php', 'config.tpl'));
|
||||
}
|
||||
}
|
35
modules/dashgoals/controllers/admin/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
528
modules/dashgoals/dashgoals.php
Normal file
@ -0,0 +1,528 @@
|
||||
<?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 DashGoals extends Module
|
||||
{
|
||||
protected static $month_labels = array();
|
||||
protected static $types = array('traffic', 'conversion', 'avg_cart_value');
|
||||
|
||||
protected static $real_color = array('#9E5BA1', '#00A89C', '#3AC4ED', '#F99031');
|
||||
protected static $more_color = array('#803E84', '#008E7E', '#20B2E7', '#F66E1B');
|
||||
protected static $less_color = array('#BC77BE', '#00C2BB', '#51D6F2', '#FBB244');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'dashgoals';
|
||||
$this->tab = 'dashboard';
|
||||
$this->version = '0.6.6';
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Dashboard Goals');
|
||||
$this->description = $this->l('Adds a block with your store\'s forecast.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
|
||||
|
||||
Dashgoals::$month_labels = array(
|
||||
'01' => $this->l('January'),
|
||||
'02' => $this->l('February'),
|
||||
'03' => $this->l('March'),
|
||||
'04' => $this->l('April'),
|
||||
'05' => $this->l('May'),
|
||||
'06' => $this->l('June'),
|
||||
'07' => $this->l('July'),
|
||||
'08' => $this->l('August'),
|
||||
'09' => $this->l('September'),
|
||||
'10' => $this->l('October'),
|
||||
'11' => $this->l('November'),
|
||||
'12' => $this->l('December')
|
||||
);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
Configuration::updateValue('PS_DASHGOALS_CURRENT_YEAR', date('Y'));
|
||||
for ($month = '01'; $month <= 12; $month = sprintf('%02d', $month + 1))
|
||||
{
|
||||
$key = Tools::strtoupper('dashgoals_traffic_'.$month.'_'.date('Y'));
|
||||
if (!ConfigurationKPI::get($key))
|
||||
ConfigurationKPI::updateValue($key, 600);
|
||||
$key = Tools::strtoupper('dashgoals_conversion_'.$month.'_'.date('Y'));
|
||||
if (!ConfigurationKPI::get($key))
|
||||
ConfigurationKPI::updateValue($key, 2);
|
||||
$key = Tools::strtoupper('dashgoals_avg_cart_value_'.$month.'_'.date('Y'));
|
||||
if (!ConfigurationKPI::get($key))
|
||||
ConfigurationKPI::updateValue($key, 80);
|
||||
}
|
||||
|
||||
// Prepare tab
|
||||
$tab = new Tab();
|
||||
$tab->active = 1;
|
||||
$tab->class_name = 'AdminDashgoals';
|
||||
$tab->name = array();
|
||||
foreach (Language::getLanguages(true) as $lang)
|
||||
$tab->name[$lang['id_lang']] = 'Dashgoals';
|
||||
$tab->id_parent = -1;
|
||||
$tab->module = $this->name;
|
||||
|
||||
return (
|
||||
$tab->add()
|
||||
&& parent::install()
|
||||
&& $this->registerHook('dashboardZoneTwo')
|
||||
&& $this->registerHook('dashboardData')
|
||||
&& $this->registerHook('actionAdminControllerSetMedia')
|
||||
);
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$id_tab = (int)Tab::getIdFromClassName('AdminDashgoals');
|
||||
if ($id_tab)
|
||||
{
|
||||
$tab = new Tab($id_tab);
|
||||
$tab->delete();
|
||||
}
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function hookActionAdminControllerSetMedia()
|
||||
{
|
||||
if (get_class($this->context->controller) == 'AdminDashboardController')
|
||||
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');
|
||||
}
|
||||
|
||||
public function setMonths($year)
|
||||
{
|
||||
$months = array();
|
||||
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
||||
$months[$i.'_'.$year] = array('label' => Dashgoals::$month_labels[$i], 'values' => array());
|
||||
|
||||
foreach (Dashgoals::$types as $type)
|
||||
foreach ($months as $month => &$month_row)
|
||||
{
|
||||
$key = 'dashgoals_'.$type.'_'.$month;
|
||||
if (Tools::isSubmit('submitDashGoals'))
|
||||
ConfigurationKPI::updateValue(Tools::strtoupper($key), (float)Tools::getValue($key));
|
||||
$month_row['values'][$type] = ConfigurationKPI::get(Tools::strtoupper($key));
|
||||
}
|
||||
|
||||
return $months;
|
||||
}
|
||||
|
||||
public function hookDashboardZoneTwo($params)
|
||||
{
|
||||
$year = Configuration::get('PS_DASHGOALS_CURRENT_YEAR');
|
||||
$months = $this->setMonths($year);
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'colors' => self::$real_color,
|
||||
'currency' => $this->context->currency,
|
||||
'goals_year' => $year,
|
||||
'goals_months' => $months,
|
||||
'dashgoals_ajax_link' => $this->context->link->getAdminLink('AdminDashgoals')
|
||||
)
|
||||
);
|
||||
|
||||
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
|
||||
}
|
||||
|
||||
public function hookDashboardData($params)
|
||||
{
|
||||
$year = ((isset($params['extra']) && $params['extra'] > 1970 && $params['extra'] < 2999) ? $params['extra'] : Configuration::get('PS_DASHGOALS_CURRENT_YEAR'));
|
||||
|
||||
return array('data_chart' => array('dash_goals_chart1' => $this->getChartData($year)));
|
||||
}
|
||||
|
||||
protected function fakeConfigurationKPI_get($key)
|
||||
{
|
||||
$start = array(
|
||||
'TRAFFIC' => 3000,
|
||||
'CONVERSION' => 2,
|
||||
'AVG_CART_VALUE' => 90
|
||||
);
|
||||
|
||||
if (preg_match('/^DASHGOALS_([A-Z_]+)_([0-9]{2})/', $key, $matches))
|
||||
{
|
||||
if ($matches[1] == 'TRAFFIC')
|
||||
return $start[$matches[1]] * (1 + ($matches[2] - 1) / 10);
|
||||
else
|
||||
return $start[$matches[1]];
|
||||
}
|
||||
}
|
||||
|
||||
public function getChartData($year)
|
||||
{
|
||||
// There are stream types (different charts) and for each types there are 3 available zones (one color for the goal, one if you over perform and one if you under perfom)
|
||||
$stream_types = array(
|
||||
array('type' => 'traffic', 'title' => $this->l('Traffic'), 'unit_text' => $this->l('visits')),
|
||||
array('type' => 'conversion', 'title' => $this->l('Conversion'), 'unit_text' => ''),
|
||||
array('type' => 'avg_cart_value', 'title' => $this->l('Average cart value'), 'unit_text' => ''),
|
||||
array('type' => 'sales', 'title' => $this->l('Sales'), 'unit_text' => '')
|
||||
);
|
||||
$stream_zones = array(
|
||||
array('zone' => 'real', 'text' => ''),
|
||||
array('zone' => 'more', 'text' => $this->l('Goal exceeded')),
|
||||
array('zone' => 'less', 'text' => $this->l('Goal not reached'))
|
||||
);
|
||||
|
||||
// We initialize all the streams types for all the zones
|
||||
$streams = array();
|
||||
$average_goals = array();
|
||||
|
||||
foreach ($stream_types as $key => $stream_type)
|
||||
{
|
||||
$streams[$stream_type['type']] = array();
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams[$stream_type['type']][$stream_zone['zone']] = array(
|
||||
'key' => $stream_type['type'].'_'.$stream_zone['zone'],
|
||||
'title' => $stream_type['title'],
|
||||
'unit_text' => $stream_type['unit_text'],
|
||||
'zone_text' => $stream_zone['text'],
|
||||
'color' => ($stream_zone['zone'] == 'more' ? self::$more_color[$key] : ($stream_zone['zone'] == 'less' ? self::$less_color[$key] : self::$real_color[$key])),
|
||||
'values' => array(),
|
||||
'disabled' => (isset($stream_type['type']) && $stream_type['type'] == 'sales') ? false : true
|
||||
);
|
||||
|
||||
if (isset($stream_type['type']))
|
||||
$average_goals[$stream_type['type']] = 0;
|
||||
}
|
||||
|
||||
if (Configuration::get('PS_DASHBOARD_SIMULATION'))
|
||||
{
|
||||
$visits = $orders = $sales = array();
|
||||
$from = strtotime(date('Y-01-01 00:00:00'));
|
||||
$to = strtotime(date('Y-12-31 00:00:00'));
|
||||
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
|
||||
{
|
||||
$visits[$date] = round(rand(2000, 5000));
|
||||
$orders[$date] = round(rand(40, 100));
|
||||
$sales[$date] = round(rand(3000, 9000), 2);
|
||||
}
|
||||
|
||||
// We need to calculate the average value of each goals for the year, this will be the base rate for "100%"
|
||||
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
||||
{
|
||||
$average_goals['traffic'] += $this->fakeConfigurationKPI_get('DASHGOALS_TRAFFIC_'.$i.'_'.$year);
|
||||
$average_goals['conversion'] += $this->fakeConfigurationKPI_get('DASHGOALS_CONVERSION_'.$i.'_'.$year);
|
||||
$average_goals['avg_cart_value'] += $this->fakeConfigurationKPI_get('DASHGOALS_AVG_CART_VALUE_'.$i.'_'.$year);
|
||||
}
|
||||
foreach ($average_goals as &$average_goal)
|
||||
$average_goal /= 12;
|
||||
$average_goals['sales'] = $average_goals['traffic'] * $average_goals['conversion'] / 100 * $average_goals['avg_cart_value'];
|
||||
|
||||
// Now we can calculate the value for every months
|
||||
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
||||
{
|
||||
$timestamp = strtotime($year.'-'.$i.'-01');
|
||||
|
||||
$month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_TRAFFIC_'.$i.'_'.$year);
|
||||
$value = (isset($visits[$timestamp]) ? $visits[$timestamp] : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['traffic'], $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['traffic'] = $value;
|
||||
$stream_values['real']['goal'] = $month_goal;
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['traffic'] = $value;
|
||||
$stream_values['more']['traffic'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = $goal_diff;
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = $goal_diff;
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['traffic']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['traffic'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
|
||||
$month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_CONVERSION_'.$i.'_'.$year);
|
||||
$value = 100 * ((isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp]) ? ($orders[$timestamp] / $visits[$timestamp]) : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['conversion'], $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['conversion'] = round($value, 2);
|
||||
$stream_values['real']['goal'] = round($month_goal, 2);
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['conversion'] = $value;
|
||||
$stream_values['more']['conversion'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['conversion']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['conversion'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
|
||||
$month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_AVG_CART_VALUE_'.$i.'_'.$year);
|
||||
$value = ((isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp]) ? ($sales[$timestamp] / $orders[$timestamp]) : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['avg_cart_value'], $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['avg_cart_value'] = $value;
|
||||
$stream_values['real']['goal'] = $month_goal;
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['avg_cart_value'] = $value;
|
||||
$stream_values['more']['avg_cart_value'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = $goal_diff;
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = $goal_diff;
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['avg_cart_value']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['avg_cart_value'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
|
||||
$month_goal = $this->fakeConfigurationKPI_get('DASHGOALS_TRAFFIC_'.$i.'_'.$year) * $this->fakeConfigurationKPI_get('DASHGOALS_CONVERSION_'.$i.'_'.$year) / 100 * $this->fakeConfigurationKPI_get('DASHGOALS_AVG_CART_VALUE_'.$i.'_'.$year);
|
||||
$value = (isset($sales[$timestamp]) ? $sales[$timestamp] : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['sales'], $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['sales'] = $value;
|
||||
$stream_values['real']['goal'] = $month_goal;
|
||||
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['sales'] = $value;
|
||||
$stream_values['more']['sales'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = $goal_diff;
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = $goal_diff;
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['sales']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['sales'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Retrieve gross data from AdminStatsController
|
||||
$visits = AdminStatsController::getVisits(false, $year.date('-01-01'), $year.date('-12-31'), 'month');
|
||||
$orders = AdminStatsController::getOrders($year.date('-01-01'), $year.date('-12-31'), 'month');
|
||||
$sales = AdminStatsController::getTotalSales($year.date('-01-01'), $year.date('-12-31'), 'month');
|
||||
|
||||
// We need to calculate the average value of each goals for the year, this will be the base rate for "100%"
|
||||
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
||||
{
|
||||
$average_goals['traffic'] += ConfigurationKPI::get('DASHGOALS_TRAFFIC_'.$i.'_'.$year);
|
||||
$average_goals['conversion'] += ConfigurationKPI::get('DASHGOALS_CONVERSION_'.$i.'_'.$year) / 100;
|
||||
$average_goals['avg_cart_value'] += ConfigurationKPI::get('DASHGOALS_AVG_CART_VALUE_'.$i.'_'.$year);
|
||||
}
|
||||
foreach ($average_goals as &$average_goal)
|
||||
$average_goal /= 12;
|
||||
$average_goals['sales'] = $average_goals['traffic'] * $average_goals['conversion'] * $average_goals['avg_cart_value'];
|
||||
|
||||
// Now we can calculate the value for every months
|
||||
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
|
||||
{
|
||||
$timestamp = strtotime($year.'-'.$i.'-01');
|
||||
|
||||
$month_goal = ConfigurationKPI::get('DASHGOALS_TRAFFIC_'.$i.'_'.$year);
|
||||
$value = (isset($visits[$timestamp]) ? $visits[$timestamp] : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['traffic'], $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['traffic'] = $value;
|
||||
$stream_values['real']['goal'] = $month_goal;
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['traffic'] = $value;
|
||||
$stream_values['more']['traffic'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = $goal_diff;
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = $goal_diff;
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['traffic']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['traffic'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
|
||||
$month_goal = ConfigurationKPI::get('DASHGOALS_CONVERSION_'.$i.'_'.$year);
|
||||
$value = 100 * ((isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp]) ? ($orders[$timestamp] / $visits[$timestamp]) : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['conversion'] * 100, $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['conversion'] = round($value, 2);
|
||||
$stream_values['real']['goal'] = round($month_goal, 2);
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['conversion'] = $value;
|
||||
$stream_values['more']['conversion'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['conversion']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['conversion'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
|
||||
$month_goal = ConfigurationKPI::get('DASHGOALS_AVG_CART_VALUE_'.$i.'_'.$year);
|
||||
$value = ((isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp]) ? ($sales[$timestamp] / $orders[$timestamp]) : 0);
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['avg_cart_value'], $month_goal, $value, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['avg_cart_value'] = $value;
|
||||
$stream_values['real']['goal'] = $month_goal;
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['avg_cart_value'] = $value;
|
||||
$stream_values['more']['avg_cart_value'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = $goal_diff;
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = $goal_diff;
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['avg_cart_value']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['avg_cart_value'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
|
||||
$month_goal = ConfigurationKPI::get('DASHGOALS_TRAFFIC_'.$i.'_'.$year) * ConfigurationKPI::get('DASHGOALS_CONVERSION_'.$i.'_'.$year) / 100 * ConfigurationKPI::get('DASHGOALS_AVG_CART_VALUE_'.$i.'_'.$year);
|
||||
$value = (isset($sales[$timestamp]) && $sales[$timestamp]) ? $sales[$timestamp] : 0;
|
||||
$stream_values = $this->getValuesFromGoals($average_goals['sales'], $month_goal, isset($sales[$timestamp]) ? $sales[$timestamp] : 0, Dashgoals::$month_labels[$i]);
|
||||
$goal_diff = $value - $month_goal;
|
||||
$stream_values['real']['sales'] = $value;
|
||||
$stream_values['real']['goal'] = $month_goal;
|
||||
|
||||
if ($value > 0)
|
||||
$stream_values['real']['goal_diff'] = round(($goal_diff * 100) / ($month_goal > 0 ? $month_goal : 1), 2);
|
||||
|
||||
$stream_values['less']['sales'] = $value;
|
||||
$stream_values['more']['sales'] = $value;
|
||||
|
||||
if ($value > 0 && $value < $month_goal)
|
||||
$stream_values['less']['goal_diff'] = $goal_diff;
|
||||
elseif ($value > 0)
|
||||
$stream_values['more']['goal_diff'] = $goal_diff;
|
||||
|
||||
if ($value == 0)
|
||||
{
|
||||
$streams['sales']['less']['zone_text'] = $this->l('Goal set:');
|
||||
$stream_values['less']['goal'] = $month_goal;
|
||||
}
|
||||
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$streams['sales'][$stream_zone['zone']]['values'][] = $stream_values[$stream_zone['zone']];
|
||||
}
|
||||
}
|
||||
|
||||
// Merge all the streams before sending
|
||||
$all_streams = array();
|
||||
foreach ($stream_types as $stream_type)
|
||||
foreach ($stream_zones as $stream_zone)
|
||||
$all_streams[] = $streams[$stream_type['type']][$stream_zone['zone']];
|
||||
|
||||
return array('chart_type' => 'bar_chart_goals', 'data' => $all_streams);
|
||||
}
|
||||
|
||||
protected function getValuesFromGoals($average_goal, $month_goal, $value, $label)
|
||||
{
|
||||
// Initialize value for each zone
|
||||
$stream_values = array(
|
||||
'real' => array('x' => $label, 'y' => 0),
|
||||
'less' => array('x' => $label, 'y' => 0),
|
||||
'more' => array('x' => $label, 'y' => 0)
|
||||
);
|
||||
|
||||
// Calculate the percentage of fullfilment of the goal
|
||||
$fullfilment = 0;
|
||||
if ($value && $month_goal)
|
||||
$fullfilment = round($value / $month_goal, 2);
|
||||
|
||||
// Base rate is essential here : it determines the value of the goal compared to the "100%" of the chart legend
|
||||
$base_rate = 0;
|
||||
if ($average_goal && $month_goal)
|
||||
$base_rate = $month_goal / $average_goal;
|
||||
|
||||
// Fullfilment of 1 means that we performed exactly anticipated
|
||||
if ($fullfilment == 1)
|
||||
$stream_values['real'] = array('x' => $label, 'y' => round($base_rate, 2));
|
||||
// Fullfilment lower than 1 means that we UNDER performed
|
||||
elseif ($fullfilment < 1)
|
||||
{
|
||||
$stream_values['real'] = array('x' => $label, 'y' => round($fullfilment * $base_rate, 2));
|
||||
$stream_values['less'] = array('x' => $label, 'y' => round($base_rate - ($fullfilment * $base_rate), 2));
|
||||
}
|
||||
// Fullfilment greater than 1 means that we OVER performed
|
||||
elseif ($fullfilment > 1)
|
||||
{
|
||||
$stream_values['real'] = array('x' => $label, 'y' => round($base_rate, 2));
|
||||
$stream_values['more'] = array('x' => $label, 'y' => round(($fullfilment * $base_rate) - $base_rate, 2));
|
||||
}
|
||||
|
||||
return $stream_values;
|
||||
}
|
||||
}
|
35
modules/dashgoals/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
BIN
modules/dashgoals/logo.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
modules/dashgoals/logo.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
43
modules/dashgoals/translations/fr.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_50698c5b8ffaf2b7dd089898a244a668'] = 'Tableau de bord des objectifs';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_14089da5dd6132b674d9829b136efff9'] = 'Affiche un bloc avec les prévisions de votre boutique.';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_86f5978d9b80124f509bdb71786e929e'] = 'Janvier';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_659e59f062c75f81259d22786d6c44aa'] = 'Février';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_fa3e5edac607a88d8fd7ecb9d6d67424'] = 'Mars';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_3fcf026bbfffb63fb24b8de9d0446949'] = 'Avril';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_195fbb57ffe7449796d23466085ce6d8'] = 'Mai';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_688937ccaf2a2b0c45a1c9bbba09698d'] = 'Juin';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_1b539f6f34e8503c97f6d3421346b63c'] = 'Juillet';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_41ba70891fb6f39327d8ccb9b1dafb84'] = 'Août';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_cc5d90569e1c8313c2b1c2aab1401174'] = 'Septembre';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_eca60ae8611369fe28a02e2ab8c5d12e'] = 'Octobre';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_7e823b37564da492ca1629b4732289a8'] = 'Novembre';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_82331503174acbae012b2004f6431fa5'] = 'Décembre';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_e7935ae6c516d89405ec532359d2d75a'] = 'Trafic';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_233d48e63da77b092da350559d2f8382'] = 'visites';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_3bb1503332637805beddb73a2dd1fe1b'] = 'Transformation';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_71241798130f714cbd2786df3da2cf0b'] = 'Valeur du panier moyen';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_11ff9f68afb6b8b5b8eda218d7c83a65'] = 'Ventes';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_9ac642c5ef334ea05256563f921bb304'] = 'Objectif dépassé';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_7c103c9bbbaecee07ca898ed65667cbf'] = 'Objectif non atteint';
|
||||
$_MODULE['<{dashgoals}prestashop>dashgoals_eb233580dc419f03df5905f175606e4d'] = 'Objectif :';
|
||||
$_MODULE['<{dashgoals}prestashop>config_254f642527b45bc260048e30704edb39'] = 'Paramètres';
|
||||
$_MODULE['<{dashgoals}prestashop>config_e7935ae6c516d89405ec532359d2d75a'] = 'Trafic';
|
||||
$_MODULE['<{dashgoals}prestashop>config_e4c3da18c66c0147144767efeb59198f'] = 'Taux de transformation';
|
||||
$_MODULE['<{dashgoals}prestashop>config_8c804960da61b637c548c951652b0cac'] = 'Panier moyen';
|
||||
$_MODULE['<{dashgoals}prestashop>config_11ff9f68afb6b8b5b8eda218d7c83a65'] = 'Ventes';
|
||||
$_MODULE['<{dashgoals}prestashop>config_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_89c1265be62d3ba835a3d963db5956b0'] = 'Prévisions';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_63a6a88c066880c5ac42394a22803ca6'] = 'Rafraîchir';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_e7935ae6c516d89405ec532359d2d75a'] = 'Trafic';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_3bb1503332637805beddb73a2dd1fe1b'] = 'Transformation';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_8c804960da61b637c548c951652b0cac'] = 'Panier moyen';
|
||||
$_MODULE['<{dashgoals}prestashop>dashboard_zone_two_11ff9f68afb6b8b5b8eda218d7c83a65'] = 'Ventes';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/dashgoals/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
35
modules/dashgoals/views/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
166
modules/dashgoals/views/js/dashgoals.js
Normal file
@ -0,0 +1,166 @@
|
||||
var dashgoals_data;
|
||||
var dashgoals_chart;
|
||||
|
||||
function bar_chart_goals(widget_name, chart_details)
|
||||
{
|
||||
nv.addGraph(function() {
|
||||
dashgoals_data = chart_details.data;
|
||||
|
||||
var chart = nv.models.multiBarChart()
|
||||
.stacked(true)
|
||||
.showControls(false)
|
||||
.tooltipContent(function(key, y, e, graph) {
|
||||
if (graph.value == 0)
|
||||
return '';
|
||||
|
||||
if (key == 'sales_real') {
|
||||
var result = '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + formatCurrency(parseInt(graph.point.sales), currency_format, currency_sign, currency_blank) + '</strong><br />(' + formatCurrency(parseInt(graph.point.goal), currency_format, currency_sign, currency_blank) + ')<br/>';
|
||||
if (graph.point.sales > graph.point.goal)
|
||||
result += '<span class="dash_trend dash_trend_up">+';
|
||||
else
|
||||
result += '<span class="dash_trend dash_trend_down">';
|
||||
result += graph.point.goal_diff + '%</span></div>';
|
||||
return result;
|
||||
} else if (key == 'sales_less') {
|
||||
if (graph.point.sales > 0)
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_down">' + formatCurrency(parseInt(graph.point.goal_diff), currency_format, currency_sign, currency_blank) + '</span></div>';
|
||||
else
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br />(' + formatCurrency(parseInt(graph.point.goal), currency_format, currency_sign, currency_blank) + ')</div>';
|
||||
} else if (key == 'sales_more')
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_up">+' + formatCurrency(parseInt(graph.point.goal_diff), currency_format, currency_sign, currency_blank) + '</span></div>';
|
||||
else if (key == 'avg_cart_value_real') {
|
||||
var result = '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + formatCurrency(parseInt(graph.point.avg_cart_value), currency_format, currency_sign, currency_blank) + '</strong><br />(' + formatCurrency(parseInt(graph.point.goal), currency_format, currency_sign, currency_blank) + ')<br/>';
|
||||
if (graph.point.avg_cart_value > graph.point.goal)
|
||||
result += '<span class="dash_trend dash_trend_up">+';
|
||||
else
|
||||
result += '<span class="dash_trend dash_trend_down">';
|
||||
result += graph.point.goal_diff + '%</span></div>';
|
||||
return result;
|
||||
} else if (key == 'avg_cart_value_less') {
|
||||
if (graph.point.avg_cart_value > 0)
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_down">' + formatCurrency(parseInt(graph.point.goal_diff), currency_format, currency_sign, currency_blank) + '</span></div>';
|
||||
else
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br />(' + formatCurrency(parseInt(graph.point.goal), currency_format, currency_sign, currency_blank) + ')</div>';
|
||||
} else if (key == 'avg_cart_value_more')
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_up">+' + formatCurrency(parseInt(graph.point.goal_diff), currency_format, currency_sign, currency_blank) + '</span></div>';
|
||||
else if (key == 'traffic_real') {
|
||||
var result = '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.point.traffic + ' ' +graph.series.unit_text+'</strong><br />(' + graph.point.goal + ' ' +graph.series.unit_text+')<br/>';
|
||||
if (graph.point.traffic > graph.point.goal)
|
||||
result += '<span class="dash_trend dash_trend_up">+';
|
||||
else
|
||||
result += '<span class="dash_trend dash_trend_down">';
|
||||
result += graph.point.goal_diff + '%</span></div>';
|
||||
return result;
|
||||
} else if (key == 'traffic_less') {
|
||||
if (graph.point.traffic > 0)
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_down">' + graph.point.goal_diff + ' ' +graph.series.unit_text+'</span></div>';
|
||||
else
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br />(' + graph.point.goal + ' ' +graph.series.unit_text+')</div>';
|
||||
} else if (key == 'traffic_more')
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_up">+' + graph.point.goal_diff + ' ' +graph.series.unit_text+'</span></div>';
|
||||
else if (key == 'conversion_real') {
|
||||
var result = '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.point.conversion + '%</strong><br />(' + graph.point.goal + '%)</strong><br/>';
|
||||
if (graph.point.conversion > graph.point.goal)
|
||||
result += '<span class="dash_trend dash_trend_up">+';
|
||||
else
|
||||
result += '<span class="dash_trend dash_trend_down">';
|
||||
result += graph.point.goal_diff + '%</span></div>';
|
||||
return result;
|
||||
} else if (key == 'conversion_less') {
|
||||
if (graph.point.conversion > 0)
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_down">' + graph.point.goal_diff + '%</span></div>';
|
||||
else
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br />(' + graph.point.goal + '%)</div>';
|
||||
} else if (key == 'conversion_more')
|
||||
return '<div class="tooltip-panel"><div class="tooltip-panel-heading">' + graph.series.title + '</div><strong>' + graph.series.zone_text + '</strong><br /><span class="dash_trend dash_trend_up">+' + graph.point.goal_diff + '%</span></div>';
|
||||
|
||||
});
|
||||
|
||||
chart.yAxis.tickFormat(d3.format('.1f'));
|
||||
dashgoals_chart = chart;
|
||||
|
||||
d3.select('#dash_goals_chart1 svg')
|
||||
.datum(chart_details.data)
|
||||
.transition()
|
||||
.call(chart);
|
||||
|
||||
$('#dash_goals_chart1 .nv-legendWrap').remove();
|
||||
|
||||
nv.utils.windowResize(chart.update);
|
||||
|
||||
return chart;
|
||||
});
|
||||
}
|
||||
|
||||
function selectDashgoalsChart(type)
|
||||
{
|
||||
if (type !== false)
|
||||
{
|
||||
$.each(dashgoals_data, function(index, value) {
|
||||
if (value.key == type + '_real' || value.key == type + '_more' || value.key == type + '_less')
|
||||
value.disabled = false;
|
||||
else
|
||||
value.disabled = true;
|
||||
});
|
||||
}
|
||||
dashgoals_toggleDashConfig();
|
||||
}
|
||||
|
||||
/* Refresh dashgoals chart when coming from the config panel
|
||||
Called from /js/admin-dashboard.js: toggleDashConfig() */
|
||||
function dashgoals_toggleDashConfig()
|
||||
{
|
||||
d3.select('#dash_goals_chart1 svg')
|
||||
.datum(dashgoals_data)
|
||||
.transition()
|
||||
.call(dashgoals_chart);
|
||||
nv.utils.windowResize(dashgoals_chart.update);
|
||||
}
|
||||
|
||||
/* Calculate Sales based on the traffic, average cart value and conversion rate */
|
||||
function dashgoals_calc_sales()
|
||||
{
|
||||
$('.dashgoals_sales').each(function() {
|
||||
var key = $(this).attr('id').substr(16);
|
||||
var sales = parseFloat($('#dashgoals_traffic_' + key).val()) * parseFloat($('#dashgoals_avg_cart_value_' + key).val()) * parseFloat($('#dashgoals_conversion_' + key).val()) / 100;
|
||||
if (isNaN(sales))
|
||||
$(this).text(formatCurrency(0, currency_format, currency_sign, currency_blank));
|
||||
else
|
||||
$(this).text(formatCurrency(parseInt(sales), currency_format, currency_sign, currency_blank));
|
||||
});
|
||||
}
|
||||
|
||||
function dashgoals_changeYear(xward)
|
||||
{
|
||||
var new_year = dashgoals_year;
|
||||
if (xward == 'forward')
|
||||
new_year = dashgoals_year + 1;
|
||||
else if (xward == 'backward')
|
||||
new_year = dashgoals_year - 1;
|
||||
|
||||
$.ajax({
|
||||
url: dashgoals_ajax_link,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'changeconfyear',
|
||||
year: new_year
|
||||
},
|
||||
success : function(result){
|
||||
$('#dashgoals_title').text($('#dashgoals_title').text().replace(dashgoals_year, new_year));
|
||||
var hide_conf = $('#dashgoals_config').hasClass('hide');
|
||||
$('#dashgoals_config').replaceWith(result);
|
||||
dashgoals_calc_sales();
|
||||
if (!hide_conf)
|
||||
$('#dashgoals_config').removeClass('hide');
|
||||
$('.dashgoals_config_input').off();
|
||||
$('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); });
|
||||
dashgoals_year = new_year;
|
||||
refreshDashboard('dashgoals', false, dashgoals_year);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); });
|
||||
dashgoals_calc_sales();
|
||||
});
|
35
modules/dashgoals/views/js/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
74
modules/dashgoals/views/templates/hook/config.tpl
Normal file
@ -0,0 +1,74 @@
|
||||
{*
|
||||
* 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
|
||||
*}
|
||||
<section id="dashgoals_config" class="dash_config hide">
|
||||
<header><i class="icon-wrench"></i> {l s='Configuration' mod='dashgoals'}</header>
|
||||
<form class="defaultForm form-horizontal" method="post" action="{$link->getAdminLink('AdminDashboard')|escape:'html':'UTF-8'}">
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fixed-width-md">{$goals_year}</th>
|
||||
<th class="fixed-width-md">{l s='Traffic' mod='dashgoals'}</th>
|
||||
<th class="fixed-width-md">{l s='Conversion Rate' mod='dashgoals'}</th>
|
||||
<th class="fixed-width-lg">{l s='Average Cart Value' mod='dashgoals'}</th>
|
||||
<th>{l s='Sales' mod='dashgoals'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $goals_months as $month}
|
||||
<tr>
|
||||
<td>
|
||||
{$month.label}
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<input id="dashgoals_traffic_{$month@key}" name="dashgoals_traffic_{$month@key}" class="dashgoals_config_input form-control"
|
||||
value="{$month.values.traffic|intval}" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<input id="dashgoals_conversion_{$month@key}" name="dashgoals_conversion_{$month@key}" class="dashgoals_config_input form-control"
|
||||
value="{$month.values.conversion|floatval}" />
|
||||
<span class="input-group-addon">%</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$currency->iso_code|escape}</span>
|
||||
<input id="dashgoals_avg_cart_value_{$month@key}" name="dashgoals_avg_cart_value_{$month@key}" class="dashgoals_config_input form-control"
|
||||
value="{$month.values.avg_cart_value|intval}" />
|
||||
</div>
|
||||
</td>
|
||||
<td id="dashgoals_sales_{$month@key}" class="dashgoals_sales">
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="panel-footer">
|
||||
<button class="btn btn-default pull-right" name="submitDashGoals" type="submit"><i class="process-icon-save"></i> {l s='Save' mod='dashgoals'}</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
@ -0,0 +1,74 @@
|
||||
{*
|
||||
* 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
|
||||
*}
|
||||
<div class="clearfix"></div>
|
||||
<script>
|
||||
var currency_format = {$currency->format|intval};
|
||||
var currency_sign = '{$currency->sign|addslashes}';
|
||||
var currency_blank = {$currency->blank|intval};
|
||||
var priceDisplayPrecision = 0;
|
||||
var dashgoals_year = {$goals_year|intval};
|
||||
var dashgoals_ajax_link = '{$dashgoals_ajax_link|addslashes}';
|
||||
</script>
|
||||
|
||||
<section id="dashgoals" class="panel widget">
|
||||
<header class="panel-heading">
|
||||
<i class="icon-bar-chart"></i>
|
||||
{l s='Forecast' mod='dashgoals'}
|
||||
<span id="dashgoals_title" class="badge">{$goals_year}</span>
|
||||
<span class="btn-group">
|
||||
<a href="javascript:void(0);" onclick="dashgoals_changeYear('backward');" class="btn btn-default btn-xs"><i class="icon-backward"></i></a>
|
||||
<a href="javascript:void(0);" onclick="dashgoals_changeYear('forward');" class="btn btn-default btn-xs"><i class="icon-forward"></i></a>
|
||||
</span>
|
||||
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="toggleDashConfig('dashgoals');" title="{l s='Configure' mod='dashtrends'}">
|
||||
<i class="process-icon-configure"></i>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="refreshDashboard('dashgoals');" title="{l s='Refresh' mod='dashtrends'}">
|
||||
<i class="process-icon-refresh"></i>
|
||||
</a>
|
||||
</span>
|
||||
</header>
|
||||
{include file='./config.tpl'}
|
||||
<section class="loading">
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-default">
|
||||
<input type="radio" name="options" onchange="selectDashgoalsChart('traffic');"/><i class="icon-circle" style="color:{$colors[0]}"></i> {l s='Traffic' mod='dashgoals'}
|
||||
</label>
|
||||
<label class="btn btn-default">
|
||||
<input type="radio" name="options" onchange="selectDashgoalsChart('conversion');"/><i class="icon-circle" style="color:{$colors[1]}"></i> {l s='Conversion' mod='dashgoals'}
|
||||
</label>
|
||||
<label class="btn btn-default">
|
||||
<input type="radio" name="options" onchange="selectDashgoalsChart('avg_cart_value');"/><i class="icon-circle" style="color:{$colors[2]}"></i> {l s='Average Cart Value' mod='dashgoals'}
|
||||
</label>
|
||||
<label class="btn btn-default active">
|
||||
<input type="radio" name="options" onchange="selectDashgoalsChart('sales');"/><i class="icon-circle" style="color:{$colors[3]}"></i> {l s='Sales' mod='dashgoals'}
|
||||
</label>
|
||||
</div>
|
||||
<div id="dash_goals_chart1" class="chart with-transitions">
|
||||
<svg></svg>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
35
modules/dashgoals/views/templates/hook/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
35
modules/dashgoals/views/templates/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
@ -1 +0,0 @@
|
||||
Subproject commit b9c3c7c440ac6ae7b2e67003ce89d4e3b6c881ff
|
3
modules/dashproducts/CHANGELOG.txt
Normal file
@ -0,0 +1,3 @@
|
||||
2014-04-22 18:58:19 +0200 // Changelog updated
|
||||
2014-03-24 15:21:15 +0100 / MO dashproducts : ps_versions_compliancy added
|
||||
2014-03-20 14:32:28 +0100 Initial commit
|
37
modules/dashproducts/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Dashboard Products
|
||||
|
||||
## About
|
||||
|
||||
Adds a block with a table of your latest orders and a ranking of your products.
|
||||
|
||||
## 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 dashproducts 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
|
||||
|
12
modules/dashproducts/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashproducts</name>
|
||||
<displayName><![CDATA[Dashboard Products]]></displayName>
|
||||
<version><![CDATA[0.3.3]]></version>
|
||||
<description><![CDATA[Adds a block with a table of your latest orders and a ranking of your products.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[dashboard]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/dashproducts/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashproducts</name>
|
||||
<displayName><![CDATA[Tableau de bord Produits]]></displayName>
|
||||
<version><![CDATA[0.3.3]]></version>
|
||||
<description><![CDATA[Ajoute un bloc avec un tableau de vos dernières commandes et le classement de vos meilleurs produits]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[dashboard]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
586
modules/dashproducts/dashproducts.php
Normal file
@ -0,0 +1,586 @@
|
||||
<?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 DashProducts extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'dashproducts';
|
||||
$this->tab = 'dashboard';
|
||||
$this->version = '0.3.3';
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
$this->push_filename = _PS_CACHE_DIR_.'push/activity';
|
||||
$this->allow_push = true;
|
||||
|
||||
parent::__construct();
|
||||
$this->displayName = $this->l('Dashboard Products');
|
||||
$this->description = $this->l('Adds a block with a table of your latest orders and a ranking of your products');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_LAST_ORDER', 10);
|
||||
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_BEST_SELLER', 10);
|
||||
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_MOST_VIEWED', 10);
|
||||
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_TOP_SEARCH', 10);
|
||||
|
||||
return (parent::install()
|
||||
&& $this->registerHook('dashboardZoneTwo')
|
||||
&& $this->registerHook('dashboardData')
|
||||
&& $this->registerHook('actionObjectOrderAddAfter')
|
||||
&& $this->registerHook('actionSearch')
|
||||
);
|
||||
}
|
||||
|
||||
public function hookDashboardZoneTwo($params)
|
||||
{
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'DASHACTIVITY_CART_ACTIVE' => Configuration::get('DASHACTIVITY_CART_ACTIVE'),
|
||||
'DASHACTIVITY_VISITOR_ONLINE' => Configuration::get('DASHACTIVITY_VISITOR_ONLINE'),
|
||||
'DASHPRODUCT_NBR_SHOW_LAST_ORDER' => Configuration::get('DASHPRODUCT_NBR_SHOW_LAST_ORDER'),
|
||||
'DASHPRODUCT_NBR_SHOW_BEST_SELLER' => Configuration::get('DASHPRODUCT_NBR_SHOW_BEST_SELLER'),
|
||||
'DASHPRODUCT_NBR_SHOW_TOP_SEARCH' => Configuration::get('DASHPRODUCT_NBR_SHOW_TOP_SEARCH'),
|
||||
'date_from' => Tools::displayDate($params['date_from']),
|
||||
'date_to' => Tools::displayDate($params['date_to']),
|
||||
'dashproducts_config_form' => $this->renderConfigForm(),
|
||||
)
|
||||
);
|
||||
|
||||
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
|
||||
}
|
||||
|
||||
public function hookDashboardData($params)
|
||||
{
|
||||
$table_recent_orders = $this->getTableRecentOrders();
|
||||
$table_best_sellers = $this->getTableBestSellers($params['date_from'], $params['date_to']);
|
||||
$table_most_viewed = $this->getTableMostViewed($params['date_from'], $params['date_to']);
|
||||
$table_top_10_most_search = $this->getTableTop10MostSearch($params['date_from'], $params['date_to']);
|
||||
|
||||
//$table_top_5_search = $this->getTableTop5Search();
|
||||
return array(
|
||||
'data_table' => array(
|
||||
'table_recent_orders' => $table_recent_orders,
|
||||
'table_best_sellers' => $table_best_sellers,
|
||||
'table_most_viewed' => $table_most_viewed,
|
||||
'table_top_10_most_search' => $table_top_10_most_search,
|
||||
//'table_top_5_search' => $table_top_5_search
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getTableRecentOrders()
|
||||
{
|
||||
$header = array(
|
||||
array('title' => $this->l('Customer Name'), 'class' => 'text-left'),
|
||||
array('title' => $this->l('Products'), 'class' => 'text-center'),
|
||||
array('title' => $this->l('Total'), 'class' => 'text-center'),
|
||||
array('title' => $this->l('Date'), 'class' => 'text-center'),
|
||||
array('title' => $this->l('Action'), 'class' => 'text-center'),
|
||||
);
|
||||
|
||||
$limit = (int)Configuration::get('DASHPRODUCT_NBR_SHOW_LAST_ORDER') ? (int)Configuration::get('DASHPRODUCT_NBR_SHOW_LAST_ORDER') : 10;
|
||||
$orders = Order::getOrdersWithInformations($limit);
|
||||
|
||||
$body = array();
|
||||
foreach ($orders as $order)
|
||||
{
|
||||
$currency = Currency::getCurrency((int)$order['id_currency']);
|
||||
$tr = array();
|
||||
$tr[] = array(
|
||||
'id' => 'firstname_lastname',
|
||||
'value' => Tools::htmlentitiesUTF8($order['firstname']).' '.Tools::htmlentitiesUTF8($order['lastname']),
|
||||
'class' => 'text-left',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'total_products',
|
||||
'value' => count(OrderDetail::getList((int)$order['id_order'])),
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'total_paid',
|
||||
'value' => Tools::displayPrice((float)$order['total_paid'], $currency),
|
||||
'class' => 'text-center',
|
||||
'wrapper_start' => $order['valid'] ? '<span class="badge badge-success">' : '',
|
||||
'wrapper_end' => '<span>',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'date_add',
|
||||
'value' => Tools::displayDate($order['date_add']),
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'details',
|
||||
'value' => $this->l('Details'),
|
||||
'class' => 'text-right',
|
||||
'wrapper_start' => '<a class="btn btn-default" href="index.php?tab=AdminOrders&id_order='.(int)$order['id_order'].'&vieworder&token='.Tools::getAdminTokenLite('AdminOrders').'" title="'.$this->l('Details').'"><i class="icon-search"></i>',
|
||||
'wrapper_end' => '</a>'
|
||||
);
|
||||
|
||||
$body[] = $tr;
|
||||
}
|
||||
|
||||
return array('header' => $header, 'body' => $body);
|
||||
}
|
||||
|
||||
public function getTableBestSellers($date_from, $date_to)
|
||||
{
|
||||
$header = array(
|
||||
array(
|
||||
'id' => 'image',
|
||||
'title' => $this->l('Image'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'product',
|
||||
'title' => $this->l('Product'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'category',
|
||||
'title' => $this->l('Category'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'total_sold',
|
||||
'title' => $this->l('Total sold'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'sales',
|
||||
'title' => $this->l('Sales'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'net_profit',
|
||||
'title' => $this->l('Net profit'),
|
||||
'class' => 'text-center',
|
||||
)
|
||||
);
|
||||
|
||||
$products = Db::getInstance()->ExecuteS(
|
||||
'
|
||||
SELECT
|
||||
product_id,
|
||||
count(*) as total,
|
||||
AVG(total_price_tax_excl / conversion_rate) as price,
|
||||
SUM(total_price_tax_excl / conversion_rate) as sales,
|
||||
SUM(product_quantity * purchase_supplier_price / conversion_rate) as expenses
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"
|
||||
AND valid = 1
|
||||
'.Shop::addSqlRestriction(false, 'o').'
|
||||
GROUP BY product_id
|
||||
ORDER BY total DESC
|
||||
LIMIT '.(int)Configuration::get('DASHPRODUCT_NBR_SHOW_BEST_SELLER', 10)
|
||||
);
|
||||
|
||||
$body = array();
|
||||
foreach ($products as $product)
|
||||
{
|
||||
$product_obj = new Product((int)$product['product_id'], false, $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($product_obj))
|
||||
continue;
|
||||
$category = new Category($product_obj->getDefaultCategory(), $this->context->language->id);
|
||||
|
||||
$img = '';
|
||||
if (($row_image = Product::getCover($product_obj->id)) && $row_image['id_image'])
|
||||
{
|
||||
$image = new Image($row_image['id_image']);
|
||||
$path_to_image = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$this->context->controller->imageType;
|
||||
$img = ImageManager::thumbnail($path_to_image, 'product_mini_'.$product_obj->id.'.'.$this->context->controller->imageType, 45, $this->context->controller->imageType);
|
||||
}
|
||||
|
||||
$body[] = array(
|
||||
array(
|
||||
'id' => 'product',
|
||||
'value' => $img,
|
||||
'class' => 'text-center'
|
||||
),
|
||||
array(
|
||||
'id' => 'product',
|
||||
'value' => Tools::htmlentitiesUTF8($product_obj->name).'<br/>'.Tools::displayPrice($product['price']),
|
||||
'class' => 'text-center'
|
||||
),
|
||||
array(
|
||||
'id' => 'category',
|
||||
'value' => $category->name,
|
||||
'class' => 'text-center'
|
||||
),
|
||||
array(
|
||||
'id' => 'total_sold',
|
||||
'value' => $product['total'],
|
||||
'class' => 'text-center'
|
||||
),
|
||||
array(
|
||||
'id' => 'sales',
|
||||
'value' => Tools::displayPrice($product['sales']),
|
||||
'class' => 'text-center'
|
||||
),
|
||||
array(
|
||||
'id' => 'net_profit',
|
||||
'value' => Tools::displayPrice($product['sales'] - $product['expenses']),
|
||||
'class' => 'text-center'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return array('header' => $header, 'body' => $body);
|
||||
}
|
||||
|
||||
public function getTableMostViewed($date_from, $date_to)
|
||||
{
|
||||
$header = array(
|
||||
array(
|
||||
'id' => 'image',
|
||||
'title' => $this->l('Image'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'product',
|
||||
'title' => $this->l('Product'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'views',
|
||||
'title' => $this->l('Views'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'added_to_cart',
|
||||
'title' => $this->l('Added to cart'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'purchased',
|
||||
'title' => $this->l('Purchased'),
|
||||
'class' => 'text-center',
|
||||
),
|
||||
array(
|
||||
'id' => 'rate',
|
||||
'title' => $this->l('Percentage'),
|
||||
'class' => 'text-center',
|
||||
)
|
||||
);
|
||||
|
||||
if (Configuration::get('PS_STATSDATA_PAGESVIEWS'))
|
||||
{
|
||||
$products = $this->getTotalViewed($date_from, $date_to, (int)Configuration::get('DASHPRODUCT_NBR_SHOW_MOST_VIEWED'));
|
||||
$body = array();
|
||||
if (is_array($products) && count($products))
|
||||
foreach ($products as $product)
|
||||
{
|
||||
$product_obj = new Product((int)$product['id_object'], true, $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($product_obj))
|
||||
continue;
|
||||
|
||||
$img = '';
|
||||
if (($row_image = Product::getCover($product_obj->id)) && $row_image['id_image'])
|
||||
{
|
||||
$image = new Image($row_image['id_image']);
|
||||
$path_to_image = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$this->context->controller->imageType;
|
||||
$img = ImageManager::thumbnail($path_to_image, 'product_mini_'.$product_obj->id.'.'.$this->context->controller->imageType, 45, $this->context->controller->imageType);
|
||||
}
|
||||
|
||||
$tr = array();
|
||||
$tr[] = array(
|
||||
'id' => 'product',
|
||||
'value' => $img,
|
||||
'class' => 'text-center'
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'product',
|
||||
'value' => Tools::htmlentitiesUTF8($product_obj->name).'<br/>'.Tools::displayPrice(Product::getPriceStatic((int)$product_obj->id)),
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'views',
|
||||
'value' => $product['counter'],
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$added_cart = $this->getTotalProductAddedCart($date_from, $date_to, (int)$product_obj->id);
|
||||
$tr[] = array(
|
||||
'id' => 'added_to_cart',
|
||||
'value' => $added_cart,
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$purchased = $this->getTotalProductPurchased($date_from, $date_to, (int)$product_obj->id);
|
||||
$tr[] = array(
|
||||
'id' => 'purchased',
|
||||
'value' => $this->getTotalProductPurchased($date_from, $date_to, (int)$product_obj->id),
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'rate',
|
||||
'value' => ($product['counter'] ? round(100 * $purchased / $product['counter'], 1).'%' : '-'),
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$body[] = $tr;
|
||||
}
|
||||
}
|
||||
else
|
||||
$body = '<div class="alert alert-info">'.$this->l('You must enable the "Save global page views" option from the "Data mining for statistics" module in order to display the most viewed products, or use the Google Analytics module.').'</div>';
|
||||
return array('header' => $header, 'body' => $body);
|
||||
}
|
||||
|
||||
public function getTableTop10MostSearch($date_from, $date_to)
|
||||
{
|
||||
$header = array(
|
||||
array(
|
||||
'id' => 'reference',
|
||||
'title' => $this->l('Term'),
|
||||
'class' => 'text-left'
|
||||
),
|
||||
array(
|
||||
'id' => 'name',
|
||||
'title' => $this->l('Search'),
|
||||
'class' => 'text-center'
|
||||
),
|
||||
array(
|
||||
'id' => 'totalQuantitySold',
|
||||
'title' => $this->l('Results'),
|
||||
'class' => 'text-center'
|
||||
)
|
||||
);
|
||||
|
||||
$terms = $this->getMostSearchTerms($date_from, $date_to, (int)Configuration::get('DASHPRODUCT_NBR_SHOW_TOP_SEARCH'));
|
||||
$body = array();
|
||||
if (is_array($terms) && count($terms))
|
||||
foreach ($terms as $term)
|
||||
{
|
||||
$tr = array();
|
||||
$tr[] = array(
|
||||
'id' => 'product',
|
||||
'value' => $term['keywords'],
|
||||
'class' => 'text-left',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'product',
|
||||
'value' => $term['count_keywords'],
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$tr[] = array(
|
||||
'id' => 'product',
|
||||
'value' => $term['results'],
|
||||
'class' => 'text-center',
|
||||
);
|
||||
$body[] = $tr;
|
||||
}
|
||||
|
||||
return array('header' => $header, 'body' => $body);
|
||||
}
|
||||
|
||||
public function getTableTop5Search()
|
||||
{
|
||||
$header = array(
|
||||
array(
|
||||
'id' => 'reference',
|
||||
'title' => $this->l('Product'),
|
||||
)
|
||||
);
|
||||
|
||||
$body = array();
|
||||
|
||||
return array('header' => $header, 'body' => $body);
|
||||
}
|
||||
|
||||
public function getTotalProductSales($date_from, $date_to, $id_product)
|
||||
{
|
||||
$sql = 'SELECT SUM(od.`product_quantity` * od.`product_price`) AS total
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
|
||||
WHERE od.`product_id` = '.(int)$id_product.'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND o.`date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"';
|
||||
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
public function getTotalProductAddedCart($date_from, $date_to, $id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT count(`id_product`) as count
|
||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||
'.Shop::addSqlRestriction(false, 'cp').'
|
||||
AND cp.`date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"');
|
||||
}
|
||||
|
||||
public function getTotalProductPurchased($date_from, $date_to, $id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT count(`product_id`) as count
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
|
||||
WHERE od.`product_id` = '.(int)$id_product.'
|
||||
'.Shop::addSqlRestriction(false, 'od').'
|
||||
AND o.valid = 1
|
||||
AND o.`date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"');
|
||||
}
|
||||
|
||||
public function getTotalViewed($date_from, $date_to, $limit = 10)
|
||||
{
|
||||
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
|
||||
if (Validate::isLoadedObject($gapi) && $gapi->isConfigured())
|
||||
{
|
||||
$products = array();
|
||||
// Only works with the default product URL pattern at this time
|
||||
if ($result = $gapi->requestReportData('ga:pagePath', 'ga:visits', $date_from, $date_to, '-ga:visits', 'ga:pagePath=~/([a-z]{2}/)?([a-z]+/)?[0-9][0-9]*\-.*\.html$', 1, 10))
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (preg_match('@/([a-z]{2}/)?([a-z]+/)?([0-9]+)\-.*\.html$@', $row['dimensions']['pagePath'], $matches))
|
||||
$products[] = array('id_object' => (int)$matches[3], 'counter' => $row['metrics']['visits']);
|
||||
}
|
||||
|
||||
return $products;
|
||||
}
|
||||
else
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT p.id_object, pv.counter
|
||||
FROM `'._DB_PREFIX_.'page_viewed` pv
|
||||
LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
|
||||
WHERE pt.`name` = \'product\'
|
||||
'.Shop::addSqlRestriction(false, 'pv').'
|
||||
AND dr.`time_start` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
|
||||
AND dr.`time_end` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
|
||||
LIMIT '.(int)$limit);
|
||||
}
|
||||
|
||||
public function getMostSearchTerms($date_from, $date_to, $limit = 10)
|
||||
{
|
||||
if (!Module::isInstalled('statssearch'))
|
||||
return array();
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `keywords`, count(`id_statssearch`) as count_keywords, `results`
|
||||
FROM `'._DB_PREFIX_.'statssearch` ss
|
||||
WHERE ss.`date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
|
||||
'.Shop::addSqlRestriction(false, 'ss').'
|
||||
GROUP BY ss.`keywords`
|
||||
ORDER BY `count_keywords` DESC
|
||||
LIMIT '.(int)$limit);
|
||||
}
|
||||
|
||||
public function renderConfigForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'input' => array(),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'btn btn-default pull-right submit_dash_config',
|
||||
'reset' => array(
|
||||
'title' => $this->l('Cancel'),
|
||||
'class' => 'btn btn-default cancel_dash_config',
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$inputs = array(
|
||||
array(
|
||||
'label' => $this->l('Number of "Recent Orders" to display'),
|
||||
'config_name' => 'DASHPRODUCT_NBR_SHOW_LAST_ORDER'
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Number of "Best Sellers" to display'),
|
||||
'config_name' => 'DASHPRODUCT_NBR_SHOW_BEST_SELLER'
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Number of "Most Viewed" to display'),
|
||||
'config_name' => 'DASHPRODUCT_NBR_SHOW_MOST_VIEWED'
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Number of "Top Searches" to display'),
|
||||
'config_name' => 'DASHPRODUCT_NBR_SHOW_TOP_SEARCH'
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($inputs as $input)
|
||||
$fields_form['form']['input'][] = array(
|
||||
'type' => 'select',
|
||||
'label' => $input['label'],
|
||||
'name' => $input['config_name'],
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 5, 'name' => 5),
|
||||
array('id' => 10, 'name' => 10),
|
||||
array('id' => 20, 'name' => 20),
|
||||
array('id' => 50, 'name' => 50),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
)
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
$helper->id = (int)Tools::getValue('id_carrier');
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitDashConfig';
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'DASHPRODUCT_NBR_SHOW_LAST_ORDER' => Configuration::get('DASHPRODUCT_NBR_SHOW_LAST_ORDER'),
|
||||
'DASHPRODUCT_NBR_SHOW_BEST_SELLER' => Configuration::get('DASHPRODUCT_NBR_SHOW_BEST_SELLER'),
|
||||
'DASHPRODUCT_NBR_SHOW_MOST_VIEWED' => Configuration::get('DASHPRODUCT_NBR_SHOW_MOST_VIEWED'),
|
||||
'DASHPRODUCT_NBR_SHOW_TOP_SEARCH' => Configuration::get('DASHPRODUCT_NBR_SHOW_TOP_SEARCH'),
|
||||
);
|
||||
}
|
||||
|
||||
public function hookActionObjectOrderAddAfter($params)
|
||||
{
|
||||
Tools::changeFileMTime($this->push_filename);
|
||||
}
|
||||
|
||||
public function hookActionSearch($params)
|
||||
{
|
||||
Tools::changeFileMTime($this->push_filename);
|
||||
}
|
||||
}
|
35
modules/dashproducts/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
BIN
modules/dashproducts/logo.gif
Normal file
After Width: | Height: | Size: 964 B |
BIN
modules/dashproducts/logo.png
Normal file
After Width: | Height: | Size: 610 B |
49
modules/dashproducts/translations/fr.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_6655df4af87b2038afd507a33545a56d'] = 'Tableau de bord Produits';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_4a528e24be5aca96e8a15b256efe1f31'] = 'Ajoute un bloc avec un tableau de vos dernières commandes et le classement de vos meilleurs produits';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_2ea989f83006e233627987293f4bde0a'] = 'Nom du client';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_068f80c7519d0528fb08e82137a72131'] = 'Produits';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_96b0141273eabab320119c467cdcaf17'] = 'Total';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_44749712dbec183e983dcd78a7736c41'] = 'Date';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_004bf6c9a40003140292e97330236c53'] = 'Outils';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_3ec365dd533ddb7ef3d1c111186ce872'] = 'Détails';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_be53a0541a6d36f6ecb879fa2c584b08'] = 'Image';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_deb10517653c255364175796ace3553f'] = 'Produit';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_3adbdb3ac060038aa0e6e6c138ef9873'] = 'Catégorie';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_2aed3d711270a6ed67d21ec2d7cd4af8'] = 'Total vendu';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_11ff9f68afb6b8b5b8eda218d7c83a65'] = 'Ventes';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_9e79098315622e58529d664b9a8b3cf8'] = 'Bénéfice net';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_ed4832a84ee072b00a6740f657183598'] = 'Vues';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_2c04f1ad7694378897b98624780327ff'] = 'Ajoutés au panier';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_ce4ee01637f4279d02d0f232459dc9a4'] = 'Achetés';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_37be07209f53a5d636d5c904ca9ae64c'] = 'Pourcentage';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_1eb18ea1d018abef5759cef60ddc289b'] = 'Vous devez activer l\'option "Enregistrer les pages vues pour chaque client" du module "Récupération des données statistiques" afin d\'afficher les produits les plus vus, ou utiliser le module Google Analytics.';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_cf5f3091e30dee6597885d8c0e0c357f'] = 'Terme';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_13348442cc6a27032d2b4aa28b75a5d3'] = 'Rechercher';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_fd69c5cf902969e6fb71d043085ddee6'] = 'Résultats';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_85bf7474324d7d02725e4dca586afcd9'] = 'Nombre de "Commandes récentes" à afficher';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_735b8c7f6d50b4c6f818deeab3cdea4a'] = 'Nombre de "Meilleures ventes" à afficher';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_14d24dddc4c67abf8364b980b2ccd5a2'] = 'Nombre de "Produits les plus vus" à afficher';
|
||||
$_MODULE['<{dashproducts}prestashop>dashproducts_f1ee1eaab342241138d45f35f4d8466a'] = 'Nombre de "Meilleures recherches" à afficher';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_3e361ce73ecabd6524af286d55809ed7'] = 'Produits et Ventes';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_63a6a88c066880c5ac42394a22803ca6'] = 'Rafraîchir';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_254f642527b45bc260048e30704edb39'] = 'Paramètres';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_fd3458547ef9c3a8bd0e1e1b4ef2b4dd'] = 'Commandes récentes';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_d7b2933ba512ada478c97fa43dd7ebe6'] = 'Meilleures Ventes';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_be5006eb5af9ab6dbca803f8d3065bbc'] = 'plus vus';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_1eb5e5713d7363e921dd7f5500b6d212'] = 'Meilleures recherches';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_3d23ac9ab254a9f1014c3a859b01bcfc'] = '%d dernières commandes';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_82f0f8d535196ce2a6ea16652d981f94'] = '%d meilleurs produits';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_5da618e8e4b89c66fe86e32cdafde142'] = 'Du';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_01b6e20344b68835c5ed1ddedf20d531'] = 'jusqu\'au';
|
||||
$_MODULE['<{dashproducts}prestashop>dashboard_zone_two_1daaca459ce1e6610e0b97a9ad723f27'] = '%d mots les plus recherchés';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/dashproducts/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
35
modules/dashproducts/views/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
123
modules/dashproducts/views/templates/hook/dashboard_zone_two.tpl
Normal file
@ -0,0 +1,123 @@
|
||||
{*
|
||||
* 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
|
||||
*}
|
||||
|
||||
<section id="dashproducts" class="panel widget {if $allow_push} allow_push{/if}">
|
||||
<header class="panel-heading">
|
||||
<i class="icon-bar-chart"></i> {l s='Products and Sales' mod='dashproducts'}
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-toolbar-btn" href="#" onclick="toggleDashConfig('dashproducts'); return false;" title="{l s='Configure' mod='dashproducts'}">
|
||||
<i class="process-icon-configure"></i>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="#" onclick="refreshDashboard('dashproducts'); return false;" title="{l s='Refresh' mod='dashproducts'}">
|
||||
<i class="process-icon-refresh"></i>
|
||||
</a>
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<section id="dashproducts_config" class="dash_config hide">
|
||||
<header><i class="icon-wrench"></i> {l s='Configuration' mod='dashproducts'}</header>
|
||||
{$dashproducts_config_form}
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<nav>
|
||||
<ul class="nav nav-pills">
|
||||
<li class="active">
|
||||
<a href="#dash_recent_orders" data-toggle="tab">
|
||||
<i class="icon-fire"></i>
|
||||
<span class="hidden-inline-xs">{l s='Recent Orders' mod='dashproducts'}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#dash_best_sellers" data-toggle="tab">
|
||||
<i class="icon-trophy"></i>
|
||||
<span class="hidden-inline-xs">{l s='Best Sellers' mod='dashproducts'}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#dash_most_viewed" data-toggle="tab">
|
||||
<i class="icon-eye-open"></i>
|
||||
<span class="hidden-inline-xs">{l s='Most Viewed' mod='dashproducts'}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#dash_top_search" data-toggle="tab">
|
||||
<i class="icon-search"></i>
|
||||
<span class="hidden-inline-xs">{l s='Top Searches' mod='dashproducts'}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="tab-content panel">
|
||||
<div class="tab-pane active" id="dash_recent_orders">
|
||||
<h3>{l s='Last %d orders' sprintf=$DASHPRODUCT_NBR_SHOW_LAST_ORDER|intval mod='dashproducts'}</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table data_table" id="table_recent_orders">
|
||||
<thead></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="dash_best_sellers">
|
||||
<h3>
|
||||
{l s='Top %d products' sprintf=$DASHPRODUCT_NBR_SHOW_BEST_SELLER|intval mod='dashproducts'}
|
||||
<span>{l s="From" mod='dashproducts'} {$date_from} {l s="to" mod='dashproducts'} {$date_to}</span>
|
||||
</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table data_table" id="table_best_sellers">
|
||||
<thead></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="dash_most_viewed">
|
||||
<h3>
|
||||
{l s="Most Viewed" mod='dashproducts'}
|
||||
<span>{l s="From" mod='dashproducts'} {$date_from} {l s="to" mod='dashproducts'} {$date_to}</span>
|
||||
</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table data_table" id="table_most_viewed">
|
||||
<thead></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="dash_top_search">
|
||||
<h3>
|
||||
{l s='Top %d most search terms' sprintf=$DASHPRODUCT_NBR_SHOW_TOP_SEARCH|intval mod='dashproducts'}
|
||||
<span>{l s="From" mod='dashproducts'} {$date_from} {l s="to" mod='dashproducts'} {$date_to}</span>
|
||||
</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table data_table" id="table_top_10_most_search">
|
||||
<thead></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</section>
|
35
modules/dashproducts/views/templates/hook/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
35
modules/dashproducts/views/templates/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
@ -1 +0,0 @@
|
||||
Subproject commit 12d4a2932c0fca927d3b807e3e91a0678b6316db
|
10
modules/dashtrends/CHANGELOG.txt
Normal file
@ -0,0 +1,10 @@
|
||||
2014-04-22 16:25:49 +0200 // dashtrends: Better translatability.
|
||||
2014-04-14 14:51:09 +0200 [-] MO : Dashtrends - FixBug #PSCSX-1742
|
||||
2014-04-03 10:17:09 +0200 // fix date
|
||||
2014-04-01 16:33:15 +0200 [*] MO : Dashboard trends - FixBug PSCSX-1517
|
||||
2014-04-01 15:48:49 +0200 [-] MO : Dashtrends - FixBug #PSCSX-1527 - Wrong date
|
||||
2014-03-31 16:50:35 +0200 // Missing correct color on dashtrends init
|
||||
2014-03-31 16:47:09 +0200 // Fix dashtrends init
|
||||
2014-03-29 14:14:48 +0100 [-] MO : Dashtrends - FixBug #PSCSX-984 - Set units for all graphs
|
||||
2014-03-24 15:45:38 +0100 / MO dashtrends : ps_versions_compliancy added
|
||||
2014-03-20 14:32:31 +0100 Initial commit
|
37
modules/dashtrends/Readme.md
Normal 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
|
||||
|
12
modules/dashtrends/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>dashtrends</name>
|
||||
<displayName><![CDATA[Dashboard Trends]]></displayName>
|
||||
<version><![CDATA[0.7.5]]></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>
|
12
modules/dashtrends/config_fr.xml
Normal 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[0.7.5]]></version>
|
||||
<description><![CDATA[Ajoute à votre tableau de bord un graphique représentant l'évolution des indicateurs clé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>
|
338
modules/dashtrends/dashtrends.php
Normal file
@ -0,0 +1,338 @@
|
||||
<?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 = '0.7.5';
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
$this->push_filename = _PS_CACHE_DIR_.'push/trends';
|
||||
$this->allow_push = true;
|
||||
|
||||
parent::__construct();
|
||||
$this->displayName = $this->l('Dashboard Trends');
|
||||
$this->description = $this->l('Adds a block with a graphical representation of the development of your store(s) based on selected key data.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', '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
|
||||
));
|
||||
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).'%' : '∞')
|
||||
),
|
||||
'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).'%' : '∞')
|
||||
),
|
||||
'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).'%' : '∞')
|
||||
),
|
||||
'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).'%' : '∞')
|
||||
),
|
||||
'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->l('%s points'), round(100 * ($data1['conversion_rate'] - $data2['conversion_rate']), 2)) : '∞')
|
||||
),
|
||||
'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).'%' : '∞')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function hookDashboardData($params)
|
||||
{
|
||||
// Artificially remove the decimals in order to get a cleaner Dashboard
|
||||
$currency = clone $this->context->currency;
|
||||
$currency->decimals = 0;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
return array(
|
||||
'data_value' => array(
|
||||
'sales_score' => Tools::displayPrice(round($this->dashboard_data_sum['sales']), $currency),
|
||||
'orders_score' => Tools::displayNumber($this->dashboard_data_sum['orders'], $currency),
|
||||
'cart_value_score' => Tools::displayPrice($this->dashboard_data_sum['average_cart_value'], $currency),
|
||||
'visits_score' => Tools::displayNumber($this->dashboard_data_sum['visits'], $currency),
|
||||
'conversion_rate_score' => round(100 * $this->dashboard_data_sum['conversion_rate'], 2).'%',
|
||||
'net_profits_score' => Tools::displayPrice(round($this->dashboard_data_sum['net_profits']), $currency),
|
||||
),
|
||||
'data_trends' => $this->data_trends,
|
||||
'data_chart' => array('dash_trends_chart1' => $this->getChartTrends()),
|
||||
);
|
||||
}
|
||||
|
||||
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->l('Sales'),
|
||||
'orders' => $this->l('Orders'),
|
||||
'average_cart_value' => $this->l('Average Cart Value'),
|
||||
'visits' => $this->l('Visits'),
|
||||
'conversion_rate' => $this->l('Conversion Rate'),
|
||||
'net_profits' => $this->l('Net Profit')
|
||||
);
|
||||
|
||||
$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->l('%s (previous period)'), $title),
|
||||
'values' => $chart_data_compare[$key],
|
||||
'disabled' => ($key == 'sales' ? false : true)
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function hookActionOrderStatusPostUpdate($params)
|
||||
{
|
||||
Tools::changeFileMTime($this->push_filename);
|
||||
}
|
||||
}
|
35
modules/dashtrends/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
BIN
modules/dashtrends/logo.gif
Normal file
After Width: | Height: | Size: 973 B |
BIN
modules/dashtrends/logo.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
33
modules/dashtrends/translations/fr.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_ee653ade5f520037ef95e9dc2a42364c'] = 'Tableau de bord des tendances';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_f2d0efa68eb71bfd5209abeb9f4b0943'] = 'Ajoute à votre tableau de bord un graphique représentant l\'évolution des indicateurs clés de votre boutique.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_2d125dc25b158f28a1960bd96a9fa8d1'] = '%s points';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_11ff9f68afb6b8b5b8eda218d7c83a65'] = 'Ventes';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_8c804960da61b637c548c951652b0cac'] = 'Panier moyen';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_d7e637a6e9ff116de2fa89551240a94d'] = 'Visites';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_e4c3da18c66c0147144767efeb59198f'] = 'Taux de transformation';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_43d729c7b81bfa5fc10e756660d877d1'] = 'Bénéfice net';
|
||||
$_MODULE['<{dashtrends}prestashop>dashtrends_46418a037045b91e6715c4da91a2a269'] = '%s (période précédente)';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_2938c7f7e560ed972f8a4f68e80ff834'] = 'Tableau de bord';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_63a6a88c066880c5ac42394a22803ca6'] = 'Rafraîchir';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_e537825dd409a90ef70d8c2eb56122a1'] = 'Chiffre d\'affaires (HT) généré sur la période donnée par les commandes considérées comme validées.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_11ff9f68afb6b8b5b8eda218d7c83a65'] = 'Ventes';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_8bc1c5ca521b99b87908db0bcd33ec76'] = 'Nombre total de commandes passées dans l\'intervalle de dates et considérées comme validées.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_f15f2a2bf99d3dcad2cba1a2c615b9dc'] = 'Le Panier Moyen est une mesure représentant la valeur de la commande moyenne sur la période. Elle est calculée en divisant le montant global des ventes par le nombre de commandes.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_791d6355d34dfaf60d68ef04d1ee5767'] = 'Panier Moyen';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_4f631447981c5fa240006a5ae2c4b267'] = 'Nombre total de visites dans l\'intervalle de dates. Une visite est la durée pendant laquelle un utilisateur est actif sur votre site.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_d7e637a6e9ff116de2fa89551240a94d'] = 'Visites';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_7a6e858f8c7c0b78fb4d43cefcb8c017'] = 'Le taux de conversion e-commerce est le pourcentage de visites ayant abouti à une commande validée.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_e4c3da18c66c0147144767efeb59198f'] = 'Taux de transformation';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_8dedc1b3ee3a92212fb5b5acad7f207f'] = 'Le bénéfice est une mesure de la profitabilité de votre entreprise après déduction de tous les frais de gestion. Vous pouvez renseigner ces coûts en cliquant sur l\'icône de configuration ci-dessus.';
|
||||
$_MODULE['<{dashtrends}prestashop>dashboard_zone_two_43d729c7b81bfa5fc10e756660d877d1'] = 'Bénéfice net';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/dashtrends/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
35
modules/dashtrends/views/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
85
modules/dashtrends/views/js/dashtrends.js
Normal 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();
|
||||
});
|
35
modules/dashtrends/views/js/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
@ -0,0 +1,79 @@
|
||||
{*
|
||||
* 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
|
||||
*}
|
||||
<script>
|
||||
var currency_format = {$currency->format|intval};
|
||||
var currency_sign = '{$currency->sign|@addcslashes:'\''}';
|
||||
var currency_blank = {$currency->blank|intval};
|
||||
var priceDisplayPrecision = 0;
|
||||
</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' mod='dashtrends'}
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-toolbar-btn" href="{$link->getAdminLink('AdminDashboard')|escape:'html':'UTF-8'}&profitability_conf=1" title="{l s='Configure' mod='dashtrends'}">
|
||||
<i class="process-icon-configure"></i>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="#" onclick="refreshDashboard('dashtrends'); return false;" title="{l s='Refresh' mod='dashtrends'}">
|
||||
<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.' mod='dashtrends'}" data-placement="bottom">
|
||||
<dt>{l s='Sales' mod='dashtrends'}</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.' mod='dashtrends'}" data-placement="bottom">
|
||||
<dt>{l s='Orders' mod='dashtrends'}</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.' mod='dashtrends'}" data-placement="bottom">
|
||||
<dt>{l s='Cart Value' mod='dashtrends'}</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.' mod='dashtrends'}" data-placement="bottom">
|
||||
<dt>{l s='Visits' mod='dashtrends'}</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.' mod='dashtrends'}" data-placement="bottom">
|
||||
<dt>{l s='Conversion Rate' mod='dashtrends'}</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.' mod='dashtrends'}" data-placement="bottom">
|
||||
<dt>{l s='Net Profit' mod='dashtrends'}</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>
|
35
modules/dashtrends/views/templates/hook/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
35
modules/dashtrends/views/templates/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
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;
|
@ -1 +0,0 @@
|
||||
Subproject commit f086532625c0ce03dbdec54c38863d4cf2156802
|
4
modules/graphnvd3/CHANGELOG.txt
Normal file
@ -0,0 +1,4 @@
|
||||
2014-04-22 18:58:39 +0200 // Changelog updated
|
||||
2014-04-17 11:58:28 +0200 [-] MO : graphnvd3 - Fix 1.5 ps_version_compliancy issue
|
||||
2014-03-24 15:21:45 +0100 / MO graphnvd3 : ps_versions_compliancy added
|
||||
2014-03-20 14:33:52 +0100 Initial commit
|
37
modules/graphnvd3/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# NVD3 Charts
|
||||
|
||||
## About
|
||||
|
||||
|
||||
|
||||
## 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 graphnvd3 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
|
||||
|
12
modules/graphnvd3/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>graphnvd3</name>
|
||||
<displayName><![CDATA[NVD3 Charts]]></displayName>
|
||||
<version><![CDATA[1.4]]></version>
|
||||
<description><![CDATA[]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[administration]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/graphnvd3/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>graphnvd3</name>
|
||||
<displayName><![CDATA[Graphiques NVD3]]></displayName>
|
||||
<version><![CDATA[1.4]]></version>
|
||||
<description><![CDATA[]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[administration]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
180
modules/graphnvd3/graphnvd3.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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 GraphNvD3 extends ModuleGraphEngine
|
||||
{
|
||||
private $_width;
|
||||
private $_height;
|
||||
private $_values;
|
||||
private $_legend;
|
||||
private $_titles;
|
||||
|
||||
function __construct($type = null)
|
||||
{
|
||||
if ($type !== null)
|
||||
return parent::__construct($type);
|
||||
|
||||
$this->name = 'graphnvd3';
|
||||
$this->tab = 'administration';
|
||||
$this->version = '1.4';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
Module::__construct();
|
||||
|
||||
$this->displayName = $this->l('NVD3 Charts');
|
||||
$this->description = '';
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
return (parent::install() && $this->registerHook('GraphEngine') && $this->registerHook('actionAdminControllerSetMedia'));
|
||||
}
|
||||
|
||||
public function hookActionAdminControllerSetMedia($params)
|
||||
{
|
||||
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
|
||||
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
|
||||
|
||||
$this->context->controller->addJS(array(
|
||||
_PS_JS_DIR_.'vendor/d3.v3.min.js',
|
||||
__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->context->employee->bo_theme.'/js/vendor/nv.d3.min.js',
|
||||
));
|
||||
$this->context->controller->addCSS(__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->context->employee->bo_theme.'/css/vendor/nv.d3.css');
|
||||
}
|
||||
|
||||
public static function hookGraphEngine($params, $drawer)
|
||||
{
|
||||
static $divid = 1;
|
||||
|
||||
if (strpos($params['width'], '%') !== false)
|
||||
$params['width'] = (int)preg_replace('/\s*%\s*/', '', $params['width']).'%';
|
||||
else
|
||||
$params['width'] = (int)$params['width'].'px';
|
||||
|
||||
$nvd3_func = array(
|
||||
'line' => '
|
||||
nv.models.lineChart()',
|
||||
'pie' => '
|
||||
nv.models.pieChart()
|
||||
.x(function(d) { return d.label; })
|
||||
.y(function(d) { return d.value; })
|
||||
.showLabels(true)
|
||||
.showLegend(false)'
|
||||
);
|
||||
|
||||
return '
|
||||
<div id="nvd3_chart_'.$divid.'" class="chart with-transitions">
|
||||
<svg style="width:'.$params['width'].';height:'.(int)$params['height'].'px"></svg>
|
||||
</div>
|
||||
<script>
|
||||
$.ajax({
|
||||
url: "'.addslashes($drawer).'",
|
||||
dataType: "json",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
headers: {"cache-control": "no-cache"},
|
||||
success: function(jsonData){
|
||||
nv.addGraph(function(){
|
||||
var chart = '.$nvd3_func[$params['type']].';
|
||||
|
||||
if (jsonData.axisLabels.xAxis != null)
|
||||
chart.xAxis.axisLabel(jsonData.axisLabels.xAxis);
|
||||
if (jsonData.axisLabels.yAxis != null)
|
||||
chart.yAxis.axisLabel(jsonData.axisLabels.yAxis);
|
||||
|
||||
d3.select("#nvd3_chart_'.($divid++).' svg")
|
||||
.datum(jsonData.data)
|
||||
.transition().duration(500)
|
||||
.call(chart);
|
||||
|
||||
nv.utils.windowResize(chart.update);
|
||||
|
||||
return chart;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function createValues($values)
|
||||
{
|
||||
$this->_values = $values;
|
||||
}
|
||||
|
||||
public function setSize($width, $height)
|
||||
{
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
}
|
||||
|
||||
public function setLegend($legend)
|
||||
{
|
||||
$this->_legend = $legend;
|
||||
}
|
||||
|
||||
public function setTitles($titles)
|
||||
{
|
||||
$this->_titles = $titles;
|
||||
}
|
||||
|
||||
public function draw()
|
||||
{
|
||||
$array = array(
|
||||
'axisLabels' => array('xAxis' => $this->_titles['x'], 'yAxis' => $this->_titles['y']),
|
||||
'data' => array()
|
||||
);
|
||||
|
||||
if (!isset($this->_values[0]) || !is_array($this->_values[0]))
|
||||
{
|
||||
$nvd3_values = array();
|
||||
if (Tools::getValue('type') == 'pie')
|
||||
{
|
||||
foreach ($this->_values as $x => $y)
|
||||
$nvd3_values[] = array('label' => $this->_legend[$x], 'value' => $y);
|
||||
$array['data'] = $nvd3_values;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($this->_values as $x => $y)
|
||||
$nvd3_values[] = array('x' => $x, 'y' => $y);
|
||||
$array['data'][] = array('values' => $nvd3_values, 'key' => $this->_titles['main']);
|
||||
}
|
||||
}
|
||||
else
|
||||
foreach ($this->_values as $layer => $gross_values)
|
||||
{
|
||||
$nvd3_values = array();
|
||||
foreach ($gross_values as $x => $y)
|
||||
$nvd3_values[] = array('x' => $x, 'y' => $y);
|
||||
$array['data'][] = array('values' => $nvd3_values, 'key' => $this->_titles['main'][$layer]);
|
||||
}
|
||||
die(preg_replace('/"([0-9]+)"/', '$1', Tools::jsonEncode($array)));
|
||||
}
|
||||
}
|
35
modules/graphnvd3/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
BIN
modules/graphnvd3/logo.gif
Normal file
After Width: | Height: | Size: 924 B |
BIN
modules/graphnvd3/logo.png
Normal file
After Width: | Height: | Size: 629 B |
9
modules/graphnvd3/translations/fr.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{graphnvd3}prestashop>graphnvd3_a9f70dff230e6fc8e878043486e6cddf'] = 'Graphiques NVD3';
|
||||
|
||||
|
||||
return $_MODULE;
|
@ -1 +0,0 @@
|
||||
Subproject commit 862c0e26dd98f9d2ced42593e1dc3db090fde007
|
6
modules/gridhtml/CHANGELOG.txt
Normal file
@ -0,0 +1,6 @@
|
||||
2014-04-22 18:58:41 +0200 // Changelog updated
|
||||
2014-04-17 11:33:15 +0200 [-] MO : gridhtml - Fix 1.5 ps_version_compliancy issue
|
||||
2014-04-16 13:26:45 +0200 // Missing closing parenthesis.
|
||||
2014-04-16 12:30:41 +0200 // gridhtml: mode description translatable.
|
||||
2014-03-24 15:21:48 +0100 / MO gridhtml : ps_versions_compliancy added
|
||||
2014-03-20 14:35:17 +0100 Initial commit
|
37
modules/gridhtml/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Simple HTML table display
|
||||
|
||||
## About
|
||||
|
||||
Allows the statistics system to display data in a grid.
|
||||
|
||||
## 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 gridhtml 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
|
||||
|
12
modules/gridhtml/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>gridhtml</name>
|
||||
<displayName><![CDATA[Simple HTML table display]]></displayName>
|
||||
<version><![CDATA[1.2.2]]></version>
|
||||
<description><![CDATA[Allows the statistics system to display data in a grid.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[administration]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/gridhtml/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>gridhtml</name>
|
||||
<displayName><![CDATA[Affichage HTML simple]]></displayName>
|
||||
<version><![CDATA[1.2.2]]></version>
|
||||
<description><![CDATA[Permet au système de statistiques d'afficher ses données dans une grille.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[administration]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
183
modules/gridhtml/gridhtml.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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 GridHtml extends ModuleGridEngine
|
||||
{
|
||||
private $_values;
|
||||
private static $_columns;
|
||||
|
||||
function __construct($type = null)
|
||||
{
|
||||
if ($type != null)
|
||||
parent::__construct($type);
|
||||
else
|
||||
{
|
||||
$this->name = 'gridhtml';
|
||||
$this->tab = 'administration';
|
||||
$this->version = '1.2.2';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
Module::__construct();
|
||||
|
||||
$this->displayName = $this->l('Simple HTML table display');
|
||||
$this->description = $this->l('Allows the statistics system to display data in a grid.');
|
||||
}
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
return (parent::install() AND $this->registerHook('GridEngine'));
|
||||
}
|
||||
|
||||
public static function hookGridEngine($params, $grider)
|
||||
{
|
||||
self::$_columns = $params['columns'];
|
||||
if (!isset($params['emptyMsg']))
|
||||
$params['emptyMsg'] = 'Empty';
|
||||
|
||||
$html = '
|
||||
<table class="table" id="grid_1">
|
||||
<thead>
|
||||
<tr>';
|
||||
foreach ($params['columns'] as $column)
|
||||
$html .= '<th class="center"><span class="title_box active">'.$column['header'].'</span></th>';
|
||||
$html .= '</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
<tfoot><tr><th colspan="'.count($params['columns']).'"></th></tr></tfoot>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
function getGridData(url)
|
||||
{
|
||||
$("#grid_1 tbody").html("<tr><td style=\"text-align:center\" colspan=\"" + '.count($params['columns']).' + "\"><img src=\"../img/loadingAnimation.gif\" /></td></tr>");
|
||||
$.get(url, "", function(json) {
|
||||
$("#grid_1 tbody").html("");
|
||||
var array = $.parseJSON(json);
|
||||
$("#grid_1 tfoot tr th").html("'.addslashes($params['pagingMessage']).'");
|
||||
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html().replace("{0}", array["from"]));
|
||||
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html().replace("{1}", array["to"]));
|
||||
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html().replace("{2}", array["total"]));
|
||||
|
||||
if (array["from"] > 1)
|
||||
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html() + " <a style=\\"cursor:pointer;text-decoration:none\\" onclick=\\"gridPrevPage(\'"+ url +"\');\\"><<</a>");
|
||||
if (array["to"] < array["total"])
|
||||
$("#grid_1 tfoot tr th").html($("#grid_1 tfoot tr th").html() + " | <a style=\\"cursor:pointer;text-decoration:none\\" onclick=\\"gridNextPage(\'"+ url +"\');\\">>></a>");
|
||||
var values = array["values"];
|
||||
if (values.length > 0)
|
||||
$.each(values, function(index, row){
|
||||
var newLine = "<tr>";';
|
||||
foreach ($params['columns'] as $column)
|
||||
$html .= ' newLine += "<td'.(isset($column['align']) ? ' align=\"'.$column['align'].'\"' : '').'>" + row["'.$column['dataIndex'].'"] + "</td>";';
|
||||
if (!isset($params['defaultSortColumn']))
|
||||
$params['defaultSortColumn'] = false;
|
||||
if (!isset($params['defaultSortDirection']))
|
||||
$params['defaultSortDirection'] = false;
|
||||
$html .= ' $("#grid_1 tbody").append(newLine);
|
||||
});
|
||||
else
|
||||
$("#grid_1 tbody").append("<tr><td class=\"center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>");
|
||||
});
|
||||
}
|
||||
|
||||
function gridNextPage(url)
|
||||
{
|
||||
var from = url.match(/&start=[0-9]+/i);
|
||||
if (from && from[0] && parseInt(from[0].replace("&start=", "")) > 0)
|
||||
from = "&start=" + (parseInt(from[0].replace("&start=", "")) + 40);
|
||||
else
|
||||
from = "&start=40";
|
||||
url = url.replace(/&start=[0-9]+/i, "") + from;
|
||||
getGridData(url);
|
||||
}
|
||||
|
||||
function gridPrevPage(url)
|
||||
{
|
||||
var from = url.match(/&start=[0-9]+/i);
|
||||
if (from && from[0] && parseInt(from[0].replace("&start=", "")) > 0)
|
||||
{
|
||||
var fromInt = parseInt(from[0].replace("&start=", "")) - 40;
|
||||
if (fromInt > 0)
|
||||
from = "&start=" + fromInt;
|
||||
else
|
||||
from = "&start=0";
|
||||
}
|
||||
else
|
||||
from = "&start=0";
|
||||
url = url.replace(/&start=[0-9]+/i, "") + from;
|
||||
getGridData(url);
|
||||
}
|
||||
|
||||
$(document).ready(function(){getGridData("'.$grider.'&sort='.urlencode($params['defaultSortColumn']).'&dir='.urlencode($params['defaultSortDirection']).'");});
|
||||
</script>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function setColumnsInfos(&$infos)
|
||||
{
|
||||
}
|
||||
|
||||
public function setValues($values)
|
||||
{
|
||||
$this->_values = $values;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
public function setSize($width, $height)
|
||||
{
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
}
|
||||
|
||||
public function setTotalCount($totalCount)
|
||||
{
|
||||
$this->_totalCount = $totalCount;
|
||||
}
|
||||
|
||||
public function setLimit($start, $limit)
|
||||
{
|
||||
$this->_start = (int)$start;
|
||||
$this->_limit = (int)$limit;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
echo Tools::jsonEncode(array(
|
||||
'total' => $this->_totalCount,
|
||||
'from' => min($this->_start + 1, $this->_totalCount),
|
||||
'to' => min($this->_start + $this->_limit, $this->_totalCount),
|
||||
'values' => $this->_values
|
||||
));
|
||||
}
|
||||
}
|
||||
|
35
modules/gridhtml/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
BIN
modules/gridhtml/logo.gif
Normal file
After Width: | Height: | Size: 998 B |
BIN
modules/gridhtml/logo.png
Normal file
After Width: | Height: | Size: 855 B |
10
modules/gridhtml/translations/fr.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{gridhtml}prestashop>gridhtml_cf6b972204ee563b4e5691b293e931b6'] = 'Affichage HTML simple';
|
||||
$_MODULE['<{gridhtml}prestashop>gridhtml_05ce5a49b49dd6245f71e384c4b43564'] = 'Permet au système de statistiques d\'afficher ses données dans une grille.';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/gridhtml/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
@ -1 +0,0 @@
|
||||
Subproject commit cfa60d018267e810cbda1e5368db1edcfdcecfa8
|
4
modules/homefeatured/CHANGELOG.txt
Normal file
@ -0,0 +1,4 @@
|
||||
2014-04-22 18:58:43 +0200 // Changelog updated
|
||||
2014-04-07 18:48:47 +0200 // typo
|
||||
2014-04-07 18:46:31 +0200 [-] FO : Fix css bug #PSCFV-11485 for 1.5
|
||||
2014-03-20 14:35:19 +0100 Initial commit
|
37
modules/homefeatured/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Featured products on the homepage
|
||||
|
||||
## About
|
||||
|
||||
Displays featured products in the central column of your homepage.
|
||||
|
||||
## 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 homefeatured 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
|
||||
|
12
modules/homefeatured/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>homefeatured</name>
|
||||
<displayName><![CDATA[Featured products on the homepage]]></displayName>
|
||||
<version><![CDATA[1.6.4]]></version>
|
||||
<description><![CDATA[Displays featured products in the central column of your homepage.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/homefeatured/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>homefeatured</name>
|
||||
<displayName><![CDATA[Produits mis en avant sur la page d'accueil]]></displayName>
|
||||
<version><![CDATA[1.6.4]]></version>
|
||||
<description><![CDATA[Affiche vos produits phares dans la colonne centrale de votre page d'accueil.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
73
modules/homefeatured/css/homefeatured.css
Normal file
@ -0,0 +1,73 @@
|
||||
#featured-products_block_center li {
|
||||
margin-right:10px;
|
||||
padding:10px 0;
|
||||
width:126px;
|
||||
height:240px
|
||||
}
|
||||
#featured-products_block_center li.last_item_of_line {margin-right:0;}
|
||||
#featured-products_block_center .s_title_block, #featured-products_block_center h5 {
|
||||
padding-top:5px;
|
||||
height:30px;
|
||||
min-height:30px;
|
||||
max-height:30px;
|
||||
overflow: hidden;
|
||||
font-size:12px;
|
||||
color:#222;
|
||||
padding-bottom: 0;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#featured-products_block_center .product_image {
|
||||
display:block;
|
||||
position:relative;
|
||||
overflow:hidden
|
||||
}
|
||||
#featured-products_block_center .product_image span.new {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right:-30px;
|
||||
padding: 1px 4px;
|
||||
width: 101px;
|
||||
font-size:10px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
-moz-transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
-o-transform:rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
background-color: #990000;
|
||||
transform: rotate(45deg); /* Newer browsers */
|
||||
}
|
||||
|
||||
#featured-products_block_center .product_desc {
|
||||
height: 45px;
|
||||
min-height:45px;
|
||||
max-height: 45px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#featured-products_block_center .product_desc,
|
||||
#featured-products_block_center .product_desc a {
|
||||
color:#666
|
||||
}
|
||||
#featured-products_block_center .lnk_more {
|
||||
display:inline;
|
||||
padding-right:10px;
|
||||
font-weight:bold;
|
||||
font-size:10px;
|
||||
color:#0088cc;
|
||||
background:url(../img/arrow_right_1.png) no-repeat 100% 3px;
|
||||
}
|
||||
#featured-products_block_center .price_container {
|
||||
margin-top:10px;
|
||||
padding:0;
|
||||
}
|
||||
#featured-products_block_center .price {
|
||||
font-weight:bold;
|
||||
font-size:14px;
|
||||
color:#990000
|
||||
}
|
||||
#featured-products_block_center li .ajax_add_to_cart_button {display:none;}
|
||||
#featured-products_block_center li span.exclusive {display:none;}
|
||||
|
35
modules/homefeatured/css/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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;
|
272
modules/homefeatured/homefeatured.php
Normal file
@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 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-2014 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 HomeFeatured extends Module
|
||||
{
|
||||
protected static $cache_products;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'homefeatured';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.6.4';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Featured products on the homepage');
|
||||
$this->description = $this->l('Displays featured products in the central column of your homepage.');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
$this->_clearCache('*');
|
||||
Configuration::updateValue('HOME_FEATURED_NBR', 8);
|
||||
Configuration::updateValue('HOME_FEATURED_CAT', (int)Context::getContext()->shop->getCategory());
|
||||
Configuration::updateValue('HOME_FEATURED_RANDOMIZE', false);
|
||||
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('addproduct')
|
||||
|| !$this->registerHook('updateproduct')
|
||||
|| !$this->registerHook('deleteproduct')
|
||||
|| !$this->registerHook('categoryUpdate')
|
||||
|| !$this->registerHook('displayHomeTab')
|
||||
|| !$this->registerHook('displayHomeTabContent')
|
||||
)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$this->_clearCache('*');
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = '';
|
||||
$errors = array();
|
||||
if (Tools::isSubmit('submitHomeFeatured'))
|
||||
{
|
||||
$nbr = Tools::getValue('HOME_FEATURED_NBR');
|
||||
if (!Validate::isInt($nbr) || $nbr <= 0)
|
||||
$errors[] = $this->l('The number of products is invalid. Please enter a positive number.');
|
||||
|
||||
$cat = Tools::getValue('HOME_FEATURED_CAT');
|
||||
if (!Validate::isInt($cat) || $cat <= 0)
|
||||
$errors[] = $this->l('The category ID is invalid. Please choose an existing category ID.');
|
||||
|
||||
$rand = Tools::getValue('HOME_FEATURED_RANDOMIZE');
|
||||
if (!Validate::isBool($rand))
|
||||
$errors[] = $this->l('Invalid value for the "randomize" flag.');
|
||||
if (isset($errors) && count($errors))
|
||||
$output = $this->displayError(implode('<br />', $errors));
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('HOME_FEATURED_NBR', (int)$nbr);
|
||||
Configuration::updateValue('HOME_FEATURED_CAT', (int)$cat);
|
||||
Configuration::updateValue('HOME_FEATURED_RANDOMIZE', (bool)$rand);
|
||||
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
|
||||
$output = $this->displayConfirmation($this->l('Your settings have been updated.'));
|
||||
}
|
||||
}
|
||||
|
||||
return $output.$this->renderForm();
|
||||
}
|
||||
|
||||
public function hookDisplayHeader($params)
|
||||
{
|
||||
$this->hookHeader($params);
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index')
|
||||
$this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||
$this->context->controller->addCSS(($this->_path).'css/homefeatured.css', 'all');
|
||||
}
|
||||
|
||||
public function _cacheProducts()
|
||||
{
|
||||
if (!isset(HomeFeatured::$cache_products))
|
||||
{
|
||||
$category = new Category((int)Configuration::get('HOME_FEATURED_CAT'), (int)Context::getContext()->language->id);
|
||||
$nb = (int)Configuration::get('HOME_FEATURED_NBR');
|
||||
if (Configuration::get('HOME_FEATURED_RANDOMIZE'))
|
||||
HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), null, null, false, true, true, ($nb ? $nb : 8));
|
||||
else
|
||||
HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position');
|
||||
}
|
||||
|
||||
if (HomeFeatured::$cache_products === false || empty(HomeFeatured::$cache_products))
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hookDisplayHomeTab($params)
|
||||
{
|
||||
if (!$this->isCached('tab.tpl', $this->getCacheId('homefeatured-tab')))
|
||||
$this->_cacheProducts();
|
||||
|
||||
return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('homefeatured-tab'));
|
||||
}
|
||||
|
||||
public function hookDisplayHome($params)
|
||||
{
|
||||
if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
|
||||
{
|
||||
$this->_cacheProducts();
|
||||
$this->smarty->assign(
|
||||
array(
|
||||
'products' => HomeFeatured::$cache_products,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
public function hookDisplayHomeTabContent($params)
|
||||
{
|
||||
return $this->hookDisplayHome($params);
|
||||
}
|
||||
|
||||
public function hookAddProduct($params)
|
||||
{
|
||||
$this->_clearCache('*');
|
||||
}
|
||||
|
||||
public function hookUpdateProduct($params)
|
||||
{
|
||||
$this->_clearCache('*');
|
||||
}
|
||||
|
||||
public function hookDeleteProduct($params)
|
||||
{
|
||||
$this->_clearCache('*');
|
||||
}
|
||||
|
||||
public function hookCategoryUpdate($params)
|
||||
{
|
||||
$this->_clearCache('*');
|
||||
}
|
||||
|
||||
public function _clearCache($template, $cache_id = NULL, $compile_id = NULL)
|
||||
{
|
||||
parent::_clearCache('homefeatured.tpl');
|
||||
parent::_clearCache('tab.tpl', 'homefeatured-tab');
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'description' => $this->l('To add products to your homepage, simply add them to the corresponding product category (default: "Home").'),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Number of products to be displayed'),
|
||||
'name' => 'HOME_FEATURED_NBR',
|
||||
'class' => 'fixed-width-xs',
|
||||
'desc' => $this->l('Set the number of products that you would like to display on homepage (default: 8).'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Category from which to pick products to be displayed'),
|
||||
'name' => 'HOME_FEATURED_CAT',
|
||||
'class' => 'fixed-width-xs',
|
||||
'desc' => $this->l('Choose the category ID of the products that you would like to display on homepage (default: 2 for "Home").'),
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Randomly display featured products'),
|
||||
'name' => 'HOME_FEATURED_RANDOMIZE',
|
||||
'class' => 'fixed-width-xs',
|
||||
'desc' => $this->l('Enable if you wish the products to be displayed randomly (default: no).'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Yes')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('No')
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
$helper->id = (int)Tools::getValue('id_carrier');
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitHomeFeatured';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'HOME_FEATURED_NBR' => Tools::getValue('HOME_FEATURED_NBR', (int)Configuration::get('HOME_FEATURED_NBR')),
|
||||
'HOME_FEATURED_CAT' => Tools::getValue('HOME_FEATURED_CAT', (int)Configuration::get('HOME_FEATURED_CAT')),
|
||||
'HOME_FEATURED_RANDOMIZE' => Tools::getValue('HOME_FEATURED_RANDOMIZE', (bool)Configuration::get('HOME_FEATURED_RANDOMIZE')),
|
||||
);
|
||||
}
|
||||
}
|
BIN
modules/homefeatured/img/arrow_right_1.png
Normal file
After Width: | Height: | Size: 93 B |