Jump to content

Anadir nuevo enlace en back-office y mostrar un template


jat

Recommended Posts

Hola a tod@s  

Estoy haciendo un modulo para Prestashop 1.7.

La idea es, dentro del back-office, en el menú: Configuración de Pedidos anidar un nuevo menú y mostrar un template .tpl para mostrar en una tabla el resultado de una consulta sql.

Tengo gran parte ya desarrollada:

class modulejat extends Module
{
	public function __construct(){	}

	public function install()
    {
        include(dirname(__FILE__) . '/sql/install.php');
        return parent::install() && $this->installModuleTab();
    }
	
	private function installModuleTab()
    {
        $tab = new Tab();
        $tab->module = $this->name;
        $tab->active = 1;
        $tab->class_name = 'AdminModulejat';
        $tab->id_parent = (int)Tab::getIdFromClassName('AdminParentOrders');
        $tab->position = Tab::getNewLastPosition($tab->id_parent);
        foreach (Language::getLanguages(false) as $lang) {
            $tab->name[(int)$lang['id_lang']] = 'MenuJat';
        }
        return $tab->add();
    }
	// code
}


Lo que no logro, es mostrar en ese enlace 'MenuJat' el template y o la consulta sql. No he encontrado mucha información. 

Alguien tiene alguna idea o un ejemplo que me puede ayudar?

Muchísimas gracias!

PS: 1.7.6.7

menujat.png

Edited by jat
versión prestashop (see edit history)
Link to comment
Share on other sites

He creado un controlador, pero hay algo que me falta

class AdminModulejatController extends ModuleAdminController
{
    public function __construct()
    {
        parent::__construct();

        $this->table = 'module_jat';
        $this->_orderBy = 'date';
        $this->_orderWay = 'DESC';
        $this->identifier = 'id';
        $this->addRowAction('');
        $this->bootstrap = true;


        $this->_select = '
        a.id, a.id_order, a.id_customer AS id_client, CONCAT(c.firstname,\' \',c.lastname) AS client, a.id_supplier, ps.name AS fournisseur,  a.id_employee,
	    CONCAT(pe.firstname,\' \',pe.lastname) AS employe, a.folder_year, a.folder_month, a.folder_day, a.file as fichier, a.date_send as date ';
        $this->_join = '
        LEFT JOIN ps_customer c ON (c.id_customer = a.id_customer)
        LEFT JOIN ps_employee pe  ON (pe.id_employee = a.id_employee)
        LEFT JOIN ps_supplier ps   ON (ps.id_supplier = a.id_supplier)';

        $this->_use_found_rows = true;

        $this->fields_list = array(
            'id_order' => [
                'title' => $this->l('Id Commande'),
                'align' => 'center',
                'width' => 25
            ],

            'client' => [
                'title' => $this->l('client'),
                'align' => 'center',
                'width' => 25
            ],

            'fournisseur' => [
                'title' => $this->l('Fournisseur'),
                'align' => 'center',
                'width' => 25
            ],

            'employe' => [
                'title' => $this->l('Employé'),
                'align' => 'center',
                'width' => 25
            ],

            'fichier' => [
                'title' => $this->l('fichier'),
                'align' => 'center',
                'width' => 25
            ],

            'date' => [
                'title' => $this->l('Date Commande'),
                'align' => 'center',
                'width' => 25
            ],

        );

    }

}

Alguna idea o pista que me pueda ayudar?

Muchas gracias

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...