Jump to content

Edit History

ps8modules

ps8modules

Hi.

Add $db to the beginning of ajax.php

$db = Db::getInstance();

// add
$context = Context::getContext();

Upload the whole ajax.php code for me here if you edited it.

 

update ajax.php

header("Access-Control-Allow-Origin: *");

include('../../../config/config.inc.php');
include('../../../init.php');

$module_name = 'ps8mod_customerpwd';

$token = pSQL(Tools::encrypt($module_name.'/ajax.php'));
$token_url = pSQL(Tools::getValue('token'));

$db = Db::getInstance();

$context = Context::getContext();

$module = Module::getInstanceByName($module_name);
if ($token != $token_url || !Module::isInstalled($module_name)) {
    echo($module->l('AJAX error'));
}

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.

Add $db to the beginning of ajax.php

$db = Db::getInstance();

// add
$context = Context::getContext();

Upload the whole ajax.php code for me here if you edited it.

ps8modules

ps8modules

Hi.

Add $db to the beginning of ajax.php

$db = Db::getInstance();

// add
$context = Context::getContext();

 

×
×
  • Create New...