* @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 StatsBestSuppliers extends ModuleGrid { private $html = null; private $query = null; private $columns = null; private $default_sort_column = null; private $default_sort_direction = null; private $empty_message = null; private $paging_message = null; public function __construct() { $this->name = 'statsbestsuppliers'; $this->tab = 'analytics_stats'; $this->version = '1.3.1'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->default_sort_column = 'sales'; $this->default_sort_direction = 'DESC'; $this->empty_message = $this->l('Empty record set returned'); $this->paging_message = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); $this->columns = array( array( 'id' => 'name', 'header' => $this->l('Name'), 'dataIndex' => 'name', 'align' => 'center' ), array( 'id' => 'quantity', 'header' => $this->l('Quantity sold'), 'dataIndex' => 'quantity', 'align' => 'center' ), array( 'id' => 'sales', 'header' => $this->l('Total paid'), 'dataIndex' => 'sales', 'align' => 'center' ) ); $this->displayName = $this->l('Best suppliers'); $this->description = $this->l('Adds a list of the best suppliers 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_category', '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') == 1) $this->csvExport($engine_params); $this->html = '