* @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 StatsBestVouchers extends ModuleGrid { private $html; private $query; private $columns; private $default_sort_column; private $default_sort_direction; private $empty_message; private $paging_message; public function __construct() { $this->name = 'statsbestvouchers'; $this->tab = 'analytics_stats'; $this->version = '1.4.1'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->default_sort_column = 'ca'; $this->default_sort_direction = 'DESC'; $this->empty_message = $this->l('Empty recordset returned.'); $this->paging_message = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); $this->columns = array( array( 'id' => 'code', 'header' => $this->l('Code'), 'dataIndex' => 'code', 'align' => 'left' ), array( 'id' => 'name', 'header' => $this->l('Name'), 'dataIndex' => 'name', 'align' => 'left' ), array( 'id' => 'ca', 'header' => $this->l('Sales'), 'dataIndex' => 'ca', 'align' => 'right' ), array( 'id' => 'total', 'header' => $this->l('Total used'), 'dataIndex' => 'total', 'align' => 'center' ) ); $this->displayName = $this->l('Best vouchers'); $this->description = $this->l('Adds a list of the best vouchers to the Stats dashboard.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } public function install() { return (parent::install() && $this->registerHook('AdminStatsModules')); } public function hookAdminStatsModules($params) { $engine_params = array( 'id' => 'id_product', 'title' => $this->displayName, 'columns' => $this->columns, 'defaultSortColumn' => $this->default_sort_column, 'defaultSortDirection' => $this->default_sort_direction, 'emptyMessage' => $this->empty_message, 'pagingMessage' => $this->paging_message ); if (Tools::getValue('export')) $this->csvExport($engine_params); $this->html = '