diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index d06585f73..bb1e9422b 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -12,7 +12,7 @@ Thelia\Controller\Front\CustomerController::createAction - connexion + register @@ -57,6 +57,10 @@ + + Thelia\Controller\Front\DefaultController::noAction + cart + Thelia\Controller\Front\CartController::addItem cart diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index bd2556072..988159be4 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -215,8 +215,6 @@ class BaseController extends ContainerAware $url = $this->getRequest()->get("success_url"); } - echo "url=$url"; - if (null !== $url) $this->redirect($url); } diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 85db69472..0a60126e6 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -44,6 +44,7 @@ use Thelia\Core\Security\Exception\WrongPasswordException; */ class CustomerController extends BaseFrontController { + use \Thelia\Cart\CartTrait; /** * Create a new customer. * On success, redirect to success_url if exists, otherwise, display the same view again. @@ -65,7 +66,12 @@ class CustomerController extends BaseFrontController $this->processLogin($customerCreateEvent->getCustomer()); - $this->redirectSuccess($customerCreation); + $cart = $this->getCart($this->getRequest()); + if($cart->getCartItems()->count() > 0) { + $this->redirectToRoute("cart.view"); + } else { + $this->redirectSuccess($customerCreation); + } } catch (FormValidationException $e) { $message = sprintf("Please check your input: %s", $e->getMessage()); } catch (\Exception $e) { @@ -232,7 +238,7 @@ class CustomerController extends BaseFrontController $data["country"], isset($data["email"])?$data["email"]:null, isset($data["password"]) ? $data["password"]:null, - $this->getRequest()->getSession()->getLang(), + $this->getRequest()->getSession()->getLang()->getId(), isset($data["reseller"])?$data["reseller"]:null, isset($data["sponsor"])?$data["sponsor"]:null, isset($data["discount"])?$data["discount"]:null diff --git a/templates/default/register.html b/templates/default/register.html index 48339b873..9e0caf202 100644 --- a/templates/default/register.html +++ b/templates/default/register.html @@ -19,18 +19,44 @@ {intl l="Create New Account"} {form name="thelia.customer.creation"} + {form_field form=$form field='success_url'} + {* the url the user is redirected to on login success *} + {/form_field} + {form_field form=$form field='error_message'} + {* the url the user is redirected to on login success *} + {/form_field} + {form_hidden_fields form=$form} + {if $form_error}{$form_error_message}{/if} 1. {intl l="Personal Informations"} + {form_field form=$form field="title"} + + {$label} * + + + -- {intl l="Select Title"} -- + {loop type="title" name="country.list"} + {$LONG} + {/loop} + + {if $error } + {$message} + {elseif $value != "" && !$error} + + {/if} + + + {/form_field} {form_field form=$form field="firstname"} - + {$label} * - + {if $error } {$message} {elseif $value != "" && !$error} @@ -40,7 +66,7 @@ {/form_field} {form_field form=$form field="lastname"} - + {$label} * @@ -53,7 +79,7 @@ {/form_field} {form_field form=$form field="email"} - + {$label} * @@ -67,7 +93,7 @@ {/form_field} {form_field form=$form field="phone"} - + {$label} @@ -80,7 +106,7 @@ {/form_field} {form_field form=$form field="cellphone"} - + {$label} @@ -102,7 +128,7 @@ {form_field form=$form field="company"} - + {$label} @@ -116,7 +142,7 @@ {/form_field} {form_field form=$form field="address1"} - + {$label} * @@ -130,7 +156,7 @@ {/form_field} {form_field form=$form field="address2"} - + {$label} @@ -144,7 +170,7 @@ {/form_field} {form_field form=$form field="city"} - + {$label} * @@ -158,7 +184,7 @@ {/form_field} {form_field form=$form field="zipcode"} - + {$label} * @@ -172,13 +198,13 @@ {/form_field} {form_field form=$form field="country"} - + {$label} * - - -- Select Country -- + + -- {intl l="Select Country"} -- {loop type="country" name="country.list"} - {$TITLE} + {$TITLE} {/loop} {if $error } @@ -198,7 +224,7 @@ {form_field form=$form field="password"} - + {$label} * @@ -212,7 +238,7 @@ {/form_field} {form_field form=$form field="password_confirm"} - + {$label} * @@ -231,7 +257,7 @@ - I've read and agreed on Terms & Conditions. + I've read and agreed on Terms & Conditions.