Jump to content

Edit History

nguigno

nguigno

Hi !

I'm trying to do the same thing, when the user finish his subscription to our website, but my module seams to do nothing at all !

Here my code :

<?php

if (!defined('_PS_VERSION_')) {
    exit;
}

class AttachToClientGroup extends Module
{
    public function __construct()
        {
            $this->name = 'attachtoclientgroup';
            $this->tab = 'others';
            $this->version = '1.0.1';
            $this->author = 'Quentin';
            $this->need_instance = 0;
            $this->ps_versions_compliancy = [
                'min' => '1.6',
                'max' => _PS_VERSION_
            ];
            $this->bootstrap = true;

            parent::__construct();

            $this->displayName = $this->l('Attach To Client Group');
            $this->description = $this->l('When a customer subscribe to our website, hes attached to the customer group Particuliers TTC, This module add him also into Client group.');

            $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');

            if (!Configuration::get('MYMODULE_NAME')) {
                $this->warning = $this->l('No name provided');
            }
        }   
}


public function install()
{
    return parent::install();
}

public function uninstall()
{
    return parent::uninstall();
}


public function hookcreateAccount($params)
{
    $this->context->customer->addGroups(array(3));
    $this->context->customer->update();
    //$this->context->customer->addGroups(3);
    print_r("print_r TEST");
    
    
}

?>

 

the print_r does not display the test message 😕

This is pretty simple did i miss something ?

 

Thanks in advance !

edit : prestashop 1.7.6.5

nguigno

nguigno

Hi !

I'm trying to do the same thing, when the user finish his subscription to our website, but my module seams to do nothing at all !

Here my code :

<?php

if (!defined('_PS_VERSION_')) {
    exit;
}

class AttachToClientGroup extends Module
{
    public function __construct()
        {
            $this->name = 'attachtoclientgroup';
            $this->tab = 'others';
            $this->version = '1.0.1';
            $this->author = 'Quentin';
            $this->need_instance = 0;
            $this->ps_versions_compliancy = [
                'min' => '1.6',
                'max' => _PS_VERSION_
            ];
            $this->bootstrap = true;

            parent::__construct();

            $this->displayName = $this->l('Attach To Client Group');
            $this->description = $this->l('When a customer subscribe to our website, hes attached to the customer group Particuliers TTC, This module add him also into Client group.');

            $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');

            if (!Configuration::get('MYMODULE_NAME')) {
                $this->warning = $this->l('No name provided');
            }
        }   
}


public function install()
{
    return parent::install();
}

public function uninstall()
{
    return parent::uninstall();
}


public function hookcreateAccount($params)
{
    $this->context->customer->addGroups(array(3));
    $this->context->customer->update();
    //$this->context->customer->addGroups(3);
    print_r("print_r TEST");
    
    
}

?>

 

the print_r does not display the test message 😕

This is pretty simple did i miss something ?

 

Thanks in advance !

×
×
  • Create New...