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}

{if isset($id_address)}{l s='Your address'}{else}{l s='New address'}{/if}

diff --git a/themes/prestashop/authentication.tpl b/themes/prestashop/authentication.tpl index b46c07552..3322aaf19 100644 --- a/themes/prestashop/authentication.tpl +++ b/themes/prestashop/authentication.tpl @@ -123,7 +123,6 @@ $(function(){ldelim} data: 'controller=authentication&SubmitCreate=1&ajax=true&email_create='+$('#email_create').val()+'&token='+token, success: function(jsonData) { - //console.log(jsonData); if (jsonData.hasError) { var errors = ''; diff --git a/themes/prestashop/lang/fr.php b/themes/prestashop/lang/fr.php index d3ff900aa..8b1991afa 100644 --- a/themes/prestashop/lang/fr.php +++ b/themes/prestashop/lang/fr.php @@ -12,7 +12,6 @@ $_LANG['404_8cf04a9734132302f96da8e113e80ce5'] = 'Accueil'; $_LANG['address_3908e1afa0ff22fbf112aff3c5ba55c1'] = 'Vos adresses'; $_LANG['address_e9b6b3aa3cab28048d3879710882e1de'] = 'Modifier cette adresse'; $_LANG['address_d7f172af352aa5232de5295afeaa68e5'] = 'Pour ajouter une nouvelle adresse, merci de remplir ce formulaire.'; -$_LANG['address_f5226f8494cf5f5b0f3f2257d47662c5'] = 'Votre compte est maintenant créé. Vous pouvez ajouter votre première adresse, ou surfer sur le site.'; $_LANG['address_455175f3f5be6306247babb349c0515a'] = 'Votre adresse'; $_LANG['address_393d8c6bc7a04264bd9523dc8c92b818'] = 'Nouvelle adresse'; $_LANG['address_b60bb13a87fe3ae5463aeb0980a5a8a1'] = 'Numéro d\'identification fiscale :'; @@ -164,7 +163,6 @@ $_LANG['errors_cb5e100e5a9a3e7f6d1fd97512215282'] = 'erreur'; $_LANG['errors_0557fa923dcee4d0f86b1409f5c2167f'] = 'Retour'; $_LANG['guest-tracking_77cd9fa27c50288413e2ead667fdda84'] = 'Suivez votre commande'; $_LANG['guest-tracking_b5a4f215d9c7e8fbc20532f1e7e03e9e'] = 'Créez votre compte client'; -$_LANG['guest-tracking_943a199b38fa52e39a1ee77b46aed98f'] = 'Votre compte invité a été transformé en compte client avec succès. Vous pouvez maintenant vous connecter sur cette'; $_LANG['guest-tracking_71860c77c6745379b0d44304d66b6a13'] = 'page'; $_LANG['guest-tracking_109636f722b8fccc95d072b2760a6282'] = 'Transformez votre compte invité en compte client et profitez de :'; $_LANG['guest-tracking_7661b3dd0ed101708b4c5ba8948ef03d'] = 'Un accès personnel sécurisé'; @@ -243,6 +241,7 @@ $_LANG['manufacturer-list_3426bf3cca12b1f6550fd8bd36171e2f'] = 'voir les article $_LANG['manufacturer_2f09fc3dc3fc1518375e48a05ccabe2d'] = 'Liste des produits du fabricant :'; $_LANG['manufacturer_a65ed5e8df4b1c2bb34844f81cc9b451'] = 'Pas de produit pour ce fabricant.'; $_LANG['my-account_d95cf4ab2cbf1dfb63f066b50558b07d'] = 'Mon compte'; +$_LANG['my-account_a341bed9cce718f17657a7aeb3d96af1'] = 'Votre compte est maintenant créé.'; $_LANG['my-account_c75db6799ed40b04a5f0fe865cb75020'] = 'Bienvenue sur votre page d\'accueil. Vous pouvez gérer vos informations personnelles, vos commandes ainsi que vos adresses.'; $_LANG['my-account_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes'; $_LANG['my-account_d1c55b03aa566f1dbe40569fe957c496'] = 'Historique et détails de mes commandes'; @@ -558,8 +557,6 @@ $_LANG['product_a134618182b99ff9151d7e0b6b92410a'] = '(ne sera pas compris dans $_LANG['product_fe3838c7c11aa406dd956566e17360d5'] = 'par'; $_LANG['product_ea23e12cae068315b351f8d36d432d76'] = 'Référence :'; $_LANG['product_2c59ffd0a6631127450d729861975719'] = 'Quantité :'; -$_LANG['product_07d814a3df5cfd2d637e77b215519034'] = 'Vous devez ajouter au minimum '; -$_LANG['product_f3bbad73b35f19730399b3da21c3ef32'] = ' quantités pour acheter ce produit.'; $_LANG['product_8c751c4aab0db0b811cdfbddf0b4ea56'] = 'Disponibilité :'; $_LANG['product_100f1a22cb79da8d72ce3379a4e834ed'] = 'Produit disponible le: '; $_LANG['product_4b98be16b76b0941840140f2043432a9'] = 'pièce disponible'; @@ -620,6 +617,7 @@ $_LANG['shopping-cart-product-line_07c5e982fa212f517539c266b7d5a166'] = 'Vous de $_LANG['shopping-cart-product-line_a2c97afedb345264c3c8fb81011bd010'] = ' quantités pour acheter ce produit.'; $_LANG['shopping-cart_a40cab5994f36d4c48103a22ca082e8f'] = 'Votre panier'; $_LANG['shopping-cart_5f6b9be870bc784ecc15ddb5dcf7f22e'] = 'Récapitulatif de la commande'; +$_LANG['shopping-cart_a341bed9cce718f17657a7aeb3d96af1'] = 'Votre compte est maintenant créé.'; $_LANG['shopping-cart_879f6b8877752685a966564d072f498f'] = 'Votre panier est vide.'; $_LANG['shopping-cart_5af5f631f774a71445e3028253874394'] = 'Cette boutique n\'a pas accepté votre nouvelle commande.'; $_LANG['shopping-cart_f5bf48aa40cad7891eb709fcf1fde128'] = 'produit'; diff --git a/themes/prestashop/my-account.tpl b/themes/prestashop/my-account.tpl index b1b6d8bbb..bbf55aabb 100644 --- a/themes/prestashop/my-account.tpl +++ b/themes/prestashop/my-account.tpl @@ -28,6 +28,11 @@ {include file="$tpl_dir./breadcrumb.tpl"}

{l s='My account'}

+{if isset($account_created)} +

+ {l s='Your account is now created.'} +

+{/if}

{l s='Welcome to your account. Here you can manage your addresses and orders.'}