Jump to content

Edit History

ps8modules

ps8modules

Hi.

The problem will be that the sample module is for the classic theme.

It would be useful to put console.log() in javascript to see if data is being sent to ajax.php.

It would also be a good idea to turn on debug mode so that the error is displayed in the console. So in front-customer.js insert the feedback display:

function afterPostSubmitForm(email, pwd) {

    console.log(email);
    console.log(pwd);

    $.ajax({
        type: "POST",
        url: ajax_ps8mod_customerpwd,
        data:'action=afterCreateAccount&email='+email+'&pwd='+pwd,
        success: function(data){
            console.log(data);
            
            if (data !== ''){
                // OK
            } 
        }
    });
}

 

and update ajax.php

if ($module->active && Tools::getValue('action') == 'afterCreateAccount' && Tools::getValue('email') && Tools::getValue('pwd')) {
    // OK, data exists
    $response = '';
    $idCustomer = 0;

    $email = Tools::getValue('email');
    $pwd = Tools::getValue('pwd');
    $idCustomer = $context->customer->id; 

    if ($idCustomer) {
        $response = $module->newRegisteredCustomer($email, $pwd, $idCustomer);
    } else  {
        $response = $module->l('Customer ID not exists');
    }

    echo $response;
}

 

In the console I can see that the data from the form is being sent correctly to ajax.php, but no response.

obrazek.png.b1fa73be539118c7154b97a37a59fffb.png

ps8modules

ps8modules

Hi.

The problem will be that the sample module is for the classic theme.

It would be useful to put console.log() in javascript to see if data is being sent to ajax.php.

It would also be a good idea to turn on debug mode so that the error is displayed in the console. So in front-customer.js insert the feedback display:

function afterPostSubmitForm(email, pwd) {

    console.log(email);
    console.log(pwd);

    $.ajax({
        type: "POST",
        url: ajax_ps8mod_customerpwd,
        data:'action=afterCreateAccount&email='+email+'&pwd='+pwd,
        success: function(data){
            console.log(data);
            
            if (data !== ''){
                // OK
            } 
        }
    });
}

 

and update ajax.php

if ($module->active && Tools::getValue('action') == 'afterCreateAccount' && Tools::getValue('email') && Tools::getValue('pwd')) {
    // OK, data exists
    $response = '';
    $idCustomer = 0;

    $email = Tools::getValue('email');
    $pwd = Tools::getValue('pwd');
    $idCustomer = $context->customer->id; 

    if ($idCustomer) {
        $response = $module->newRegisteredCustomer($email, $pwd, $idCustomer);
    } else  {
        $response = $module->l('Customer ID not exists');
    }

    echo $response;
}

 

ps8modules

ps8modules

Hi.

The problem will be that the sample module is for the classic theme.

It would be useful to put console.log() in javascript to see if data is being sent to ajax.php.

It would also be a good idea to turn on debug mode so that the error is displayed in the console. So in front-customer.js insert the feedback display:

function afterPostSubmitForm(email, pwd) {

    console.log(email);
    console.log(pwd);

    $.ajax({
        type: "POST",
        url: ajax_ps8mod_customerpwd,
        data:'action=afterCreateAccount&email='+email+'&pwd='+pwd,
        success: function(data){
            console.log(data);
            
            if (data !== ''){
                // OK
            } 
        }
    });
}

 

×
×
  • Create New...