* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ 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 = '2.0.1'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->default_sort_column = 'ca'; $this->default_sort_direction = 'DESC'; $this->empty_message = $this->trans('Empty recordset returned.', array(), 'Modules.Statsbestvouchers.Admin'); $this->paging_message = $this->trans('Displaying %1$s of %2$s', array('{0} - {1}', '{2}'), 'Admin.Global'); $this->columns = array( array( 'id' => 'code', 'header' => $this->trans('Code', array(), 'Admin.Global'), 'dataIndex' => 'code', 'align' => 'left' ), array( 'id' => 'name', 'header' => $this->trans('Name', array(), 'Admin.Global'), 'dataIndex' => 'name', 'align' => 'left' ), array( 'id' => 'ca', 'header' => $this->trans('Sales', array(), 'Admin.Global'), 'dataIndex' => 'ca', 'align' => 'right' ), array( 'id' => 'total', 'header' => $this->trans('Total used', array(), 'Modules.Statsbestvouchers.Admin'), 'dataIndex' => 'total', 'align' => 'center' ) ); $this->displayName = $this->trans('Best vouchers', array(), 'Modules.Statsbestvouchers.Admin'); $this->description = $this->trans('Enrich your stats, add a list of the most used vouchers to the dashboard.', array(), 'Modules.Statsbestvouchers.Admin'); $this->ps_versions_compliancy = array('min' => '1.7.6.0', 'max' => _PS_VERSION_); } public function install() { return (parent::install() && $this->registerHook('displayAdminStatsModules')); } public function hookDisplayAdminStatsModules($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 = '