[*] FO : Register process enhancement

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10029 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot
2011-11-10 10:56:14 +00:00
parent 568327849c
commit 669aed08c6
8 changed files with 55 additions and 20 deletions
@@ -56,11 +56,11 @@ class AdminPreferencesControllerCore extends AdminController
$registration_process_type = array(
array(
'value' => PS_REGISTRATION_PROCESS_STANDARD,
'name' => $this->l('2 steps (Account creation and address creation)')
'name' => $this->l('Only account creation')
),
array(
'value' => PS_REGISTRATION_PROCESS_AIO,
'name' => $this->l('Standard (all in one)')
'name' => $this->l('Standard (account creation and address creation)')
)
);
@@ -98,7 +98,7 @@ class AdminPreferencesControllerCore extends AdminController
'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480', 'visibility' => Shop::CONTEXT_ALL),
'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480', 'visibility' => Shop::CONTEXT_ALL),
'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'),
'PS_REGISTRATION_PROCESS_TYPE' => array('title' => $this->l('Registration process type'), 'desc' => $this->l('The 2 steps register process allows the customer to register faster, and create his address later.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $registration_process_type, 'identifier' => 'value'),
'PS_REGISTRATION_PROCESS_TYPE' => array('title' => $this->l('Registration process type'), 'desc' => $this->l('The "Only account creation" step register process allows the customer to register faster, and create his address later.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $registration_process_type, 'identifier' => 'value'),
'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')),
'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'),
+33 -7
View File
@@ -62,6 +62,15 @@ class AuthControllerCore extends FrontController
$this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js');
}
/**
* Run ajax process
* @see FrontController::displayAjax()
*/
public function displayAjax()
{
$this->display();
}
/**
* Assign template vars related to page content
* @see FrontController::initContent()
@@ -104,13 +113,6 @@ class AuthControllerCore extends FrontController
}
}
// if account created with the 2 steps register process, remove 'accoun_created' from cookie
if (isset($this->context->cookie->account_created))
{
$this->context->smarty->assign('account_created', 1);
unset($this->context->cookie->account_created);
}
if (Tools::getValue('create_account'))
$this->context->smarty->assign('email_create', 1);
@@ -500,6 +502,12 @@ class AuthControllerCore extends FrontController
if ($back = Tools::getValue('back'))
Tools::redirect('index.php?controller='.$back);
Tools::redirect('index.php?controller=my-account');
// redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order');
// else : redirection to the account
else
Tools::redirect('index.php?controller=my-account');
}
}
}
@@ -542,6 +550,24 @@ class AuthControllerCore extends FrontController
$this->context->smarty->assign('email_create', Tools::safeOutput($email));
$_POST['email'] = $email;
}
if ($this->ajax)
{
// Call a hook to display more information on form
$this->context->smarty->assign(array(
'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('createAccountForm'),
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('createAccountTop'),
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'genders' => Gender::getGenders()
));
$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'page' => $this->context->smarty->fetch(_PS_THEME_DIR_.'authentication.tpl'),
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
}
/**