diff --git a/classes/FrontController.php b/classes/FrontController.php index 4c5e5357b..2b2efaafd 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -103,6 +103,13 @@ class FrontControllerCore extends Controller $this->display_footer = false; } + // 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); + } + ob_start(); // Switch language if needed and init cookie language diff --git a/controllers/admin/AdminPreferencesController.php b/controllers/admin/AdminPreferencesController.php index c55d9d182..61cdc2481 100644 --- a/controllers/admin/AdminPreferencesController.php +++ b/controllers/admin/AdminPreferencesController.php @@ -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'), diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 27d4f840c..3c2099e48 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -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)); + } } /** diff --git a/themes/prestashop/address.tpl b/themes/prestashop/address.tpl index eb066daca..b255d03fd 100644 --- a/themes/prestashop/address.tpl +++ b/themes/prestashop/address.tpl @@ -115,11 +115,6 @@ $(function(){ldelim} {include file="$tpl_dir./errors.tpl"} -{if isset($account_created)} -
- {l s='Your account is now created. You can create your first address, or surf on this website.'} -
-{/if}