Alevg91 Posted April 30, 2021 Share Posted April 30, 2021 (edited) Hola, buenos días, Estoy intentando añadir una columna, donde muestre el logotipo de los transportistas. Según, he leído, se añade en AdminOrdersController.php, pero estoy utilizandoi la versión 1.7.7.3 de prestashop, y según he visto, este archivo ya no existe en esta versión. Tras comprobar que ya se está utilizando más los Hook, he creado un módulo, registrado el hook, y llamado, pero no funciona a día de hoy. <?php /** * 2007-2021 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 [email protected] 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 <[email protected]> * @copyright 2007-2018 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 columnextra extends Module { protected $config_form = false; public function __construct() { $this->name = 'columnextra'; $this->tab = 'administration'; $this->version = '1.0.1'; $this->author = '--'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Column Extra'); $this->description = $this->l('Modificar las Columnas de los listados en el backoficce'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } public function install() { return parent::install() && $this->registerHook('actionAdminCustomersListingFieldsModifier') && $this->registerHook('actionAdminOrdersListingFieldsModifier') && $this->registerHook('actionOrderGridDefinitionModifier') && $this->registerHook('actionOrderGridQueryBuilderModifier') && $this->registerHook('actionOrderGridDataModifier') && $this->registerHook('actionOrderGridPresenterModifier'); } public function uninstall() { return parent::uninstall(); } public function hookactionAdminOrdersListingFieldsModifier($params) { echo 'Holaaaa'; } public function hookactionOrderGridDefinitionModifier($params) { if (!isset($params['fields']['tracking_number'])) { $params['fields']['tracking_number'] = array( 'title' => 'N Seguimiento', "align" => "text-center", "class" => "fixed-width-xs", "filter_key" => "oca!tracking_number" ); } if (!isset($params['fields']['carrier_name'])) { $params['fields']['carrier_name'] = array( 'title' => 'Transportista', "align" => "text-center", "class" => "fixed-width-xs", "filter_key" => "ca!name" ); } if (isset($params['select'])) { $params['select'] .= ", oca.tracking_number AS tracking_number"; $params['select'] .= ", ca.name AS carrier_name"; } if (isset($params['join'])) { $params['join'] .= 'LEFT JOIN `' . _DB_PREFIX_ . 'order_carrier` oca ON (a.`id_order` = oca.`id_order`)'; $params['join'] .= 'LEFT JOIN `' . _DB_PREFIX_ . 'carrier` ca ON (ca.`id_carrier` = oca.`id_carrier`)'; } } public function hookActionAdminCustomersListingFieldsModifier($params) { if (!isset($params['fields']['customer_group'])) { $params['fields']['customer_group'] = array( 'title' => 'Grupo', "align" => "text-center", "class" => "fixed-width-xs", "filter_key" => "cg!id_group" ); } if (isset($params['select'])) { $params['select'] .= ", cg.id_group AS customer_group"; } if (isset($params['join'])) { $params['join'] .= 'LEFT JOIN `' . _DB_PREFIX_ . 'customer_group` cg ON (a.`id_customer` = cg.`id_customer`)'; } } } Edited April 30, 2021 by Alevg91 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now