Jump to content

Edit History

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

Then I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

The columns fields definition --> It's OK , data is diplayed :  

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my table data -> it's OK, But the  $id and $name vars are null, only $token is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the methode processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

Then I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

The columns fields definition --> It's OK , data is diplayed :  

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my table data -> it's OK, But the  $id and $name vars are null, only $token is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the function processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

Then I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my table data -> it's OK, But the  $id and $name vars are null, only $token is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the function processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

Then I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my list of data -> it's OK, But the  $id and $name vars are null, only $token is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the function processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

Then I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my list of data -> it's OK, But the  $id and $name vars are null, only $token is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the function processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

Then I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my list of data -> it's OK, But the  $id and $name vars are null, only $token car is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the function processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

Slayem

Slayem

Hello, 

I create a new module.

I create a custom admin controller to display a list of data, i create new query and the data is displayed correctly in the page.

The I created a custom button, but when i click in the button the $ID variable to get the current row is null

how can I retrieve information from the current row of my table when the user clicks on the button

I do many research but the documentation of prestashop is  limited ! 

 $this->fields_list = [
            'id_customer' => [
                'title' => $this->module->l('ID Revendeur'), //Titre
                'align' => 'center', // Alignement
                'class' => 'fixed-width-xs' //classe css de l'élément
            ],
            'code_revendeur' => [
                'title' => $this->module->l('Code Revendeur'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'phone' => [
                'title' => $this->module->l('Téléphone'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'firstname' => [
                'title' => $this->module->l('Prénom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'lastname' => [
                'title' => $this->module->l('Nom'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ],
            'email' => [
                'title' => $this->module->l('E-mail'),
                'align' => 'left',
                'class' => 'fixed-width-xs'
            ]
        ];

  The definition of mu custom button 

    public function renderList() {

        $this->addRowAction('newaction');

        return parent::renderList();
    }

Display the button in my list of data -> it's OK, But the  $id and $name vars are null, only $token car is with data  

    public function displayNewactionLink($token, $id, $name)
    {
        
        $this->context->smarty->assign(array(
            'href' => self::$currentIndex.'&'.$this->identifier.'='.(int)$id
                .'&action=newaction&token='.($token != null ? $token : $this->token),
            'action' => $this->l('Payer la commission du revendeur'),
            'icon' => 'icon-mail-forward',
        ));

        return $this->context->smarty->fetch($this->module->getLocalPath().'views/templates/admin/list_action_payer.tpl');
    }

process action methode : 

    public function processNewaction() {


        // do actions
        
    }

 

when i debug my code, the function processNewaction is called, but I have no information about the row of the table that the user has selected.

 

Thanks for you 

×
×
  • Create New...