* @copyright 2007-2013 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 StatsBestCustomers extends ModuleGrid { private $_html; private $_query; private $_columns; private $_defaultSortColumn; private $_defaultSortDirection; private $_emptyMessage; private $_pagingMessage; public function __construct() { $this->name = 'statsbestcustomers'; $this->tab = 'analytics_stats'; $this->version = 1.0; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->_defaultSortColumn = 'totalMoneySpent'; $this->_defaultSortDirection = 'DESC'; $this->_emptyMessage = $this->l('Empty recordset returned'); $this->_pagingMessage = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->_columns = array( array( 'id' => 'lastname', 'header' => $this->l('Last Name'), 'dataIndex' => 'lastname', 'width' => 80 ), array( 'id' => 'firstname', 'header' => $this->l('First Name'), 'dataIndex' => 'firstname', 'width' => 80 ), array( 'id' => 'email', 'header' => $this->l('Email'), 'dataIndex' => 'email', 'width' => 140 ), array( 'id' => 'totalVisits', 'header' => $this->l('Visits'), 'dataIndex' => 'totalVisits', 'width' => 80, 'align' => 'right'), array( 'id' => 'totalValidOrders', 'header' => $this->l('Valid orders'), 'dataIndex' => 'totalValidOrders', 'width' => 80, 'align' => 'right'), array( 'id' => 'totalMoneySpent', 'header' => $this->l('Money spent').' ('.Tools::safeOutput($currency->iso_code).')', 'dataIndex' => 'totalMoneySpent', 'width' => 140, 'align' => 'right') ); $this->displayName = $this->l('Best customers'); $this->description = $this->l('A list of best customers.'); } public function install() { return (parent::install() && $this->registerHook('AdminStatsModules')); } public function hookAdminStatsModules($params) { $engineParams = array( 'id' => 'id_customer', 'title' => $this->displayName, 'columns' => $this->_columns, 'defaultSortColumn' => $this->_defaultSortColumn, 'defaultSortDirection' => $this->_defaultSortDirection, 'emptyMessage' => $this->_emptyMessage, 'pagingMessage' => $this->_pagingMessage ); if (Tools::getValue('export')) $this->csvExport($engineParams); $this->_html = '
'.$this->l('Keeping a client is more profitable than gaining a new one. That is one of the many reasons it is necessary to cultivate customer loyalty.').'
'.$this->l('Word of mouth is also a means for getting new, satisfied clients. A dissatisfied customer can hurt your e-reputation and obstruct future sales goals.').'
'.$this->l('In order to achieve this goal, you can organize:').'